MVMDisplayControllerpublic class MVMDisplayController extends DisplayController This class controls which MIDlet's display is in the foreground.
Running only in the AMS Isolate (0) the controller consulted by the MIDlet
proxy list for any foreground when various state changes occur in a MIDlet.
The display controller defers the display decision to the user by choosing
the foreground selector to be the next foreground.
From the user perspective when the last MIDlet the user launched sets its
current displayable for the first time, that MIDlet should automatically
get the foreground (see the midletCreated and foregroundRequest methods).
A MIDlet that is paused or destroyed is treated as if it has requested the
background as described above. |
Fields Summary |
---|
private MIDletProxy | foregroundSelectorForeground Selector MIDlet. |
Constructors Summary |
---|
public MVMDisplayController(MIDletProxyList theMIDletProxyList, MIDletProxy theForegroundSelector)Construct a DisplayController with a reference to the ProxyList.
super(theMIDletProxyList);
foregroundSelector = theForegroundSelector;
/*
* Ensure the foreground selector will get the foreground
* when requested.
*/
lastMidletCreated = foregroundSelector;
|
Methods Summary |
---|
MIDletProxy | backgroundRequest(MIDletProxy midlet)Handles MIDlet background requests.
If the MIDlet is the foreground MIDlet, then bring the foreground
selector to the foreground.
MIDletProxy foreground = midletProxyList.getForegroundMIDlet();
if (midlet != foreground) {
// not in the foreground, so don't change the foreground
return foreground;
}
/*
* Normal MVM mode case,
* Let the user choose the next foreground.
*/
return getForegroundSelector();
| MIDletProxy | foregroundRequest(MIDletProxy midlet)Handles MIDlet foreground requests.
If proxy being updated belongs last MIDlet created in the proxy list,
then put the MIDlet in the foreground.
Otherwise, the request will not be granted. Foreground will not change.
/*
* When the last MIDlet started wants the foreground automatically
* put in the foreground this time only.
*/
return (midlet == lastMidletCreated) ? midlet
: midletProxyList.getForegroundMIDlet();
| private MIDletProxy | getForegroundSelector()Returns the foreground selector MIDlet.
return foregroundSelector;
| MIDletProxy | selectForeground(boolean onlyFromLaunchedList)Called to process a select foreground event.
Returns the foreground selector MIDlet in the foreground.
notifyListenersOfSelectForeground(onlyFromLaunchedList);
return getForegroundSelector();
| MIDletProxy | startPreempting(MIDletProxy preempting)Preempt an Isolate's displays.
Enumeration midlets;
MIDletProxy preempted;
MIDletProxy foreground;
/*
* Preempt all of the MIDlets in the same Isolate as the preempting
* proxy.
*/
midlets = midletProxyList.getMIDlets();
while (midlets.hasMoreElements()) {
MIDletProxy current = (MIDletProxy)midlets.nextElement();
if (current.getIsolateId() != preempting.getIsolateId()) {
continue;
}
preempting.setPreemptedMidlet(current);
current.setPreemptingDisplay(preempting);
midletProxyList.notifyListenersOfProxyUpdate(current,
MIDletProxyListListener.PREEMPTING_DISPLAY);
}
foreground = midletProxyList.getForegroundMIDlet();
if (foreground == null) {
return preempting;
}
if (foreground.getIsolateId() == preempting.getIsolateId()) {
preempting.setPreemptedMidlet(foreground);
return preempting;
}
return foreground;
|
|