< prev index next >

src/java.desktop/share/classes/java/awt/im/InputContext.java

Print this page




 111      *
 112      * <li>
 113      * If the user has previously selected an input method or keyboard layout
 114      * for the requested locale from the user interface, then the most recently
 115      * selected such input method or keyboard layout is reselected.</li>
 116      *
 117      * <li>
 118      * Otherwise, an input method or keyboard layout that supports the requested
 119      * locale is selected in an implementation dependent way.</li>
 120      *
 121      * </ul>
 122      * Before switching away from an input method, any currently uncommitted text
 123      * is committed. If no input method or keyboard layout supporting the requested
 124      * locale is available, then false is returned.
 125      *
 126      * <p>
 127      * Not all host operating systems provide API to determine the locale of
 128      * the currently selected native input method or keyboard layout, and to
 129      * select a native input method or keyboard layout by locale.
 130      * For host operating systems that don't provide such API,
 131      * <code>selectInputMethod</code> assumes that native input methods or
 132      * keyboard layouts provided by the host operating system support only the
 133      * system's default locale.
 134      *
 135      * <p>
 136      * A text editing component may call this method, for example, when
 137      * the user changes the insertion point, so that the user can
 138      * immediately continue typing in the language of the surrounding text.
 139      *
 140      * @param locale The desired new locale.
 141      * @return true if the input method or keyboard layout that's active after
 142      *         this call supports the desired locale.
 143      * @exception NullPointerException if <code>locale</code> is null
 144      */
 145     public boolean selectInputMethod(Locale locale) {
 146         // real implementation is in sun.awt.im.InputContext
 147         return false;
 148     }
 149 
 150     /**
 151      * Returns the current locale of the current input method or keyboard
 152      * layout.
 153      * Returns null if the input context does not have a current input method
 154      * or keyboard layout or if the current input method's
 155      * {@link java.awt.im.spi.InputMethod#getLocale()} method returns null.
 156      *
 157      * <p>
 158      * Not all host operating systems provide API to determine the locale of
 159      * the currently selected native input method or keyboard layout.
 160      * For host operating systems that don't provide such API,
 161      * <code>getLocale</code> assumes that the current locale of all native
 162      * input methods or keyboard layouts provided by the host operating system
 163      * is the system's default locale.
 164      *
 165      * @return the current locale of the current input method or keyboard layout
 166      * @since 1.3
 167      */
 168     public Locale getLocale() {
 169         // real implementation is in sun.awt.im.InputContext
 170         return null;
 171     }
 172 
 173     /**
 174      * Sets the subsets of the Unicode character set that input methods of this input
 175      * context should be allowed to input. Null may be passed in to
 176      * indicate that all characters are allowed. The initial value
 177      * is null. The setting applies to the current input method as well
 178      * as input methods selected after this call is made. However,
 179      * applications cannot rely on this call having the desired effect,
 180      * since this setting cannot be passed on to all host input methods -
 181      * applications still need to apply their own character validation.
 182      * If no input methods are available, then this method has no effect.
 183      *
 184      * @param subsets The subsets of the Unicode character set from which characters may be input
 185      */
 186     public void setCharacterSubsets(Subset[] subsets) {
 187         // real implementation is in sun.awt.im.InputContext
 188     }
 189 
 190     /**
 191      * Enables or disables the current input method for composition,
 192      * depending on the value of the parameter <code>enable</code>.
 193      * <p>
 194      * An input method that is enabled for composition interprets incoming
 195      * events for both composition and control purposes, while a
 196      * disabled input method does not interpret events for composition.
 197      * Note however that events are passed on to the input method regardless
 198      * whether it is enabled or not, and that an input method that is disabled
 199      * for composition may still interpret events for control purposes,
 200      * including to enable or disable itself for composition.
 201      * <p>
 202      * For input methods provided by host operating systems, it is not always possible to
 203      * determine whether this operation is supported. For example, an input method may enable
 204      * composition only for some locales, and do nothing for other locales. For such input
 205      * methods, it is possible that this method does not throw
 206      * {@link java.lang.UnsupportedOperationException UnsupportedOperationException},
 207      * but also does not affect whether composition is enabled.
 208      *
 209      * @param enable whether to enable the current input method for composition
 210      * @throws UnsupportedOperationException if there is no current input
 211      * method available or the current input method does not support
 212      * the enabling/disabling operation
 213      * @see #isCompositionEnabled
 214      * @since 1.3
 215      */
 216     public void setCompositionEnabled(boolean enable) {
 217         // real implementation is in sun.awt.im.InputContext
 218     }
 219 
 220     /**
 221      * Determines whether the current input method is enabled for composition.
 222      * An input method that is enabled for composition interprets incoming
 223      * events for both composition and control purposes, while a
 224      * disabled input method does not interpret events for composition.
 225      *
 226      * @return <code>true</code> if the current input method is enabled for
 227      * composition; <code>false</code> otherwise
 228      * @throws UnsupportedOperationException if there is no current input
 229      * method available or the current input method does not support
 230      * checking whether it is enabled for composition
 231      * @see #setCompositionEnabled
 232      * @since 1.3
 233      */
 234     @Transient
 235     public boolean isCompositionEnabled() {
 236         // real implementation is in sun.awt.im.InputContext
 237         return false;
 238     }
 239 
 240     /**
 241      * Asks the current input method to reconvert text from the
 242      * current client component. The input method obtains the text to
 243      * be reconverted from the client component using the
 244      * {@link InputMethodRequests#getSelectedText InputMethodRequests.getSelectedText}
 245      * method. The other <code>InputMethodRequests</code> methods
 246      * must be prepared to deal with further information requests by
 247      * the input method. The composed and/or committed text will be
 248      * sent to the client component as a sequence of
 249      * <code>InputMethodEvent</code>s. If the input method cannot
 250      * reconvert the given text, the text is returned as committed
 251      * text in an <code>InputMethodEvent</code>.
 252      *
 253      * @throws UnsupportedOperationException if there is no current input
 254      * method available or the current input method does not support
 255      * the reconversion operation.
 256      *
 257      * @since 1.3
 258      */
 259     public void reconvert() {
 260         // real implementation is in sun.awt.im.InputContext
 261     }
 262 
 263     /**
 264      * Dispatches an event to the active input method. Called by AWT.
 265      * If no input method is available, then the event will never be consumed.
 266      *
 267      * @param event The event
 268      * @exception NullPointerException if <code>event</code> is null
 269      */
 270     public void dispatchEvent(AWTEvent event) {
 271         // real implementation is in sun.awt.im.InputContext
 272     }
 273 
 274     /**
 275      * Notifies the input context that a client component has been
 276      * removed from its containment hierarchy, or that input method
 277      * support has been disabled for the component. This method is
 278      * usually called from the client component's
 279      * {@link java.awt.Component#removeNotify() Component.removeNotify}
 280      * method. Potentially pending input from input methods
 281      * for this component is discarded.
 282      * If no input methods are available, then this method has no effect.
 283      *
 284      * @param client Client component
 285      * @exception NullPointerException if <code>client</code> is null
 286      */
 287     public void removeNotify(Component client) {
 288         // real implementation is in sun.awt.im.InputContext
 289     }
 290 
 291     /**
 292      * Ends any input composition that may currently be going on in this
 293      * context. Depending on the platform and possibly user preferences,
 294      * this may commit or delete uncommitted text. Any changes to the text
 295      * are communicated to the active component using an input method event.
 296      * If no input methods are available, then this method has no effect.
 297      *
 298      * <p>
 299      * A text editing component may call this in a variety of situations,
 300      * for example, when the user moves the insertion point within the text
 301      * (but outside the composed text), or when the component's text is
 302      * saved to a file or copied to the clipboard.
 303      *
 304      */
 305     public void endComposition() {




 111      *
 112      * <li>
 113      * If the user has previously selected an input method or keyboard layout
 114      * for the requested locale from the user interface, then the most recently
 115      * selected such input method or keyboard layout is reselected.</li>
 116      *
 117      * <li>
 118      * Otherwise, an input method or keyboard layout that supports the requested
 119      * locale is selected in an implementation dependent way.</li>
 120      *
 121      * </ul>
 122      * Before switching away from an input method, any currently uncommitted text
 123      * is committed. If no input method or keyboard layout supporting the requested
 124      * locale is available, then false is returned.
 125      *
 126      * <p>
 127      * Not all host operating systems provide API to determine the locale of
 128      * the currently selected native input method or keyboard layout, and to
 129      * select a native input method or keyboard layout by locale.
 130      * For host operating systems that don't provide such API,
 131      * {@code selectInputMethod} assumes that native input methods or
 132      * keyboard layouts provided by the host operating system support only the
 133      * system's default locale.
 134      *
 135      * <p>
 136      * A text editing component may call this method, for example, when
 137      * the user changes the insertion point, so that the user can
 138      * immediately continue typing in the language of the surrounding text.
 139      *
 140      * @param locale The desired new locale.
 141      * @return true if the input method or keyboard layout that's active after
 142      *         this call supports the desired locale.
 143      * @exception NullPointerException if {@code locale} is null
 144      */
 145     public boolean selectInputMethod(Locale locale) {
 146         // real implementation is in sun.awt.im.InputContext
 147         return false;
 148     }
 149 
 150     /**
 151      * Returns the current locale of the current input method or keyboard
 152      * layout.
 153      * Returns null if the input context does not have a current input method
 154      * or keyboard layout or if the current input method's
 155      * {@link java.awt.im.spi.InputMethod#getLocale()} method returns null.
 156      *
 157      * <p>
 158      * Not all host operating systems provide API to determine the locale of
 159      * the currently selected native input method or keyboard layout.
 160      * For host operating systems that don't provide such API,
 161      * {@code getLocale} assumes that the current locale of all native
 162      * input methods or keyboard layouts provided by the host operating system
 163      * is the system's default locale.
 164      *
 165      * @return the current locale of the current input method or keyboard layout
 166      * @since 1.3
 167      */
 168     public Locale getLocale() {
 169         // real implementation is in sun.awt.im.InputContext
 170         return null;
 171     }
 172 
 173     /**
 174      * Sets the subsets of the Unicode character set that input methods of this input
 175      * context should be allowed to input. Null may be passed in to
 176      * indicate that all characters are allowed. The initial value
 177      * is null. The setting applies to the current input method as well
 178      * as input methods selected after this call is made. However,
 179      * applications cannot rely on this call having the desired effect,
 180      * since this setting cannot be passed on to all host input methods -
 181      * applications still need to apply their own character validation.
 182      * If no input methods are available, then this method has no effect.
 183      *
 184      * @param subsets The subsets of the Unicode character set from which characters may be input
 185      */
 186     public void setCharacterSubsets(Subset[] subsets) {
 187         // real implementation is in sun.awt.im.InputContext
 188     }
 189 
 190     /**
 191      * Enables or disables the current input method for composition,
 192      * depending on the value of the parameter {@code enable}.
 193      * <p>
 194      * An input method that is enabled for composition interprets incoming
 195      * events for both composition and control purposes, while a
 196      * disabled input method does not interpret events for composition.
 197      * Note however that events are passed on to the input method regardless
 198      * whether it is enabled or not, and that an input method that is disabled
 199      * for composition may still interpret events for control purposes,
 200      * including to enable or disable itself for composition.
 201      * <p>
 202      * For input methods provided by host operating systems, it is not always possible to
 203      * determine whether this operation is supported. For example, an input method may enable
 204      * composition only for some locales, and do nothing for other locales. For such input
 205      * methods, it is possible that this method does not throw
 206      * {@link java.lang.UnsupportedOperationException UnsupportedOperationException},
 207      * but also does not affect whether composition is enabled.
 208      *
 209      * @param enable whether to enable the current input method for composition
 210      * @throws UnsupportedOperationException if there is no current input
 211      * method available or the current input method does not support
 212      * the enabling/disabling operation
 213      * @see #isCompositionEnabled
 214      * @since 1.3
 215      */
 216     public void setCompositionEnabled(boolean enable) {
 217         // real implementation is in sun.awt.im.InputContext
 218     }
 219 
 220     /**
 221      * Determines whether the current input method is enabled for composition.
 222      * An input method that is enabled for composition interprets incoming
 223      * events for both composition and control purposes, while a
 224      * disabled input method does not interpret events for composition.
 225      *
 226      * @return {@code true} if the current input method is enabled for
 227      * composition; {@code false} otherwise
 228      * @throws UnsupportedOperationException if there is no current input
 229      * method available or the current input method does not support
 230      * checking whether it is enabled for composition
 231      * @see #setCompositionEnabled
 232      * @since 1.3
 233      */
 234     @Transient
 235     public boolean isCompositionEnabled() {
 236         // real implementation is in sun.awt.im.InputContext
 237         return false;
 238     }
 239 
 240     /**
 241      * Asks the current input method to reconvert text from the
 242      * current client component. The input method obtains the text to
 243      * be reconverted from the client component using the
 244      * {@link InputMethodRequests#getSelectedText InputMethodRequests.getSelectedText}
 245      * method. The other {@code InputMethodRequests} methods
 246      * must be prepared to deal with further information requests by
 247      * the input method. The composed and/or committed text will be
 248      * sent to the client component as a sequence of
 249      * {@code InputMethodEvent}s. If the input method cannot
 250      * reconvert the given text, the text is returned as committed
 251      * text in an {@code InputMethodEvent}.
 252      *
 253      * @throws UnsupportedOperationException if there is no current input
 254      * method available or the current input method does not support
 255      * the reconversion operation.
 256      *
 257      * @since 1.3
 258      */
 259     public void reconvert() {
 260         // real implementation is in sun.awt.im.InputContext
 261     }
 262 
 263     /**
 264      * Dispatches an event to the active input method. Called by AWT.
 265      * If no input method is available, then the event will never be consumed.
 266      *
 267      * @param event The event
 268      * @exception NullPointerException if {@code event} is null
 269      */
 270     public void dispatchEvent(AWTEvent event) {
 271         // real implementation is in sun.awt.im.InputContext
 272     }
 273 
 274     /**
 275      * Notifies the input context that a client component has been
 276      * removed from its containment hierarchy, or that input method
 277      * support has been disabled for the component. This method is
 278      * usually called from the client component's
 279      * {@link java.awt.Component#removeNotify() Component.removeNotify}
 280      * method. Potentially pending input from input methods
 281      * for this component is discarded.
 282      * If no input methods are available, then this method has no effect.
 283      *
 284      * @param client Client component
 285      * @exception NullPointerException if {@code client} is null
 286      */
 287     public void removeNotify(Component client) {
 288         // real implementation is in sun.awt.im.InputContext
 289     }
 290 
 291     /**
 292      * Ends any input composition that may currently be going on in this
 293      * context. Depending on the platform and possibly user preferences,
 294      * this may commit or delete uncommitted text. Any changes to the text
 295      * are communicated to the active component using an input method event.
 296      * If no input methods are available, then this method has no effect.
 297      *
 298      * <p>
 299      * A text editing component may call this in a variety of situations,
 300      * for example, when the user moves the insertion point within the text
 301      * (but outside the composed text), or when the component's text is
 302      * saved to a file or copied to the clipboard.
 303      *
 304      */
 305     public void endComposition() {


< prev index next >