/** * @see java.awt.im.InputContext#setCharacterSubsets */ public void setCharacterSubsets(Subset[] subsets) { if (subsets == null) { characterSubsets = null; } else { characterSubsets = new Subset[subsets.length]; System.arraycopy(subsets, 0, characterSubsets, 0, characterSubsets.length); } if (inputMethod != null) { inputMethod.setCharacterSubsets(subsets); } }
@Override public void setCharacterSubsets(Subset[] subsets) { if (inputMethod != null) { inputMethod.setCharacterSubsets(subsets); } super.setCharacterSubsets(subsets); }
/** * Implements InputMethod.setCharacterSubsets for Windows. * * @see java.awt.im.spi.InputMethod#setCharacterSubsets */ @Override public void setCharacterSubsets(Subset[] subsets) { if (subsets == null){ setConversionStatus(context, cmode); setOpenStatus(context, open); return; } // Use first subset only. Other subsets in array is ignored. // This is restriction of Win32 implementation. Subset subset1 = subsets[0]; Locale locale = getNativeLocale(); int newmode; if (locale == null) { return; } if (locale.getLanguage().equals(Locale.JAPANESE.getLanguage())) { if (subset1 == UnicodeBlock.BASIC_LATIN || subset1 == InputSubset.LATIN_DIGITS) { setOpenStatus(context, false); } else { if (subset1 == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS || subset1 == InputSubset.KANJI || subset1 == UnicodeBlock.HIRAGANA) newmode = IME_CMODE_NATIVE | IME_CMODE_FULLSHAPE; else if (subset1 == UnicodeBlock.KATAKANA) newmode = IME_CMODE_NATIVE | IME_CMODE_KATAKANA| IME_CMODE_FULLSHAPE; else if (subset1 == InputSubset.HALFWIDTH_KATAKANA) newmode = IME_CMODE_NATIVE | IME_CMODE_KATAKANA; else if (subset1 == InputSubset.FULLWIDTH_LATIN) newmode = IME_CMODE_FULLSHAPE; else return; setOpenStatus(context, true); newmode |= (getConversionStatus(context)&IME_CMODE_ROMAN); // reserve ROMAN input mode setConversionStatus(context, newmode); } } else if (locale.getLanguage().equals(Locale.KOREAN.getLanguage())) { if (subset1 == UnicodeBlock.BASIC_LATIN || subset1 == InputSubset.LATIN_DIGITS) { setOpenStatus(context, false); } else { if (subset1 == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS || subset1 == InputSubset.HANJA || subset1 == UnicodeBlock.HANGUL_SYLLABLES || subset1 == UnicodeBlock.HANGUL_JAMO || subset1 == UnicodeBlock.HANGUL_COMPATIBILITY_JAMO) newmode = IME_CMODE_NATIVE; else if (subset1 == InputSubset.FULLWIDTH_LATIN) newmode = IME_CMODE_FULLSHAPE; else return; setOpenStatus(context, true); setConversionStatus(context, newmode); } } else if (locale.getLanguage().equals(Locale.CHINESE.getLanguage())) { if (subset1 == UnicodeBlock.BASIC_LATIN || subset1 == InputSubset.LATIN_DIGITS) { setOpenStatus(context, false); } else { if (subset1 == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS || subset1 == InputSubset.TRADITIONAL_HANZI || subset1 == InputSubset.SIMPLIFIED_HANZI) newmode = IME_CMODE_NATIVE; else if (subset1 == InputSubset.FULLWIDTH_LATIN) newmode = IME_CMODE_FULLSHAPE; else return; setOpenStatus(context, true); setConversionStatus(context, newmode); } } }
/** * Implements InputMethod.setCharacterSubsets for Windows. * * @see java.awt.im.spi.InputMethod#setCharacterSubsets */ public void setCharacterSubsets(Subset[] subsets) { if (subsets == null){ setConversionStatus(context, cmode); setOpenStatus(context, open); return; } // Use first subset only. Other subsets in array is ignored. // This is restriction of Win32 implementation. Subset subset1 = subsets[0]; Locale locale = getNativeLocale(); int newmode; if (locale == null) { return; } if (locale.getLanguage().equals(Locale.JAPANESE.getLanguage())) { if (subset1 == UnicodeBlock.BASIC_LATIN || subset1 == InputSubset.LATIN_DIGITS) { setOpenStatus(context, false); } else { if (subset1 == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS || subset1 == InputSubset.KANJI || subset1 == UnicodeBlock.HIRAGANA) newmode = IME_CMODE_NATIVE | IME_CMODE_FULLSHAPE; else if (subset1 == UnicodeBlock.KATAKANA) newmode = IME_CMODE_NATIVE | IME_CMODE_KATAKANA| IME_CMODE_FULLSHAPE; else if (subset1 == InputSubset.HALFWIDTH_KATAKANA) newmode = IME_CMODE_NATIVE | IME_CMODE_KATAKANA; else if (subset1 == InputSubset.FULLWIDTH_LATIN) newmode = IME_CMODE_FULLSHAPE; else return; setOpenStatus(context, true); newmode |= (getConversionStatus(context)&IME_CMODE_ROMAN); // reserve ROMAN input mode setConversionStatus(context, newmode); } } else if (locale.getLanguage().equals(Locale.KOREAN.getLanguage())) { if (subset1 == UnicodeBlock.BASIC_LATIN || subset1 == InputSubset.LATIN_DIGITS) { setOpenStatus(context, false); } else { if (subset1 == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS || subset1 == InputSubset.HANJA || subset1 == UnicodeBlock.HANGUL_SYLLABLES || subset1 == UnicodeBlock.HANGUL_JAMO || subset1 == UnicodeBlock.HANGUL_COMPATIBILITY_JAMO) newmode = IME_CMODE_NATIVE; else if (subset1 == InputSubset.FULLWIDTH_LATIN) newmode = IME_CMODE_FULLSHAPE; else return; setOpenStatus(context, true); setConversionStatus(context, newmode); } } else if (locale.getLanguage().equals(Locale.CHINESE.getLanguage())) { if (subset1 == UnicodeBlock.BASIC_LATIN || subset1 == InputSubset.LATIN_DIGITS) { setOpenStatus(context, false); } else { if (subset1 == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS || subset1 == InputSubset.TRADITIONAL_HANZI || subset1 == InputSubset.SIMPLIFIED_HANZI) newmode = IME_CMODE_NATIVE; else if (subset1 == InputSubset.FULLWIDTH_LATIN) newmode = IME_CMODE_FULLSHAPE; else return; setOpenStatus(context, true); setConversionStatus(context, newmode); } } }
/** * Sets the subsets of the Unicode character set that this input method * is allowed to input. Null may be passed in to indicate that all * characters are allowed. * <p> * This method is called * <ul> * <li>immediately after instantiating this input method, * <li>when switching to this input method from a different one, and * <li>by {@link java.awt.im.InputContext#setCharacterSubsets InputContext.setCharacterSubsets}. * </ul> * * @param subsets the subsets of the Unicode character set from which * characters may be input */ public void setCharacterSubsets(Subset[] subsets);
/** * Sets the subsets of the Unicode character set that input methods of this input * context should be allowed to input. Null may be passed in to * indicate that all characters are allowed. The initial value * is null. The setting applies to the current input method as well * as input methods selected after this call is made. However, * applications cannot rely on this call having the desired effect, * since this setting cannot be passed on to all host input methods - * applications still need to apply their own character validation. * If no input methods are available, then this method has no effect. * * @param subsets The subsets of the Unicode character set from which characters may be input */ public void setCharacterSubsets(Subset[] subsets) { // real implementation is in sun.awt.im.InputContext }
/** * Sets the subsets of the Unicode character set that this input method * is allowed to input. Null may be passed in to indicate that all * characters are allowed. * <p> * This method is called * <ul> * <li>immediately after instantiating this input method, * <li>when switching to this input method from a different one, and * <li>by {@link java.awt.im.InputContext#setCharacterSubsets InputContext.setCharacterSubsets}. * </ul> * * @param subsets the subsets of the Unicode character set from which * characters may be input */ public void setCharacterSubsets(Subset[] subsets) { // -- SAK: Does mac OS X support this? }
/** * Does nothing - XIM doesn't let you specify which characters you expect. * * @see java.awt.im.spi.InputMethod#setCharacterSubsets */ public void setCharacterSubsets(Subset[] subsets) { }