|
|||||||||
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.ScrollView
net.rim.device.api.ui.Manager
net.rim.device.api.ui.Screen
public abstract class Screen
Base class for all screens.
Each UiEngine
presents an interface to the user by pushing
screens onto its display stack, and popping them off when interaction with
the managed fields on that screen is finished.
Each Screen
object has a delegate manager, the single
Manager
object directly controlled by the screen to handle layout and
scrolling for the entire screen.
Screen
does not accept Field.FOCUSABLE_MASK
or
Field.EDITABLE_MASK
.
Field Summary | ||
---|---|---|
static long |
DEFAULT_CLOSE
If specified, screen will provide a close action. |
|
static long |
DEFAULT_MENU
If specified, screen will provide a default menu. |
|
static long |
NO_SYSTEM_MENU_ITEMS
If specified, screen will not have system menu items. |
Fields inherited from class net.rim.device.api.ui.Manager |
---|
BOTTOMMOST, DOWNWARD, HORIZONTAL_SCROLL, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_MASK, HORIZONTAL_SCROLL_MASK, LEAVE_BLANK_SPACE, LEFTMOST, LEFTWARD, NO_HORIZONTAL_SCROLL, NO_HORIZONTAL_SCROLLBAR, NO_SCROLL_RESET, NO_VERTICAL_SCROLL, NO_VERTICAL_SCROLLBAR, QUANTA_FONT, RIGHTMOST, RIGHTWARD, TOPMOST, UPWARD, VERTICAL_SCROLL, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_MASK, VERTICAL_SCROLL_MASK |
Constructor Summary | ||
---|---|---|
Screen(Manager delegate)
Constructs a new Screen instance with the provided delegate
manager. |
||
Screen(Manager delegate,
long style)
Constructs a new Screen instance with the provided delegate
manager and style. |
Method Summary | ||
---|---|---|
void |
add(Field field)
Adds a field to this screen's manager. |
|
void |
addInputSettings(InputSettings settings)
Applies attributes in the specified InputSettings
object to this screen. |
|
void |
addKeyListener(KeyListener listener)
Registers a key event listener for this screen. |
|
void |
addScreenUiEngineAttachedListener(ScreenUiEngineAttachedListener listener)
Registers a ScreenUiEngineAttachedListener event listener for
this screen. |
|
void |
addTrackwheelListener(TrackwheelListener listener)
Registers a trackwheel event listener for this screen. |
|
void |
clearInputSettings()
Removes all custom input settings for this screen and revert to defaults. |
|
void |
close()
Closes this screen. |
|
protected boolean |
cursorClick(int x,
int y,
int status,
int time)
Delegates cursor click events. |
|
protected boolean |
cursorUnclick(int x,
int y,
int status,
int time)
Delegates cursor unclick events. |
|
void |
delete(Field field)
Deletes a field from this screen's manager. |
|
void |
deleteRange(int start,
int count)
Deletes a range of fields from this screen's manager. |
|
void |
doPaint()
Paints this screen. |
|
void |
ensureRegionVisible(Field field,
int x,
int y,
int width,
int height)
Attempts to make your provided region visible. |
|
AccessibleContext |
getAccessibleContext()
Gets the accessible representation of the field for a screen reader. |
|
Application |
getApplication()
Retrieves this screen's application. |
|
ContextMenuProvider |
getContextMenuProvider()
Returns the context menu provider. |
|
MenuItem |
getDefaultMenuItem(int instance)
Retrieves the default menu item. |
|
Manager |
getDelegate()
Retrieves this screen's delegate manager. |
|
Field |
getField(int index)
Retrieves the controlled field with the specified index. |
|
int |
getFieldAtLocation(int x,
int y)
Retrieves the index of the field under the provided point. |
|
int |
getFieldCount()
Retrieves the number of controlled fields. |
|
Field |
getFieldWithFocus()
Retrieves the controlled field with focus. |
|
int |
getFieldWithFocusIndex()
Retrieves the index of the controlled field with focus. |
|
void |
getFocusRect(XYRect rect)
Retrieves the current extent of the focus. |
|
Graphics |
getGraphics()
Retrieves the graphics context for this screen. |
|
InputHelperBase |
getInputHelper()
Gets the InputHelperBase instance associated with this screen. |
|
void |
getInputSettings(InputSettings settings)
Retrieves the values for the attributes in the specified InputSettings object for this screen. |
|
Field |
getLeafFieldWithFocus()
Retrieves the leaf field with focus. |
|
Menu |
getMenu(int instance)
Retrieves the menu. |
|
Screen |
getScreenAbove()
Retrieves the handle for the local screen above this one. |
|
Screen |
getScreenBelow()
Retrieves the handle for the local screen below this one. |
|
ServiceMode |
getServiceMode()
Gets the current service mode for this screen. |
|
TitleBar |
getTitleBar()
Retrieves the current TitleBar object used by this screen. |
|
UiEngine |
getUiEngine()
Retrieves the UiEngine that owns this screen. |
|
VirtualKeyboard |
getVirtualKeyboard()
Retrieves the VirtualKeyboard object associated with this
screen. |
|
void |
insert(Field field,
int index)
Inserts a field to this screen's manager. |
|
void |
invalidate()
Invalidates the entire screen. |
|
void |
invalidate(int x,
int y,
int width,
int height)
Invalidates a region of this screen. |
|
void |
invalidateAll(int x,
int y,
int width,
int height)
Invalidates a region of this screen. |
|
void |
invalidateLayout()
Invalidates this screen's layout (including all controlled fields). |
|
protected boolean |
invokeAction(int action)
Invokes an action on this screen. |
|
boolean |
isDataValid()
Computes and returns whether or not the data on this screen is valid. |
|
boolean |
isDirty()
Determines if this screen is dirty. |
|
boolean |
isDisplayed()
Determines if this screen is currently in use. |
|
boolean |
isFocus()
Determines if this screen currently has the focus. |
|
boolean |
isFocusable()
Verifies that the delegate manager accepts the focus. |
|
boolean |
isGlobal()
Determines if this is a global screen. |
|
boolean |
isGlobalStatus()
Deprecated. Use isGlobal() |
|
boolean |
isMuddy()
Determines if this screen is muddy. |
|
boolean |
isSelecting()
Determines if this screen has the focus. |
|
protected boolean |
keyChar(char c,
int status,
int time)
Delegates key generation event to the controlled field with focus. |
|
protected boolean |
keyCharUnhandled(char key,
int status,
int time)
Invoked when a keyChar event is unhandled. |
|
protected boolean |
keyControl(char c,
int status,
int time)
Delegates a key generation event to the controlled field with focus. |
|
protected boolean |
keyDown(int keycode,
int time)
Delegates a key down event to controlled field with focus. |
|
protected boolean |
keyRepeat(int keycode,
int time)
Delegates a key repeat event to controlled field with focus. |
|
protected boolean |
keyStatus(int keycode,
int time)
Delegates a key status event to controlled field with focus. |
|
protected boolean |
keyUp(int keycode,
int time)
Delegates a key up event to controlled field with focus. |
|
protected void |
layoutDelegate(int width,
int height)
Lays out this screen's delegate. |
|
protected void |
makeMenu(Menu menu,
int instance)
Called from Screen.onMenu(int) to populate the menu. |
|
protected boolean |
navigationClick(int status,
int time)
Delegates navigational click events. |
|
protected boolean |
navigationMovement(int dx,
int dy,
int status,
int time)
Invoked when a navigational motion occurs. |
|
protected boolean |
navigationUnclick(int status,
int time)
Delegates navigation unclick events. |
|
boolean |
onClose()
Indicates that a close event has occurred. |
|
protected void |
onDisplay()
Deprecated. Use onUiEngineAttached |
|
protected void |
onExposed()
Invoked when this screen is exposed. |
|
protected void |
onFocus(int direction)
Finds a controlled field to give the focus. |
|
protected void |
onFocusNotify(boolean focus)
Called whenever the screen has gained or lost focus. |
|
boolean |
onMenu(int instance)
Invoked when displaying a menu. |
|
protected void |
onMenuDismissed()
Deprecated. Use onMenuDismissed(Menu). |
|
protected void |
onMenuDismissed(Menu menu)
Called when the menu is dismissed. |
|
protected void |
onObscured()
Invoked when this screen is obscured. |
|
protected boolean |
onSave()
Invoked when the screen should save its contents. |
|
protected boolean |
onSavePrompt()
Invoked when the screen should prompt to save its contents. |
|
protected void |
onUiEngineAttached(boolean attached)
Called whenever the screen is attached or detached from a UiEngine . |
|
protected void |
onUndisplay()
Deprecated. Use onUiEngineAttached |
|
protected void |
onUnfocus()
Invoked when focus is removed from this screen. |
|
protected boolean |
openDevelopmentBackdoor(int backdoorCode)
Handles development backdoor key-sequences. |
|
protected boolean |
openProductionBackdoor(int backdoorCode)
Handles production backdoor key-sequences. |
|
protected void |
paint(Graphics graphics)
Paints this screen's visible region. |
|
protected void |
paintBackground(Graphics graphics)
Paint this screen's background. |
|
void |
removeFocus()
Removes focus from this screen. |
|
void |
removeInputSettings(InputSettings settings)
Removes attributes in the specified InputSettings
object from this screen. |
|
void |
removeKeyListener(KeyListener listener)
Removes a key event listener from this screen. |
|
void |
removeScreenUiEngineAttachedListener(ScreenUiEngineAttachedListener listener)
Removes a ScreenUiEngineAttachedListener event listener from this
screen. |
|
void |
removeTrackwheelListener(TrackwheelListener listener)
Removes a trackwheel event listener from this screen. |
|
void |
replace(Field oldField,
Field newField)
Removes a field from this Screen and replaces it with another field. |
|
void |
save()
Invoked when the screen should save its contents. |
|
boolean |
scroll(int direction)
Scrolls the focus in the specified direction. |
|
protected void |
setBackdoorAltStatus(boolean altStatus)
Sets whether backdoors key sequences use ALT'd or un-ALT'd keystrokes. |
|
void |
setContextMenuProvider(ContextMenuProvider contextMenuProvider)
Sets the context menu provider. |
|
void |
setCursorInputMode(boolean enable)
Enables or disables cursor mode. |
|
protected void |
setDefaultClose(boolean provideDefaultClose)
Controls whether the screen's menu contains a "close" menu item. |
|
void |
setDirty(boolean dirty)
Cleans or dirties all controlled fields. |
|
void |
setFocus()
Sets the focus to the delegate manager. |
|
boolean |
setFocus(Field field,
int x,
int y,
int status,
int time)
Sets focus to an exact position on the current screen. |
|
void |
setHorizontalQuantization(int horizontalQuanta)
Sets the horizontal quantization. |
|
void |
setInputHelper(InputHelperBase hlp)
Associates an InputHelperBase instance with this screen, to
dispatch events to. |
|
protected void |
setPositionDelegate(int x,
int y)
Sets the position of this screen's layout manager (delegate). |
|
void |
setServiceMode(ServiceMode serviceMode)
Set the current service mode for this screen. |
|
protected void |
setServiceModeImpl(ServiceMode serviceMode)
Implementation that backs the Screen.setServiceMode(ServiceMode)
method, used to set the current service mode for this screen. |
|
void |
setTitleBar(TitleBar titleBar)
Sets the TitleBar object for this screen. |
|
void |
setTrackballFilter(int filter)
Sets the trackball filter for this screen. |
|
void |
setTrackballSensitivityXOffset(int trackballSensitivityXOffset)
Sets the relative trackball sensitivity for the X axis. |
|
void |
setTrackballSensitivityYOffset(int trackballSensitivityYOffset)
Sets the relative trackball sensitivity for the Y axis. |
|
void |
setVerticalQuantization(int verticalQuanta)
Sets the vertical quantization. |
|
boolean |
suggestServiceMode(ServiceMode serviceMode)
Suggests a new service mode for this screen. |
|
protected boolean |
touchEvent(TouchEvent message)
Handles touch input events. |
|
protected boolean |
trackwheelClick(int status,
int time)
Delegates trackwheel click events. |
|
protected boolean |
trackwheelClickUnhandled(int status,
int time)
Handles trackwheel click event if delegate passes it through. |
|
protected boolean |
trackwheelRoll(int amount,
int status,
int time)
Invoked when the trackwheel is rolled. |
|
protected boolean |
trackwheelUnclick(int status,
int time)
Delegates trackwheel unclick events. |
|
void |
updateDisplay()
Updates the display. |
Methods inherited from class net.rim.device.api.ui.Manager |
---|
addAll, cursorMovement, deleteAll, getHorizontalScroll, getPreferredHeightOfChild, getPreferredWidthOfChild, getVerticalScroll, getVirtualHeight, getVirtualWidth, insertAll, invalidateFieldRange, isDownArrowShown, isUpArrowShown, isValidLayout, layout, layoutChild, moveFocus, moveFocus, nextFocus, nextFocus, paintChild, setFocus, setPositionChild, setScrollingInertial, setVirtualExtent, shouldCursorScroll, sublayout, subpaint |
Methods inherited from class net.rim.device.api.ui.ScrollView |
---|
configurationChanged, getHorizontalAdjustment, getVerticalAdjustment, getVisibleHeight, getVisibleWidth, setCurrentLocation, setExtent, setHorizontalAdjustment, setHorizontalScroll, setHorizontalScroll, setScrollListener, setVerticalAdjustment, setVerticalScroll, setVerticalScroll, valueChanged, waitForScrolling |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_MENU
MainScreen.addMenuItem(MenuItem)
method for details
public static final long DEFAULT_CLOSE
When ESC is pressed, the Screen.close()
method will be called, and a
menu item is also provided to do this.
public static final long NO_SYSTEM_MENU_ITEMS
Constructor Detail |
---|
public Screen(Manager delegate)
Screen
instance with the provided delegate
manager.
delegate
- The Manager
this screen uses as layout
delegate.public Screen(Manager delegate, long style)
Screen
instance with the provided delegate
manager and style.
Use this constructor to build a screen of a particular style.
delegate
- The Manager
this screen uses as layout
delegate.style
- The style the screen uses for instantiation.Method Detail |
---|
public void setTitleBar(TitleBar titleBar)
TitleBar
object for this screen.
If a TitleBar
object already exists, passing
null
removes the TitleBar
from the
Screen
. Otherwise, passing null
has no effect.
titleBar
- A predefined TitleBar
object, can be
null
.StandardTitleBar
public TitleBar getTitleBar()
TitleBar
object used by this screen.
TitleBar
object, or null
if
no TitleBar
is defined.public void add(Field field)
Provided a field, this method invokes Manager.add(net.rim.device.api.ui.Field)
on this
screen's delegate manager, prompting the manager to add the field.
add
in class Manager
field
- The field to add.public final void addKeyListener(KeyListener listener)
listener
- The key event listener to handle key events passed to
this screen.public void addScreenUiEngineAttachedListener(ScreenUiEngineAttachedListener listener)
ScreenUiEngineAttachedListener
event listener for
this screen.
listener
- The ScreenUiEngineAttachedListener
event
listener to register.public final void addTrackwheelListener(TrackwheelListener listener)
listener
- The trackwheel event listener to handle trackwheel events
that are passed to this screen.public void close()
By default, this method pops this screen, and if the
screen stack is empty, invokes
System.exit(0)
. Derived classes can override this
method to provide more particular functionality.
public void delete(Field field)
This method invokes Manager.delete(net.rim.device.api.ui.Field)
on this screen's delegate
manager to delete your provided field. Note that, after deletion, the
list of fields gets compacted.
delete
in class Manager
field
- The field to delete.public void deleteRange(int start, int count)
This method invokes Manager.deleteRange(int, int)
on this screen's
delegate manager to delete a range of fields. Note that, after deletion,
the list of fields gets compacted.
deleteRange
in class Manager
start
- The index of the first field to delete.count
- The number of fields to delete.public final void doPaint()
Invoke this method to force a repaint of this screen, its delegate manager, and all owned fields.
public void ensureRegionVisible(Field field, int x, int y, int width, int height)
Pass this method a field, and a region (extent), and this method attempts to scroll the screen to make as much of your region visible as possible.
If your region is smaller than the screen's visible extent, this method does as little work as possible to ensure the entire region appears on the screen.
If your region is larger than the screen's visible extent, this method produces the net effect of aligning the top left corner of your region with the top left corner of the screen's visible extent.
field
- The field that contains your region.x
- The left edge of the region.y
- The top edge of the region.width
- The width (in pixels) of the region.height
- The height (in pixels) of the region.public Application getApplication()
null
if the screen is not attached to any application.public Manager getDelegate()
public int getFieldAtLocation(int x, int y)
This method invokes Manager.getFieldAtLocation(int, int)
on this
screen's delegate manager.
getFieldAtLocation
in class Manager
x
- The distance from the left edge of the screen's extent.y
- The distance from the top edge of the screen's extent.
public void getFocusRect(XYRect rect)
Invoke this method to retrieve the extent of the current focus region. Notice that the coordinates expressed are local to this screen's region.
getFocusRect
in class Manager
rect
- The XYRect
object to receive the retrieved extent
data.public Graphics getGraphics()
This method returns the graphics context for this screen, with a clipping region on top of the graphics stack set to the screen's entire extent.
The Graphics
object returned by this call becomes invalid and
should not be used after the end of the current UI event.
Note: We recommend against direct use of this method;
instead, use the various Screen.invalidate()
methods. It may be used for
direct drawing to the display when the screen contains no fields.
public Menu getMenu(int instance)
instance
- The instance of the desired menu. If this screen supports
only one menu, this may be ignored. By default, it is 0.
Screen.onMenu(int)
public Screen getScreenAbove() throws IllegalArgumentException, IllegalStateException
If there is no screen above this, this method returns null
.
If the only screen above this is global, this method returns
null
regardless of whether or not the global screen is
active.
null
if there is no
screen above this one that is not a global screen.
IllegalArgumentException
- if this screen is not a local screen.
IllegalStateException
- if this screen is not attached to a
UiEngine
.public Screen getScreenBelow() throws IllegalArgumentException, IllegalStateException
If there is no screen below this, this method returns null
.
If the only screen below this is global, this method returns
null
regardless of whether or not the global screen is
active.
null
if there is no
screen below this one that is not a global screen.
IllegalArgumentException
- if this screen is not a local screen.
IllegalStateException
- if this screen is not attached to a
UiEngine
.public final UiEngine getUiEngine()
UiEngine
that owns this screen.
UiEngine
that owns this screen.public void invalidateLayout()
This method prompts this screen's delegate manager to invalidate this screen's layout.
IllegalStateException
- if this method is called while the screen
is displayed.public boolean isDataValid()
The current implementation simply returns this.getDelegate().isDataValid()
.
isDataValid
in class Manager
true
if the data of all fields on this screen is valid,
false
if the data of at least one field on this screen is not valid.Manager.isDataValid()
,
Screen.getDelegate()
public boolean isDirty()
This method invokes Manager.isDirty()
on this screen's delegate
manager.
isDirty
in class Manager
true
if the delegate manager has changed since
construction or Screen.setDirty(boolean)
was invoked (which is also passed on to
the delegate manager), false
otherwise.Field.isMuddy()
,
Field.setDirty(boolean)
public final boolean isDisplayed()
This will return true
if and only if this screen is on a
display stack. Its position within the stack does not matter; this
function does not indicate visibility. A screen is deemed displayed as
soon as it is pushed onto the display stack, and not displayed as soon as
it is popped from the display stack.
For global screens, this indicates whether this screen is the current one displayed. Any global screen that has been queued or that has had its display preempted by a higher priority global screen is deemed not displayed.
true
if the screen is currently on a display stack
(even if not currently visible), false
otherwise.public boolean isFocus()
isFocus
in class Field
true
if this screen has the focus,
false
otherwise.public boolean isFocusable()
This method invokes Manager.isFocusable()
on this screen's
delegate manager to determine whether the delegate manager (and thus the
screen) accepts the focus.
isFocusable
in class Manager
true
if the delegate manager accepts the focus,
false
otherwise.public boolean isGlobal()
A global screen is one that appears over other applications.
true
if this screen is attached to a UiEngine
as a global screen, false
otherwise.public boolean isGlobalStatus()
public boolean isMuddy()
This method invokes Manager.isMuddy()
on this screen's delegate
manager.
isMuddy
in class Manager
true
if a controlled field has changed and the focus
has not been moved or left the field since the change,
false
otherwise.Field.isDirty()
,
Field.setMuddy(boolean)
public boolean isSelecting()
This method invokes Manager.isSelecting()
on this screen's
delegate manager.
isSelecting
in class Manager
true
if one of the delegate manager's controlled
fields currently has the focus, false
otherwise.Field.select(boolean)
public void insert(Field field, int index)
Provided a field and an index, this method invokes
Manager.insert(Field,int)
on this screen's delegate manager,
prompting the manager to insert the field at the specified position in
its list.
insert
in class Manager
field
- The field to insert.index
- The position in the manager's list of controlled fields at
which to insert the new field.protected boolean invokeAction(int action)
First invokeAction(action)
is invoked on the
object returned from Screen.getDelegate()
. If Manager.invokeAction(int)
returns
true
then true
is returned. Otherwise, the following logic is performed:
action
is not Field.ACTION_INVOKE
then false
is returned.Screen.getLeafFieldWithFocus()
returns null
then false
is returned.true
is returned.
invokeAction
in class Manager
action
- The action to be performed, as described above.
true
if the action was consumed, false
if the action
was not consumed.public MenuItem getDefaultMenuItem(int instance)
instance
- The instance of the desired menu. If your screen supports
only one menu, this may be ignored. By default, it is 0.
public void invalidate()
This method marks the entire screen as requiring a repaint. The main event dispatch thread handles the repaint at a later time.
Note: Any thread can safely invoke this method, and does not require to synchronize on the event lock.
invalidate
in class Manager
Field.invalidate()
public void invalidate(int x, int y, int width, int height)
This method marks a region of this screen as needing a repaint. The repainting is handled later by the main event dispatch thread.
Note: Any thread can safely invoke this method,
and does not require to synchronize on the
event lock
.
invalidate
in class Manager
x
- The left edge of the region in ContentRect coordinates.y
- The top edge of the region in ContentRect coordinates.width
- The width (in pixels) of the region.height
- The height (in pixels) of the region.Field.invalidate(int,int,int,int)
public void invalidateAll(int x, int y, int width, int height)
This method marks a region of this screen as needing a repaint. The repainting is handled later by the main event dispatch thread.
Note: Any thread can safely invoke this method,
and does not require to synchronize on the
event lock
.
invalidateAll
in class Field
x
- The left edge of the region in field coordinates.y
- The top edge of the region in field coordinates.width
- The width (in pixels) of the region.height
- The height (in pixels) of the region.Field.invalidate(int,int,int,int)
protected boolean openDevelopmentBackdoor(int backdoorCode)
Derived classes should override this method to provide support for development backdoor key-sequences.
Useful for backdoors in non-production devices.
backdoorCode
- The backdoor code to open.
false
.protected boolean openProductionBackdoor(int backdoorCode)
Derived classes should override this method to provide support for production backdoor key-sequences.
Useful for backdoors in production devices.
backdoorCode
- The backdoor code to open.
false
.protected boolean keyChar(char c, int status, int time)
This method invokes Manager.keyChar(char, int, int)
on this screen's delegate
manager.
keyChar
in class Manager
c
- The character that was generated.status
- The modifier key status.time
- The number of milliseconds since the device was turned on.
true
if the event was consumed, false
otherwise.protected boolean keyCharUnhandled(char key, int status, int time)
Derived classes should override this event to provide custom handling of keyChar events that remain unhandled by any of their controlled fields.
key
- The character that was generated.status
- The modifier key status.time
- The number of milliseconds since the device was turned on.
true
if the key provided was the
ESCAPE
key and this screen closed,
false
otherwise.protected boolean keyControl(char c, int status, int time)
This method invokes Manager.keyControl(char, int, int)
on this screen's
delegate manager.
keyControl
in class Manager
c
- The character that was generated.status
- The modifier key status.time
- The number of milliseconds since the device was turned on.
true
if the event was consumed, false
otherwise.protected boolean keyDown(int keycode, int time)
This method invokes Manager.keyDown(int, int)
on this screen's delegate
manager.
keyDown
in class Manager
keycode
- The key scan code of the key that was pressed, ignoring
any effects of modifier keys.time
- The number of milliseconds since the device was turned on.
true
if the event was consumed, false
otherwise.protected boolean keyUp(int keycode, int time)
This method invokes Manager.keyUp(int, int)
on this screen's delegate
manager.
keyUp
in class Manager
keycode
- The key scan code of the key that was released, ignoring
any effects of modifier keys.time
- The number of milliseconds since the device was turned on.
true
if the event was consumed, false
otherwise.protected boolean keyRepeat(int keycode, int time)
This method invokes Manager.keyRepeat(int, int)
on this screen's
delegate manager.
keyRepeat
in class Manager
keycode
- The key scan code of the key that was repeated, ignoring
any effects of modifier keys.time
- The number of milliseconds since the device was turned on.
true
if the event was consumed, false
otherwise.protected boolean keyStatus(int keycode, int time)
This method invokes Manager.keyStatus(int, int)
on this screen's
delegate manager.
keyStatus
in class Manager
keycode
- The key scan code of character shown, before any effects of
modifier keys.time
- The number of milliseconds since the device was turned on.
true
if the event was consumed, false
otherwise.public void setInputHelper(InputHelperBase hlp)
InputHelperBase
instance with this screen, to
dispatch events to.
hlp
- The InputHelperBase
instance to associate
with this screen.public InputHelperBase getInputHelper()
InputHelperBase
instance associated with this screen.
InputHelperBase
instance associated with this
screen.protected final void layoutDelegate(int width, int height)
width
- The amount of available horizontal space.height
- The amount of available vertical space.protected void makeMenu(Menu menu, int instance)
Screen.onMenu(int)
to populate the menu.
makeMenu
in class Manager
menu
- The menu to which items should be added.instance
- The instance of the desired menu. If your screen supports
only one menu, this may be ignored. By default, it is 0.public boolean onClose()
By setting the Screen.DEFAULT_CLOSE
style for this screen, you use
the default closing behaviour (if the screen is dirty, the framework
calls Screen.onSavePrompt()
to verify with the user that closing the
screen is OK, and then calls Screen.close()
if successful).
true
if the screen closes, false
otherwise.protected void onDisplay()
This method is invoked by the system after this screen is pushed onto the stack and layout has been done, but before any painting occurs.
If no controlled field has the focus, this method attempts to assign the focus to the first field that will accept it, starting with the first field in the delegate manager's field list. Additionally, this method makes the focus visible, and resets scrolling to 0 if possible (ensuring the focused region stays on the screen).
The complementary callback is Screen.onUndisplay()
.
onDisplay
in class Field
protected void onExposed()
Subclasses of screen should override this method for special handling.
The complementing callback is Screen.onObscured()
.
onExposed
in class Manager
Screen.onUiEngineAttached(boolean)
,
Field.onVisibilityChange(boolean)
protected void onFocus(int direction)
This method invokes Manager.onFocus(int)
on this screen's delegate
manager, thus starting with the delegate manager's controlled field list,
looking for a field to give the focus. This method passes the focus to
the first found field that accepts it.
onFocus
in class Manager
direction
- If 1, start at the top of the delegate manager's field
list and search forward. If -1, start at the bottom of the delegate
manager's field list and search backward.protected void onFocusNotify(boolean focus)
focus
- true
if this screen has gained the focus,
false
if this screen has lost focus.public boolean onMenu(int instance)
If you set the Screen.DEFAULT_MENU
style, this method creates a
menu and adds a context menu.
Then menu.show()
will be invoked, and
MenuItem.run()
is used to activate the selected item.
If you set the Menu.MENU_POPUP
style, this method creates and
displays a popup menu.
instance
- The instance of the menu to display. If your screen supports
only one menu, this may be ignored. By default, it is 0.
true
if the menu is created, false
otherwise.protected void onMenuDismissed(Menu menu)
This method calls onMenuDismissed(Menu)
on all the fields
and managers that are currently in focus. It also calls
onMenuDismissed()
.
onMenuDismissed
in class Field
menu
- The menu to be dismissed.protected void onMenuDismissed()
onMenuDismissed
in class Field
protected void onObscured()
Derived classes should override this method for special handling.
The complementing callback is Screen.onExposed()
.
onObscured
in class Field
Screen.onUiEngineAttached(boolean)
,
Field.onVisibilityChange(boolean)
protected boolean onSave()
If Screen.isDataValid()
returns true
, this method then calls
Screen.save()
(and displays an error dialog if save()
throws an
IOException
).
true
if the save was successful, false
otherwise.protected boolean onSavePrompt()
Overriding classes should provide a dialog and call Screen.onSave()
if the user has chosen to save. If the return is true
, the
framework will call onClose
.
true
if the screen should close, false
otherwise.MainScreen.onSavePrompt()
protected void onUndisplay()
Derived classes should override this method for special handling.
The complementing callback is Screen.onDisplay()
.
onUndisplay
in class Field
protected void onUnfocus()
This method invokes Manager.onUnfocus()
on this screen's
delegate manager to remove the focus from this screen.
onUnfocus
in class Manager
protected void onUiEngineAttached(boolean attached)
UiEngine
.
Replaces Screen.onDisplay()
and Screen.onUndisplay()
.
attached
- If true
the event is an attach event, if
false
the event is a detach event.Screen.onExposed()
,
Screen.onFocusNotify(boolean)
protected void paint(Graphics graphics)
Invoke this method to prompt the screen to paint itself. If you
extend Screen
to create a custom layout, you may want to
implement the base class's Manager.subpaint(net.rim.device.api.ui.Graphics)
method, as this
method invokes it.
This method also draws the focus indicator as required.
paint
in class Manager
graphics
- The graphics context used for painting.protected void paintBackground(Graphics graphics)
The system calls this method before painting begins in order to clear this screen's background, initializing your provided graphics context to this screen's extent.
By default, this method simple invokes Graphics.clear()
; for
more complex handling, you should override this method in extending
classes.
paintBackground
in class Field
graphics
- The graphics context used to draw the background.public void replace(Field oldField, Field newField)
Screen
and replaces it with another field.
This method simply invokes replace(oldField, newField)
on the Manager
returned from Screen.getDelegate()
.
See Manager.replace(Field, Field)
for more details about how this method behaves,
including exceptions that can be thrown.
replace
in class Manager
oldField
- The field to be replaced.newField
- The field to replace it.Manager.delete(Field)
,
Manager.insert(Field, int)
,
Field.getIndex()
,
Field.getManager()
,
Field.setFocus()
public void save() throws IOException
IOException
public void addInputSettings(InputSettings settings)
InputSettings
object to this screen.
May be invoked multiple times to apply additional input settings. Does
nothing if this screen does not accept input and/or the specified
InputSettings
object is not
associated with a supported input device. Note that the settings are
applied when this screen gains focus or immediately if already in focus.
Note also that this only *adds* settings. If a particular setting
is omitted from the InputSettings
list it is not removed/reverted.
To remove one or more settings (reverting them to defaults), use
Screen.removeInputSettings(net.rim.device.api.ui.input.InputSettings)
.
settings
- The InputSettings
object to be applied to this screen.
IllegalArgumentException
- if settings
is
null
or associated with an unrecognized input device (see
net.rim.device.api.ui.input
for a list of available (recognized)
input devices.public void removeInputSettings(InputSettings settings)
InputSettings
object from this screen.
May be invoked multiple times to remove input settings. Does
nothing if this screen does not accept input and/or the specified attributes do not
exist or InputSettings
object is not associated
with a supported input device. Note that the updated settings are applied when this
screen gains focus or immediately if already in focus.
settings
- The InputSettings
object to be removed from this screen.
IllegalArgumentException
- if settings
is
null
or associated with an unrecognized input device (see
net.rim.device.api.ui.input
for a list of available (recognized)
input devices.public void clearInputSettings()
Does nothing if this screen does not accept input and/or no custom input settings exist. Note that default settings are applied when this screen gains focus or immediately if already in focus.
public void getInputSettings(InputSettings settings)
InputSettings
object for this screen.
The values can be obtained by invoking InputSettings.get(int)
once the method returns. Does nothing if this screen does not accept input
and/or the specified attributes do not exist or InputSettings
object is not associated with a
supported input device.
settings
- The InputSettings
object to be populated with values.
IllegalArgumentException
- if settings
is
null
or associated with an unrecognized input device (see
net.rim.device.api.ui.input
for a list of available (recognized)
input devices.public void removeFocus()
removeFocus
in class Manager
protected void setBackdoorAltStatus(boolean altStatus)
altStatus
- If true
ALT key sequences are required, if
false
un-ALT'd keystrokes can be used as backdoors.protected void setDefaultClose(boolean provideDefaultClose)
provideDefaultClose
- If true
the menu includes a close
item, if false
the menu does not include a close item.public final VirtualKeyboard getVirtualKeyboard()
VirtualKeyboard
object associated with this
screen.
VirtualKeyboard
object containing properties such
as visibility, or null
on non-touchscreen devices.protected boolean navigationClick(int status, int time)
This method passes on navigation click events to this
screen's delegate manager by invoking Manager.navigationClick(int, int)
.
One scenario that calls this method is when a Screen
object
is pushed to an application and a Navigation event is injected
into the same application. When this scenario occurs, this method is
called using 0 for the time
parameter.
navigationClick
in class Manager
status
- The state of the modifier keys.time
- The number of milliseconds since the device was turned on.
true
if the delegate manager consumed the event,
false
otherwise.protected boolean navigationMovement(int dx, int dy, int status, int time)
The source of the navigation event can be determined by checking the KeypadListener.STATUS_TRACKWHEEL
and KeypadListener.STATUS_FOUR_WAY
bits in the status
parameter;
exactly one of these will be set.
One scenario that calls this method is when a Screen
object
is pushed to an application and a Navigation event is injected into the
same application. When this scenario occurs, this method is called using
0 for the time
parameter.
navigationMovement
in class Manager
dx
- The magnitude of navigational motion: negative for a move left
and positive for a move right.dy
- The magnitude of navigational motion: negative for an upwards
move, and positive for a downwards move.status
- The modifier key status at the time of the move.time
- The number of milliseconds since the device was turned on.
true
if the event was consumed, false
otherwise.protected boolean cursorClick(int x, int y, int status, int time)
This method passes on cursor click events to
this screen's delegate manager by invoking
Manager.cursorClick(int, int, int, int)
.
cursorClick
in class Manager
x
- X coordinate of the event.y
- Y coordinate of the event.status
- State of the modifier keys.time
- Number of milliseconds since the device was turned on.
protected boolean cursorUnclick(int x, int y, int status, int time)
This method passes on cursor unclick events to
this screen's delegate manager by invoking
Manager.cursorUnclick(int, int, int, int)
.
cursorUnclick
in class Manager
x
- X coordinate of the event.y
- Y coordinate of the event.status
- State of the modifier keys.time
- Number of milliseconds since the device was turned on.
protected boolean navigationUnclick(int status, int time)
This method passes on navigation unclick events to
this screen's delegate manager by invoking
Manager.navigationUnclick(int, int)
.
One scenario that calls this method is when a Screen
object
is pushed to an application and a Navigation event is injected into the
same application. When this scenario occurs, this method is called using
0 for the time
parameter.
navigationUnclick
in class Manager
status
- The state of the modifier keys.time
- The number of milliseconds since the device was turned on.
true
if the delegate manager consumed the event,
false
otherwise.protected boolean trackwheelClick(int status, int time)
This method passes on trackwheel click events to this
screen's delegate manager by invoking Manager.trackwheelClick(int, int)
.
trackwheelClick
in class Manager
status
- The state of the modifier keys.time
- The number of milliseconds since the device was turned on.
true
if the delegate manager consumed the event,
false
otherwise.protected boolean trackwheelClickUnhandled(int status, int time)
Use this method to handle trackwheel click events that remained
unhandled after invoking Screen.trackwheelClick(int, int)
.
status
- The modifier key status (currently ignored).time
- The number of milliseconds since the device was turned on
(currently ignored).
true
if the event was consumed, false
otherwise.protected boolean trackwheelRoll(int amount, int status, int time)
trackwheelRoll
in class Manager
amount
- The number of scrolling positions: negative for an upwards
roll, and positive for a downwards roll.status
- The modifier key status at the time of the roll.time
- The number of milliseconds since the device was turned on.
true
if the event was consumed, false
otherwise.protected boolean trackwheelUnclick(int status, int time)
This method passes on trackwheel unclick events to
this screen's delegate manager by invoking
Manager.trackwheelUnclick(int, int)
.
trackwheelUnclick
in class Manager
status
- The state of the modifier keys.time
- The number of milliseconds since the device was turned on.
true
if the delegate manager consumed the event,
false
otherwise.protected boolean touchEvent(TouchEvent message)
The message
parameter contains various input parameters
including the event type and touch coordinates. The coordinates reflect
the location of the touch event with respect to this screen.
The x-y coordinates are then further mapped to the top-left corner of the
delegate.
touchEvent
in class Manager
message
- The TouchEvent
object containing various input
parameters, including the event type and touch coordinates.
true
if the event was consumed, false
otherwise.
IllegalArgumentException
- if message
is
null
.public final void setContextMenuProvider(ContextMenuProvider contextMenuProvider)
You can use this method to specify a context menu provider that this
screen should use to build and display a pop-up menu. You can pass in a
DefaultContextMenuProvider
to get a default implementation of a pop-up menu. If you don't use this
method to set a context menu provider (or provide null
to
this method), this screen uses the legacy context menu to build a
pop-up menu.
See DefaultContextMenuProvider
for more information on pop-up menus and how legacy context menus are
supported.
contextMenuProvider
- The context menu provider that this screen
should use to build a pop-up menu, or null
to use the legacy
context menu support.public final ContextMenuProvider getContextMenuProvider()
null
if it is
not currently set.public int getFieldCount()
This method invokes Manager.getFieldCount()
on this screen's
delegate manager to retrieve the number of fields it controls.
getFieldCount
in class Manager
public Field getField(int index)
This method invokes Manager.getField(int)
on this screen's
delegate manager to retrieve a particular field from its list.
getField
in class Manager
index
- The index of the field to retrieve.
IndexOutOfBoundsException
- if index
is not valid.public Field getFieldWithFocus()
This method invokes Manager.getFieldWithFocus()
on this
screen's delegate manager to retrieve the currently focused field.
getFieldWithFocus
in class Manager
null
if no field
has the focus.Manager.getLeafFieldWithFocus()
public int getFieldWithFocusIndex()
This method invokes Manager.getFieldWithFocusIndex()
on this
screen's delegate manager to retrieve the currently focused field.
getFieldWithFocusIndex
in class Manager
public Field getLeafFieldWithFocus()
A screen may manage several fields, each of which may manage several other fields. A leaf field is a field that does not manage any other fields. Use this method to figure out which leaf field (which is managed by one of the managed components) has the focus.
This method invokes Manager.getLeafFieldWithFocus()
on this
screen's delegate manager to retrieve the (bottom-most, non-manager) leaf
field that has the focus.
getLeafFieldWithFocus
in class Manager
null
if no
field has the focus.Manager.getFieldWithFocus()
public final void removeKeyListener(KeyListener listener)
listener
- The key event listener to remove from this screen.public final void removeScreenUiEngineAttachedListener(ScreenUiEngineAttachedListener listener)
ScreenUiEngineAttachedListener
event listener from this
screen.
listener
- The ScreenUiEngineAttachedListener
event
listener to remove from this screen.public final void removeTrackwheelListener(TrackwheelListener listener)
listener
- The trackwheel event listener to remove from this screen.public final boolean scroll(int direction)
The parameter passed to this method indicates the direction and amount of movement required.
To control vertical movement use Manager.UPWARD
and Manager.DOWNWARD
to move the focus one screen up or down; use Manager.TOPMOST
and
Manager.BOTTOMMOST
to move the focus all the way to the top edge or
bottom edge of the manager's region.
To control horizontal movement use Manager.LEFTWARD
and
Manager.RIGHTWARD
to move the focus one screen left or right; use
Manager.LEFTMOST
and Manager.RIGHTMOST
to move the focus all the way to
the left or right edge of the manager's region.
You can combine one vertical movement constant and one horizontal movement constant to effectively move the focus diagonally. However, this method performs the vertical movement first, and then the horizontal movement, in order to simulate diagonal motion.
Note: Focus movement is constrained in all directions by the extent of this manager. If the focus is currently less than one screen from an edge of the manager's extent it must move towards, it stops at that edge. Also, this method scrolls the visible region of this manager as required to ensure the focus remains visible.
direction
- A combination of constant values to indicate in which
direction, and how much, the focus is to move.
true
.public void setDirty(boolean dirty)
This method invokes Manager.setDirty(boolean)
on this screen's
delegate manager to clean (or dirty) all this screen's controlled fields.
setDirty
in class Manager
dirty
- If true
the fields will be dirtied, if
false
the fields will be cleaned.Field.isDirty()
,
Field.setMuddy(boolean)
public void setFocus()
This method assigns the focus to the delegate manager through
invoking Field.setFocus()
on the delegate manager.
setFocus
in class Field
public final boolean setFocus(Field field, int x, int y, int status, int time)
field
- The field in which to place the focus.x
- The distance from the left edge of the screen.y
- The distance from the top edge of the screen.status
- The state of modifier keys.time
- The number of milliseconds since the device was turned on.
true
if the field under the desired point accepts
the focus, false
otherwise.
IllegalArgumentException
- if field
does not belong to
this screen.public void setCursorInputMode(boolean enable)
Cursor mode is an alternative to focus-based touchpad navigation.
In order to process cursor events fields should implement cursor related methods such as
Field.cursorClick(int, int, int, int)
, Field.cursorUnclick(int, int, int, int)
, etc.
Note. Some components may not work as expected in cursor mode.
enable
- True to enable cursor input mode; false to disable.public void setHorizontalQuantization(int horizontalQuanta)
When a screen's layout manager or delegate is laying out components on the screen, the layout manager uses the horizontal quantization to determine how many rows can be fully displayed on a screen. By default, the delegate uses the font size as the horizontal quantization value. For example: You want to display rows of text that use a font size of 11 on a screen that is 140 pixels in height. By default, the screen delegate can fully display 12 of these rows.
You may want to set the value if you are laying out non-text rows.
The actual horizontal display length will be a multiple of the value you specify.
setHorizontalQuantization
in class Manager
horizontalQuanta
- The horizontal quantization (in pixels).Screen.setVerticalQuantization(int)
protected final void setPositionDelegate(int x, int y)
x
- The left edge position for this screen's delegate.y
- The top edge position for this screen's delegate.public void setTrackballFilter(int filter)
filter
- A bitmask of the Trackball.FILTER_*
constants.
IllegalArgumentException
- if filter
is not a valid
value, as described above.public void setTrackballSensitivityXOffset(int trackballSensitivityXOffset)
If your provided sensitivity offset value is
Integer.MAX_VALUE
, then it is treated as
unset. Otherwise, the value is added to the user-set sensitivity when
this screen has the focus.
trackballSensitivityXOffset
- The relative trackball sensitivity for
the X axis, ranging from -100 to 100, or
Trackball.SENSITIVITY_UNSET
.
IllegalArgumentException
- if trackballSensitivityXOffset
is not in the range of -100 to 100 or Integer.MAX_VALUE
.public void setTrackballSensitivityYOffset(int trackballSensitivityYOffset)
Integer.MAX_VALUE
, then it is treated as
unset. Otherwise, the value is added to the user-set sensitivity when
this screen has the focus.
trackballSensitivityYOffset
- The relative trackball sensitivity for
the Y axis, ranging from -100 to 100 or
Trackball.SENSITIVITY_UNSET
.
IllegalArgumentException
- if trackballSensitivityYOffset
is not in the range of -100 to 100 or Integer.MAX_VALUE
.public void setVerticalQuantization(int verticalQuanta)
When a screen's layout manager or delegate is laying out components on the screen, the layout manager uses the vertical quantization to determine how many columns can be fully displayed.
By default, the delegate uses the font size as the vertical quantization value.
The actual vertical display length will be a multiple of the value you specify.
setVerticalQuantization
in class Manager
verticalQuanta
- The vertical quantization (in pixels).Screen.setHorizontalQuantization(int)
public final void updateDisplay()
public AccessibleContext getAccessibleContext()
getAccessibleContext
in class Manager
AccessibleContext
instance that represents the field
for a screen reader.public ServiceMode getServiceMode()
The return value should be a service mode that is representative of the data currently being managed by the screen. If a screen can manage data from multiple services and is currently in a state for which an appropriate service cannot be determined then the service mode should reflect this.
Classes that extend Screen
should override this method to
provide the desired implementation. By default this method will return
null
.
null
.public final void setServiceMode(ServiceMode serviceMode)
This method is used to change the current service mode for a screen. When this method is called the screen must change its current service mode to the new specified service mode.
Note that the screen's service mode can only be modified by a core platform module or a module that the owning application explicitly depends on.
serviceMode
- The new service mode for this screen, may be
null
.
ControlledAccessException
- if the caller is not allowed to modify
this screen's service mode.Screen.setServiceModeImpl(ServiceMode)
protected void setServiceModeImpl(ServiceMode serviceMode)
Screen.setServiceMode(ServiceMode)
method, used to set the current service mode for this screen.
Classes that extend Screen
should override this method to
provide the desired implementation of the
setServiceMode(ServiceMode)
method.
serviceMode
- The new service mode for this screen, may be
null
.Screen.setServiceMode(ServiceMode)
public boolean suggestServiceMode(ServiceMode serviceMode)
Use this method to suggest to a screen a more appropriate service mode for this screen to operate in. This can happen as a result of data being passed to the screen from an external source that is associated with another service. As part of passing this data a suggestion to operate in the mode associated the data may be made.
Note that the screen does not need to always accept the suggested service mode. It is acceptable for the screen to reject suggestions.
Classes that extend Screen
should override this method to
provide the desired implementation. The default behavior is to reject all
suggestions.
serviceMode
- The new service mode being suggested for this screen,
may be null
.
true
if the new mode was accepted, false
otherwise.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal