FileDocCategorySizeDatePackage
AutoDisplayController.javaAPI DocphoneME MR2 API (J2ME)3065Wed May 02 18:00:08 BST 2007com.sun.midp.main

AutoDisplayController

public class AutoDisplayController extends DisplayController
Automation API display controller

Fields Summary
AutoDisplayControllerListener
listener
Foreground state changes listener
Constructors Summary
public AutoDisplayController(MIDletProxyList midletProxyList)
Construct a DisplayController with a reference to the ProxyList.

param
midletProxyList reference to the MIDlet proxy list

        super(midletProxyList);
        listener = null;
    
Methods Summary
MIDletProxyforegroundMidletChanging(MIDletProxy midlet)
Call to notify that foreground MIDlet is changing and give the display controller a chance to preempt the change. Also the last MIDlet created state will be reset.

If the MIDlet to get the foreground is paused, then activate it.

param
midlet proxy of the MIDlet to be put in the foreground
return
Proxy of the next foreground MIDlet, may be the foreground MIDlet if the foreground should not change

        MIDletProxy oldForeground = midletProxyList.getForegroundMIDlet();
        MIDletProxy newForeground = super.foregroundMidletChanging(midlet);
        
        notifyListenersOfForegroundChange(oldForeground, newForeground);
        
        return newForeground;
    
private voidnotifyListenersOfForegroundChange(MIDletProxy oldForeground, MIDletProxy newForeground)
Notifies listener about foreground change.

param
oldForeground MIDlet currently in foreground
param
newForeground MIDlet getting foreground


        if (listener != null) {
            listener.foregroundMIDletChanged(oldForeground, newForeground);
        }
    
public voidsetListener(AutoDisplayControllerListener listener)
Sets a listener for foreground state changes.

param
listener listener

        this.listener = listener;