FileDocCategorySizeDatePackage
SuspendResumeUI.javaAPI DocphoneME MR2 API (J2ME)5652Wed May 02 18:00:10 BST 2007com.sun.midp.suspend

SuspendResumeUI

public class SuspendResumeUI extends Object
User interface utilities for suspend/resume subsystem.

Fields Summary
private static com.sun.midp.lcdui.SystemAlert
suspendAlert
Alert notifying user of system suspension. It is null if the alert is not being shown currently.
Constructors Summary
Methods Summary
static synchronized voiddismissSuspendAlert()
Dismisses alert notifying user of system suspend.

        if (null != suspendAlert) {
            suspendAlert.dismiss();
            suspendAlert = null;
        }
    
private static com.sun.midp.lcdui.DisplayEventHandlergetDisp(com.sun.midp.security.SecurityToken token)
Retrieves a display handler that guarantees exposition of a system alert.

param
token security token for accessing restricted API
return
DisplayEventHandler instance for alert exposition

        /* IMPL_NOTE: Due to current implementation of display preempting,
         * alert is shown immediately only if launched from the isolate
         * that has foreground. Moving AMS isolate to foreground to
         * get display preemption.
         */
        MIDletProxyList proxyList = MIDletProxyList.getMIDletProxyList(token);
        proxyList.setForegroundMIDlet(proxyList.findAmsProxy());

        return DisplayEventHandlerFactory.getDisplayEventHandler(token);
    
static voidshowAllKilledAlert(com.sun.midp.security.SecurityToken token)
Shows alert notifying user that all MIDlets were killed during preceding system suspension.

param
token security token for accessing restricted API

        String title = Resource.getString(
            ResourceConstants.SR_ALL_KILLED_ALERT_TITLE, null);
        String message = Resource.getString(
            ResourceConstants.SR_ALL_KILLED_ALERT_MSG, null);

        SystemAlert alert = new SystemAlert(getDisp(token), title,
                message, null, AlertType.WARNING);
        alert.runInNewThread();
    
static synchronized voidshowSuspendAlert(com.sun.midp.security.SecurityToken token)
Shows alert notifying user of system suspend.

param
token security token for accessing restricted API

        if (null == suspendAlert && AlertTimer.shouldShow()) {
            String title = Resource.getString(
                ResourceConstants.SR_SUSPEND_ALERT_TITLE, null);
            String message = Resource.getString(
                ResourceConstants.SR_SUSPEND_ALERT_MSG, null);

            AlertTimer.start();

            CommandListener ignoring = new CommandListener() {
                public void commandAction(Command c, Displayable d) {}
            };

            suspendAlert = new SystemAlert(getDisp(token), title,
                message, null, AlertType.WARNING);
            suspendAlert.setCommandListener(ignoring);

            suspendAlert.runInNewThread();
        }