|
|||||||||
| 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.RichTextField
net.rim.device.api.ui.component.ActiveRichTextField
public class ActiveRichTextField
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 clicks on them.
| Field Summary | ||
|---|---|---|
protected static long |
INVALID_COOKIE_ID
Placeholder to flag invalid cookie regions. |
|
static int |
SCANFLAG_DISABLE_ALL_THREADING
Disable all threading when scanning. |
|
static int |
SCANFLAG_THREAD_ON_CREATE
Enable threads on creation. |
|
protected long[] |
_cookieID
Array of cookie types, one for each region. |
|
| Fields inherited from class net.rim.device.api.ui.component.RichTextField |
|---|
TEXT_ALIGN_HCENTER, TEXT_ALIGN_LEFT, TEXT_ALIGN_RIGHT, USE_TEXT_WIDTH |
| 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 | ||
|---|---|---|
ActiveRichTextField(String text)
Creates a new ActiveRichTextField instance from provided string after scanning for active "links". |
||
ActiveRichTextField(String text,
int[] offsets,
byte[] attributes,
Font[] fonts,
int[] foregroundColors,
int[] backgroundColors,
long style)
Creates a new ActiveRichTextField instance from provided formatted string and style flags after scanning for active "links". |
||
ActiveRichTextField(String text,
long style)
Creates a new ActiveRichTextField instance from provided string and style flags after scanning for active "links". |
||
| Method Summary | ||
|---|---|---|
protected void |
drawFocus(Graphics graphics,
boolean on)
Draws the focus indicator for this field. |
|
protected int |
drawText(Graphics graphics,
String text,
int offset,
int len,
int x,
int y,
int flags,
int width)
Deprecated. |
|
protected void |
executeBackgroundScan()
Executes the string pattern scan on a background thread |
|
protected Object |
getContextMenuContext()
Retrieves the context object to be passed to CookieProviderUtilities.getFocusVerbs(net.rim.device.api.ui.component.CookieProvider, java.lang.Object, net.rim.device.apps.api.framework.verb.Verb[])
to fetch the context menu verbs. |
|
Object |
getCookieWithFocus()
Retrieves the cookie for the region currently with the focus. |
|
void |
getFocusRect(XYRect rect)
Retrieves the extent of the focus region. |
|
protected Manager |
getMainScreenManager()
Deprecated. Meaningless method accidentally exposed. |
|
Object |
getRegionCookie()
Retrieves the cookie for the region under the current cursor position. |
|
Object |
getRegionCookie(int region)
Generates a cookie for the specified region. |
|
static int |
getScanFlags()
Retrieves flags that govern scanning functionality. |
|
String |
getText(int offset,
int length)
Retrieves text string from this field. |
|
protected boolean |
keyDown(int keycode,
int time)
Handles key down events. |
|
boolean |
regionHasCookie()
Determines if the cursor is on a cookie object. |
|
boolean |
regionHasCookie(int region)
Determine if provided region has an associated cookie. |
|
protected int |
scrollVertically(int amount)
Moves the cursor position vertically. |
|
void |
selectionCopy(Clipboard cb)
Copies the current selection to the clipboard. |
|
void |
setAttributes(int[] colorForeground,
int[] colorBackground)
Sets new colour attributes for this field. |
|
static void |
setScanFlags(int flags)
Sets flags that govern scanning functionality. |
|
void |
setText(String text)
Provides new text for this field to show. |
|
void |
setText(String text,
int[] offsets,
byte[] attributes,
Font[] fonts)
Provides new, formatted text for this field to show, with associated cookies. |
|
void |
setText(String text,
int[] offsets,
byte[] attributes,
Font[] fonts,
int[] foregroundColors,
int[] backgroundColors)
Provides new, formatted and coloured text for this field to show, with associated cookies. |
|
| Methods inherited from class net.rim.device.api.ui.component.RichTextField |
|---|
charAt, getAttributes, getBackgroundColors, getCursorPosition, getFonts, getForegroundColors, getOffsets, getPreferredHeight, getRegion, getRegionFont, getRegionFont, getRegionText, getRegionText, getText, getTextLength, isSelectable, keyChar, layout, moveFocus, paint, setCursorPosition, setFont, setText |
| Methods inherited from class net.rim.device.api.ui.component.TextField |
|---|
backspace, backspace, backspace, clear, displayFieldFullMessage, drawText, fieldChangeNotify, getAccessibleContext, getFilter, getLabel, getLabelLength, getMaxSize, getPreferredWidth, getText, getTextAbstractString, insert, insert, isPasteable, isSelecting, isSelectionCopyable, isSelectionDeleteable, isSymbolScreenAllowed, keyControl, makeContextMenu, moveFocus, navigationClick, navigationUnclick, onFocus, paste, select, selectionDelete, setCursorPosition, setFilter, setLabel, setMaxSize, setText, toString, update, wipe |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int SCANFLAG_DISABLE_ALL_THREADING
public static final int SCANFLAG_THREAD_ON_CREATE
protected long[] _cookieID
protected static final long INVALID_COOKIE_ID
| Constructor Detail |
|---|
public ActiveRichTextField(String text)
text - String to scan and display.
public ActiveRichTextField(String text,
long style)
text - String to scan and display.style - Style flags for this field.
public ActiveRichTextField(String text,
int[] offsets,
byte[] attributes,
Font[] fonts,
int[] foregroundColors,
int[] backgroundColors,
long style)
text - String to scan and display.offsets - List of character offsets that mark formatting changes.attributes - List that associates this field's formatting regions
with the font formats used.fonts - List of fonts formats for this field.foregroundColors - List of foreground colors for this field.backgroundColors - List of background colors for this field.style - Style flags for this field.| Method Detail |
|---|
protected void executeBackgroundScan()
protected void drawFocus(Graphics graphics,
boolean on)
This field's manager invokes this method after painting the field, in order to overpaint the focus indictor. By default, this method simply inverts the pixels in the focus's extent.
Note that if currently selecting more than one character in this field, then the focus region occupies the entire extent of the selected field.
This method also highlights current cookie regions as appropriate.
drawFocus in class TextFieldgraphics - Graphics context for drawing the focus.on - If true, focus is over an active region, and entire active text
gets highlighted and then cursor superimposed over that; otherwise focus
painting happens as normal.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 Object getContextMenuContext()
CookieProviderUtilities.getFocusVerbs(net.rim.device.api.ui.component.CookieProvider, java.lang.Object, net.rim.device.apps.api.framework.verb.Verb[])
to fetch the context menu verbs.
public Object getRegionCookie()
getRegionCookie in class RichTextFieldpublic Object getCookieWithFocus()
getCookieWithFocus in interface CookieProviderprotected Manager getMainScreenManager()
public Object getRegionCookie(int region)
getRegionCookie in class RichTextFieldregion - Region for which to generate a cookie.
public static int getScanFlags()
protected boolean keyDown(int keycode,
int time)
Keypad.KEY_APPLICATION is pressed while the cursor is over an
active region, this method dispatches to the appropriate application key
verb for that region.
If Keypad.KEY_ENTER is pressed while the cursor is over an active
region, this method dispatches to the default menu item verb for that
region; otherwise, this method hands the event up to the parent.
keyDown in class Fieldkeycode - Code of key pressed.time - Number of milliseconds since the device was turned on.
public boolean regionHasCookie()
public boolean regionHasCookie(int region)
region - Region to test.
protected int scrollVertically(int amount)
This method moves the cursor position up and down lines within this field. If the cursor reaches the first line, or last line, in this field, it will not wrap around the entire field.
Just before the first vertical scroll, this method remembers the distance of the cursor from the left edge of the field (in pixels). When it scrolls, it places the cursor over the character on the new line that is as close as possible to the offset it remembers from its original position.
If there is another cookie within a line either way of the current position, this method jumps so that the current position is on top of the new cookie.
scrollVertically in class TextFieldamount - Amount by which to scroll (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 static void setScanFlags(int flags)
flags - New mask of scanning flags set/unset.public void setText(String text)
setText in class RichTextFieldtext - New text to show in this field; this text is re-parsed
against the original patterns array to determine whether the active
regions have changed.
public void setText(String text,
int[] offsets,
byte[] attributes,
Font[] fonts)
setText in class RichTextFieldtext - New text to show in this field; this text is re-parsed
against the original patterns array to determine whether the active
regions have changed.offsets - List of character offsets that mark formatting changes.attributes - List that associates this field's formatting regions
with the font formats used.fonts - List of fonts formats for this field.
public void setText(String text,
int[] offsets,
byte[] attributes,
Font[] fonts,
int[] foregroundColors,
int[] backgroundColors)
text - New text to show in this field; this text is re-parsed
against the original patterns array to determine whether the active
regions have changed.offsets - List of character offsets that mark formatting changes.attributes - List that associates this field's formatting regions
with the font formats used.fonts - List of fonts formats for this field.foregroundColors - List of foreground colors for this field.backgroundColors - List of background colors for this field.
public void setAttributes(int[] colorForeground,
int[] colorBackground)
setAttributes in class RichTextFieldcolorForeground - New foreground colour attributes.colorBackground - New background colour attributes.
public String getText(int offset,
int length)
If smileys exist in this field, this method first "decodes" them, and then returns the result.
getText in class RichTextFieldoffset - First character in field to retrieve.length - Number of characters to retrieve.
protected int drawText(Graphics graphics,
String text,
int offset,
int len,
int x,
int y,
int flags,
int width)
|
|||||||||
| 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.