Java 类java.awt.im.spi.InputMethod 实例源码

项目:cn1    文件:InputMethodContext.java   
private void activateIM(InputMethod im) {
    Component c;

    im.activate();
    if ((nativeIM != null) && (im != nativeIM)) {
        // when Java IM is active
        // native input method editor must be
        // explicitly disabled
        nativeIM.disableIME();
    }
    IMManager.setLastActiveIMC(this);

    c = getClient();
    if (c != null) {
       c.getInputMethodRequests();
    }
}
项目:cn1    文件:InputMethodContext.java   
@Override
public boolean selectInputMethod(Locale locale) {        

    if ((inputMethod != null) && inputMethod.setLocale(locale)) {
        return true;
    }
    // first
    // take last user-selected IM for locale            
    InputMethod newIM = localeIM.get(locale);

    // if not found search through IM descriptors
    // and take already created instance if exists
    // or create, store new IM instance in descriptor->instance map
    if (newIM == null) {
        try {
            newIM = getIMInstance(IMManager.getIMDescriptors().iterator(),
                                  locale);
        } catch (Exception e) {
            // ignore exceptions - just return false
        }
    }

    return switchToIM(locale, newIM);
}
项目:cn1    文件:InputMethodContext.java   
public void enableClientWindowNotification(InputMethod inputMethod,
                                           boolean enable) {
    if (enable) {
        notifyIM.add(inputMethod);
        if (client != null) {
            notifyClientWindowChange(IMManager.getWindow(client).getBounds());
        } else {
            pendingClientNotify = true;
        }
    } else {
        notifyIM.remove(inputMethod);
    }



}
项目:freeVM    文件:InputMethodContext.java   
@Override
public boolean selectInputMethod(Locale locale) {        

    if ((inputMethod != null) && inputMethod.setLocale(locale)) {
        return true;
    }
    // first
    // take last user-selected IM for locale            
    InputMethod newIM = localeIM.get(locale);

    // if not found search through IM descriptors
    // and take already created instance if exists
    // or create, store new IM instance in descriptor->instance map
    if (newIM == null) {
        try {
            newIM = getIMInstance(IMManager.getIMDescriptors().iterator(),
                                  locale);
        } catch (Exception e) {
            // ignore exceptions - just return false
        }
    }

    return switchToIM(locale, newIM);
}
项目:freeVM    文件:InputMethodContext.java   
public void enableClientWindowNotification(InputMethod inputMethod,
                                           boolean enable) {
    if (enable) {
        notifyIM.add(inputMethod);
        if (client != null) {
            notifyClientWindowChange(IMManager.getWindow(client).getBounds());
        } else {
            pendingClientNotify = true;
        }
    } else {
        notifyIM.remove(inputMethod);
    }



}
项目:freeVM    文件:InputMethodContext.java   
private void activateIM(InputMethod im) {
    Component c;

    im.activate();
    if ((nativeIM != null) && (im != nativeIM)) {
        // when Java IM is active
        // native input method editor must be
        // explicitly disabled
        nativeIM.disableIME();
    }
    IMManager.setLastActiveIMC(this);

    c = getClient();
    if (c != null) {
       c.getInputMethodRequests();
    }
}
项目:freeVM    文件:InputMethodContext.java   
@Override
public boolean selectInputMethod(Locale locale) {        

    if ((inputMethod != null) && inputMethod.setLocale(locale)) {
        return true;
    }
    // first
    // take last user-selected IM for locale            
    InputMethod newIM = localeIM.get(locale);

    // if not found search through IM descriptors
    // and take already created instance if exists
    // or create, store new IM instance in descriptor->instance map
    if (newIM == null) {
        try {
            newIM = getIMInstance(IMManager.getIMDescriptors().iterator(),
                                  locale);
        } catch (Exception e) {
            // ignore exceptions - just return false
        }
    }

    return switchToIM(locale, newIM);
}
项目:freeVM    文件:InputMethodContext.java   
public void enableClientWindowNotification(InputMethod inputMethod,
                                           boolean enable) {
    if (enable) {
        notifyIM.add(inputMethod);
        if (client != null) {
            notifyClientWindowChange(IMManager.getWindow(client).getBounds());
        } else {
            pendingClientNotify = true;
        }
    } else {
        notifyIM.remove(inputMethod);
    }



}
项目:OpenJSharp    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#reconvert
 * @since 1.3
 * @exception UnsupportedOperationException when input method is null
 */
public synchronized void reconvert() {
    InputMethod inputMethod = getInputMethod();
    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.reconvert();
}
项目:OpenJSharp    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#getInputMethodControlObject
 */
