1 /*
2 * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
769 }
770
771 if (inputMethodInfo != null && !inputMethodInfo.equals("")) {
772 return inputMethodInfo;
773 }
774
775 // do our best to return something useful.
776 return inputMethod.toString() + "-" + inputMethod.getLocale().toString();
777 }
778
779 /**
780 * Turns off the native IM. The native IM is diabled when
781 * the deactive method of InputMethod is called. It is
782 * delayed until the active method is called on a different
783 * peer component. This method is provided to explicitly disable
784 * the native IM.
785 */
786 public void disableNativeIM() {
787 InputMethod inputMethod = getInputMethod();
788 if (inputMethod != null && inputMethod instanceof InputMethodAdapter) {
789 ((InputMethodAdapter)inputMethod).disableInputMethod();
790 }
791 }
792
793
794 private synchronized InputMethod getInputMethod() {
795 if (inputMethod != null) {
796 return inputMethod;
797 }
798
799 if (inputMethodCreationFailed) {
800 return null;
801 }
802
803 inputMethod = getInputMethodInstance();
804 return inputMethod;
805 }
806
807 /**
808 * Returns an instance of the input method described by
809 * the current input method locator. This may be an input
|
1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
769 }
770
771 if (inputMethodInfo != null && !inputMethodInfo.equals("")) {
772 return inputMethodInfo;
773 }
774
775 // do our best to return something useful.
776 return inputMethod.toString() + "-" + inputMethod.getLocale().toString();
777 }
778
779 /**
780 * Turns off the native IM. The native IM is diabled when
781 * the deactive method of InputMethod is called. It is
782 * delayed until the active method is called on a different
783 * peer component. This method is provided to explicitly disable
784 * the native IM.
785 */
786 public void disableNativeIM() {
787 InputMethod inputMethod = getInputMethod();
788 if (inputMethod != null && inputMethod instanceof InputMethodAdapter) {
789 ((InputMethodAdapter)inputMethod).stopListening();
790 }
791 }
792
793
794 private synchronized InputMethod getInputMethod() {
795 if (inputMethod != null) {
796 return inputMethod;
797 }
798
799 if (inputMethodCreationFailed) {
800 return null;
801 }
802
803 inputMethod = getInputMethodInstance();
804 return inputMethod;
805 }
806
807 /**
808 * Returns an instance of the input method described by
809 * the current input method locator. This may be an input
|