|
|||||||||
| 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.EditField
|
+--net.rim.device.api.ui.component.AutoTextEditField
|
+--net.rim.device.api.ui.component.ActiveAutoTextEditField
Field that uses a supplied set of string patterns to scan through a simple text string and pick out 'active' regions.
These active regions are highlighted with underlining and will supply additional menu verbs if the user thumbclicks on them.
To add new data types to the recognizer set:
StringPattern and add it to the
StringPatternRepository.
ActiveFieldCookie interface
Factory for this new object, add the factory to
the RuntimeStore with an appropriate Long ID (GUID).
Match
class. Set the Match.id
field to the GUID of the factory.
ActiveFieldContext instance that
contains the String region into your Factory. Use
this String to initialize your object.
CookieProvider,
ActiveFieldCookie| Field Summary |
| Fields inherited from class net.rim.device.api.ui.component.AutoTextEditField |
AUTOCAP_OFF, AUTOPERIOD_OFF, AUTOREPLACE_OFF |
| 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 | ||
ActiveAutoTextEditField(String label,
String initialValue)
Constructs a new ActiveAutoTextEditField instance. |
||
ActiveAutoTextEditField(String label,
String initialValue,
int maxNumChars)
Constructs a new, smaller ActiveAutoTextEditField instance. |
||
ActiveAutoTextEditField(String label,
String initialValue,
int maxNumChars,
long style)
Constructs a new, smaller ActiveAutoTextEditField instance, of a given style. |
||
| Method Summary | ||
protected void |
drawFocus(Graphics graphics,
boolean on)
Draws the focus indicator for this field. |
|
protected int |
drawText(Graphics graphics,
int x,
int y,
int offset,
int length)
Deprecated. |
|
|
protected void |
fieldChangeNotify(int context)
Invoked for this field when a change event occurs. |
|
Object |
getCookieWithFocus()
Generates a cookie for the current region with focus. |
void |
getFocusRect(XYRect rect)
Retrieves the extent of the focus region. |
|
|
protected int |
getRegion()
Searches for region containing the current cursor position. |
|
protected int |
getRegion(int curPos)
Searches for region containing the specified cursor position. |
|
protected String |
getRegionText(int region)
Retrieves the text under the specified hyperlink region. |
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. |
|
AbstractString |
getTextAbstractString()
Retrieves this field's text "as is" including embedded graphics characters. |
|
int |
insert(String text,
int context,
boolean stripInvalid,
boolean validateText)
Inserts a string into this field, potentially stripping new lines and/or validating entered value. |
|
boolean |
isSelectionCopyable()
Determines if this field supports copy operations. |
|
boolean |
isSelectionDeleteable()
Determines if this field supports cut operations. |
|
protected boolean |
isSymbolScreenAllowed()
Determines if this field supports use of the symbol screen. |
|
protected boolean |
keyChar(char key,
int status,
int time)
Traps key generation events. |
|
protected boolean |
keyControl(char key,
int status,
int time)
Handles control character generation events. |
|
|
protected boolean |
keyDown(int keycode,
int time)
Handles symbol screen key sequences. |
protected void |
onFocus(int direction)
Invoked when focus passes to field (activated) |
|
protected void |
paint(Graphics graphics)
Redraws this field. |
|
boolean |
paste(Clipboard cb)
Paste the contents of the provided clipboard into this field. |
|
|
protected boolean |
regionHasCookie()
Determines if the cursor is on top of a cookie region. |
|
protected boolean |
regionHasCookie(int region)
Determines if provided region has an associated cookie. |
void |
run()
Implements Runnable interface. |
|
void |
scanForActiveRegions()
Scans for active regions in this field. |
|
protected int |
scrollHorizontally(int amount)
Moves the cursor position horizontally. |
|
protected int |
scrollVertically(int amount)
Handles moving focus vertically within this field. |
|
void |
selectionCopy(Clipboard cb)
Copies the current selection to the clipboard. |
|
void |
selectionDelete()
Deletes active auto text, or deletes selection. |
|
void |
setText(String text)
Sets the text value for this field. |
|
| Methods inherited from class net.rim.device.api.ui.component.AutoTextEditField |
backspace, insert, keyRepeat, moveFocus, setText, update |
| Methods inherited from class net.rim.device.api.ui.component.EditField |
isEnteringRollerCharacter |
| Methods inherited from class net.rim.device.api.ui.component.BasicEditField |
backspace, backspace, charAt, clear, displayFieldFullMessage, getCursorPosition, getFilter, getLabel, getLabelLength, getMaxSize, getPreferredHeight, getPreferredWidth, getText, getTextLength, insert, insert, layout, makeContextMenu, moveFocus, onUnfocus, setCursorPosition, setCursorPosition, setFilter, setFont, setLabel, setMaxSize, wipe |
| Methods inherited from class net.rim.device.api.ui.component.TextField |
drawText, isPasteable, isSelectable, isSelecting, navigationClick, navigationUnclick, select, toString |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ActiveAutoTextEditField(String label, String initialValue)
This method builds an editable autotext field that can hold up to
EditField#DEFAULT_MAXCHARS.
label - Label for this field.initialValue - Initial text to show in the buffer.public ActiveAutoTextEditField(String label, String initialValue, int maxNumChars)
This method builds an editable autotext field that can hold a number of characters up to the amount you specify.
label - Label for this field.initialValue - Initial text to show in the buffer.maxNumChars - Maximum number of characters this field can hold.public ActiveAutoTextEditField(String label, String initialValue, int maxNumChars, long style)
This method builds an autotext field of a specified style, that can hold a number of characters up to the amount you specify.
label - Label for this field.initialValue - Initial text to show in the buffer.maxNumChars - Maximum number of characters this field can hold.style - Styles to apply to this field (for an editable field,
specify the style Field.EDITABLE.| Method Detail |
protected void drawFocus(Graphics graphics, boolean on)
This field's manager invokes this method after painting the field, in order to overpaint the focus indicator and the current cookie regions.
Note that if currently selecting more than one character in this field, then the focus region occupies the entire extent of the selected text.
drawFocus in class BasicEditFieldgraphics - Graphics context for drawing the focus.on - This parameter is ignored; the focus is always set at the
location at which it is drawn.protected int drawText(Graphics graphics, int x, int y, int offset, int length)
protected void fieldChangeNotify(int context)
TextFieldCustom fields should call this function when their state changes.
The dirty state is cleared if the change was programmatic, and is set (dirtied) if the change was user driven.
fieldChangeNotify in class TextFieldField.fieldChangeNotify(int)public Object getCookieWithFocus()
public void getFocusRect(XYRect rect)
The framework invokes this method to retrieve this field's current focus region.
getFocusRect in class TextFieldrect - To contain the focus extent for this field, in local
coordinates.protected int getRegion()
protected int getRegion(int curPos)
curPos - Offset into text string (including label text).protected String getRegionText(int region)
region - Hyperlink region to examine.public String getText()
getText in class BasicEditFieldpublic String getText(int offset, int length)
getText in class BasicEditFieldoffset - First character of this field's text to retrieve.length - Number of characters to retrieve.public AbstractString getTextAbstractString()
getTextAbstractString in class BasicEditFieldpublic int insert(String text, int context, boolean stripInvalid, boolean validateText)
This method attempts to insert your specified string at the current cursor position. If this method (even partially) succeeds with the insertion, then it moves the cursor to just after the last character successfully inserted.
If this field's capacity is reached before all characters are inserted, then only those that fit are inserted.
insert in class AutoTextEditFieldtext - String to insert; if null, nothing happens.context - Information describing the origin of the change.stripInvalid - True if this method should strip out invalid
characters from the provided text; otherwise, fail if invalid characters
exist in the provided text.validateText - True if this method should validate the provided
text before attempting to insert it; otherwise, this method won't attempt
to validate your provided text.public boolean isSelectionCopyable()
This method returns true if there is currently a selection (fields that can select text always have a selection, even if it's zero characters in size).
isSelectionCopyable in class TextFieldpublic boolean isSelectionDeleteable()
isSelectionDeleteable in class TextFieldprotected boolean isSymbolScreenAllowed()
isSymbolScreenAllowed in class BasicEditField
protected boolean keyChar(char key,
int status,
int time)
AutoTextEditField This field's manager invokes this event to handle all key generation
events, except for the special symbol screen event (triggered with
ALT+SPACE) which is handled by AutoTextEditField.keyDown(int, int).
This method consumes all key events, except in the following cases:
TextField.NO_NEWLINE, and the ENTER key was pressed.
EDITABLE (exception: if in
select mode, and the ENTER key was pressed).
keyChar in class AutoTextEditFieldWe need to track user events in order to know when to replace smileys later on
protected boolean keyControl(char key,
int status,
int time)
TextFieldThis field's manager invokes this method to send this field a control character event.
keyControl in class BasicEditField
TextFieldkey - Character generated.status - Modifier key status. See KeypadListener.time - Number of milliseconds since the device was turned on.
protected boolean keyDown(int keycode,
int time)
This method traps application key presses, and if the appropriate active field data is application invokeable, the appropriate verb is invoked, and the key event consumed.
keyDown in class AutoTextEditFieldkeycode - Character generated by the event.time - Number of milliseconds since the device was turned on.protected void onFocus(int direction)
direction - Direction of cursor movement; greater than zero means
it came from above this field, less than zero means it came from below
this field, zero means focus is being set to the field directly (that
is, not by means of a trackwheel roll).protected void paint(Graphics graphics)
TextFieldThis field's manager invokes this method during the repainting process to instruct this field to repaint itself.
paint in class BasicEditField
TextFieldgraphics - Graphics context for repainting this field.public boolean paste(Clipboard cb)
If this field is Field.EDITABLE, this method pastes the contents
of the provided 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 that selection with the contents of the provided clipboard.
paste in class BasicEditFieldcb - Clipboard containing text to paste into this field.protected boolean regionHasCookie()
protected boolean regionHasCookie(int region)
public void run()
Runnable interface.
Background threads invoke this method to scan for active regions.
Thread.run()public void scanForActiveRegions()
The scan is performed in the background.
protected int scrollHorizontally(int amount)
TextFieldThis method scrolls the cursor position within this field horizontally. If the cursor reaches the last character on a line, it wraps to the first character on the following line. If the cursor reaches the first character on a line, it wraps to the last character on the previous line.
If the cursor reaches either the first character or last character in this field, it will not wrap around the entire field.
The sign of the amount parameter indicates the direction in which to scroll; the parameter's value indicates the number of character positions to scroll.
TextFieldprotected int scrollVertically(int amount)
If there is another cookie within a line either way of the current position, jump so that the current position is on top of the cookie.
TextFieldamount - Number of positions to move, positive means down, negative
up.public void selectionCopy(Clipboard cb)
Note that this method always succeeds, even if zero characters are copied onto the clipboard. If at least one character exists in the selection to copy, then this method overwrites the clipboard's previous contents.
selectionCopy in class TextFieldcb - Clipboard to contain copied text.public void selectionDelete()
If selection is made and includes portion of the active auto text,
then AutoTextEditField.selectionDelete() is executed for default
behaviour.
selectionDelete in class AutoTextEditField
TextFieldField.isSelectionDeleteable(),
Field.selectionCut(net.rim.device.api.system.Clipboard)public void setText(String text)
This method updates the text contents of this field with new text information. This must be re-parsed against the original patterns array to determine whether the active regions have changed.
setText in class BasicEditFieldtext - New string value for this field; if null, this method clears
the field.IllegalArgumentException - If the text cannot be entered into an
edit field.
|
|||||||||
| 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.