Fields Summary |
---|
public static final int | MIDLET_ACTIVEConstant for active state of a MIDlet. |
public static final int | MIDLET_PAUSEDConstant for paused state of a MIDlet. |
public static final int | MIDLET_DESTROYEDConstant for destroyed state of a MIDlet. |
private static com.sun.midp.lcdui.ForegroundEventProducer | foregroundEventProducerCached reference to the ForegroundEventProducer. |
private static com.sun.midp.midlet.MIDletEventProducer | midletEventProducerCached reference to the MIDletEventProducer. |
private int | externalIdID given to this midlet by an external application manager. |
private int | isolateIdID of the Isolate the MIDlet is running in. |
private int | displayIdID of the MIDlet's Display. |
private int | suiteIdID of the suite the MIDlet belongs to. |
private String | classNameClass name of the MIDlet. |
private String | displayNameDisplay name of the MIDlet to show the user. |
private int | midletStateMIDlet life cycle state. Will be either MIDLET_ACTIVE, MIDLET_PAUSED,
or MIDLET_DESTROYED. |
boolean | wasNotActiveIndicates that the midlet was just created. |
private boolean | wantsForegroundStateTrue if the MIDlet want's its Display in the foreground. |
private boolean | requestedForegroundTrue if the MIDlet has the foreground at least once. |
private MIDletProxy | preemptingThe display that is preempting this MIDlet. |
private boolean | alertWaitingTrue if alert is waiting for the foreground. |
private MIDletProxy | preemptedThe display to put in the foreground after this display stops
preempting. If no display in this isolate had the foreground
then this will be null. |
private Timer | proxyTimerTimer for the MIDlet proxy. Used when a midlet is hanging. |
private MIDletProxyList | parentParent list. |
Methods Summary |
---|
public void | activateMidlet()Asynchronously change the MIDlet's state to active.
This method does NOT change the state in the proxy, but
sends a activate MIDlet event to the MIDlet's Display.
The state in the proxy is only update when the MIDlet sends
a MIDlet activated event to the proxy list.
if (midletState != MIDLET_DESTROYED) {
wasNotActive = false;
midletEventProducer.sendMIDletActivateEvent(isolateId, className);
}
|
public void | destroyMidlet()Asynchronously change the MIDlet's state to destroyed.
This method does NOT change the state in the proxy, but
sends request to destroy MIDlet event to the AMS.
The state in the proxy is only update when the MIDlet sends
a MIDlet destroyed event to the proxy list.
if (midletState != MIDLET_DESTROYED) {
if (getTimer() != null) {
// A destroy MIDlet event has been sent.
return;
}
MIDletDestroyTimer.start(this, parent);
midletEventProducer.sendMIDletDestroyEvent(isolateId, className);
}
|
void | destroyedNotification()Process a MIDlet destroyed notification.
setTimer(null);
setMidletState(MIDLET_DESTROYED);
|
public java.lang.String | getClassName()Get the class name of the MIDlet.
return className;
|
public int | getDisplayId()Get the ID of the MIDlet's Display. Public for testing purposes.
return displayId;
|
public java.lang.String | getDisplayName()Get the Display name of the MIDlet.
return displayName;
|
public int | getExternalAppId()Get the external application ID used for forwarding changes.
return externalId;
|
public int | getIsolateId()Get the ID of the Isolate the MIDlet is running in. Public for testing
purposes.
return isolateId;
|
public int | getMidletState()Get the MIDlet lifecycle state.
return midletState;
|
com.sun.midp.main.MIDletProxy | getPreemptedMidlet()Get the proxy of the MIDlet that should get the foreground
after preempting is done.
return preempted;
|
com.sun.midp.main.MIDletProxy | getPreemptingDisplay()Get the proxy of the display that is preempting this MIDlet.
return preempting;
|
public int | getSuiteId()Get the ID of the MIDlet's suite.
return suiteId;
|
java.util.Timer | getTimer()Gets the timer object
return proxyTimer;
|
static void | initClass(com.sun.midp.lcdui.ForegroundEventProducer theForegroundEventProducer, com.sun.midp.midlet.MIDletEventProducer theMIDletEventProducer)Initialize the MIDletProxy class. Should only be called by the
MIDletProxyList.
foregroundEventProducer = theForegroundEventProducer;
midletEventProducer = theMIDletEventProducer;
|
public boolean | isAlertWaiting()Called to determine if alert is waiting for the foreground.
return alertWaiting;
|
public boolean | noDisplay()Check if the MIDlet has not created its display.
return displayId == 0;
|
public boolean | noDisplayable()Check if the MIDlet has not set a displayable in its display.
Used by foreground selector to determine if the MIDlet it is
about to put in the foreground will draw the screen.
return !requestedForeground;
|
void | notifyMIDletHasForeground(boolean hasForeground)Notify the midlet's display of a foreground change. Called by
the MIDlet proxy list to notify the old and new foreground displays
of a foreground change.
if (hasForeground) {
alertWaiting = false;
foregroundEventProducer.sendDisplayForegroundNotifyEvent(
isolateId, displayId);
} else {
foregroundEventProducer.sendDisplayBackgroundNotifyEvent(
isolateId, displayId);
}
|
public void | pauseMidlet()Asynchronously change the MIDlet's state to paused.
This method does NOT change the state in the proxy, but
sends a pause MIDlet event to the MIDlet's Display.
The state in the proxy is only update when the MIDlet sends
a MIDlet paused event to the proxy list.
if (midletState != MIDLET_DESTROYED) {
midletEventProducer.sendMIDletPauseEvent(isolateId, className);
}
|
void | setDisplayId(int id)Sets the ID of the MIDlet's Display.
displayId = id;
|
void | setMidletState(int newMidletState)Set the MIDlet cycle state. Called by the
MIDlet proxy list when it receives an event from the MIDlet
to update this value.
midletState = newMidletState;
|
void | setPreemptedMidlet(com.sun.midp.main.MIDletProxy preemptedDisplay)Set the proxy of the MIDlet that should get the foreground
after preempting is done.
preempted = preemptedDisplay;
|
void | setPreemptingDisplay(com.sun.midp.main.MIDletProxy preemptingDisplay)Set the proxy of the display that is preempting this MIDlet.
// Turn on the user notification status for this proxy
if (preemptingDisplay != null) {
alertWaiting = true;
} else {
if (preempting != null) {
/*
* There could be a proxy timer waiting to destroy the
* isolate if the user ended the alert with the end MIDlet
* button, so cancel the timer.
*/
preempting.setTimer(null);
}
alertWaiting = false;
}
preempting = preemptingDisplay;
|
void | setTimer(java.util.Timer t)Sets the timer object
proxyTimer = t;
|
void | setWantsForeground(boolean newWantsForeground, boolean isAlert)Set the wants foreground state in the proxy. Called by the
MIDlet proxy list when it receives an event from the MIDlet's
display to update this value.
wantsForegroundState = newWantsForeground;
if (newWantsForeground) {
requestedForeground = true;
alertWaiting = isAlert;
} else {
alertWaiting = false;
}
|
public void | terminateNotPausedMidlet()Terminates ther MIDlet if it is neither paused nor destroyed.
if (midletState != MIDLET_DESTROYED && midletState != MIDLET_PAUSED) {
MIDletProxyUtils.terminateMIDletIsolate(this, parent);
}
|
public java.lang.String | toString()Print the state of the proxy.
return "MIDletProxy: suite id = " + suiteId +
"\n class name = " + className +
"\n display name = " + displayName +
"\n isolate id = " + isolateId +
", display id = " + displayId +
", midlet state = " + midletState +
", wantsForeground = " + wantsForegroundState +
", requestedForeground = " + requestedForeground +
"\n alertWaiting = " + alertWaiting;
|
public boolean | wantsForeground()Check if the MIDlet want's its Display in the foreground.
return wantsForegroundState;
|