bluegammon.gui.menu
Class BinaryPageItem

java.lang.Object
  extended bybluegammon.gui.menu.PageItem
      extended bybluegammon.gui.menu.BinaryPageItem
All Implemented Interfaces:
ItemAction

public abstract class BinaryPageItem
extends PageItem
implements ItemAction

An abstract item that can be set to true or false. An image is used to represent each state. The method getBoolean must be implemented to get the state of the item. The method setBoolean is called with the new state when user selects this item.

Author:
Peter Andersson

Field Summary
 
Fields inherited from class bluegammon.gui.menu.PageItem
LAYOUT_ALIGN_LEFT, LAYOUT_ALIGN_RIGHT, LAYOUT_CENTERED_LEFT, LAYOUT_CENTERED_RIGHT
 
Constructor Summary
BinaryPageItem(char[] label, javax.microedition.lcdui.Image imageTrue, javax.microedition.lcdui.Image imageFalse, MenuPage subPage)
          Constructor for BinaryPageItem.
BinaryPageItem(char[] label, javax.microedition.lcdui.Image imageTrue, javax.microedition.lcdui.Image imageFalse, MenuPage subPage, ItemAction dispatchAction, int id)
          Constructor for BinaryPageItem.
 
Method Summary
 void addedToPage()
          Initializes this item with correct image.
abstract  boolean getBoolean()
          Implement this to return the state of the flag.
 void itemAction(MenuPage page, PageItem item)
          Toggles the boolean value by calling getBoolean and setBoolean.
abstract  void setBoolean(boolean value)
          Implement this to set the state of the flag.
 
Methods inherited from class bluegammon.gui.menu.PageItem
getAction, getId, getImage, getLabel, getLayout, getProperty, getSubPage, isEnabled, setAction, setEnabled, setImage, setLabel, setLayout, setProperty, setSubPage
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryPageItem

public BinaryPageItem(char[] label,
                      javax.microedition.lcdui.Image imageTrue,
                      javax.microedition.lcdui.Image imageFalse,
                      MenuPage subPage)
Constructor for BinaryPageItem.

Parameters:
label - The label of the item or null.
imageTrue - Image for true value or null.
imageFalse - Image for false value or null.
subPage - The page that will be navigated to when activating this item, or null of no such page.

BinaryPageItem

public BinaryPageItem(char[] label,
                      javax.microedition.lcdui.Image imageTrue,
                      javax.microedition.lcdui.Image imageFalse,
                      MenuPage subPage,
                      ItemAction dispatchAction,
                      int id)
Constructor for BinaryPageItem.

Parameters:
label - The label of the item or null.
imageTrue - Image for true value or null.
imageFalse - Image for false value or null.
subPage - The page that will be navigated to when activating this item, or null of no such page.
dispatchAction - The action that is called when activating this item, or null if no action.
id - The id of this item.
Method Detail

addedToPage

public void addedToPage()
Initializes this item with correct image.

Overrides:
addedToPage in class PageItem

itemAction

public void itemAction(MenuPage page,
                       PageItem item)
Toggles the boolean value by calling getBoolean and setBoolean. If a dispatch action is given in constructor, this is called after switching flags.

Specified by:
itemAction in interface ItemAction
Parameters:
page - The page this action is called from.
item - The item this action is called from.

getBoolean

public abstract boolean getBoolean()
Implement this to return the state of the flag.

Returns:
The state of the flag.

setBoolean

public abstract void setBoolean(boolean value)
Implement this to set the state of the flag.

Parameters:
value - The new boolean value of the flag.