]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_4_2-src/tools/misc/src/com/ibm/icu/dev/tool/ime/translit/TransliteratorInputMethodDescriptor.java
go
[Dictionary.git] / jars / icu4j-4_4_2-src / tools / misc / src / com / ibm / icu / dev / tool / ime / translit / TransliteratorInputMethodDescriptor.java
1 /*\r
2  *******************************************************************************\r
3  * Copyright (C) 2004-2010, International Business Machines Corporation and    *\r
4  * others. All Rights Reserved.                                                *\r
5  *******************************************************************************\r
6  */\r
7 \r
8 package com.ibm.icu.dev.tool.ime.translit;\r
9 \r
10 import java.awt.Image;\r
11 import java.awt.im.spi.InputMethod;\r
12 import java.awt.im.spi.InputMethodDescriptor;\r
13 import java.util.Locale;\r
14 import java.util.MissingResourceException;\r
15 import java.util.ResourceBundle;\r
16 \r
17 /**\r
18 * The TransliteratorInputMethodDescriptor class is used to identify this package\r
19 * as an input method editor.\r
20 */\r
21 \r
22 public class TransliteratorInputMethodDescriptor implements InputMethodDescriptor {\r
23 \r
24     private ResourceBundle rb = null;\r
25 \r
26     /**\r
27     * Creates the Transliterator IME this is automatically callled by the\r
28     * JVM when the Transliterator IME is selected from the input method list.\r
29     *\r
30     * @return InputMethod The Transliterator IME object.\r
31     */\r
32     public InputMethod createInputMethod() throws Exception {\r
33         return new TransliteratorInputMethod();\r
34     }\r
35   \r
36     /**\r
37     * Get the list of locales that this IME supports.\r
38     *\r
39     * @return Locale[] This will always have one locale. By default\r
40     *                  we just return the current locale. Therefore\r
41     *                  the Transliterator IME works in all locales.\r
42     */\r
43     // use the current active locale\r
44     public Locale[] getAvailableLocales() {\r
45         return new Locale[] {Locale.getDefault()};\r
46     }\r
47 \r
48     /**\r
49     * The Transliterator IME does not support dynamic locales. The Transliterator\r
50     * IME's functionality does not depend upon any locale.\r
51     *\r
52     * @return boolean This will always be false.\r
53     */\r
54     public boolean hasDynamicLocaleList() {\r
55         return false;\r
56     }\r
57 \r
58     /**\r
59     * Obtain the localized name of the Transliterator IME\r
60     *\r
61     * @param inputLocale the requested input method locale\r
62     * @param displayLanguage The requested translation of the Transliterator IME\r
63     * @return the localized name for the Transliterator IME\r
64     */\r
65     public String getInputMethodDisplayName(Locale inputLocale,\r
66                                             Locale displayLanguage) {\r
67         String name = null;\r
68 \r
69         try {\r
70             rb = ResourceBundle.getBundle("com.ibm.icu.dev.tool.ime.translit.Transliterator", displayLanguage);\r
71             name = rb.getString("name");\r
72         }\r
73         catch (MissingResourceException m) {\r
74             // use a hardcoded value\r
75             name = "Transliterator";\r
76         }\r
77         return name;\r
78     }\r
79 \r
80     /**\r
81     * Get the icon for the Transliterator IME. This is not supported.\r
82     *\r
83     * @param inputLocale (This is ignored).\r
84     *\r
85     * @return Image This will always be null.\r
86     */\r
87     public Image getInputMethodIcon(Locale inputLocale) {\r
88        return null;\r
89     }\r
90 }\r
91 \r