|
|||||||||
| 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_EDIT_MODE_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 BasicEditField
TextFieldpublic 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 BasicEditField
TextFieldcount - Number of characters to delete.
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 BasicEditField
TextFieldcount - Number of characters to delete.context - Information specifying the origin of the change.public char charAt(int offset)
TextFieldIndex zero is the first character position after this field's label.
charAt in class BasicEditField
TextFieldoffset - Index of the character to retrieve.IndexOutOfBoundsException - if offset is less than zero, or
greater than or equal to the value returned from TextField.getTextLength().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 BasicEditField
TextFieldcontext - Context ID for this action.protected void displayFieldFullMessage()
TextFielddisplayFieldFullMessage in class BasicEditFieldpublic 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 BasicEditField
TextFieldpublic String getLabel()
TextFieldgetLabel in class BasicEditField
TextFieldpublic 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 BasicEditField
TextFieldpublic int getMaxSize()
TextFieldThis method does not include this field's label as part of its accounting.
getMaxSize in class BasicEditField
TextFieldpublic 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 BasicEditField
TextFieldpublic 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 BasicEditField
TextFieldpublic String getText()
TextFieldgetText in class BasicEditField
TextFieldpublic 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 BasicEditField
TextFieldoffset - First character to return.length - Number of characters to return.
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 BasicEditField
TextFieldsrcBegin - First character in source to retrieve.srcEnd - Last character in source to retrieve.dst - Character buffer to contain retrieved text.dstBegin - Offset into buffer to receive the first retrieved
character.public 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 BasicEditField
TextFieldpublic int getTextLength()
TextFieldgetTextLength in class BasicEditField
TextFieldpublic 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 BasicEditField
TextFieldtext - String to insert.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 BasicEditField
TextFieldtext - String to insert.context - Information specifying the origin of the change. false
indicates user-initiated insertion.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 BasicEditField
TextFieldtrue if this field supports the symbol screen;
false if it does not.
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()
BasicEditFieldThe 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 BasicEditField
TextFieldcb - Clipboard object holding the text scrap.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 BasicEditField
TextFieldField.isSelectionDeleteable(),
Field.selectionCut(net.rim.device.api.system.Clipboard)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 BasicEditField
TextFieldoffset - Character position to receive the cursor, counting from the
first character in this field's value.
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 BasicEditField
TextFieldoffset - Character position to receive the cursor, counting from the
first character in this field's value.context - Information specifying the origin of the change.public void setLabel(String newLabel)
TextFieldsetLabel in class BasicEditField
TextFieldnewLabel - New label for this field.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 BasicEditField
TextFieldMaxSize - New maximum number of characters for this edit field's
value.IllegalArgumentException - If maxNumChars is less than zero.public void setText(String text) throws IllegalArgumentException
TextFieldtext.setText in class BasicEditField
TextFieldtext - New string value for this field; if null, this method clears
the field.IllegalArgumentException - If the text cannot be entered into an
edit field.protected void setText(String text, int context) throws IllegalArgumentException
TextFieldsetText in class BasicEditField
TextFieldtext - New string value for this field; if null, this method clears
the field.context - Information specifying the origin of the change.IllegalArgumentException - If the text cannot be entered
into an edit field.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 BasicEditField
TextFielddelta - Number of characters by which the field has changed,
negative or positive (negative means that characters have been
deleted).public void wipe()
TextFieldwipe in class BasicEditField
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2008 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.