65
66 // attribute definition in Win32 (in IMM.H)
67 public final static byte ATTR_INPUT = 0x00;
68 public final static byte ATTR_TARGET_CONVERTED = 0x01;
69 public final static byte ATTR_CONVERTED = 0x02;
70 public final static byte ATTR_TARGET_NOTCONVERTED = 0x03;
71 public final static byte ATTR_INPUT_ERROR = 0x04;
72 // cmode definition in Win32 (in IMM.H)
73 public final static int IME_CMODE_ALPHANUMERIC = 0x0000;
74 public final static int IME_CMODE_NATIVE = 0x0001;
75 public final static int IME_CMODE_KATAKANA = 0x0002;
76 public final static int IME_CMODE_LANGUAGE = 0x0003;
77 public final static int IME_CMODE_FULLSHAPE = 0x0008;
78 public final static int IME_CMODE_HANJACONVERT = 0x0040;
79 public final static int IME_CMODE_ROMAN = 0x0010;
80
81 // flag values for endCompositionNative() behavior
82 private final static boolean COMMIT_INPUT = true;
83 private final static boolean DISCARD_INPUT = false;
84
85 private static Map[] highlightStyles;
86
87 // Initialize highlight mapping table
88 static {
89 Map styles[] = new Map[4];
90 HashMap map;
91
92 // UNSELECTED_RAW_TEXT_HIGHLIGHT
93 map = new HashMap(1);
94 map.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_DOTTED);
95 styles[0] = Collections.unmodifiableMap(map);
96
97 // SELECTED_RAW_TEXT_HIGHLIGHT
98 map = new HashMap(1);
99 map.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_GRAY);
100 styles[1] = Collections.unmodifiableMap(map);
101
102 // UNSELECTED_CONVERTED_TEXT_HIGHLIGHT
103 map = new HashMap(1);
104 map.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_DOTTED);
105 styles[2] = Collections.unmodifiableMap(map);
106
107 // SELECTED_CONVERTED_TEXT_HIGHLIGHT
108 map = new HashMap(4);
109 Color navyBlue = new Color(0, 0, 128);
110 map.put(TextAttribute.FOREGROUND, navyBlue);
393 gets called is when the native input method is
394 switched to java input method, for example.
395 */
396 setStatusWindowVisible(awtFocussedComponentPeer, false);
397 statusWindowHidden = true;
398 }
399 }
400
401 /**
402 * @see java.awt.im.spi.InputMethod#removeNotify
403 */
404 public void removeNotify() {
405 endCompositionNative(context, DISCARD_INPUT);
406 awtFocussedComponent = null;
407 awtFocussedComponentPeer = null;
408 }
409
410 /**
411 * @see java.awt.Toolkit#mapInputMethodHighlight
412 */
413 static Map mapInputMethodHighlight(InputMethodHighlight highlight) {
414 int index;
415 int state = highlight.getState();
416 if (state == InputMethodHighlight.RAW_TEXT) {
417 index = 0;
418 } else if (state == InputMethodHighlight.CONVERTED_TEXT) {
419 index = 2;
420 } else {
421 return null;
422 }
423 if (highlight.isSelected()) {
424 index += 1;
425 }
426 return highlightStyles[index];
427 }
428
429 // see sun.awt.im.InputMethodAdapter.supportsBelowTheSpot
430 protected boolean supportsBelowTheSpot() {
431 return true;
432 }
433
|
65
66 // attribute definition in Win32 (in IMM.H)
67 public final static byte ATTR_INPUT = 0x00;
68 public final static byte ATTR_TARGET_CONVERTED = 0x01;
69 public final static byte ATTR_CONVERTED = 0x02;
70 public final static byte ATTR_TARGET_NOTCONVERTED = 0x03;
71 public final static byte ATTR_INPUT_ERROR = 0x04;
72 // cmode definition in Win32 (in IMM.H)
73 public final static int IME_CMODE_ALPHANUMERIC = 0x0000;
74 public final static int IME_CMODE_NATIVE = 0x0001;
75 public final static int IME_CMODE_KATAKANA = 0x0002;
76 public final static int IME_CMODE_LANGUAGE = 0x0003;
77 public final static int IME_CMODE_FULLSHAPE = 0x0008;
78 public final static int IME_CMODE_HANJACONVERT = 0x0040;
79 public final static int IME_CMODE_ROMAN = 0x0010;
80
81 // flag values for endCompositionNative() behavior
82 private final static boolean COMMIT_INPUT = true;
83 private final static boolean DISCARD_INPUT = false;
84
85 private static Map<TextAttribute,Object> [] highlightStyles;
86
87 // Initialize highlight mapping table
88 static {
89 Map<TextAttribute,Object> styles[] = new Map[4];
90 HashMap<TextAttribute,Object> map;
91
92 // UNSELECTED_RAW_TEXT_HIGHLIGHT
93 map = new HashMap(1);
94 map.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_DOTTED);
95 styles[0] = Collections.unmodifiableMap(map);
96
97 // SELECTED_RAW_TEXT_HIGHLIGHT
98 map = new HashMap(1);
99 map.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_GRAY);
100 styles[1] = Collections.unmodifiableMap(map);
101
102 // UNSELECTED_CONVERTED_TEXT_HIGHLIGHT
103 map = new HashMap(1);
104 map.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_DOTTED);
105 styles[2] = Collections.unmodifiableMap(map);
106
107 // SELECTED_CONVERTED_TEXT_HIGHLIGHT
108 map = new HashMap(4);
109 Color navyBlue = new Color(0, 0, 128);
110 map.put(TextAttribute.FOREGROUND, navyBlue);
393 gets called is when the native input method is
394 switched to java input method, for example.
395 */
396 setStatusWindowVisible(awtFocussedComponentPeer, false);
397 statusWindowHidden = true;
398 }
399 }
400
401 /**
402 * @see java.awt.im.spi.InputMethod#removeNotify
403 */
404 public void removeNotify() {
405 endCompositionNative(context, DISCARD_INPUT);
406 awtFocussedComponent = null;
407 awtFocussedComponentPeer = null;
408 }
409
410 /**
411 * @see java.awt.Toolkit#mapInputMethodHighlight
412 */
413 static Map<TextAttribute,?> mapInputMethodHighlight(InputMethodHighlight highlight) {
414 int index;
415 int state = highlight.getState();
416 if (state == InputMethodHighlight.RAW_TEXT) {
417 index = 0;
418 } else if (state == InputMethodHighlight.CONVERTED_TEXT) {
419 index = 2;
420 } else {
421 return null;
422 }
423 if (highlight.isSelected()) {
424 index += 1;
425 }
426 return highlightStyles[index];
427 }
428
429 // see sun.awt.im.InputMethodAdapter.supportsBelowTheSpot
430 protected boolean supportsBelowTheSpot() {
431 return true;
432 }
433
|