Java 类java.awt.im.InputMethodRequests 实例源码
项目:OpenJSharp
文件:CompositionAreaHandler.java
/**
* Creates the composition area.
*/
private void createCompositionArea() {
synchronized(compositionAreaLock) {
compositionArea = new CompositionArea();
if (compositionAreaOwner != null) {
compositionArea.setHandlerInfo(compositionAreaOwner, inputMethodContext);
}
// If the client component is an active client using below-the-spot style, then
// make the composition window undecorated without a title bar.
Component client = clientComponent.get();
if(client != null){
InputMethodRequests req = client.getInputMethodRequests();
if (req != null && inputMethodContext.useBelowTheSpotInput()) {
setCompositionAreaUndecorated(true);
}
}
}
}
项目:OpenJSharp
文件:CompositionAreaHandler.java
public Rectangle getTextLocation(TextHitInfo offset) {
synchronized (compositionAreaLock) {
if (compositionAreaOwner == this && isCompositionAreaVisible()) {
return compositionArea.getTextLocation(offset);
} else if (composedText != null) {
// there's composed text, but it's not displayed, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
} else {
InputMethodRequests requests = getClientInputMethodRequests();
if (requests != null) {
return requests.getTextLocation(offset);
} else {
// passive client, no composed text, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
}
}
}
}
项目:jdk8u-jdk
文件:CompositionAreaHandler.java
/**
* Creates the composition area.
*/
private void createCompositionArea() {
synchronized(compositionAreaLock) {
compositionArea = new CompositionArea();
if (compositionAreaOwner != null) {
compositionArea.setHandlerInfo(compositionAreaOwner, inputMethodContext);
}
// If the client component is an active client using below-the-spot style, then
// make the composition window undecorated without a title bar.
Component client = clientComponent.get();
if(client != null){
InputMethodRequests req = client.getInputMethodRequests();
if (req != null && inputMethodContext.useBelowTheSpotInput()) {
setCompositionAreaUndecorated(true);
}
}
}
}
项目:jdk8u-jdk
文件:CompositionAreaHandler.java
public Rectangle getTextLocation(TextHitInfo offset) {
synchronized (compositionAreaLock) {
if (compositionAreaOwner == this && isCompositionAreaVisible()) {
return compositionArea.getTextLocation(offset);
} else if (composedText != null) {
// there's composed text, but it's not displayed, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
} else {
InputMethodRequests requests = getClientInputMethodRequests();
if (requests != null) {
return requests.getTextLocation(offset);
} else {
// passive client, no composed text, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
}
}
}
}
项目:openjdk-jdk10
文件:CompositionAreaHandler.java
/**
* Creates the composition area.
*/
private void createCompositionArea() {
synchronized(compositionAreaLock) {
compositionArea = new CompositionArea();
if (compositionAreaOwner != null) {
compositionArea.setHandlerInfo(compositionAreaOwner, inputMethodContext);
}
// If the client component is an active client using below-the-spot style, then
// make the composition window undecorated without a title bar.
Component client = clientComponent.get();
if(client != null){
InputMethodRequests req = client.getInputMethodRequests();
if (req != null && inputMethodContext.useBelowTheSpotInput()) {
setCompositionAreaUndecorated(true);
}
}
}
}
项目:openjdk-jdk10
文件:CompositionAreaHandler.java
public Rectangle getTextLocation(TextHitInfo offset) {
synchronized (compositionAreaLock) {
if (compositionAreaOwner == this && isCompositionAreaVisible()) {
return compositionArea.getTextLocation(offset);
} else if (composedText != null) {
// there's composed text, but it's not displayed, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
} else {
InputMethodRequests requests = getClientInputMethodRequests();
if (requests != null) {
return requests.getTextLocation(offset);
} else {
// passive client, no composed text, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
}
}
}
}
项目:openjdk9
文件:CompositionAreaHandler.java
/**
* Creates the composition area.
*/
private void createCompositionArea() {
synchronized(compositionAreaLock) {
compositionArea = new CompositionArea();
if (compositionAreaOwner != null) {
compositionArea.setHandlerInfo(compositionAreaOwner, inputMethodContext);
}
// If the client component is an active client using below-the-spot style, then
// make the composition window undecorated without a title bar.
Component client = clientComponent.get();
if(client != null){
InputMethodRequests req = client.getInputMethodRequests();
if (req != null && inputMethodContext.useBelowTheSpotInput()) {
setCompositionAreaUndecorated(true);
}
}
}
}
项目:openjdk9
文件:CompositionAreaHandler.java
public Rectangle getTextLocation(TextHitInfo offset) {
synchronized (compositionAreaLock) {
if (compositionAreaOwner == this && isCompositionAreaVisible()) {
return compositionArea.getTextLocation(offset);
} else if (composedText != null) {
// there's composed text, but it's not displayed, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
} else {
InputMethodRequests requests = getClientInputMethodRequests();
if (requests != null) {
return requests.getTextLocation(offset);
} else {
// passive client, no composed text, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
}
}
}
}
项目:jdk8u_jdk
文件:CompositionAreaHandler.java
/**
* Creates the composition area.
*/
private void createCompositionArea() {
synchronized(compositionAreaLock) {
compositionArea = new CompositionArea();
if (compositionAreaOwner != null) {
compositionArea.setHandlerInfo(compositionAreaOwner, inputMethodContext);
}
// If the client component is an active client using below-the-spot style, then
// make the composition window undecorated without a title bar.
Component client = clientComponent.get();
if(client != null){
InputMethodRequests req = client.getInputMethodRequests();
if (req != null && inputMethodContext.useBelowTheSpotInput()) {
setCompositionAreaUndecorated(true);
}
}
}
}
项目:jdk8u_jdk
文件:CompositionAreaHandler.java
public Rectangle getTextLocation(TextHitInfo offset) {
synchronized (compositionAreaLock) {
if (compositionAreaOwner == this && isCompositionAreaVisible()) {
return compositionArea.getTextLocation(offset);
} else if (composedText != null) {
// there's composed text, but it's not displayed, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
} else {
InputMethodRequests requests = getClientInputMethodRequests();
if (requests != null) {
return requests.getTextLocation(offset);
} else {
// passive client, no composed text, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
}
}
}
}
项目:lookaside_java-1.8.0-openjdk
文件:CompositionAreaHandler.java
/**
* Creates the composition area.
*/
private void createCompositionArea() {
synchronized(compositionAreaLock) {
compositionArea = new CompositionArea();
if (compositionAreaOwner != null) {
compositionArea.setHandlerInfo(compositionAreaOwner, inputMethodContext);
}
// If the client component is an active client using below-the-spot style, then
// make the composition window undecorated without a title bar.
Component client = clientComponent.get();
if(client != null){
InputMethodRequests req = client.getInputMethodRequests();
if (req != null && inputMethodContext.useBelowTheSpotInput()) {
setCompositionAreaUndecorated(true);
}
}
}
}
项目:lookaside_java-1.8.0-openjdk
文件:CompositionAreaHandler.java
public Rectangle getTextLocation(TextHitInfo offset) {
synchronized (compositionAreaLock) {
if (compositionAreaOwner == this && isCompositionAreaVisible()) {
return compositionArea.getTextLocation(offset);
} else if (composedText != null) {
// there's composed text, but it's not displayed, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
} else {
InputMethodRequests requests = getClientInputMethodRequests();
if (requests != null) {
return requests.getTextLocation(offset);
} else {
// passive client, no composed text, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
}
}
}
}
项目:infobip-open-jdk-8
文件:CompositionAreaHandler.java
/**
* Creates the composition area.
*/
private void createCompositionArea() {
synchronized(compositionAreaLock) {
compositionArea = new CompositionArea();
if (compositionAreaOwner != null) {
compositionArea.setHandlerInfo(compositionAreaOwner, inputMethodContext);
}
// If the client component is an active client using below-the-spot style, then
// make the composition window undecorated without a title bar.
Component client = clientComponent.get();
if(client != null){
InputMethodRequests req = client.getInputMethodRequests();
if (req != null && inputMethodContext.useBelowTheSpotInput()) {
setCompositionAreaUndecorated(true);
}
}
}
}
项目:infobip-open-jdk-8
文件:CompositionAreaHandler.java
public Rectangle getTextLocation(TextHitInfo offset) {
synchronized (compositionAreaLock) {
if (compositionAreaOwner == this && isCompositionAreaVisible()) {
return compositionArea.getTextLocation(offset);
} else if (composedText != null) {
// there's composed text, but it's not displayed, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
} else {
InputMethodRequests requests = getClientInputMethodRequests();
if (requests != null) {
return requests.getTextLocation(offset);
} else {
// passive client, no composed text, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
}
}
}
}
项目:jdk8u-dev-jdk
文件:CompositionAreaHandler.java
/**
* Creates the composition area.
*/
private void createCompositionArea() {
synchronized(compositionAreaLock) {
compositionArea = new CompositionArea();
if (compositionAreaOwner != null) {
compositionArea.setHandlerInfo(compositionAreaOwner, inputMethodContext);
}
// If the client component is an active client using below-the-spot style, then
// make the composition window undecorated without a title bar.
Component client = clientComponent.get();
if(client != null){
InputMethodRequests req = client.getInputMethodRequests();
if (req != null && inputMethodContext.useBelowTheSpotInput()) {
setCompositionAreaUndecorated(true);
}
}
}
}
项目:jdk8u-dev-jdk
文件:CompositionAreaHandler.java
public Rectangle getTextLocation(TextHitInfo offset) {
synchronized (compositionAreaLock) {
if (compositionAreaOwner == this && isCompositionAreaVisible()) {
return compositionArea.getTextLocation(offset);
} else if (composedText != null) {
// there's composed text, but it's not displayed, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
} else {
InputMethodRequests requests = getClientInputMethodRequests();
if (requests != null) {
return requests.getTextLocation(offset);
} else {
// passive client, no composed text, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
}
}
}
}
项目:jdk7-jdk
文件:CompositionAreaHandler.java
/**
* Creates the composition area.
*/
private void createCompositionArea() {
synchronized(compositionAreaLock) {
compositionArea = new CompositionArea();
if (compositionAreaOwner != null) {
compositionArea.setHandlerInfo(compositionAreaOwner, inputMethodContext);
}
// If the client component is an active client using below-the-spot style, then
// make the composition window undecorated without a title bar.
if(clientComponent!=null){
InputMethodRequests req = clientComponent.getInputMethodRequests();
if (req != null && inputMethodContext.useBelowTheSpotInput()) {
setCompositionAreaUndecorated(true);
}
}
}
}
项目:jdk7-jdk
文件:CompositionAreaHandler.java
public Rectangle getTextLocation(TextHitInfo offset) {
synchronized (compositionAreaLock) {
if (compositionAreaOwner == this && isCompositionAreaVisible()) {
return compositionArea.getTextLocation(offset);
} else if (composedText != null) {
// there's composed text, but it's not displayed, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
} else {
InputMethodRequests requests = getClientInputMethodRequests();
if (requests != null) {
return requests.getTextLocation(offset);
} else {
// passive client, no composed text, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
}
}
}
}
项目:openjdk-source-code-learn
文件:CompositionAreaHandler.java
/**
* Creates the composition area.
*/
private void createCompositionArea() {
synchronized(compositionAreaLock) {
compositionArea = new CompositionArea();
if (compositionAreaOwner != null) {
compositionArea.setHandlerInfo(compositionAreaOwner, inputMethodContext);
}
// If the client component is an active client using below-the-spot style, then
// make the composition window undecorated without a title bar.
if(clientComponent!=null){
InputMethodRequests req = clientComponent.getInputMethodRequests();
if (req != null && inputMethodContext.useBelowTheSpotInput()) {
setCompositionAreaUndecorated(true);
}
}
}
}
项目:openjdk-source-code-learn
文件:CompositionAreaHandler.java
public Rectangle getTextLocation(TextHitInfo offset) {
synchronized (compositionAreaLock) {
if (compositionAreaOwner == this && isCompositionAreaVisible()) {
return compositionArea.getTextLocation(offset);
} else if (composedText != null) {
// there's composed text, but it's not displayed, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
} else {
InputMethodRequests requests = getClientInputMethodRequests();
if (requests != null) {
return requests.getTextLocation(offset);
} else {
// passive client, no composed text, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
}
}
}
}
项目:OLD-OpenJDK8
文件:CompositionAreaHandler.java
/**
* Creates the composition area.
*/
private void createCompositionArea() {
synchronized(compositionAreaLock) {
compositionArea = new CompositionArea();
if (compositionAreaOwner != null) {
compositionArea.setHandlerInfo(compositionAreaOwner, inputMethodContext);
}
// If the client component is an active client using below-the-spot style, then
// make the composition window undecorated without a title bar.
Component client = clientComponent.get();
if(client != null){
InputMethodRequests req = client.getInputMethodRequests();
if (req != null && inputMethodContext.useBelowTheSpotInput()) {
setCompositionAreaUndecorated(true);
}
}
}
}
项目:OLD-OpenJDK8
文件:CompositionAreaHandler.java
public Rectangle getTextLocation(TextHitInfo offset) {
synchronized (compositionAreaLock) {
if (compositionAreaOwner == this && isCompositionAreaVisible()) {
return compositionArea.getTextLocation(offset);
} else if (composedText != null) {
// there's composed text, but it's not displayed, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
} else {
InputMethodRequests requests = getClientInputMethodRequests();
if (requests != null) {
return requests.getTextLocation(offset);
} else {
// passive client, no composed text, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
}
}
}
}
项目:openjdk-jdk7u-jdk
文件:CompositionAreaHandler.java
/**
* Creates the composition area.
*/
private void createCompositionArea() {
synchronized(compositionAreaLock) {
compositionArea = new CompositionArea();
if (compositionAreaOwner != null) {
compositionArea.setHandlerInfo(compositionAreaOwner, inputMethodContext);
}
// If the client component is an active client using below-the-spot style, then
// make the composition window undecorated without a title bar.
if(clientComponent!=null){
InputMethodRequests req = clientComponent.getInputMethodRequests();
if (req != null && inputMethodContext.useBelowTheSpotInput()) {
setCompositionAreaUndecorated(true);
}
}
}
}
项目:openjdk-jdk7u-jdk
文件:CompositionAreaHandler.java
public Rectangle getTextLocation(TextHitInfo offset) {
synchronized (compositionAreaLock) {
if (compositionAreaOwner == this && isCompositionAreaVisible()) {
return compositionArea.getTextLocation(offset);
} else if (composedText != null) {
// there's composed text, but it's not displayed, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
} else {
InputMethodRequests requests = getClientInputMethodRequests();
if (requests != null) {
return requests.getTextLocation(offset);
} else {
// passive client, no composed text, so fake a rectangle
return new Rectangle(0, 0, 0, 10);
}
}
}
}
项目:incubator-netbeans
文件:NbFxPanel.java
@Override
public InputMethodRequests getInputMethodRequests() {
try {
return super.getInputMethodRequests();
} catch (NullPointerException ex) {
return null;
}
}
项目:OpenJSharp
文件:CompositionArea.java
/**
* Positions the composition window near (usually below) the
* insertion point in the client component if the client
* component is an active client (below-the-spot input).
*/
void updateWindowLocation() {
InputMethodRequests req = handler.getClientInputMethodRequests();
if (req == null) {
// not an active client
return;
}
Point windowLocation = new Point();
Rectangle caretRect = req.getTextLocation(null);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension windowSize = compositionWindow.getSize();
final int SPACING = 2;
if (caretRect.x + windowSize.width > screenSize.width) {
windowLocation.x = screenSize.width - windowSize.width;
} else {
windowLocation.x = caretRect.x;
}
if (caretRect.y + caretRect.height + SPACING + windowSize.height > screenSize.height) {
windowLocation.y = caretRect.y - SPACING - windowSize.height;
} else {
windowLocation.y = caretRect.y + caretRect.height + SPACING;
}
compositionWindow.setLocation(windowLocation);
}
项目:OpenJSharp
文件:CompositionAreaHandler.java
/**
* Returns the input method request handler of the client component.
* When using the composition window for an active client (below-the-spot
* input), input method requests that do not relate to the display of
* the composed text are forwarded to the client component.
*/
InputMethodRequests getClientInputMethodRequests() {
Component client = clientComponent.get();
if (client != null) {
return client.getInputMethodRequests();
}
return null;
}
项目:OpenJSharp
文件:CompositionAreaHandler.java
public int getInsertPositionOffset() {
InputMethodRequests req = getClientInputMethodRequests();
if (req != null) {
return req.getInsertPositionOffset();
}
// we don't have access to the client component's text.
return 0;
}
项目:OpenJSharp
文件:CompositionAreaHandler.java
public AttributedCharacterIterator getCommittedText(int beginIndex,
int endIndex,
Attribute[] attributes) {
InputMethodRequests req = getClientInputMethodRequests();
if(req != null) {
return req.getCommittedText(beginIndex, endIndex, attributes);
}
// we don't have access to the client component's text.
return EMPTY_TEXT;
}
项目:OpenJSharp
文件:CompositionAreaHandler.java
public int getCommittedTextLength() {
InputMethodRequests req = getClientInputMethodRequests();
if(req != null) {
return req.getCommittedTextLength();
}
// we don't have access to the client component's text.
return 0;
}
项目:OpenJSharp
文件:CompositionAreaHandler.java
public AttributedCharacterIterator cancelLatestCommittedText(Attribute[] attributes) {
InputMethodRequests req = getClientInputMethodRequests();
if(req != null) {
return req.cancelLatestCommittedText(attributes);
}
// we don't have access to the client component's text.
return null;
}
项目:OpenJSharp
文件:CompositionAreaHandler.java
public AttributedCharacterIterator getSelectedText(Attribute[] attributes) {
InputMethodRequests req = getClientInputMethodRequests();
if(req != null) {
return req.getSelectedText(attributes);
}
// we don't have access to the client component's text.
return EMPTY_TEXT;
}
项目:OpenJSharp
文件:InputMethodContext.java
/**
* Dispatches committed text to a client component.
* Called by composition window.
*
* @param client The component that the text should get dispatched to.
* @param text The iterator providing access to the committed
* (and possible composed) text.
* @param committedCharacterCount The number of committed characters in the text.
*/
synchronized void dispatchCommittedText(Component client,
AttributedCharacterIterator text,
int committedCharacterCount) {
// note that the client is not always the current client component -
// some host input method adapters may dispatch input method events
// through the Java event queue, and we may have switched clients while
// the event was in the queue.
if (committedCharacterCount == 0
|| text.getEndIndex() <= text.getBeginIndex()) {
return;
}
long time = System.currentTimeMillis();
dispatchingCommittedText = true;
try {
InputMethodRequests req = client.getInputMethodRequests();
if (req != null) {
// active client -> send text as InputMethodEvent
int beginIndex = text.getBeginIndex();
AttributedCharacterIterator toBeCommitted =
(new AttributedString(text, beginIndex, beginIndex + committedCharacterCount)).getIterator();
InputMethodEvent inputEvent = new InputMethodEvent(
client,
InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
toBeCommitted,
committedCharacterCount,
null, null);
client.dispatchEvent(inputEvent);
} else {
// passive client -> send text as KeyEvents
char keyChar = text.first();
while (committedCharacterCount-- > 0 && keyChar != CharacterIterator.DONE) {
KeyEvent keyEvent = new KeyEvent(client, KeyEvent.KEY_TYPED,
time, 0, KeyEvent.VK_UNDEFINED, keyChar);
client.dispatchEvent(keyEvent);
keyChar = text.next();
}
}
} finally {
dispatchingCommittedText = false;
}
}
项目:OpenJSharp
文件:InputMethodContext.java
private InputMethodRequests getReq() {
if (haveActiveClient() && !useBelowTheSpotInput()) {
return getClientComponent().getInputMethodRequests();
} else {
return getCompositionAreaHandler(false);
}
}
项目:OpenJSharp
文件:JTextComponent.java
public InputMethodRequests getInputMethodRequests() {
if (inputMethodRequestsHandler == null) {
inputMethodRequestsHandler = new InputMethodRequestsHandler();
Document doc = getDocument();
if (doc != null) {
doc.addDocumentListener((DocumentListener)inputMethodRequestsHandler);
}
}
return inputMethodRequestsHandler;
}
项目:OpenJSharp
文件:XTextFieldPeer.java
/**
* @see java.awt.peer.TextComponentPeer
*/
@Override
public InputMethodRequests getInputMethodRequests() {
if (xtext != null) return xtext.getInputMethodRequests();
else return null;
}
项目:jdk8u-jdk
文件:CompositionArea.java
/**
* Positions the composition window near (usually below) the
* insertion point in the client component if the client
* component is an active client (below-the-spot input).
*/
void updateWindowLocation() {
InputMethodRequests req = handler.getClientInputMethodRequests();
if (req == null) {
// not an active client
return;
}
Point windowLocation = new Point();
Rectangle caretRect = req.getTextLocation(null);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension windowSize = compositionWindow.getSize();
final int SPACING = 2;
if (caretRect.x + windowSize.width > screenSize.width) {
windowLocation.x = screenSize.width - windowSize.width;
} else {
windowLocation.x = caretRect.x;
}
if (caretRect.y + caretRect.height + SPACING + windowSize.height > screenSize.height) {
windowLocation.y = caretRect.y - SPACING - windowSize.height;
} else {
windowLocation.y = caretRect.y + caretRect.height + SPACING;
}
compositionWindow.setLocation(windowLocation);
}
项目:jdk8u-jdk
文件:CompositionAreaHandler.java
/**
* Returns the input method request handler of the client component.
* When using the composition window for an active client (below-the-spot
* input), input method requests that do not relate to the display of
* the composed text are forwarded to the client component.
*/
InputMethodRequests getClientInputMethodRequests() {
Component client = clientComponent.get();
if (client != null) {
return client.getInputMethodRequests();
}
return null;
}
项目:jdk8u-jdk
文件:CompositionAreaHandler.java
public int getInsertPositionOffset() {
InputMethodRequests req = getClientInputMethodRequests();
if (req != null) {
return req.getInsertPositionOffset();
}
// we don't have access to the client component's text.
return 0;
}
项目:jdk8u-jdk
文件:CompositionAreaHandler.java
public AttributedCharacterIterator getCommittedText(int beginIndex,
int endIndex,
Attribute[] attributes) {
InputMethodRequests req = getClientInputMethodRequests();
if(req != null) {
return req.getCommittedText(beginIndex, endIndex, attributes);
}
// we don't have access to the client component's text.
return EMPTY_TEXT;
}