Methods Summary |
---|
public AutoEventQueue | getEventQueue()Get MIDlet's event queue.
return null;
|
public AutoMIDletForegroundState | getForegroundState()Get current foreground state.
synchronized (foregroundStateTracker) {
Object state = foregroundStateTracker.getCurrentState();
return (AutoMIDletForegroundState)state;
}
|
public AutoMIDletLifeCycleState | getLifeCycleState()Get current lifecycle state.
synchronized (lifeCycleStateTracker) {
Object state = lifeCycleStateTracker.getCurrentState();
return (AutoMIDletLifeCycleState)state;
}
|
public AutoMIDletDescriptor | getMIDletDescriptor()Get MIDlet's descriptor.
return midletDescriptor;
|
private void | guaranteeMIDletNotDestroyed(java.lang.String s)Guarantees that MIDlet is not destroyed: if MIDlet
is destroyed, exception is thrown.
if (lifeCycleStateTracker.getCurrentState() ==
AutoMIDletLifeCycleState.DESTROYED) {
throw new IllegalStateException(s);
}
|
private void | guaranteeStateTransitionIsValid(AutoMIDletLifeCycleState state, java.lang.String s)Guarantees that state transition is valid (possible):
if state is unreachable, exception is thrown.
if (state != AutoMIDletLifeCycleState.DESTROYED) {
guaranteeMIDletNotDestroyed(s);
}
|
private void | guaranteeStateTransitionIsValid(AutoMIDletForegroundState state, java.lang.String s)Guarantees that waiting for state is valid:
if state is unreachable, exception is thrown.
guaranteeMIDletNotDestroyed(s);
|
void | stateChanged(AutoMIDletLifeCycleState newState)To be called when MIDlet's life cycle state has changed.
boolean interruptWaiters = false;
if (newState == AutoMIDletLifeCycleState.DESTROYED) {
interruptWaiters = true;
}
lifeCycleStateTracker.setCurrentState(newState, interruptWaiters);
if (newState == AutoMIDletLifeCycleState.DESTROYED) {
foregroundStateTracker.interruptWait();
midletDescriptor.midletDestroyed();
}
|
void | stateChanged(AutoMIDletForegroundState newState)To be called when MIDlet's foreground state has changed.
foregroundStateTracker.setCurrentState(newState, false);
|
public void | switchTo(AutoMIDletLifeCycleState state, boolean wait)Initiate a switch (transition) from current to specified
lifecycle state.
synchronized (lifeCycleStateTracker) {
guaranteeStateTransitionIsValid(state, "switchTo");
midletStateController.switchTo(this, state);
if (wait) {
waitFor(state);
}
}
|
public void | switchTo(AutoMIDletForegroundState state, boolean wait)Initiate a switch (transition) from current to specified
foreground state.
synchronized (foregroundStateTracker) {
guaranteeStateTransitionIsValid(state, "switchTo");
foregroundStateController.switchTo(this, state);
if (wait) {
waitFor(state);
}
}
|
public void | waitFor(AutoMIDletForegroundState state)Wait (block) until MIDlet reaches specified foreground state.
synchronized (foregroundStateTracker) {
guaranteeStateTransitionIsValid(state, "waitFor");
foregroundStateTracker.waitFor(state);
// wait might have been interrupted, so check again
// if waiting for this state is still valid
guaranteeStateTransitionIsValid(state, "waitFor");
}
|
public void | waitFor(AutoMIDletLifeCycleState state)Wait (block) until MIDlet reaches specified lifecycle state.
synchronized (lifeCycleStateTracker) {
guaranteeStateTransitionIsValid(state, "waitFor");
// wait
lifeCycleStateTracker.waitFor(state);
// wait might have been interrupted, so check again
// if waiting for this state is still valid
guaranteeStateTransitionIsValid(state, "waitFor");
}
|