jMobileCore toolkit

com.jmobilecore.ui.core
Class ScreenManager

java.lang.Object
  extended by com.jmobilecore.ui.core.ScreenManager

public class ScreenManager
extends java.lang.Object

This class provides access to the MIDlet's environment and supports navigation among the screens.

Author:
Greg Gridin

Field Summary
protected static javax.microedition.midlet.MIDlet application
          Current midlet
protected static javax.microedition.lcdui.Display display
          Reference to Display object that is unique to this MIDlet
protected static java.util.Stack screens
          A stack of the path to the currently-displayed screen.
 
Constructor Summary
ScreenManager()
           
 
Method Summary
static void beep(javax.microedition.lcdui.AlertType alert)
          Causes the handset to emit a beep if setMIDlet has been previously called.
static void destructor()
          Default destructor.
static javax.microedition.lcdui.Displayable getCurrentScreen()
          Gets the current screen (the screen at the top of the stack).
static javax.microedition.lcdui.Display getDisplay()
          Gets the Display object associated with the midlet.
static javax.microedition.midlet.MIDlet getMIDlet()
          Returns the current MIDlet.
static void goBack()
          Makes the previously displayed screen the currently displayed screen.
static void goForward(javax.microedition.lcdui.Displayable newScreen)
          Display a new screen, and the new screen supports going back to the previous screen.
static void goHome()
          Goes back to the first (home) screen.
static void replaceScreen(javax.microedition.lcdui.Displayable newScreen)
          Replaces the currently displayed screen to the new displayed screen.
static void resetScreens()
          Resets screen stack
static void setMIDlet(javax.microedition.midlet.MIDlet midlet)
          Sets the current MIDlet.
static void showAlert(java.lang.String title, java.lang.String text, int delay, javax.microedition.lcdui.AlertType type)
          Shows alert message and backs to current scrren
static void showAlert(java.lang.String title, java.lang.String text, int delay, javax.microedition.lcdui.AlertType type, javax.microedition.lcdui.Displayable next)
          Shows alert message and moves to specified scrren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

application

protected static javax.microedition.midlet.MIDlet application
Current midlet

See Also:
setMIDlet(javax.microedition.midlet.MIDlet)

display

protected static javax.microedition.lcdui.Display display
Reference to Display object that is unique to this MIDlet

See Also:
setMIDlet(javax.microedition.midlet.MIDlet)

screens

protected static java.util.Stack screens
A stack of the path to the currently-displayed screen.

Constructor Detail

ScreenManager

public ScreenManager()
Method Detail

beep

public static void beep(javax.microedition.lcdui.AlertType alert)
Causes the handset to emit a beep if setMIDlet has been previously called.


destructor

public static void destructor()
Default destructor. Helps VM to perform garbage collection


getCurrentScreen

public static javax.microedition.lcdui.Displayable getCurrentScreen()
Gets the current screen (the screen at the top of the stack).

Returns:
the current screen as Displayable object

getDisplay

public static javax.microedition.lcdui.Display getDisplay()
Gets the Display object associated with the midlet. This may allow another object, such as an Component, to use environment information which is accessible only via a MIDlet object. For example, the following code in beep causes the handset to emit a beep.

 if ( ScreenManager.getDisplay() != null )
        AlertType.WARNING.playSound( ScreenManager.getDisplay() );
 

Returns:
The Display object for the MIDlet, or null if the MIDlet has not previously called setMIDlet

getMIDlet

public static javax.microedition.midlet.MIDlet getMIDlet()
Returns the current MIDlet.

Returns:
The current MIDlet if setMIDlet(javax.microedition.midlet.MIDlet) was previously called, else null.

goBack

public static void goBack()
Makes the previously displayed screen the currently displayed screen.


goForward

public static void goForward(javax.microedition.lcdui.Displayable newScreen)
Display a new screen, and the new screen supports going back to the previous screen.

Parameters:
newScreen - The new screen to display

goHome

public static void goHome()
Goes back to the first (home) screen.


replaceScreen

public static void replaceScreen(javax.microedition.lcdui.Displayable newScreen)
Replaces the currently displayed screen to the new displayed screen.

Parameters:
newScreen - The new replacement screen to display

resetScreens

public static void resetScreens()
Resets screen stack


setMIDlet

public static void setMIDlet(javax.microedition.midlet.MIDlet midlet)
Sets the current MIDlet. If a MIDlet calls this method then environmental information which can only be accessed via the MIDlet object, such as the javax.microedition.lcdui.Display, will be accessible to other objects via this class.

Parameters:
midlet - The midlet

showAlert

public static void showAlert(java.lang.String title,
                             java.lang.String text,
                             int delay,
                             javax.microedition.lcdui.AlertType type)
Shows alert message and backs to current scrren

Parameters:
title - The title for alert screen
text - The alert message
delay - How long the alert will be displayed, If delay is Alert.FOREVER then alert will be visible until user dismisses it
type - The alert type
See Also:
Alert

showAlert

public static void showAlert(java.lang.String title,
                             java.lang.String text,
                             int delay,
                             javax.microedition.lcdui.AlertType type,
                             javax.microedition.lcdui.Displayable next)
Shows alert message and moves to specified scrren

Parameters:
title - The title for alert screen
text - The alert message
delay - How long the alert will be displayed, If delay is Alert.FOREVER then alert will be visible until user dismisses it
type - The alert type
next - The next screen
See Also:
Alert

jMobileCore toolkit