01: /*
02: * @(#)InputMethod.java 1.12 06/10/10
03: *
04: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: *
26: */
27:
28: package sun.awt.im;
29:
30: import java.util.Locale;
31: import java.awt.AWTEvent;
32:
33: /**
34: * InputMethod class is an abstract class for input method.
35: * Input method which is implemented as a subclass of this class can be
36: * plugged in JDK.
37: *
38: * @version 1.8 08/19/02
39: * @author Sun Microsystems, Inc.
40: */
41:
42: public abstract class InputMethod {
43: protected InputMethodContext inputContext;
44:
45: /**
46: * Constructs a new input method.
47: */
48: protected InputMethod() {
49: }
50:
51: /**
52: * Sets the input context which can dispatch input method
53: * events to the client component.
54: */
55: public void setInputContext(InputMethodContext context) {
56: inputContext = context;
57: }
58:
59: /**
60: * Dispatch event to input method. InputContext dispatch event with this
61: * method. Input method set consume flag if event is consumed in
62: * input method.
63: *
64: * @param e event
65: */
66: public abstract void dispatchEvent(AWTEvent e);
67:
68: /**
69: * Activate input method.
70: */
71: public abstract void activate();
72:
73: /**
74: * Deactivate input method.
75: */
76: public abstract void deactivate();
77:
78: /**
79: * Ends any input composition that may currently be going on in this
80: * context. Depending on the platform and possibly user preferences,
81: * this may commit or delete uncommitted text. Any changes to the text
82: * are communicated to the active component using an input method event.
83: *
84: * <p>
85: * A text editing component may call this in a variety of situations,
86: * for example, when the user moves the insertion point within the text
87: * (but outside the composed text), or when the component's text is
88: * saved to a file or copied to the clipboard.
89: *
90: */
91: public abstract void endComposition();
92:
93: /**
94: * Disposes of the input method and releases the resources used by it.
95: */
96: public abstract void dispose();
97: }
|