Class PropertyPage

java.lang.Object
  |
  +--menu.Page
        |
        +--PropertyPage

public class PropertyPage
extends Page

A PropertyPage is used to display lists of properties whose values can be obtained using the System.getProperty(keyString) or midlet.getAppProperty(keyString) methods. The list of properties that the PropertyPage displays is controlled by information provided to the constructor.

If the midlet parameter is null, then the requested properties are considered to be system properties and System.getProperty is used. If midlet is not null, then midlet.getAppProperty is used.

A String[] can be provided containing the explicit names of the properties. In this case, the PropertyPage looks up the value for each property and then displays the name and the value.

Alternatively, the caller can provide a prefix String and a String array containing the suffixes. In this case, the PropertyPage builds the key strings itself using the format prefix[n]suffix. Given a prefix, it adds the string "1", then adds each of the suffixes in turn, and uses the result as a key string. Then n is incremented and the process is repeated until for some value of n, none of the possible keys have a value. Note that if you want hyphens before and after the "n", you need to put them in the prefix and suffix Strings, since they are NOT added automatically.


Constructor Summary
PropertyPage(java.lang.String label, javax.microedition.midlet.MIDlet midlet, java.lang.String[] names)
          Initialize a new PropertyPage object using the supplied parameters and default values where needed.
PropertyPage(java.lang.String label, javax.microedition.midlet.MIDlet midlet, java.lang.String prefix, java.lang.String[] names)
          Initialize a new PropertyPage object using the supplied parameters and default values where needed.
PropertyPage(java.lang.String label, java.lang.String title, javax.microedition.lcdui.Image icon, javax.microedition.midlet.MIDlet midlet, java.lang.String prefix, java.lang.String[] suffix)
          Initialize a new PropertyPage object using the supplied parameters.
 
Method Summary
 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 PropertyPage, completely filled in and ready to display.
 
Methods inherited from class menu.Page
getIcon, getLabel, getLinkedPage, getPrevious, getTitle, setPrevious
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyPage

public PropertyPage(java.lang.String label,
                    java.lang.String title,
                    javax.microedition.lcdui.Image icon,
                    javax.microedition.midlet.MIDlet midlet,
                    java.lang.String prefix,
                    java.lang.String[] suffix)
Initialize a new PropertyPage 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
midlet - the midlet for which these properties are stored. If null, then the properties are system properties. If not, then they are application properties.
prefix - property name prefix String for generating a series of property names. If prefix is null, then no names are generated, they are just used directly from the array given in the suffix parameter.
suffix - a String[] of property names or suffixes.

PropertyPage

public PropertyPage(java.lang.String label,
                    javax.microedition.midlet.MIDlet midlet,
                    java.lang.String prefix,
                    java.lang.String[] names)
Initialize a new PropertyPage 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)
midlet - the midlet for which these properties are stored. If null, then the properties are system properties. If not, then they are application properties.
prefix - property name prefix String for generating a series of property names. If prefix is null, then no names are generated, they are just used directly from the array given in the suffix parameter.

PropertyPage

public PropertyPage(java.lang.String label,
                    javax.microedition.midlet.MIDlet midlet,
                    java.lang.String[] names)
Initialize a new PropertyPage 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). The prefix defaults to null (meaning that no names are generated automatically, they are just used as they are from the names parameter).

Parameters:
midlet - the midlet for which these properties are stored. If null, then the properties are system properties. If not, then they are application properties.
label - short label for this page (as might be used in a menu)
names - a String array containing the names of the properties of interest.
Method Detail

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.

getDisplayable

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

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