menu
Class Page

java.lang.Object
  |
  +--menu.Page
Direct Known Subclasses:
AccountPage, MenuPage, PropertyPage

public abstract class Page
extends java.lang.Object

A Page is the basic element in a hierarchy of displayable pages. This abstract class is extended to define specific types of behavior by specific types of pages.


Constructor Summary
Page(java.lang.String label, java.lang.String title, javax.microedition.lcdui.Image icon)
          Initialize a new Page object using the supplied parameters.
 
Method Summary
abstract  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.
abstract  javax.microedition.lcdui.Displayable getDisplayable()
          Return the Displayable object for this Page, completely filled in and ready to display.
 javax.microedition.lcdui.Image getIcon()
          Return Page icon.
 java.lang.String getLabel()
          Return Page label.
 Page getLinkedPage()
          Return the Page that this Page feels should be the next page to be displayed.
 Page getPrevious()
          Return pointer to previous page visited.
 java.lang.String getTitle()
          Return Page title.
 void setPrevious(Page p)
          Set pointer to previous page visited.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Page

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

Parameters:
label - short label for this page (as might be used in a menu). Must not be null.
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.
Method Detail

getDisplayable

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

Returns:
the appropriate Displayable object for this Page

doCommandAction

public abstract 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.

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. This method is called by the PageMgr after doCommandAction returns PageMgr.LINK as the pageAction value. If the subclass can return this pageAction, then it must override this implementation of getLinkedPage with an appropriate implementation that does not throw an Exception.

Returns:
Page the next Page to be displayed
Throws:
java.lang.IllegalStateException - this implementation always throws this exception

getLabel

public java.lang.String getLabel()
Return Page label.

Returns:
Page label

getTitle

public java.lang.String getTitle()
Return Page title.

Returns:
Page title

getIcon

public javax.microedition.lcdui.Image getIcon()
Return Page icon.

Returns:
Page icon

getPrevious

public Page getPrevious()
Return pointer to previous page visited.

Returns:
previous Page

setPrevious

public void setPrevious(Page p)
Set pointer to previous page visited.

Parameters:
p - previous Page