net.rim.device.api.input
Class AutoTextInputHelper

java.lang.Object
  extended by net.rim.device.api.ui.Field
      extended by net.rim.device.api.ui.component.TextFieldBase
          extended by net.rim.device.api.input.InputHelperBase
              extended by net.rim.device.api.input.InputHelper
                  extended by net.rim.device.api.input.AutoTextInputHelper
All Implemented Interfaces:
ITextInputStyle

public class AutoTextInputHelper
extends InputHelper

Enriches the input helper with the autotext features which are: auto-capitalization, auto-period, and auto-substitution.

Since:
BlackBerry API 6.0.0

Field Summary
static long AUTOCAP
          Do automatic capitalization based on preceding punctuation.
static long AUTOCAP_OFF
          Do no automatic capitalization based on preceding punctuation.
static long AUTOPERIOD
          Do automatic period insertion after two spaces.
static long AUTOPERIOD_OFF
          Do no automatic period insertion after two spaces.
static long AUTOREPLACE
          Do autotext substitution on this field.
static long AUTOREPLACE_OFF
          Do no autotext substitution on this field.
 
Fields inherited from class net.rim.device.api.input.InputHelperBase
CONSUME_INPUT, NO_NEWLINE
 
Fields inherited from class net.rim.device.api.ui.Field
ACTION_INVOKE, AXIS_HORIZONTAL, AXIS_SEQUENTIAL, AXIS_VERTICAL, EDITABLE, EDITABLE_MASK, FIELD_BOTTOM, FIELD_HALIGN_MASK, FIELD_HCENTER, FIELD_LEADING, FIELD_LEFT, FIELD_RIGHT, FIELD_TOP, FIELD_TRAILING, FIELD_VALIGN_MASK, FIELD_VCENTER, FOCUSABLE, FOCUSABLE_MASK, HIGHLIGHT_FOCUS, HIGHLIGHT_SELECT, NON_FOCUSABLE, NON_SPELLCHECKABLE, READONLY, SPELLCHECKABLE, SPELLCHECKABLE_MASK, STATUS_MOVE_FOCUS_HORIZONTALLY, STATUS_MOVE_FOCUS_VERTICALLY, USE_ALL_HEIGHT, USE_ALL_WIDTH, VISUAL_STATE_ACTIVE, VISUAL_STATE_DISABLED, VISUAL_STATE_DISABLED_FOCUS, VISUAL_STATE_FOCUS, VISUAL_STATE_NORMAL
 
Constructor Summary
AutoTextInputHelper()
          Constructs an AutoTextInputHelper instance.
AutoTextInputHelper(long inputStyle)
          Constructs an AutoTextInputHelper instance.
AutoTextInputHelper(Screen scr)
          Constructs an AutoTextInputHelper instance.
AutoTextInputHelper(Screen scr, long inputStyle)
          Constructs an AutoTextInputHelper instance with specified input style.
 
Method Summary
 boolean backspace()
          Deletes character to the left of the cursor, or deletes selection.
 boolean keyChar(char key, int status, int time)
          Traps key generation events.
protected  boolean keyDown(int keycode, int time)
          Handles key-down events.
 boolean keyRepeat(int keycode, int time)
          Handles key repeat events.
protected  void setText(String text, int context)
          Sets the text value for this field, with indication of the source of this action.
 void update(int delta)
          Updates this edit field.
 
Methods inherited from class net.rim.device.api.input.InputHelper
getLookupProperties, getVariantIterator, notifyLookupPropertiesChanged
 
Methods inherited from class net.rim.device.api.input.InputHelperBase
backspace, backspace, charAt, clear, displayFieldFullMessage, fieldChangeNotify, getAccessibleContext, getAnchorPosition, getAssociatedScreen, getCaretPosition, getCharVariants, getCursorPosition, getFilter, getLabel, getLabelLength, getMaxSize, getText, getText, getText, getTextAbstractString, getTextInputConnector, getTextLength, insert, insert, isFocusable, isPasteable, isScreenInput, isSelectable, isSelecting, isSelectionCopyable, isSelectionDeleteable, isSymbolScreenAllowed, keyControl, makeContextMenu, paste, select, selectionCopy, selectionDelete, setCursorPosition, setCursorPosition, setFilter, setFont, setInputStyle, setLabel, setLookupPosition, setMIDPDisplayable, setMaxSize, setScreenInput, setSelection, setText, setTextInputConnector, update, wipe
 
Methods inherited from class net.rim.device.api.ui.Field
cursorClick, cursorUnclick, drawFocus, drawHighlightRegion, focusAdd, focusRemove, getBackground, getBackground, getBorder, getBorder, getBorder, getChangeListener, getCommandItemProvider, getContentHeight, getContentLeft, getContentRect, getContentRect, getContentTop, getContentWidth, getContextMenu, getCookie, getExtent, getExtent, getFieldStyle, getFocusListener, getFocusRect, getFont, getHeight, getIndex, getLeafFieldWithFocus, getLeft, getManager, getMargin, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getOriginal, getPadding, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getPreferredHeight, getPreferredWidth, getScreen, getStyle, getTextFillColor, getTextStrokeColor, getTop, getVisualState, getWidth, invalidate, invalidate, invalidateAll, invokeAction, isDataValid, isDirty, isEditable, isEnabled, isFocus, isLeftToRight, isMuddy, isScrollCopyable, isSelectionCutable, isSpellCheckable, isStyle, isVisible, keyStatus, keyUp, layout, moveFocus, moveFocus, navigationClick, navigationMovement, navigationUnclick, onDisplay, onExposed, onFocus, onMenuDismissed, onMenuDismissed, onObscured, onUndisplay, onUnfocus, onVisibilityChange, paint, selectionCut, setBackground, setBackground, setBorder, setBorder, setBorder, setBorder, setChangeListener, setCommandItemProvider, setCookie, setDirty, setEditable, setEnabled, setExtent, setFocus, setFocusListener, setFont, setMargin, setMargin, setMuddy, setNonSpellCheckable, setPadding, setPadding, setPosition, setVisualState, touchEvent, trackwheelClick, trackwheelUnclick, updateLayout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.rim.device.api.im.ITextInputStyle
getPreferredInputLocale, getTextInputStyle, isEditable, isUnicodeInputAllowed, updateInputStyle
 



