net.rim.device.api.input
Class PasswordInputHelper

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

public class PasswordInputHelper
extends InputHelper

An editable text field designed specifically to handle password input.

Behaviour
This field stores the password as plain text but draws it as a series of asterisks, one for each character cluster (group of characters treated as one after diacritics and ligatures have been handled).

This field does not have any automatic input replacement, so the typed text is exactly what is typed. AutoCaps, AutoText, AutoPeriod, and any other transformation are turned off. Also, holding a key and rolling the wheel is not allowed.

This field does not support copy or cut operations.

By default, this field supports all the available characters. You can restrict this by applying a TextFilter.

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
PasswordInputHelper()
          Constructs a new PasswordEditField instance.
PasswordInputHelper(String label, String initialValue)
          Constructs a PasswordEditField instance with label and initial value.
PasswordInputHelper(String label, String initialValue, int maxNumChars, long style)
          Constructs a smaller PasswordEditField object.
 
Method Summary
 boolean isSelectionCopyable()
          Determines if this field supports copy operations.
protected  boolean keyRepeat(int keycode, int time)
          Consumes key repeat events.
 void selectionCopy(Clipboard cb)
          Does nothing.
protected  void setText(String text, int context)
          Sets the text value for this field, with indication of the source of this action.
 
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, 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, isSelectionDeleteable, isSymbolScreenAllowed, keyChar, keyControl, makeContextMenu, paste, select, selectionDelete, setCursorPosition, setCursorPosition, setFilter, setFont, setInputStyle, setLabel, setLookupPosition, setMIDPDisplayable, setMaxSize, setScreenInput, setSelection, setText, setTextInputConnector, update, 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, keyDown, 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
 



Constructor Detail

PasswordInputHelper

public PasswordInputHelper()
Constructs a new PasswordEditField instance.

This builds a new password edit field with no label and no initial contents.

Since:
BlackBerry API 6.0.0

PasswordInputHelper

public PasswordInputHelper(String label,
                           String initialValue)
Constructs a PasswordEditField instance with label and initial value.

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

Note that your provided text does not itself show up in the created field; this method shows a string of asterisks of the same length to the user.

Parameters:
label - Label for this field.
initialValue - Initial password value for this field.
Since:
BlackBerry API 6.0.0

PasswordInputHelper

public PasswordInputHelper(String label,
                           String initialValue,
                           int maxNumChars,
                           long style)
Constructs a smaller PasswordEditField object.

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

Note that your provided text does not itself show up in the created field; this method shows a string of asterisks of the same length to the user.

Parameters:
label - Label for this field.
initialValue - Initial password value for this field.
maxNumChars - Maximum number of characters this field can hold.
style - Style for this field: this value will be combined with the EDITABLE and NO_NEWLINE styles.
Since:
BlackBerry API 6.0.0


Method Detail

isSelectionCopyable

public final boolean isSelectionCopyable()
Determines if this field supports copy operations.

Overrides:
isSelectionCopyable in class InputHelperBase
Returns:
False; password edit fields do not support copy operations.
Since:
BlackBerry API 6.0.0

keyRepeat

protected boolean keyRepeat(int keycode,
                            int time)
Consumes key repeat events.

This method consumes all key repeat events, which aren't appropriate for password fields except the speakerphone key when trackball is supported or media keys.

Overrides:
keyRepeat in class Field
Parameters:
keycode - Key being repeated (ignored).
time - Number of milliseconds since the device was turned on.
Returns:
True (this method always consumes key repeat events) unless key is speakerphone key and trackball is supported, or a media key.
Since:
BlackBerry API 6.0.0

selectionCopy

public final void selectionCopy(Clipboard cb)
Does nothing.

This type of field does not support copy operations.

Overrides:
selectionCopy in class InputHelperBase
Parameters:
cb - Clipboard object.
Since:
BlackBerry API 6.0.0

setText

protected void setText(String text,
                       int context)
                throws IllegalArgumentException
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.
Throws:
IllegalArgumentException - If the text cannot be entered into an edit field.
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