|
|||||||||
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.Manager
net.rim.device.api.ui.Screen
net.rim.device.api.ui.container.FullScreen
net.rim.device.api.ui.container.MainScreen
public class MainScreen
Full screen providing features common to standard RIM device applications.
Behaviour
Main screen objects contain a title section, a separator element, and a main
scrollable section (actually a single vertical field manager used to maintain
a list of fields).
When the screen gets to handle an ENTER key event (i.e. when the event is not
consumed by one the fields managed by its contained vertical field manager),
the screen consumes the key to scroll its list forward.
Styles
Screen does not accept Field.FOCUSABLE_MASK
,
Field.EDITABLE_MASK
.
VerticalFieldManager
Field Summary |
---|
Fields inherited from class net.rim.device.api.ui.Screen |
---|
DEFAULT_CLOSE, DEFAULT_MENU, NO_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 | ||
---|---|---|
MainScreen()
Constructs a new main screen instance. |
||
MainScreen(long style)
Constructs a new main screen instance with provided style. |
Method Summary | ||
---|---|---|
void |
addMenuItem(MenuItem item)
Adds a menu item to the screen's menu. |
|
Field |
getField(int index)
Retrieves the field at specified position in the scrollable section. |
|
int |
getFieldCount()
Retrieves the number of fields in the scrollable section. |
|
Field |
getFieldWithFocus()
Retrieves the field from the scrollable section that currently has the focus. |
|
int |
getFieldWithFocusIndex()
Retrieves index of field from the scrollable section that currently has the focus. |
|
Manager |
getMainManager()
Retrieves this screen's subordinate, vertical field manager. |
|
protected boolean |
keyCharUnhandled(char key,
int status,
int time)
Invoked when a keyChar event is unhandled. |
|
protected void |
makeMenu(Menu menu,
int instance)
Called from Screen.onMenu(int) to populate the menu. |
|
protected boolean |
onSavePrompt()
Invoked when the screen should prompt to save its contents. |
|
void |
removeAllMenuItems()
Removes all menu items from this screen's menu. |
|
void |
removeMenuItem(MenuItem item)
Removes a menu item from the screen's menu. |
|
void |
setBanner(Field banner)
Sets the contents of this screen's banner section. |
|
void |
setId(String idName)
Sets the ID for this field. |
|
void |
setStatus(Field status)
Sets the contents of this screen's status section. |
|
void |
setTitle(String title)
Sets the contents of this screen's title section. |
|
void |
setTitle(ResourceBundleFamily family,
int id)
Sets the contents of this screen's title section. |
|
void |
setTitle(Field title)
Sets the contents of this screen's title section. |
Methods inherited from class net.rim.device.api.ui.container.FullScreen |
---|
sublayout |
Methods inherited from class net.rim.device.api.ui.Manager |
---|
addAll, deleteAll, getHorizontalScroll, getPreferredHeightOfChild, getPreferredWidthOfChild, getVerticalScroll, getVirtualHeight, getVirtualWidth, getVisibleHeight, getVisibleWidth, invalidateFieldRange, isDownArrowShown, isUpArrowShown, isValidLayout, layout, layoutChild, moveFocus, moveFocus, nextFocus, nextFocus, paintChild, setFocus, setHorizontalScroll, setHorizontalScroll, setPositionChild, setScrollListener, setScrollingInertial, setVerticalScroll, setVirtualExtent, subpaint |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MainScreen()
This method builds a new main screen with no particular style.
public MainScreen(long style)
style
- Style(s) for this new screen.Method Detail |
---|
public void addMenuItem(MenuItem item)
A main screen brings up a menu by default when Screen.onMenu(int)
is
invoked. If the MainScreen.makeMenu(net.rim.device.api.ui.component.Menu, int)
method is not overridden, it will add these
menu items to the menu. The close menu item is added by default.
item
- Menu item to add.public int getFieldCount()
Prompts this screen's vertical field manager to return the number of fields it controls. Note that this value does not include the fields used for this screen's title, separator, or status section, nor does it include the subordinate vertical field manager itself.
getFieldCount
in class Screen
public Field getFieldWithFocus()
Prompts this screen's vertical field manager to return its controlled field that currently has the focus.
getFieldWithFocus
in class Screen
Manager.getLeafFieldWithFocus()
public int getFieldWithFocusIndex()
Prompts this screen's vertical field manager to return the index of the controlled field that currently has the focus.
getFieldWithFocusIndex
in class Screen
public Field getField(int index)
Prompts this screen's vertical field manager to return the field at a particular position in its list.
getField
in class Screen
index
- Index position of field you want returned.
IndexOutOfBoundsException
- If index not valid.public Manager getMainManager()
Use this method to retrieve the vertical field manager this screen uses to manage the list of fields shown in its scrollable section.
protected boolean keyCharUnhandled(char key, int status, int time)
If none of this screen's controlled fields handle an ENTER key event, and this screen is not currently in select mode, this method consumes the key event and attempts to advance the focus on to the next field in its scrollable section.
keyCharUnhandled
in class Screen
key
- Character generated.status
- Modified key status.time
- Number of milliseconds since the device was turned on.
protected void makeMenu(Menu menu, int instance)
Screen.onMenu(int)
to populate the menu.
If you override this function, you must call this method on the parent class so that the main screen's items are added to the menu.
makeMenu
in class Screen
menu
- 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.Screen.onMenu(int)
protected boolean onSavePrompt()
onSavePrompt
in class Screen
Screen.onSave()
public void removeAllMenuItems()
This can be invoked right after construction to ensure the default menu items are not present in the menu.
public void removeMenuItem(MenuItem item)
item
- Menu item to remove.public void setBanner(Field banner)
banner
- the field to set for this screen's banner section, or null
to remove the banner field if one is set.public void setStatus(Field status)
This method adds your provided field to this screen's status section, even if it already contains a field.
status
- New status field.public void setTitle(Field title)
This method either simply adds the title field to this screen's title section, or replaces the existing title field with your provided one.
title
- New title field.public void setTitle(String title)
title
- Title text for this screen.public void setTitle(ResourceBundleFamily family, int id)
family
- Resource bundle containing title text.id
- Resource item ID identifying title text to use.public void setId(String idName)
setId
in class Field
idName
- The ID for the field where the ID may contain any combination of lowercase
letters and the '-' character, except the first character may not be a '-'.
IllegalArgumentException
- if idName contains upper case letters or spaces.Field.getId()
|
|||||||||
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.