|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
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.PasswordEditField
An editable text field desgined 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.
| 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_LEARNING, NO_NEWLINE |
| Fields inherited from class net.rim.device.api.ui.Field |
ACTION_INVOKE, EDITABLE, EDITABLE_MASK, FIELD_BOTTOM, FIELD_HALIGN_MASK, FIELD_HCENTER, FIELD_LEFT, FIELD_RIGHT, FIELD_TOP, 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 |
| Constructor Summary | ||
PasswordEditField()
Constructs a new PasswordEditField instance. |
||
PasswordEditField(String label,
String initialValue)
Constructs a PasswordEditField instance with label and initial value. |
||
PasswordEditField(String label,
String initialValue,
int maxNumChars,
long style)
Constructs a smaller PasswordEditField object. |
||
| Method Summary | ||
protected boolean |
backspace()
Deletes character to the left of the cursor, or deletes selection. |
|
int |
backspace(int count)
Deletes specified number of characters to the left of the cursor. |
|
protected int |
backspace(int count,
int context)
Deletes specified number of characters to the left of the cursor, with indication of source of this action. |
|
char |
charAt(int offset)
Retrieves the character at the specified offset. |
|
void |
clear(int context)
Clears this field's contents. |
|
protected void |
displayFieldFullMessage()
Displays a 'field full' message. |
|
int |
getCursorPosition()
Retrieves character offset for current cursor position in this field. |
|
String |
getLabel()
Retrieves this field's label. |
|
int |
getLabelLength()
Retrieves the length of this field's label The length returned includes any additional character appended for layout purposes. |
|
int |
getMaxSize()
Retrieves the maximum number of characters allowed for this field's value. |
|
int |
getPreferredHeight()
Retrieves this field's preferred height. |
|
int |
getPreferredWidth()
Retrieves this field's preferred width. |
|
String |
getText()
Retrieves this field's text, not including the label. |
|
String |
getText(int offset,
int length)
Retrieves a portion of this field's text. |
|
void |
getText(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
Retrieves this field's text. |
|
AbstractString |
getTextAbstractString()
Retrieves read-only handle to the underlying buffer. |
|
int |
getTextLength()
Retrieves length of this field's text, not including the label. |
|
int |
insert(String text)
Inserts string programmatically into this field. |
|
protected int |
insert(String text,
int context)
Inserts string into this field. |
|
boolean |
isSelectionCopyable()
Determines if this field supports copy operations. |
|
protected boolean |
isSymbolScreenAllowed()
Determines if this field supports use of the symbol screen. |
|
protected boolean |
keyRepeat(int keycode,
int time)
Consumes key repeat events. |
|
protected void |
onUnfocus()
Invoked when a field loses the focus. |
|
boolean |
paste(Clipboard cb)
Pastes text scrap into this field. |
|
void |
selectionCopy(Clipboard cb)
Does nothing. |
|
void |
selectionDelete()
Deletes character to the right of the cursor, or deletes selection. |
|
void |
setCursorPosition(int offset)
Places cursor on specific character within this field, at user request. |
|
protected void |
setCursorPosition(int offset,
int context)
Places cursor on specific character within this field. |
|
void |
setLabel(String newLabel)
Sets this field's label. |
|
void |
setMaxSize(int maxSize)
Sets maximum number of characters allowed for this field's value. |
|
void |
setText(String text)
Sets the text value for this field. |
|
protected void |
setText(String text,
int context)
Sets the text value for this field, with indication of the source of this action. |
|
protected void |
update(int delta)
Updates this edit field. |
|
void |
wipe()
Overwrites this field's unused contents. |
|
| Methods inherited from class net.rim.device.api.ui.component.BasicEditField |
drawFocus, getFilter, keyChar, keyControl, keyDown, layout, makeContextMenu, moveFocus, moveFocus, paint, setFilter, setFont |
| Methods inherited from class net.rim.device.api.ui.component.TextField |
drawText, fieldChangeNotify, getFocusRect, isPasteable, isSelectable, isSelecting, isSelectionDeleteable, navigationClick, navigationUnclick, onFocus, select, toString |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public PasswordEditField()
This builds a new password edit field with no label and no initial contents.
public PasswordEditField(String label, String initialValue)
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.
label - Label for this field.initialValue - Initial password value for this field.public PasswordEditField(String label, String initialValue, int maxNumChars, long style)
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.
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.| Method Detail |
protected boolean backspace()
TextFieldIf 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.
backspace in class BasicEditFieldTextField.backspace(int)public int backspace(int count)
TextFieldThis method ignores the current selection and deletes a number of characters to the left of the current cursor position. If this method runs into the beginning of this field's editable value, it deletes as many characters as possible.
backspace in class BasicEditFieldTextField.backspace(int)
protected int backspace(int count,
int context)
TextFieldThis method ignores the current selection and deletes a number of characters to the left of the current cursor position. If this method runs into the beginning of this field's editable value, it deletes as many characters as possible.
You can specify whether this method was invoked programmatically, or as an event prompted by the user.
backspace in class BasicEditFieldTextField.backspace(int)public char charAt(int offset)
TextFieldIndex zero is the first character position after this field's label.
charAt in class BasicEditFieldTextField.charAt(int)public void clear(int context)
TextFieldOverride this method if you want the default text to be non empty when the field is cleared. For example, a URLEditField might call setText("http://", context).
clear in class BasicEditFieldTextField.clear(int)protected void displayFieldFullMessage()
TextFielddisplayFieldFullMessage in class BasicEditFieldTextField.displayFieldFullMessage()public int getCursorPosition()
TextFieldThis method does not include the label as part of its accounting (that is, a returned offset of zero means that the cursor is currently sitting on the first character in this field's value).
getCursorPosition in class BasicEditFieldTextField.getCursorPosition()public String getLabel()
TextFieldgetLabel in class BasicEditFieldTextField.getLabel()public int getLabelLength()
TextField The length returned includes any additional character appended for layout purposes.
Therefore the value may not be the same as #getLabel().length()
getLabelLength in class BasicEditFieldTextField.getLabelLength()public int getMaxSize()
TextFieldThis method does not include this field's label as part of its accounting.
getMaxSize in class BasicEditFieldTextField.getMaxSize()public int getPreferredHeight()
TextFieldManagers make use of this value during layout. Edit fields determine their preferred height based on the height of the font they're using to display their text contents.
getPreferredHeight in class BasicEditFieldTextField.getPreferredHeight()public int getPreferredWidth()
TextFieldManagers make use of this value during layout. All editable fields to be as wide as possible. Non editable fields to be layed out with as little space as possible.
getPreferredWidth in class BasicEditFieldTextField.getPreferredWidth()public String getText()
TextFieldgetText in class BasicEditFieldTextField#getTextpublic String getText(int offset, int length)
TextFieldProvide a character offset and length to retrieve a substring of this field's contents.
Note: This method includes the label in the field's contents, so if you pass in an offset of zero, the first character returned is the first character of the label.
Note: Different system themes may modify the contents of the label.
getText in class BasicEditFieldTextField#getText
public void getText(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
TextFieldNote: This method adjusts for the label in the field's contents, so the srcBegin and srcEnd parameters decribe the field's actual contents.
getText in class BasicEditFieldTextField#getTextpublic AbstractString getTextAbstractString()
TextField Note: The underlying buffer can be modified by this field if
methods such as TextField.insert(java.lang.String) or TextField.selectionDelete() are invoked.
getTextAbstractString in class BasicEditFieldTextField.getTextAbstractString()public int getTextLength()
TextFieldgetTextLength in class BasicEditFieldTextField.getTextLength()public int insert(String text)
TextFieldThis method attempts to insert your specified string 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.
Note: use this method for programmatic changes to this field;
be default, this method simply invokes
insert(yourString, FieldChangeListener.PROGRAMMATIC).
insert in class BasicEditFieldTextField.insert(java.lang.String)protected int insert(String text, int context)
TextFieldThis method attempts to insert your specified string 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.
insert in class BasicEditFieldTextField.insert(java.lang.String)public final boolean isSelectionCopyable()
isSelectionCopyable in class TextFieldprotected boolean isSymbolScreenAllowed()
TextFieldUse this method to determine if this field supports the symbol screen (all edit fields do by default). The user can press ALT+SPACE to show the symbol screen.
Subclasses may override this method to return different values depending on if they want the symbol screen to be allowed.
The implementation in this class unconditionally returns true.
isSymbolScreenAllowed in class BasicEditFieldTextField.isSymbolScreenAllowed()
protected boolean keyRepeat(int keycode,
int time)
This method consumes all key repeat events, which aren't appropriate for password fields except the speakerphone key when trackball is supported.
keycode - Key being repeated (ignored).time - Number of milliseconds since the device was turned on.protected void onUnfocus()
The method will not be invoked if this field does not already have the focus.
By default, this method clears the muddy bit and removes selection. If your custom field requires special handling upon losing the focus, you must override this method. Don't forget to call super.onUnFocus() though or the muddy bit won't get cleared.
onUnfocus in class BasicEditFieldpublic boolean paste(Clipboard cb)
TextField If this field is EDITABLE, this method pastes the
scrap currently on the clipboard after the current cursor position.
This method attempts to insert as many characters as it can into this field. If this field's capacity is reached before all characters are pasted, then only those that fit are pasted.
If this field currently has some text selected, this method replaces the selection with the scrap from the clipboard.
paste in class BasicEditFieldTextField.paste(net.rim.device.api.system.Clipboard)public final void selectionCopy(Clipboard cb)
This type of field does not support copy operations.
selectionCopy in class TextFieldcb - Clipboard object.public void selectionDelete()
TextFieldIf some characters are currently selected, this method deletes the selection as if they were a single character.
If no characters are selected, this method deletes the character immediately to the right of the cursor. If the cursor is currently on the last character in the field, this method does nothing.
selectionDelete in class BasicEditFieldTextField.selectionDelete()public void setCursorPosition(int offset)
TextFieldThis method does not include the label as part of its accounting (that is, an offset of zero represents the first character in this field's text value).
This method assumes the repositioning request was user-initiated.
setCursorPosition in class BasicEditFieldTextField.setCursorPosition(int)
protected void setCursorPosition(int offset,
int context)
TextFieldThis method does not include the label as part of its accounting (that is, an offset of zero represents the first character in this field's text value).
setCursorPosition in class BasicEditFieldTextField.setCursorPosition(int)public void setLabel(String newLabel)
TextFieldsetLabel in class BasicEditFieldTextField.setLabel(java.lang.String)public void setMaxSize(int maxSize)
TextFieldIf this field currently holds more than your provided number, this method truncates this field's contents to fit.
This method does not include the label in its accounting.
setMaxSize in class BasicEditFieldTextField.setMaxSize(int)public void setText(String text) throws IllegalArgumentException
TextFieldtext.setText in class BasicEditFieldTextField.setText(java.lang.String)protected void setText(String text, int context) throws IllegalArgumentException
TextFieldsetText in class BasicEditFieldTextField.setText(java.lang.String)protected void update(int delta)
TextFieldThis field invokes this method when text is inserted or deleted so this field can update itself.
update in class BasicEditFieldTextField.update(int)public void wipe()
TextFieldwipe in class BasicEditFieldTextField.wipe()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2007 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.