Field Detail

AUTOREPLACE

public static final long AUTOREPLACE
Do autotext substitution on this field.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

AUTOREPLACE_OFF

public static final long AUTOREPLACE_OFF
Do no autotext substitution on this field.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

AUTOCAP

public static final long AUTOCAP
Do automatic capitalization based on preceding punctuation.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

AUTOCAP_OFF

public static final long AUTOCAP_OFF
Do no automatic capitalization based on preceding punctuation.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

AUTOPERIOD

public static final long AUTOPERIOD
Do automatic period insertion after two spaces.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

AUTOPERIOD_OFF

public static final long AUTOPERIOD_OFF
Do no automatic period insertion after two spaces.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0


Constructor Detail

AutoTextInputHelper

public AutoTextInputHelper()
Constructs an AutoTextInputHelper instance.

Since:
BlackBerry API 6.0.0

AutoTextInputHelper

public AutoTextInputHelper(long inputStyle)
Constructs an AutoTextInputHelper instance.

Parameters:
inputStyle - Combination of field style bits to specify display and filter attributes, e.g. BasicEditField.FILTER_NUMERIC, Field.EDITABLE, Field.FOCUSABLE.
Since:
BlackBerry API 6.0.0

AutoTextInputHelper

public AutoTextInputHelper(Screen scr)
Constructs an AutoTextInputHelper instance.

Parameters:
scr - Screen instance associated with this helper.
Since:
BlackBerry API 6.0.0

AutoTextInputHelper

public AutoTextInputHelper(Screen scr,
                           long inputStyle)
Constructs an AutoTextInputHelper instance with specified input style.

Parameters:
scr - Associated with this helper Screen instance
inputStyle - Combination of field style bits to specify display and filter attributes, e.g. BasicEditField.FILTER_NUMERIC, Field.EDITABLE, Field.FOCUSABLE.
Since:
BlackBerry API 6.0.0


Method Detail

backspace

public boolean backspace()
Description copied from class: InputHelperBase
Deletes character to the left of the cursor, or deletes selection.

If some characters are currently selected, this method deletes the selection as if it were a single character.

If no characters are selected, this method deletes the character immediately to the left of the cursor. If the cursor is currently on the first character in the field, this method does nothing.

Overrides:
backspace in class InputHelperBase
Returns:
True if this method successfully removed a character or selection; otherwise, false.
See Also:
TextFieldBase.backspace()
Since:
BlackBerry API 6.0.0

keyChar

public boolean keyChar(char key,
                       int status,
                       int time)
Description copied from class: InputHelperBase
Traps key generation events.

This method, invoked by this field's manager, handles all key generation events, except for the special symbol screen event (triggered with ALT+SPACE) which is handled by Field.keyDown(int, int).

This method consumes all key events, except in the following cases:

Overrides:
keyChar in class InputHelperBase
Parameters:
key - Character generated by the event.
status - Modifier key status.
time - Number of milliseconds since the device was turned on.
Returns:
True if the event was consumed; otherwise, false.
See Also:
TextFieldBase.keyChar( char key, int status, int time)
Since:
BlackBerry API 6.0.0

keyDown

protected boolean keyDown(int keycode,
                          int time)
Description copied from class: Field
Handles key-down events.

By default, this method returns false. Custom fields that specially handle key down events must override this method.

Overrides:
keyDown in class Field
Parameters:
keycode - The code of the key that was pressed.
time - The number of milliseconds since the device was turned on.
Returns:
false. Classes that extend Field must override this method to provide specific handling.
See Also:
Field.keyDown(int keycode, int time)
Since:
BlackBerry API 6.0.0

keyRepeat

public boolean keyRepeat(int keycode,
                         int time)
Description copied from class: Field
Handles key repeat events.

By default, this method returns false. Custom fields that specially handle key repeat events must override this method.

Overrides:
keyRepeat in class Field
Parameters:
keycode - The code of the key that was repeated.
time - The number of milliseconds since the device was turned on.
Returns:
false. Classes that extend Field must override this method to provide specific handling.
See Also:
Field.keyRepeat(int keycode, int time)
Since:
BlackBerry API 6.0.0

setText

protected void setText(String text,
                       int context)
Description copied from class: InputHelperBase
Sets the text value for this field, with indication of the source of this action.

Overrides:
setText in class InputHelperBase
Parameters:
text - New string value for this field; if null, this method clears the field.
context - Information specifying the origin of the change.
See Also:
TextFieldBase.setText(String text, int context)
Since:
BlackBerry API 6.0.0

update

public void update(int delta)
Description copied from class: InputHelperBase
Updates this edit field.

This field invokes this method when text is inserted or deleted so this field can update itself.

Overrides:
update in class InputHelperBase
Parameters:
delta - Number of characters by which the field has changed, negative or positive (negative means that characters have been deleted).
See Also:
TextFieldBase.update(int delta)
Since:
BlackBerry API 6.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal