Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/classes/sun/awt/X11InputMethodDescriptor.java
32287 views
/*1* Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/242526package sun.awt;2728import java.awt.Image;29import java.awt.Toolkit;30import java.awt.im.spi.InputMethod;31import java.awt.im.spi.InputMethodDescriptor;32import java.security.AccessController;33import java.util.Locale;34import sun.awt.SunToolkit;35import sun.security.action.GetPropertyAction;3637/**38* Provides sufficient information about an input method39* to enable selection and loading of that input method.40* The input method itself is only loaded when it is actually used.41*42* @since JDK1.343*/4445public abstract class X11InputMethodDescriptor implements InputMethodDescriptor {4647private static Locale locale;4849public X11InputMethodDescriptor() {50locale = getSupportedLocale();51}5253/**54* @see java.awt.im.spi.InputMethodDescriptor#getAvailableLocales55*/56public Locale[] getAvailableLocales() {57Locale[] locales = {locale};58return locales;59}6061/**62* @see java.awt.im.spi.InputMethodDescriptor#hasDynamicLocaleList63*/64public boolean hasDynamicLocaleList() {65return false;66}6768/**69* @see java.awt.im.spi.InputMethodDescriptor#getInputMethodDisplayName70*/71public synchronized String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage) {72// We ignore the input locale.73// When displaying for the default locale, rely on the localized AWT properties;74// for any other locale, fall back to English.75String name = "System Input Methods";76if (Locale.getDefault().equals(displayLanguage)) {77name = Toolkit.getProperty("AWT.HostInputMethodDisplayName", name);78}79return name;80}8182/**83* @see java.awt.im.spi.InputMethodDescriptor#getInputMethodIcon84*/85public Image getInputMethodIcon(Locale inputLocale) {86return null;87}8889/**90* @see java.awt.im.spi.InputMethodDescriptor#createInputMethod91*/92public abstract InputMethod createInputMethod() throws Exception;9394/**95* returns supported locale. Currently this method returns the locale in which96* the VM is started since Solaris doesn't provide a way to determine the login locale.97*/98static Locale getSupportedLocale() {99return SunToolkit.getStartupLocale();100}101}102103104