menu
Class MenuPage

java.lang.Object
  |
  +--menu.Page
        |
        +--menu.MenuPage
Direct Known Subclasses:
AccountIndexPage

public class MenuPage
extends Page

A MenuPage is used to hold lists of other Pages. The user selects a Page from the list and then the new Page is shown on the display.


Constructor Summary
MenuPage(java.lang.String label)
          Initialize a new MenuPage object using the supplied parameters and default values where needed.
MenuPage(java.lang.String label, boolean hasExit)
          Initialize a new MenuPage object using the supplied parameters and default values where needed.
MenuPage(java.lang.String label, java.lang.String title, javax.microedition.lcdui.Image icon, boolean hasExit)
          Initialize a new MenuPage object using the supplied parameters.
 
Method Summary
 void addChild(Page p)
          Add a Page to the list of Pages that are children of this menu.
 int doCommandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable d)
          Process the user command and return an integer value telling the PageMgr what to do next.
 javax.microedition.lcdui.Displayable getDisplayable()
          Return the Displayable object for this MenuPage, completely filled in and ready to display.
 Page getLinkedPage()
          Return the Page that this Page feels should be the next page to be displayed.
 void removeAllChildren()
          Remove all children from the list for this MenuPage.
 
Methods inherited from class menu.Page
getIcon, getLabel, getPrevious, getTitle, setPrevious
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MenuPage

public MenuPage(java.lang.String label,
                java.lang.String title,
                javax.microedition.lcdui.Image icon,
                boolean hasExit)
Initialize a new MenuPage object using the supplied parameters.

Parameters:
label - short label for this page (as might be used in a menu)
title - longer label for this page (as might be used in a screen title)
icon - small icon for this page (as might be used in a toolbar or menu
hasExit - true if this menu page should have an Exit command.

MenuPage

public MenuPage(java.lang.String label,
                boolean hasExit)
Initialize a new MenuPage object using the supplied parameters and default values where needed. The title defaults to null (meaning that the label will be used in its place). The icon defaults to null (meaning text only will be displayed).

Parameters:
label - short label for this page (as might be used in a menu)
hasExit - true if this menu page should have an Exit command.

MenuPage

public MenuPage(java.lang.String label)
Initialize a new MenuPage object using the supplied parameters and default values where needed. The title defaults to null (meaning that the label will be used in its place). The icon defaults to null (meaning text only will be displayed). hasExit defaults to false, meaning that there is no Exit command

Parameters:
label - short label for this page (as might be used in a menu)
Method Detail

addChild

public void addChild(Page p)
Add a Page to the list of Pages that are children of this menu. The label of each child page will be shown when this MenuPage is displayed, and then one of them will be selected by the user.

Parameters:
p - the Page to add to the list of child Pages

removeAllChildren

public void removeAllChildren()
Remove all children from the list for this MenuPage.


doCommandAction

public int doCommandAction(javax.microedition.lcdui.Command c,
                           javax.microedition.lcdui.Displayable d)
Process the user command and return an integer value telling the PageMgr what to do next. This method handles the details of a command for a page, while the commandAction method in the PageMgr handles the general responsibility of switching displays.

Specified by:
doCommandAction in class Page
Parameters:
c - a Command object identifying the command.
d - the Displayable on which this event has occurred
Returns:
a pageAction code, selected from the public fields defined by PageMgr.

getLinkedPage

public Page getLinkedPage()
Return the Page that this Page feels should be the next page to be displayed. Note that the return value was set during the doCommandAction execution that immediately preceded this call.

Overrides:
getLinkedPage in class Page
Returns:
Page the next Page to be displayed

getDisplayable

public javax.microedition.lcdui.Displayable getDisplayable()
Return the Displayable object for this MenuPage, completely filled in and ready to display.

Specified by:
getDisplayable in class Page
Returns:
the appropriate Displayable object for this Page