|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbluegammon.gui.menu.PageItem
The PageItem
defines a choice in a MenuPage
.
An item can have a subpage and/or an ItemAction
implementation.
When an item is selected by user, the ItemAction
implementation is
invoked, and/or a transition to the subpage is started.
PageItem
s can also have key/value pairs typed as int/Object.
When there is both a subpage and an action; pressing fire on such an item will first start a new thread invokinh the action, then the menu will navigate to the subpage. If the user presses right on such an item, the action is not executed but the subpage is navigated to.
Menu
,
MenuPage
,
ItemAction
Field Summary | |
static int |
LAYOUT_ALIGN_LEFT
Left aligned image, right aligned text |
static int |
LAYOUT_ALIGN_RIGHT
Right aligned image, left aligned text |
static int |
LAYOUT_CENTERED_LEFT
Centered item, image to the left of text (Default layout) |
static int |
LAYOUT_CENTERED_RIGHT
Centered item, image to the right of text |
Constructor Summary | |
PageItem(char[] label,
javax.microedition.lcdui.Image image,
ItemAction action,
MenuPage subPage)
Creates an item that is to be inserted into a MenuPage .
|
|
PageItem(char[] label,
javax.microedition.lcdui.Image image,
ItemAction action,
MenuPage subPage,
int id)
Creates an item that is to be inserted into a MenuPage .
|
Method Summary | |
void |
addedToPage()
Called when this item is added to a page. |
ItemAction |
getAction()
Returns action which is called upon item activation. |
int |
getId()
Returns ID of this item, or Integer.MIN_VALUE if not set. |
javax.microedition.lcdui.Image |
getImage()
Returns image of this item, or null if none set. |
char[] |
getLabel()
Returns the label of this item. |
int |
getLayout()
Returns the layout of the image, any of LAYOUT_CENTERED_LEFT, LAYOUT_CENTERED_RIGHT, LAYOUT_ALIGN_LEFT, LAYOUT_ALIGN_RIGHT. |
java.lang.Object |
getProperty(int key)
Returns value of a generic property on this item or null if not set. |
MenuPage |
getSubPage()
Returns the subpage that will be displayed when this item is activated, or null if no such page. |
boolean |
isEnabled()
Returns true if this item is enabled, false otherwise. |
void |
setAction(ItemAction action)
Sets the action which is called upon item activation. |
void |
setEnabled(boolean enabled)
Enables or disables this item. |
void |
setImage(javax.microedition.lcdui.Image image)
Sets the image of this item. |
void |
setLabel(char[] label)
Sets the text label of this item. |
void |
setLayout(int layout)
Sets the layout of the image, any of LAYOUT_CENTERED_LEFT, LAYOUT_CENTERED_RIGHT, LAYOUT_ALIGN_LEFT, LAYOUT_ALIGN_RIGHT. |
void |
setProperty(int key,
java.lang.Object value)
Sets a value to a generic property on this item, or resets it by giving null as a value. |
void |
setSubPage(MenuPage page)
Sets the subpage that will be displayed when this item is activated, or null if no such page. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int LAYOUT_CENTERED_LEFT
public static final int LAYOUT_CENTERED_RIGHT
public static final int LAYOUT_ALIGN_LEFT
public static final int LAYOUT_ALIGN_RIGHT
Constructor Detail |
public PageItem(char[] label, javax.microedition.lcdui.Image image, ItemAction action, MenuPage subPage)
MenuPage
.
Item graphical elements are the label and the image, and logical
elements are action and subpage.
label
- The text label of this item or null if no text.image
- The image of this item or null if no image.action
- The action that is called when activating this item,
or null if no action.subPage
- The page that will be navigated to when activating this item,
or null of no such page.public PageItem(char[] label, javax.microedition.lcdui.Image image, ItemAction action, MenuPage subPage, int id)
MenuPage
.
Item graphical elements are the label and the image, and logical
elements are action and subpage.
label
- The text label of this item or null if no text.image
- The image of this item or null if no image.action
- The action that is called when activating this item,
or null if no action.subPage
- The page that will be navigated to when activating this item,
or null of no such page.id
- The id of this item.Method Detail |
public int getId()
Integer.MIN_VALUE
if not set.
public void addedToPage()
public char[] getLabel()
public void setLabel(char[] label)
label
- The text label of this item.public MenuPage getSubPage()
public void setSubPage(MenuPage page)
page
- The sub page or null.public ItemAction getAction()
public void setAction(ItemAction action)
action
- The action of this item.public boolean isEnabled()
public void setEnabled(boolean enabled)
enabled
- true to enable, false to disablepublic javax.microedition.lcdui.Image getImage()
public void setImage(javax.microedition.lcdui.Image image)
image
- The image or null.public void setLayout(int layout)
layout
- Image layout.public int getLayout()
public java.lang.Object getProperty(int key)
key
- The key of the property.
public void setProperty(int key, java.lang.Object value)
null
as a value.
key
- The key of the property.value
- The value of the property, or null to reset it.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |