net.rim.device.api.ui.component
Class EmailAddressEditField

java.lang.Object
  |
  +--net.rim.device.api.ui.Field
        |
        +--net.rim.device.api.ui.component.TextField
              |
              +--net.rim.device.api.ui.component.BasicEditField
                    |
                    +--net.rim.device.api.ui.component.EditField
                          |
                          +--net.rim.device.api.ui.component.EmailAddressEditField
All Implemented Interfaces:
FieldLabelProvider, Formatter.TextRenderer, IComponent, InputMethodListener, InputMethodRequests

public class EmailAddressEditField
extends EditField

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:
JDE 4.0.0

Field Summary
 
Fields inherited from class net.rim.device.api.ui.component.BasicEditField
FILTER_DEFAULT, FILTER_EMAIL, FILTER_FILENAME, FILTER_HEXADECIMAL, FILTER_INTEGER, FILTER_LOWERCASE, FILTER_NUMERIC, FILTER_PHONE, FILTER_PIN_ADDRESS, FILTER_REAL_NUMERIC, FILTER_UPPERCASE, FILTER_URL
 
Fields inherited from class net.rim.device.api.ui.component.TextField
CONSUME_INPUT, JUMP_FOCUS_AT_END, NO_COMPLEX_INPUT, NO_EDIT_MODE_INPUT, NO_LEARNING, NO_NEWLINE, NO_SWITCHING_INPUT
 
Fields inherited from class net.rim.device.api.ui.Field
ACTION_INVOKE, 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
EmailAddressEditField(String label, String initialValue)
          Constructs an EmailAddressEditField object.
EmailAddressEditField(String label, String initialValue, int maxNumChars)
          Constructs a smaller EmailAddressEditField object.
EmailAddressEditField(String label, String initialValue, int maxNumChars, long style)
          Constructs an EmailAddressEditField object with a given set of style flags.
 
Method Summary
protected  boolean backspace()
          Deletes character to the left of the cursor, or deletes selection.
protected  boolean insert(char key, int status)
          Inserts character into this field with modifier key status.
protected  int insert(String text, int context)
          Inserts string into this field.
protected  boolean keyChar(char key, int status, int time)
          Does special handling for SPACE character generation.
 
Methods inherited from class net.rim.device.api.ui.component.EditField
isEnteringRollerCharacter, keyDown, keyRepeat, moveFocus
 
Methods inherited from class net.rim.device.api.ui.component.BasicEditField
backspace, backspace, charAt, clear, displayFieldFullMessage, drawFocus, getCursorPosition, getFilter, getLabel, getLabelLength, getMaxSize, getPreferredHeight, getPreferredWidth, getText, getText, getText, getTextAbstractString, getTextLength, insert, isSymbolScreenAllowed, keyControl, layout, makeContextMenu, moveFocus, onUnfocus, paint, paste, selectionDelete, setCursorPosition, setCursorPosition, setFilter, setFont, setLabel, setMaxSize, setText, setText, update, wipe
 
Methods inherited from class net.rim.device.api.ui.component.TextField
drawText, fieldChangeNotify, getFocusRect, isPasteable, isSelectable, isSelecting, isSelectionCopyable, isSelectionDeleteable, navigationClick, navigationUnclick, onFocus, select, selectionCopy, toString
 
Methods inherited from class net.rim.device.api.ui.Field
drawHighlightRegion, focusAdd, focusRemove, getBackground, getBackground, getBorder, getBorder, getBorder, getChangeListener, getContentHeight, getContentLeft, getContentRect, getContentRect, getContentTop, getContentWidth, getContextMenu, getCookie, getExtent, getExtent, getFieldStyle, getFocusListener, getFont, getHeight, getIndex, getLeafFieldWithFocus, getLeft, getManager, getOriginal, getScreen, getStyle, getTop, getVisualState, getWidth, invalidate, invalidate, invalidateAll, invokeAction, isDataValid, isDirty, isEditable, isFocus, isFocusable, isMuddy, isSelectionCutable, isSpellCheckable, isStyle, isVisible, keyStatus, keyUp, navigationMovement, onDisplay, onExposed, onMenuDismissed, onMenuDismissed, onObscured, onVisibilityChange, selectionCut, setBackground, setBackground, setBorder, setBorder, setBorder, setBorder, setChangeListener, setCookie, setDirty, setEditable, setExtent, setFocus, setFocusListener, setMuddy, setNonSpellCheckable, setPosition, setVisualState, trackwheelClick, trackwheelUnclick, updateLayout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EmailAddressEditField

public EmailAddressEditField(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:
JDE 4.0.0

EmailAddressEditField

public EmailAddressEditField(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:
JDE 4.0.0

EmailAddressEditField

public EmailAddressEditField(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:
4.1
Method Detail

backspace

protected 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 BasicEditField
Returns:
True if a character was actually removed.
Since:
JDE 4.0.0

insert

protected boolean insert(char key,
                         int status)
Description copied from class: TextField
Inserts character into this field with modifier key status.

This method attempts to insert your specified character at the current cursor position. If this method succeeds with the insertion, it then moves the cursor to just after the inserted character.

Overrides:
insert in class TextField
Since:
JDE 4.0.0
See Also:
TextField.insert(java.lang.String)

insert

protected 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 BasicEditField
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:
JDE 4.0.0

keyChar

protected 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 BasicEditField
Parameters:
key - Character generated by the event.
status - Modifier key status.
time - Ticks since device reset.
Since:
JDE 4.0.0



Copyright 1999-2009 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.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.