example.mmademo
Class BaseListMidlet

java.lang.Object
  extended by javax.microedition.midlet.MIDlet
      extended by example.mmademo.BaseListMidlet
All Implemented Interfaces:
javax.microedition.lcdui.CommandListener
Direct Known Subclasses:
SimplePlayer, SimpleTones

public abstract class BaseListMidlet
extends javax.microedition.midlet.MIDlet
implements javax.microedition.lcdui.CommandListener

A base class for MIDLets that provide a list as display. A history of displayed pages is maintained, to provide user flow with automatic back functionality.


Field Summary
protected  javax.microedition.lcdui.Command backCommand
           
protected  javax.microedition.lcdui.Command exitCommand
           
protected  javax.microedition.lcdui.Command playCommand
           
protected  javax.microedition.lcdui.Command selectCommand
           
 
Constructor Summary
BaseListMidlet(java.lang.String title)
           
 
Method Summary
 void commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable s)
           
 void destroyApp(boolean unconditional)
          Called when this MIDlet is destroyed.
 void exit()
          Actively finish this MIDlet
protected abstract  void fillList(javax.microedition.lcdui.List list)
          Child classes must implement this to insert the displayed list items and commands.
 javax.microedition.lcdui.Displayable getCurrentDisplayable()
           
protected  javax.microedition.lcdui.Display getDisplay()
           
protected  javax.microedition.lcdui.List getList()
           
 javax.microedition.lcdui.Displayable go(javax.microedition.lcdui.Displayable d)
          displays the given page.
 javax.microedition.lcdui.Displayable goBack()
          displays the last page that was displayed
 void pauseApp()
          Called when this MIDlet is paused.
 javax.microedition.lcdui.Displayable replaceCurrent(javax.microedition.lcdui.Displayable d)
          Replaces current displaying page with the given one.
protected abstract  void selectCommand(int index)
          Child classes must implement this in response to a selection in the list
 void startApp()
          Called when this MIDlet is started for the first time, or when it returns from paused mode.
 
Methods inherited from class javax.microedition.midlet.MIDlet
checkPermission, getAppProperty, notifyDestroyed, notifyPaused, platformRequest, resumeRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

exitCommand

protected javax.microedition.lcdui.Command exitCommand

backCommand

protected javax.microedition.lcdui.Command backCommand

playCommand

protected javax.microedition.lcdui.Command playCommand

selectCommand

protected javax.microedition.lcdui.Command selectCommand
Constructor Detail

BaseListMidlet

public BaseListMidlet(java.lang.String title)
Method Detail

goBack

public javax.microedition.lcdui.Displayable goBack()
displays the last page that was displayed


go

public javax.microedition.lcdui.Displayable go(javax.microedition.lcdui.Displayable d)
displays the given page. The current one is added to the history.


replaceCurrent

public javax.microedition.lcdui.Displayable replaceCurrent(javax.microedition.lcdui.Displayable d)
Replaces current displaying page with the given one. The current page is not added to the history.


getCurrentDisplayable

public javax.microedition.lcdui.Displayable getCurrentDisplayable()

getList

protected javax.microedition.lcdui.List getList()

getDisplay

protected javax.microedition.lcdui.Display getDisplay()

fillList

protected abstract void fillList(javax.microedition.lcdui.List list)
Child classes must implement this to insert the displayed list items and commands.


selectCommand

protected abstract void selectCommand(int index)
Child classes must implement this in response to a selection in the list


startApp

public final void startApp()
Called when this MIDlet is started for the first time, or when it returns from paused mode. When it's started for the first time, the firstTime flag is true and the list is displayed. Otherwise, if the current Displayable implements Utils.Interruptable, its resumeApp method is called.

Specified by:
startApp in class javax.microedition.midlet.MIDlet

pauseApp

public final void pauseApp()
Called when this MIDlet is paused. If the current Displayable implements Utils.Interruptable, its pauseApp method is called.

Specified by:
pauseApp in class javax.microedition.midlet.MIDlet

destroyApp

public void destroyApp(boolean unconditional)
Called when this MIDlet is destroyed. Subclasses should implement this for clean-up.

Specified by:
destroyApp in class javax.microedition.midlet.MIDlet

exit

public final void exit()
Actively finish this MIDlet


commandAction

public void commandAction(javax.microedition.lcdui.Command c,
                          javax.microedition.lcdui.Displayable s)
Specified by:
commandAction in interface javax.microedition.lcdui.CommandListener