01: /*
02: *
03: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
04: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
05: *
06: * This program is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU General Public License version
08: * 2 only, as published by the Free Software Foundation.
09: *
10: * This program is distributed in the hope that it will be useful, but
11: * WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * General Public License version 2 for more details (a copy is
14: * included at /legal/license.txt).
15: *
16: * You should have received a copy of the GNU General Public License
17: * version 2 along with this work; if not, write to the Free Software
18: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19: * 02110-1301 USA
20: *
21: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
22: * Clara, CA 95054 or visit www.sun.com if you need additional
23: * information or have any questions.
24: */
25: package com.sun.midp.chameleon.input;
26:
27: import javax.microedition.lcdui.Display;
28:
29: /**
30: * An interface which defines the protocol between LCDUI component
31: * implementations (TextFieldLFImpl, TextBoxLFImpl) and the TextInputMediator
32: * to enable text input from the system's input modes.
33: */
34: public interface TextInputComponent {
35:
36: /**
37: * Retrieve the initial input mode of this text component as
38: * defined by the MIDP TextField API.
39: *
40: * @return the initial input mode for this text component or 'null'
41: * if none was set
42: */
43: public String getInitialInputMode();
44:
45: /**
46: * Retrieve the constraints of this text component as defined
47: * by the MIDP TextField API.
48: *
49: * @return a bitmask which defines the constraints set on this
50: * text component, or 0 if none were set
51: */
52: public int getConstraints();
53:
54: /**
55: * Returns the available size (number of characters) that can be
56: * stored in this <code>TextInputComponent</code>.
57: * @return available size in characters
58: */
59: public int getAvailableSize();
60:
61: /**
62: * This is a direct call from the text input system to immediately
63: * commit the given input to this TextInputComponent's state.
64: * This call constitutes a change to the value of this TextInputComponent
65: * and should result in any of its change listeners being notified.
66: *
67: * @param input String needs to be commited
68: */
69: public void commit(String input);
70:
71: /**
72: * This is a notification from the input session that the selected
73: * input mode has changed. If the TextInputComponent is interested,
74: * it can query the session for the new InputMode.
75: */
76: public void notifyModeChanged();
77:
78: /**
79: * Clear the particular number of symbols
80: *
81: * @param num number of symbols
82: */
83: public void clear(int num);
84:
85: /**
86: * Gets the current Display
87: * @return current Display
88: */
89: public Display getDisplay();
90:
91: /**
92: * Returns true if the keyCode is used as 'clear'
93: * @param keyCode key code
94: * @return true if keu code is Clear one, false otherwise
95: */
96: public boolean isClearKey(int keyCode);
97: }
|