net.rim.device.api.input
Class EmailAddressInputHelper

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.EmailAddressInputHelper
All Implemented Interfaces:
ITextInputStyle

public class EmailAddressInputHelper
extends InputHelper

An editable text field designed specifically to handle internet email addresses.

Behaviour
This field replaces the first space you type with the at symbol (@), and replaces any subsequent space you type with a period. In addition, this field does validation on text entered, and permits only characters that are valid in an internet email address.

Since:
BlackBerry API 6.0.0

Field Summary
 
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
EmailAddressInputHelper(String label, String initialValue)
          Constructs an EmailAddressEditField object.
EmailAddressInputHelper(String label, String initialValue, int maxNumChars)
          Constructs a smaller EmailAddressEditField object.
EmailAddressInputHelper(String label, String initialValue, int maxNumChars, long style)
          Constructs an EmailAddressEditField object with a given set of style flags.
 
Method Summary
 boolean backspace()
          Deletes character to the left of the cursor, or deletes selection.
 int insert(String text, int context)
          Inserts string into this field.
 boolean keyChar(char key, int status, int time)
          Does special handling for SPACE character generation.
 
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, 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, setText, setTextInputConnector, update, update, wipe
 
Methods inherited from class net.rim.device.api.ui.Field
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, getTop, getVisualState, getWidth, invalidate, invalidate, invalidateAll, invokeAction, isDataValid, isDirty, isEditable, isEnabled, isFocus, isMuddy, isScrollCopyable, isSelectionCutable, isSpellCheckable, isStyle, isVisible, keyDown, keyRepeat, 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, 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
 



Constructor Detail

EmailAddressInputHelper

public EmailAddressInputHelper(String label,
                               String initialValue)
Constructs an EmailAddressEditField object.

This method builds an editable email-address field that can hold up to EditField#DEFAULT_MAXCHARS characters.

Parameters:
label - Label for this field.
initialValue - Initial text to show in the editable portion of this field.
Since:
BlackBerry API 6.0.0

EmailAddressInputHelper

public EmailAddressInputHelper(String label,
                               String initialValue,
                               int maxNumChars)
Constructs a smaller EmailAddressEditField object.

This method builds an editable email-address field that can hold a number of characters up to the amount you specify.

Parameters:
label - Label for this field.
initialValue - Initial text to show in the editable portion of this field.
maxNumChars - Maximum number of characters this field can hold.
Since:
BlackBerry API 6.0.0

EmailAddressInputHelper

public EmailAddressInputHelper(String label,
                               String initialValue,
                               int maxNumChars,
                               long style)
Constructs an EmailAddressEditField object with a given set of style flags.

Parameters:
label - Label for this field.
initialValue - Initial text to show in the editable portion of this field.
maxNumChars - Maximum number of characters this field can hold.
style - Field style bits
Since:
BlackBerry API 6.0.0, 4.1


Method Detail

backspace

public boolean backspace()
Deletes character to the left of the cursor, or deletes selection.

If this method backspaces (and removes) an at symbol (@), it temporarily turns off replacing spaces with the at symbol.

Overrides:
backspace in class InputHelperBase
Returns:
True if a character was actually removed.
Since:
BlackBerry API 6.0.0

keyChar

public boolean keyChar(char key,
                       int status,
                       int time)
Does special handling for SPACE character generation.

If the user types SHIFT+SPACE, then this method traps that event and forces the insertion of a literal space character, rather than the usual space translation provided by default (see class description).

Overrides:
keyChar in class InputHelperBase
Parameters:
key - Character generated by the event.
status - Modifier key status.
time - Ticks since device reset.
Returns:
True if the event was consumed; otherwise, false.
Since:
BlackBerry API 6.0.0

insert

public int insert(String text,
                  int context)
Inserts string into this field.

This method attempts to insert your specified string at the current cursor position. If this method (even partially) succeeds with the insertion, it then moves the cursor to just after the last character successfully inserted.

If the maximum size of the field is exceeded while inserting the string, as many characters as possible are inserted.

Overrides:
insert in class InputHelperBase
Parameters:
text - String to insert; if the provided string starts with a "mailto:" protocol specifier, this is stripped so only the pure email address is inserted.
context - Information describing the origin of the change.
Returns:
Number of characters actually inserted.
Since:
BlackBerry API 6.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.