01: /*
02: *******************************************************************************
03: * Copyright (C) 2004, International Business Machines Corporation and *
04: * others. All Rights Reserved. *
05: *******************************************************************************
06: */
07:
08: package com.ibm.icu.dev.tool.ime.indic;
09:
10: import java.awt.Image;
11: import java.awt.im.spi.InputMethod;
12: import java.awt.im.spi.InputMethodDescriptor;
13: import java.util.Locale;
14: import java.util.ResourceBundle;
15:
16: public abstract class IndicIMDescriptor implements
17: InputMethodDescriptor {
18: private final Locale locale;
19: private final String name;
20:
21: protected IndicIMDescriptor(Locale locale, String name) {
22: this .locale = locale;
23: this .name = name;
24: }
25:
26: protected abstract IndicInputMethodImpl getImpl();
27:
28: public Locale[] getAvailableLocales() {
29: return new Locale[] { locale };
30: }
31:
32: public boolean hasDynamicLocaleList() {
33: return false;
34: }
35:
36: public synchronized String getInputMethodDisplayName(
37: Locale inputLocale, Locale displayLanguage) {
38: try {
39: ResourceBundle rb = ResourceBundle.getBundle(
40: "com.ibm.icu.dev.tool.ime.indic.DisplayNames",
41: displayLanguage);
42: return rb.getString("DisplayName." + name);
43: } catch (Throwable t) {
44: return name;
45: }
46: }
47:
48: public Image getInputMethodIcon(Locale inputLocale) {
49: return null;
50: }
51:
52: public InputMethod createInputMethod() throws Exception {
53: return new IndicInputMethod(locale, getImpl());
54: }
55:
56: public String toString() {
57: return name;
58: }
59: }
|