menu
Class PageMgr

java.lang.Object
  |
  +--menu.PageMgr
All Implemented Interfaces:
javax.microedition.lcdui.CommandListener

public class PageMgr
extends java.lang.Object
implements javax.microedition.lcdui.CommandListener

This class manages a hierarchy of linked Page objects. Each page has a related Displayable, and the commands associated with the Displayable enable the user to jump from Page to Page and perform various actions on those pages.

Some of the public fields are integer pageAction codes that are returned by the doCommandAction methods of the various Pages. The codes drive the cycling of Pages by this class.

Some of the public fields are Command objects. These commands can be used by the various Pages to attach Commands to their Displayables. These are essentially singletons to reduce memory usage.


Field Summary
static int BACK
          Display the previously displayed page
static javax.microedition.lcdui.Command BACK_COMMAND
          Return to previously displayed page.
static int CANCEL
          Display the previously displayed page
static javax.microedition.lcdui.Command CANCEL_COMMAND
          User cancels action proposal on displayed page.
static int EXIT
          Exit the application entirely
static javax.microedition.lcdui.Command EXIT_COMMAND
          Exit the application entirely.
static javax.microedition.lcdui.Command HELP_COMMAND
          Display a help message.
static int LINK
          Display a linked page.
static int NONE
          Continue to display the current page.
static javax.microedition.lcdui.Command OK_COMMAND
          User confirms action proposal on displayed page.
static int ROOT
          Display the root page of the hierarchy
static javax.microedition.lcdui.Command STOP_COMMAND
          User requests termination of on-going action.
 
Constructor Summary
PageMgr(QuitableMIDlet m, Page r)
          Construct a new PageMgr.
 
Method Summary
 void commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable d)
          Dispatch user commands and then adjust the display as needed.
 void showRoot()
          Activate the device display by showing the root Page.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROOT

public static final int ROOT
Display the root page of the hierarchy

See Also:
Constant Field Values

BACK

public static final int BACK
Display the previously displayed page

See Also:
Constant Field Values

CANCEL

public static final int CANCEL
Display the previously displayed page

See Also:
Constant Field Values

EXIT

public static final int EXIT
Exit the application entirely

See Also:
Constant Field Values

LINK

public static final int LINK
Display a linked page. The next Page will be obtained with a call to getLinkedPage().

See Also:
Constant Field Values

NONE

public static final int NONE
Continue to display the current page.

See Also:
Constant Field Values

BACK_COMMAND

public static final javax.microedition.lcdui.Command BACK_COMMAND
Return to previously displayed page. (p2)


CANCEL_COMMAND

public static final javax.microedition.lcdui.Command CANCEL_COMMAND
User cancels action proposal on displayed page. (p1)


EXIT_COMMAND

public static final javax.microedition.lcdui.Command EXIT_COMMAND
Exit the application entirely. (p2)


HELP_COMMAND

public static final javax.microedition.lcdui.Command HELP_COMMAND
Display a help message. (p2)


OK_COMMAND

public static final javax.microedition.lcdui.Command OK_COMMAND
User confirms action proposal on displayed page. (p1)


STOP_COMMAND

public static final javax.microedition.lcdui.Command STOP_COMMAND
User requests termination of on-going action. (p2)

Constructor Detail

PageMgr

public PageMgr(QuitableMIDlet m,
               Page r)
Construct a new PageMgr.

Parameters:
m - the QuitableMIDlet that we are part of. We need this object so that we can call quitApp if the EXIT command is given. We also use it to get Display information.
r - the root Page of the hierarchy
Method Detail

showRoot

public void showRoot()
Activate the device display by showing the root Page.


commandAction

public void commandAction(javax.microedition.lcdui.Command c,
                          javax.microedition.lcdui.Displayable d)
Dispatch user commands and then adjust the display as needed. Note to Page developers: the Page method doCommandAction must return quickly because the system is blocked until we return.

Specified by:
commandAction in interface javax.microedition.lcdui.CommandListener
Parameters:
c - a Command object identifying the command.
d - the Displayable on which this event has occurred