public synchronized Object getInputMethodControlObject() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod != null) {
        return inputMethod.getControlObject();
    } else {
        return null;
    }
}
项目:OpenJSharp    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#setCompositionEnabled(boolean)
 * @exception UnsupportedOperationException when input method is null
 */
public void setCompositionEnabled(boolean enable) {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.setCompositionEnabled(enable);
}
项目:OpenJSharp    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#isCompositionEnabled
 * @exception UnsupportedOperationException when input method is null
 */
public boolean isCompositionEnabled() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    return inputMethod.isCompositionEnabled();
}
项目:OpenJSharp    文件:InputContext.java   
/**
 * @return a string with information about the current input method.
 * @exception UnsupportedOperationException when input method is null
 */
public String getInputMethodInfo() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException("Null input method");
    }

    String inputMethodInfo = null;
    if (inputMethod instanceof InputMethodAdapter) {
        // returns the information about the host native input method.
        inputMethodInfo = ((InputMethodAdapter)inputMethod).
            getNativeInputMethodInfo();
    }

    // extracts the information from the InputMethodDescriptor
    // associated with the current java input method.
    if (inputMethodInfo == null && inputMethodLocator != null) {
        inputMethodInfo = inputMethodLocator.getDescriptor().
            getInputMethodDisplayName(getLocale(), SunToolkit.
                                      getStartupLocale());
    }

    if (inputMethodInfo != null && !inputMethodInfo.equals("")) {
        return inputMethodInfo;
    }

    // do our best to return something useful.
    return inputMethod.toString() + "-" + inputMethod.getLocale().toString();
}
项目:OpenJSharp    文件:InputContext.java   
private synchronized InputMethod getInputMethod() {
    if (inputMethod != null) {
        return inputMethod;
    }

    if (inputMethodCreationFailed) {
        return null;
    }

    inputMethod = getInputMethodInstance();
    return inputMethod;
}
项目:OpenJSharp    文件:InputContext.java   
/**
 * @see java.awt.im.spi.InputMethodContext#enableClientWindowNotification
 */
synchronized void enableClientWindowNotification(InputMethod requester,
                                                 boolean enable) {
    // in case this request is not from the current input method,
    // store the request and handle it when this requesting input
    // method becomes the current one.
    if (requester != inputMethod) {
        if (perInputMethodState == null) {
            perInputMethodState = new HashMap<>(5);
        }
        perInputMethodState.put(requester, Boolean.valueOf(enable));
        return;
    }

    if (clientWindowNotificationEnabled != enable) {
        clientWindowLocation = null;
        clientWindowNotificationEnabled = enable;
    }
    if (clientWindowNotificationEnabled) {
        if (!addedClientWindowListeners()) {
            addClientWindowListeners();
        }
        if (clientWindowListened != null) {
            clientWindowLocation = null;
            notifyClientWindowChange(clientWindowListened);
        }
    } else {
        if (addedClientWindowListeners()) {
            removeClientWindowListeners();
        }
    }
}
项目:jdk8u-jdk    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#reconvert
 * @since 1.3
 * @exception UnsupportedOperationException when input method is null
 */
public synchronized void reconvert() {
    InputMethod inputMethod = getInputMethod();
    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.reconvert();
}
项目:jdk8u-jdk    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#getInputMethodControlObject
 */
public synchronized Object getInputMethodControlObject() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod != null) {
        return inputMethod.getControlObject();
    } else {
        return null;
    }
}
项目:jdk8u-jdk    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#setCompositionEnabled(boolean)
 * @exception UnsupportedOperationException when input method is null
 */
public void setCompositionEnabled(boolean enable) {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.setCompositionEnabled(enable);
}
项目:jdk8u-jdk    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#isCompositionEnabled
 * @exception UnsupportedOperationException when input method is null
 */
public boolean isCompositionEnabled() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    return inputMethod.isCompositionEnabled();
}
项目:jdk8u-jdk    文件:InputContext.java   
/**
 * @return a string with information about the current input method.
 * @exception UnsupportedOperationException when input method is null
 */
