org.havi.ui
Interface HKeyboardInputPreferred

All Known Subinterfaces:
HTextValue
All Known Implementing Classes:
HMultilineEntry, HSinglelineEntry

public interface HKeyboardInputPreferred

A component which implements HKeyboardInputPreferred indicates that this component expects to receive both HKeyEvent and HTextEvent input events.

All interoperable implementations of the HKeyboardInputPreferred interface must extend HComponent.

The set of characters which the component expects to receive via HKeyEvent events is defined by the return code from the getType() method.

When this component has focus, platforms without a physical means of generating key events with the desired range of characters will provide another means for keyboard entry e.g. by offering an on-screen "virtual" keyboard. Applications can query the system about the support of specific keyCodes through the HKeyCapabilities.isSupported(int) method.

Note that the java.awt.Component method isFocusTraversable should always return true for a java.awt.Component implementing this interface.


Field Summary
static int INPUT_ALPHA
          This constant indicates that the component requires alphabetic input, as determined by the java.lang.Character isLetter method.
static int INPUT_ANY
          Indicates that the component requires any possible character as input, as determined by the java.lang.Character isDefined method.
static int INPUT_CUSTOMIZED
          Indicates that the component requires as input the characters present in the array returned from the getValidInput() method.
static int INPUT_NUMERIC
          This constant indicates that the component requires numeric input, as determined by the java.lang.Character isDigit method.
 
Method Summary
 boolean getEditMode()
          Get the editing mode for this HKeyboardInputPreferred.
 int getType()
          Retrieve the desired input type for this component.
 char[] getValidInput()
          Retrieve the customized input character range.
 void processHKeyEvent(HKeyEvent evt)
          Process an HKeyEvent sent to this HKeyboardInputPreferred.
 void processHTextEvent(HTextEvent evt)
          Process an HTextEvent sent to this HKeyboardInputPreferred.
 void setEditMode(boolean edit)
          Set the editing mode for this HKeyboardInputPreferred.
 

Field Detail

INPUT_NUMERIC

static final int INPUT_NUMERIC
This constant indicates that the component requires numeric input, as determined by the java.lang.Character isDigit method.

See Also:
Constant Field Values

INPUT_ALPHA

static final int INPUT_ALPHA
This constant indicates that the component requires alphabetic input, as determined by the java.lang.Character isLetter method.

See Also:
Constant Field Values

INPUT_ANY

static final int INPUT_ANY
Indicates that the component requires any possible character as input, as determined by the java.lang.Character isDefined method.

See Also:
Constant Field Values

INPUT_CUSTOMIZED

static final int INPUT_CUSTOMIZED
Indicates that the component requires as input the characters present in the array returned from the getValidInput() method.

See Also:
Constant Field Values
Method Detail

getEditMode

boolean getEditMode()
Get the editing mode for this HKeyboardInputPreferred. If the returned value is true the component is in edit mode, and its textual content may be changed through user interaction such as keyboard events.

The component is switched into and out of edit mode on receiving HTextEvent.TEXT_START_CHANGE and HTextEvent.TEXT_END_CHANGE events.

Returns:
true if this component is in edit mode, false otherwise.

setEditMode

void setEditMode(boolean edit)
Set the editing mode for this HKeyboardInputPreferred.

This method is provided for the convenience of component implementors. Interoperable applications shall not call this method. It cannot be made protected because interfaces cannot have protected methods.

Parameters:
edit - true to switch this component into edit mode, false otherwise.
See Also:
getEditMode()

getType

int getType()
Retrieve the desired input type for this component. This value should be set to indicate to the system which input keys are required by this component. The input type constants can be added to define the union of the character sets corresponding to the respective constants.

Returns:
The sum of one or several of INPUT_ANY, INPUT_NUMERIC, INPUT_ALPHA, or INPUT_CUSTOMIZED.

getValidInput

char[] getValidInput()
Retrieve the customized input character range. If getType() returns a value with the INPUT_CUSTOMIZED bit set then this method shall return an array containing the range of customized input keys. If the range of customized input keys has not been set then this method shall return a zero length char array. This method shall return null if getType() returns a value without the INPUT_CUSTOMIZED bit set.

Returns:
an array containing the characters which this component expects the platform to provide, or null.

processHTextEvent

void processHTextEvent(HTextEvent evt)
Process an HTextEvent sent to this HKeyboardInputPreferred.

Parameters:
evt - the HTextEvent to process.

processHKeyEvent

void processHKeyEvent(HKeyEvent evt)
Process an HKeyEvent sent to this HKeyboardInputPreferred.

Parameters:
evt - the HKeyEvent to process.