KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > im > spi > InputMethodDescriptor


1 /*
2  * @(#)InputMethodDescriptor.java 1.11 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8
9 package java.awt.im.spi;
10
11 import java.awt.AWTException JavaDoc;
12 import java.awt.Image JavaDoc;
13 import java.util.Locale JavaDoc;
14
15 /**
16  * Defines methods that provide sufficient information about an input method
17  * to enable selection and loading of that input method.
18  * The input method itself is only loaded when it is actually used.
19  *
20  * @since 1.3
21  */

22
23 public interface InputMethodDescriptor {
24
25     /**
26      * Returns the locales supported by the corresponding input method.
27      * The locale may describe just the language, or may also include
28      * country and variant information if needed.
29      * The information is used to select input methods by locale
30      * ({@link java.awt.im.InputContext#selectInputMethod(Locale)}). It may also
31      * be used to sort input methods by locale in a user-visible
32      * list of input methods.
33      * <p>
34      * Only the input method's primary locales should be returned.
35      * For example, if a Japanese input method also has a pass-through
36      * mode for Roman characters, typically still only Japanese would
37      * be returned. Thus, the list of locales returned is typically
38      * a subset of the locales for which the corresponding input method's
39      * implementation of {@link java.awt.im.spi.InputMethod#setLocale} returns true.
40      * <p>
41      * If {@link #hasDynamicLocaleList} returns true, this method is
42      * called each time the information is needed. This
43      * gives input methods that depend on network resources the chance
44      * to add or remove locales as resources become available or
45      * unavailable.
46      *
47      * @return the locales supported by the input method
48      * @exception AWTException if it can be determined that the input method
49      * is inoperable, for example, because of incomplete installation.
50      */

51     Locale JavaDoc[] getAvailableLocales() throws AWTException JavaDoc;
52     
53     /**
54      * Returns whether the list of available locales can change
55      * at runtime. This may be the case, for example, for adapters
56      * that access real input methods over the network.
57      */

58     boolean hasDynamicLocaleList();
59     
60     /**
61      * Returns the user-visible name of the corresponding
62      * input method for the given input locale in the language in which
63      * the name will be displayed.
64      * <p>
65      * The inputLocale parameter specifies the locale for which text
66      * is input.
67      * This parameter can only take values obtained from this descriptor's
68      * {@link #getAvailableLocales} method or null. If it is null, an
69      * input locale independent name for the input method should be
70      * returned.
71      * <p>
72      * If a name for the desired display language is not available, the
73      * method may fall back to some other language.
74      *
75      * @param inputLocale the locale for which text input is supported, or null
76      * @param displayLanguage the language in which the name will be displayed
77      */

78     String JavaDoc getInputMethodDisplayName(Locale JavaDoc inputLocale, Locale JavaDoc displayLanguage);
79     
80     /**
81      * Returns an icon for the corresponding input method.
82      * The icon may be used by a user interface for selecting input methods.
83      * <p>
84      * The inputLocale parameter specifies the locale for which text
85      * is input.
86      * This parameter can only take values obtained from this descriptor's
87      * {@link #getAvailableLocales} method or null. If it is null, an
88      * input locale independent icon for the input method should be
89      * returned.
90      * <p>
91      * The icon's size should be 16&times;16 pixels.
92      *
93      * @param inputLocale the locale for which text input is supported, or null
94      * @return an icon for the corresponding input method, or null
95      */

96     Image JavaDoc getInputMethodIcon(Locale JavaDoc inputLocale);
97     
98     /**
99      * Creates a new instance of the corresponding input method.
100      *
101      * @return a new instance of the corresponding input method
102      * @exception Exception any exception that may occur while creating the
103      * input method instance
104      */

105     InputMethod JavaDoc createInputMethod() throws Exception JavaDoc;
106 }
107
Popular Tags