public String getInputMethodInfo() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException("Null input method");
    }

    String inputMethodInfo = null;
    if (inputMethod instanceof InputMethodAdapter) {
        // returns the information about the host native input method.
        inputMethodInfo = ((InputMethodAdapter)inputMethod).
            getNativeInputMethodInfo();
    }

    // extracts the information from the InputMethodDescriptor
    // associated with the current java input method.
    if (inputMethodInfo == null && inputMethodLocator != null) {
        inputMethodInfo = inputMethodLocator.getDescriptor().
            getInputMethodDisplayName(getLocale(), SunToolkit.
                                      getStartupLocale());
    }

    if (inputMethodInfo != null && !inputMethodInfo.equals("")) {
        return inputMethodInfo;
    }

    // do our best to return something useful.
    return inputMethod.toString() + "-" + inputMethod.getLocale().toString();
}
项目:jdk8u-jdk    文件:InputContext.java   
private synchronized InputMethod getInputMethod() {
    if (inputMethod != null) {
        return inputMethod;
    }

    if (inputMethodCreationFailed) {
        return null;
    }

    inputMethod = getInputMethodInstance();
    return inputMethod;
}
项目:jdk8u-jdk    文件:InputContext.java   
/**
 * @see java.awt.im.spi.InputMethodContext#enableClientWindowNotification
 */
synchronized void enableClientWindowNotification(InputMethod requester,
                                                 boolean enable) {
    // in case this request is not from the current input method,
    // store the request and handle it when this requesting input
    // method becomes the current one.
    if (requester != inputMethod) {
        if (perInputMethodState == null) {
            perInputMethodState = new HashMap<>(5);
        }
        perInputMethodState.put(requester, Boolean.valueOf(enable));
        return;
    }

    if (clientWindowNotificationEnabled != enable) {
        clientWindowLocation = null;
        clientWindowNotificationEnabled = enable;
    }
    if (clientWindowNotificationEnabled) {
        if (!addedClientWindowListeners()) {
            addClientWindowListeners();
        }
        if (clientWindowListened != null) {
            clientWindowLocation = null;
            notifyClientWindowChange(clientWindowListened);
        }
    } else {
        if (addedClientWindowListeners()) {
            removeClientWindowListeners();
        }
    }
}
项目:openjdk-jdk10    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#reconvert
 * @since 1.3
 * @exception UnsupportedOperationException when input method is null
 */
public synchronized void reconvert() {
    InputMethod inputMethod = getInputMethod();
    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.reconvert();
}
项目:openjdk-jdk10    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#getInputMethodControlObject
 */
public synchronized Object getInputMethodControlObject() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod != null) {
        return inputMethod.getControlObject();
    } else {
        return null;
    }
}
项目:openjdk-jdk10    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#setCompositionEnabled(boolean)
 * @exception UnsupportedOperationException when input method is null
 */
public void setCompositionEnabled(boolean enable) {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.setCompositionEnabled(enable);
}
项目:openjdk-jdk10    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#isCompositionEnabled
 * @exception UnsupportedOperationException when input method is null
 */
public boolean isCompositionEnabled() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    return inputMethod.isCompositionEnabled();
}
项目:openjdk-jdk10    文件:InputContext.java   
/**
 * @return a string with information about the current input method.
 * @exception UnsupportedOperationException when input method is null
 */
public String getInputMethodInfo() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException("Null input method");
    }

    String inputMethodInfo = null;
    if (inputMethod instanceof InputMethodAdapter) {
        // returns the information about the host native input method.
        inputMethodInfo = ((InputMethodAdapter)inputMethod).
            getNativeInputMethodInfo();
    }

    // extracts the information from the InputMethodDescriptor
    // associated with the current java input method.
    if (inputMethodInfo == null && inputMethodLocator != null) {
        inputMethodInfo = inputMethodLocator.getDescriptor().
            getInputMethodDisplayName(getLocale(), SunToolkit.
                                      getStartupLocale());
    }

    if (inputMethodInfo != null && !inputMethodInfo.equals("")) {
        return inputMethodInfo;
    }

    // do our best to return something useful.
    return inputMethod.toString() + "-" + inputMethod.getLocale().toString();
}
项目:openjdk-jdk10    文件:InputContext.java   
private synchronized InputMethod getInputMethod() {
    if (inputMethod != null) {
        return inputMethod;
    }

    if (inputMethodCreationFailed) {
        return null;
    }

    inputMethod = getInputMethodInstance();
    return inputMethod;
}
项目:openjdk-jdk10    文件:InputContext.java   
/**
 * @see java.awt.im.spi.InputMethodContext#enableClientWindowNotification
 */
synchronized void enableClientWindowNotification(InputMethod requester,
                                                 boolean enable) {
    // in case this request is not from the current input method,
    // store the request and handle it when this requesting input
    // method becomes the current one.
    if (requester != inputMethod) {
        if (perInputMethodState == null) {
            perInputMethodState = new HashMap<>(5);
        }
        perInputMethodState.put(requester, Boolean.valueOf(enable));
        return;
    }

    if (clientWindowNotificationEnabled != enable) {
        clientWindowLocation = null;
        clientWindowNotificationEnabled = enable;
    }
    if (clientWindowNotificationEnabled) {
        if (!addedClientWindowListeners()) {
            addClientWindowListeners();
        }
        if (clientWindowListened != null) {
            clientWindowLocation = null;
            notifyClientWindowChange(clientWindowListened);
        }
    } else {
        if (addedClientWindowListeners()) {
            removeClientWindowListeners();
        }
    }
}
项目:openjdk9    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#reconvert
 * @since 1.3
 * @exception UnsupportedOperationException when input method is null
 */
