2362N/A * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Provides methods to control text input facilities such as input 0N/A * methods and keyboard layouts. 0N/A * Two methods handle both input methods and keyboard layouts: selectInputMethod 0N/A * lets a client component select an input method or keyboard layout by locale, 0N/A * getLocale lets a client component obtain the locale of the current input method 0N/A * or keyboard layout. 0N/A * The other methods more specifically support interaction with input methods: 0N/A * They let client components control the behavior of input methods, and 0N/A * dispatch events from the client component to the input method. 0N/A * By default, one InputContext instance is created per Window instance, 0N/A * and this input context is shared by all components within the window's 0N/A * container hierarchy. However, this means that only one text input 0N/A * operation is possible at any one time within a window, and that the 0N/A * text needs to be committed when moving the focus from one text component 0N/A * to another. If this is not desired, text components can create their 0N/A * own input context instances. 0N/A * The Java Platform supports input methods that have been developed in the Java 0N/A * programming language, using the interfaces in the {@link java.awt.im.spi} package, 0N/A * and installed into a Java SE Runtime Environment as extensions. Implementations 0N/A * may also support using the native input methods of the platforms they run on; 0N/A * however, not all platforms and locales provide input methods. Keyboard layouts 0N/A * are provided by the host platform. 0N/A * Input methods are <em>unavailable</em> if (a) no input method written 0N/A * in the Java programming language has been installed and (b) the Java Platform implementation 0N/A * or the underlying platform does not support native input methods. In this case, 0N/A * input contexts can still be created and used; their behavior is specified with 0N/A * the individual methods below. 0N/A * @see java.awt.Component#getInputContext 0N/A * @see java.awt.Component#enableInputMethods 0N/A * Constructs an InputContext. 0N/A * This method is protected so clients cannot instantiate 0N/A * InputContext directly. Input contexts are obtained by 0N/A * calling {@link #getInstance}. 0N/A // real implementation is in sun.awt.im.InputContext 0N/A * Returns a new InputContext instance. 0N/A * Attempts to select an input method or keyboard layout that 0N/A * supports the given locale, and returns a value indicating whether such 0N/A * an input method or keyboard layout has been successfully selected. The 0N/A * following steps are taken until an input method has been selected: 0N/A * If the currently selected input method or keyboard layout supports the 0N/A * requested locale, it remains selected.</li> 0N/A * If there is no input method or keyboard layout available that supports 0N/A * the requested locale, the current input method or keyboard layout remains 0N/A * If the user has previously selected an input method or keyboard layout 0N/A * for the requested locale from the user interface, then the most recently 0N/A * selected such input method or keyboard layout is reselected.</li> 0N/A * Otherwise, an input method or keyboard layout that supports the requested 0N/A * locale is selected in an implementation dependent way.</li> 0N/A * Before switching away from an input method, any currently uncommitted text 0N/A * is committed. If no input method or keyboard layout supporting the requested 0N/A * locale is available, then false is returned. 0N/A * Not all host operating systems provide API to determine the locale of 0N/A * the currently selected native input method or keyboard layout, and to 0N/A * select a native input method or keyboard layout by locale. 0N/A * For host operating systems that don't provide such API, 0N/A * <code>selectInputMethod</code> assumes that native input methods or 0N/A * keyboard layouts provided by the host operating system support only the 0N/A * system's default locale. 0N/A * A text editing component may call this method, for example, when 0N/A * the user changes the insertion point, so that the user can 0N/A * immediately continue typing in the language of the surrounding text. 0N/A * @param locale The desired new locale. 0N/A * @return true if the input method or keyboard layout that's active after 0N/A * this call supports the desired locale. 0N/A * @exception NullPointerException if <code>locale</code> is null 0N/A // real implementation is in sun.awt.im.InputContext 0N/A * Returns the current locale of the current input method or keyboard 0N/A * Returns null if the input context does not have a current input method 0N/A * or keyboard layout or if the current input method's 0N/A * {@link java.awt.im.spi.InputMethod#getLocale()} method returns null. 0N/A * Not all host operating systems provide API to determine the locale of 0N/A * the currently selected native input method or keyboard layout. 0N/A * For host operating systems that don't provide such API, 0N/A * <code>getLocale</code> assumes that the current locale of all native 0N/A * input methods or keyboard layouts provided by the host operating system 0N/A * is the system's default locale. 0N/A * @return the current locale of the current input method or keyboard layout 0N/A // real implementation is in sun.awt.im.InputContext 0N/A * Sets the subsets of the Unicode character set that input methods of this input 0N/A * context should be allowed to input. Null may be passed in to 0N/A * indicate that all characters are allowed. The initial value 0N/A * is null. The setting applies to the current input method as well 0N/A * as input methods selected after this call is made. However, 0N/A * applications cannot rely on this call having the desired effect, 0N/A * since this setting cannot be passed on to all host input methods - 0N/A * applications still need to apply their own character validation. 0N/A * If no input methods are available, then this method has no effect. 0N/A * @param subsets The subsets of the Unicode character set from which characters may be input 0N/A // real implementation is in sun.awt.im.InputContext 0N/A * Enables or disables the current input method for composition, 0N/A * depending on the value of the parameter <code>enable</code>. 0N/A * An input method that is enabled for composition interprets incoming 0N/A * events for both composition and control purposes, while a 0N/A * disabled input method does not interpret events for composition. 0N/A * Note however that events are passed on to the input method regardless 0N/A * whether it is enabled or not, and that an input method that is disabled 0N/A * for composition may still interpret events for control purposes, 0N/A * including to enable or disable itself for composition. 0N/A * For input methods provided by host operating systems, it is not always possible to 0N/A * determine whether this operation is supported. For example, an input method may enable 0N/A * composition only for some locales, and do nothing for other locales. For such input 0N/A * methods, it is possible that this method does not throw 0N/A * {@link java.lang.UnsupportedOperationException UnsupportedOperationException}, 0N/A * but also does not affect whether composition is enabled. 0N/A * @param enable whether to enable the current input method for composition 0N/A * @throws UnsupportedOperationException if there is no current input 0N/A * method available or the current input method does not support 0N/A * @see #isCompositionEnabled 0N/A // real implementation is in sun.awt.im.InputContext 0N/A * Determines whether the current input method is enabled for composition. 0N/A * An input method that is enabled for composition interprets incoming 0N/A * events for both composition and control purposes, while a 0N/A * disabled input method does not interpret events for composition. 0N/A * @return <code>true</code> if the current input method is enabled for 0N/A * composition; <code>false</code> otherwise 0N/A * @throws UnsupportedOperationException if there is no current input 0N/A * method available or the current input method does not support 0N/A * checking whether it is enabled for composition 0N/A * @see #setCompositionEnabled 0N/A // real implementation is in sun.awt.im.InputContext 0N/A * Asks the current input method to reconvert text from the 0N/A * current client component. The input method obtains the text to 0N/A * be reconverted from the client component using the 0N/A * {@link InputMethodRequests#getSelectedText InputMethodRequests.getSelectedText} 0N/A * method. The other <code>InputMethodRequests</code> methods 0N/A * must be prepared to deal with further information requests by 0N/A * the input method. The composed and/or committed text will be 0N/A * sent to the client component as a sequence of 0N/A * <code>InputMethodEvent</code>s. If the input method cannot 0N/A * reconvert the given text, the text is returned as committed 0N/A * text in an <code>InputMethodEvent</code>. 0N/A * @throws UnsupportedOperationException if there is no current input 0N/A * method available or the current input method does not support 0N/A * the reconversion operation. 0N/A // real implementation is in sun.awt.im.InputContext 0N/A * Dispatches an event to the active input method. Called by AWT. 0N/A * If no input method is available, then the event will never be consumed. 0N/A * @param event The event 0N/A * @exception NullPointerException if <code>event</code> is null 0N/A // real implementation is in sun.awt.im.InputContext 0N/A * Notifies the input context that a client component has been 0N/A * removed from its containment hierarchy, or that input method 0N/A * support has been disabled for the component. This method is 0N/A * usually called from the client component's 0N/A * {@link java.awt.Component#removeNotify() Component.removeNotify} 0N/A * method. Potentially pending input from input methods 0N/A * for this component is discarded. 0N/A * If no input methods are available, then this method has no effect. 0N/A * @param client Client component 0N/A * @exception NullPointerException if <code>client</code> is null 0N/A // real implementation is in sun.awt.im.InputContext 0N/A * Ends any input composition that may currently be going on in this 0N/A * context. Depending on the platform and possibly user preferences, 0N/A * this may commit or delete uncommitted text. Any changes to the text 0N/A * are communicated to the active component using an input method event. 0N/A * If no input methods are available, then this method has no effect. 0N/A * A text editing component may call this in a variety of situations, 0N/A * for example, when the user moves the insertion point within the text 0N/A * (but outside the composed text), or when the component's text is 0N/A * saved to a file or copied to the clipboard. 0N/A // real implementation is in sun.awt.im.InputContext 0N/A * Releases the resources used by this input context. 0N/A * Called by AWT for the default input context of each Window. 0N/A * If no input methods are available, then this method 0N/A // real implementation is in sun.awt.im.InputContext 0N/A * Returns a control object from the current input method, or null. A 0N/A * control object provides methods that control the behavior of the 0N/A * input method or obtain information from the input method. The type 0N/A * of the object is an input method specific class. Clients have to 0N/A * compare the result against known input method control object 0N/A * classes and cast to the appropriate class to invoke the methods 0N/A * If no input methods are available or the current input method does 0N/A * not provide an input method control object, then null is returned. 0N/A * @return A control object from the current input method, or null. 0N/A // real implementation is in sun.awt.im.InputContext