|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.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
public class ActiveAutoTextEditField
Field that uses a supplied set of string patterns to pick out 'active' regions.
These active regions are underlined and supply context menu items if the user clicks 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, DEFAULT_MAXCHARS, JUMP_FOCUS_AT_END, NO_COMPLEX_INPUT, NO_EDIT_MODE_INPUT, NO_LEARNING, NO_NEWLINE, NO_SWITCHING_INPUT |
| Constructor Summary | ||
|---|---|---|
ActiveAutoTextEditField(String label,
String initialValue)
Constructs a new ActiveAutoTextEditField instance. |
||
ActiveAutoTextEditField(String label,
String initialValue,
int maxNumChars)
Constructs a smaller, editable ActiveAutoTextEditField instance that can hold a specified maximum number of characters. |
||
ActiveAutoTextEditField(String label,
String initialValue,
int maxNumChars,
long style)
Constructs a new, smaller ActiveAutoTextEditField instance, of a given style that can hold a specified maximum number of characters. |
||
| 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()
Returns the text value contained in this field. |
|
String |
getText(int offset,
int length)
Returns a substring of text contained in this field. |
|
AbstractString |
getTextAbstractString()
Returns 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 void |
onFocus(int direction)
Invoked when focus passes to field (i.e. when the field is 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. |
|
protected boolean |
touchEvent(TouchEvent message)
Traps touch input events. |
|
| Methods inherited from class net.rim.device.api.ui.component.AutoTextEditField |
|---|
backspace, insert, keyDown, 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, getAccessibleContext, 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 |
| Methods inherited from interface net.rim.device.api.im.ITextInputStyle |
|---|
getPreferredInputLocale, getTextInputStyle, isEditable, isUnicodeInputAllowed, updateInputStyle |
| Constructor Detail |
|---|
public ActiveAutoTextEditField(String label,
String initialValue)
This method builds an editable autotext field that can hold up to
TextField.DEFAULT_MAXCHARS.
label - Label for this field.initialValue - Initial text to show in the buffer.
public ActiveAutoTextEditField(String label,
String initialValue,
int maxNumChars)
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)
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 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 AutoTextEditFieldkey - Character generated by the event.status - Modifier key status.time - Number of milliseconds since the device was turned on.
We need to track user events in order to know when to replace smileys later onprotected boolean touchEvent(TouchEvent message)
touchEvent in class TextFieldmessage - TouchEvent object containing various input parameters
including the event type and touch coordinates.
IllegalArgumentException - If message is null.public Object getCookieWithFocus()
getCookieWithFocus in interface CookieProviderpublic 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.protected boolean regionHasCookie()
protected boolean regionHasCookie(int region)
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.
If more than one charater in this field is selected, 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.public void getFocusRect(XYRect rect)
The framework invokes this method to retrieve this field's current focus region.
getFocusRect in class TextFieldrect - The focus extent for this field, in local
coordinates.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 a selection exists and includes portion of the active auto text,
then AutoTextEditField.selectionDelete() is executed for default
behaviour.
selectionDelete in class AutoTextEditFieldTextField.isSelectionDeleteable(),
Field.selectionCut(net.rim.device.api.system.Clipboard)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 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.
scrollHorizontally in class TextFieldamount - Number of characters by which to scroll (positive means visually right, negative
visually left).
protected int scrollVertically(int amount)
If there is another cookie within a line on either side of the current position, jump so that the current position is on top of the cookie.
scrollVertically in class TextFieldamount - Number of positions to move, positive means down, negative
up.
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.
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 BasicEditFieldgraphics - Graphics context for repainting this field.
protected int drawText(Graphics graphics,
int x,
int y,
int offset,
int length)
protected void onFocus(int direction)
onFocus in class TextFielddirection - 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 a trackwheel roll).public void scanForActiveRegions()
The scan is performed in the background.
public void run()
Runnable interface.
Background threads invoke this method to scan for active regions.
run in interface RunnableThread.run()
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 BasicEditFieldkey - Character generated.status - Modifier key status. See KeypadListener.time - Number of milliseconds since the device was turned on.
protected boolean isSymbolScreenAllowed()
isSymbolScreenAllowed in class BasicEditFieldpublic String getText()
getText in class BasicEditFieldpublic AbstractString getTextAbstractString()
getTextAbstractString in class BasicEditField
public String getText(int offset,
int length)
getText in class BasicEditFieldoffset - First character of this field's text to return.length - Number of characters to return.
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.
public 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.
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 TextFieldcontext - Information specifying the origin of the change.Field.fieldChangeNotify(int)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2010 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. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.