public synchronized void reconvert() {
    InputMethod inputMethod = getInputMethod();
    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.reconvert();
}
项目:openjdk9    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#getInputMethodControlObject
 */
public synchronized Object getInputMethodControlObject() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod != null) {
        return inputMethod.getControlObject();
    } else {
        return null;
    }
}
项目:openjdk9    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#setCompositionEnabled(boolean)
 * @exception UnsupportedOperationException when input method is null
 */
public void setCompositionEnabled(boolean enable) {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.setCompositionEnabled(enable);
}
项目:openjdk9    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#isCompositionEnabled
 * @exception UnsupportedOperationException when input method is null
 */
public boolean isCompositionEnabled() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    return inputMethod.isCompositionEnabled();
}
项目:openjdk9    文件:InputContext.java   
/**
 * @return a string with information about the current input method.
 * @exception UnsupportedOperationException when input method is null
 */
public String getInputMethodInfo() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException("Null input method");
    }

    String inputMethodInfo = null;
    if (inputMethod instanceof InputMethodAdapter) {
        // returns the information about the host native input method.
        inputMethodInfo = ((InputMethodAdapter)inputMethod).
            getNativeInputMethodInfo();
    }

    // extracts the information from the InputMethodDescriptor
    // associated with the current java input method.
    if (inputMethodInfo == null && inputMethodLocator != null) {
        inputMethodInfo = inputMethodLocator.getDescriptor().
            getInputMethodDisplayName(getLocale(), SunToolkit.
                                      getStartupLocale());
    }

    if (inputMethodInfo != null && !inputMethodInfo.equals("")) {
        return inputMethodInfo;
    }

    // do our best to return something useful.
    return inputMethod.toString() + "-" + inputMethod.getLocale().toString();
}
项目:openjdk9    文件:InputContext.java   
private synchronized InputMethod getInputMethod() {
    if (inputMethod != null) {
        return inputMethod;
    }

    if (inputMethodCreationFailed) {
        return null;
    }

    inputMethod = getInputMethodInstance();
    return inputMethod;
}
项目:openjdk9    文件:InputContext.java   
/**
 * @see java.awt.im.spi.InputMethodContext#enableClientWindowNotification
 */
synchronized void enableClientWindowNotification(InputMethod requester,
                                                 boolean enable) {
    // in case this request is not from the current input method,
    // store the request and handle it when this requesting input
    // method becomes the current one.
    if (requester != inputMethod) {
        if (perInputMethodState == null) {
            perInputMethodState = new HashMap<>(5);
        }
        perInputMethodState.put(requester, Boolean.valueOf(enable));
        return;
    }

    if (clientWindowNotificationEnabled != enable) {
        clientWindowLocation = null;
        clientWindowNotificationEnabled = enable;
    }
    if (clientWindowNotificationEnabled) {
        if (!addedClientWindowListeners()) {
            addClientWindowListeners();
        }
        if (clientWindowListened != null) {
            clientWindowLocation = null;
            notifyClientWindowChange(clientWindowListened);
        }
    } else {
        if (addedClientWindowListeners()) {
            removeClientWindowListeners();
        }
    }
}
项目:jdk8u_jdk    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#reconvert
 * @since 1.3
 * @exception UnsupportedOperationException when input method is null
 */
public synchronized void reconvert() {
    InputMethod inputMethod = getInputMethod();
    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.reconvert();
}
项目:jdk8u_jdk    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#getInputMethodControlObject
 */
public synchronized Object getInputMethodControlObject() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod != null) {
        return inputMethod.getControlObject();
    } else {
        return null;
    }
}
项目:jdk8u_jdk    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#setCompositionEnabled(boolean)
 * @exception UnsupportedOperationException when input method is null
 */
public void setCompositionEnabled(boolean enable) {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.setCompositionEnabled(enable);
}
项目:jdk8u_jdk    文件:InputContext.java   
/**
 * @see java.awt.im.InputContext#isCompositionEnabled
 * @exception UnsupportedOperationException when input method is null
 */
public boolean isCompositionEnabled() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    return inputMethod.isCompositionEnabled();
}