FileDocCategorySizeDatePackage
DummyNamsMIDlet.javaAPI DocphoneME MR2 API (J2ME)4546Wed May 02 18:00:04 BST 2007com.sun.midp.main

DummyNamsMIDlet

public class DummyNamsMIDlet extends javax.microedition.midlet.MIDlet implements javax.microedition.lcdui.CommandListener
Base class for several Dummy MIDlets used in NAMS I3 testing

Fields Summary
protected String
name
private javax.microedition.lcdui.Command
cmdMgr
private javax.microedition.lcdui.Command
cmdHide
private javax.microedition.lcdui.Command
cmdPause
private javax.microedition.lcdui.Command
cmdDestroy
private javax.microedition.lcdui.Form
form
main midlet screen
Constructors Summary
public DummyNamsMIDlet(String dummyName)
public constructor

param
dummyName name of the MIDlet (i.e.name of its its screen)

        int i;

        name = dummyName;
        
        cmdDestroy = new Command("Destroy", Command.EXIT, 0);
        cmdPause = new Command("Pause", Command.STOP, 0);
        cmdHide = new Command("Hide", Command.SCREEN, 0);
        cmdMgr = new Command("Show Manager", Command.SCREEN, 0);
        
        form = new Form(name + " screen");
        
        form.addCommand(cmdMgr);
        form.addCommand(cmdHide);
        form.addCommand(cmdPause);
        form.addCommand(cmdDestroy);

        form.setCommandListener(this);

        Logging.report(Logging.WARNING, LogChannels.LC_CORE,
           "DEBUG: " + name + ": created in isolate #" + 
           MIDletSuiteUtils.getIsolateId());
    
Methods Summary
public voidcommandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable s)


        if (c == cmdDestroy) {
            /*
            Logging.report(Logging.WARNING, LogChannels.LC_CORE,
                "DEBUG: " + name + ": user requested to destroy ...");
             */
            try {
                destroyApp(true);
            } catch (MIDletStateChangeException e) {};
        } else if (c == cmdPause) {
            /*
            Logging.report(Logging.WARNING, LogChannels.LC_CORE,
                "DEBUG: " + name + ": user requested to pause ...");
             */
            pauseApp();
        } else if (c == cmdHide) {
            /*
            Logging.report(Logging.WARNING, LogChannels.LC_CORE,
                "DEBUG: " + name + ": user requested to go to background ...");
             */
            NamsManager.midletSetBackground();
        } else if (c == cmdMgr) {
            /*
            Logging.report(Logging.WARNING, LogChannels.LC_CORE,
                "DEBUG: " + name + ": user requested to show NamsManager ...");
             */
            NamsManager.midletSetForeground(0);
        }
    
protected voiddestroyApp(boolean unconditional)

        Logging.report(Logging.WARNING, LogChannels.LC_CORE,
           "DEBUG: " + name + ": entered destroyed state ...");
        notifyDestroyed();
    
protected voidpauseApp()

        Logging.report(Logging.WARNING, LogChannels.LC_CORE,
           "DEBUG: " + name + ": entered paused state ...");
        notifyPaused();
    
protected voidstartApp()

        Logging.report(Logging.WARNING, LogChannels.LC_CORE,
           "DEBUG: " + name + ": entered active state ...");
        
        Display.getDisplay(this).setCurrent(form);