ExecuteMIDletEventListenerpublic class ExecuteMIDletEventListener extends Object implements Runnable, com.sun.midp.events.EventListenerHandles execute MIDlet events. |
Fields Summary |
---|
private static com.sun.midp.security.SecurityToken | classSecurityTokenAn internal security token. | private static com.sun.midp.lcdui.DisplayEventHandler | displayEventHandlerThe controller of Displays. | private int | externalAppIdExternal app ID of an installed suite to execute. | private int | idID of an installed suite to execute. | private String | midletMIDlet class name of MIDlet to invoke. | private String | displayNamedisplayName name to display to the user. | private String | arg0arg0 if not null, is application property arg-0. | private String | arg1arg1 if not null, is application property arg-1. | private String | arg2arg2 if not null, is application property arg-2. |
Constructors Summary |
---|
private ExecuteMIDletEventListener()Initialize an ExecuteMIDletEventListener to with execute arguments.
| private ExecuteMIDletEventListener(int externalAppId, int id, String midlet, String displayName, String arg0, String arg1, String arg2)Initialize an ExecuteMIDletEventListener with arguments to execute.
this.externalAppId = externalAppId;
this.id = id;
this.midlet = midlet;
this.displayName = displayName;
this.arg0 = arg0;
this.arg1 = arg1;
this.arg2 = arg2;
|
Methods Summary |
---|
public boolean | preprocess(com.sun.midp.events.Event event, com.sun.midp.events.Event waitingEvent)Preprocess an event that is being posted to the event queue.
This implementation of the method always return true.
return true;
| public void | process(com.sun.midp.events.Event genericEvent)Process an Execute event to start a new MIDlet.
If the MIDlet is already in the ProxyList it will not
start it again.
If the MIDlet/Isolate has decided to exit but has
not yet sent the remove event the execute will be unreliable.
// Verify that the requested MIDlet is not already running
// (is not in the MIDletProxyList)
if (MIDletProxyList.getMIDletProxyList().isMidletInList(id, midlet)) {
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.WARNING, LogChannels.LC_CORE,
"MIDlet already running; execute ignored");
}
return;
}
try {
// The execute MIDlet method may block
NativeEvent event = (NativeEvent)genericEvent;
ExecuteMIDletEventListener runnable =
new ExecuteMIDletEventListener(event.intParam1,
event.intParam2,
event.stringParam1,
event.stringParam2,
event.stringParam3,
event.stringParam4,
event.stringParam5);
(new Thread(runnable)).start();
} catch (Throwable t) {
Logging.trace(t, "Error creating a new Execute thread");
}
| public void | run()Processes an execute MIDlet event outside of the event thread.
try {
MIDletSuiteUtils.executeWithArgs(classSecurityToken,
externalAppId, id, midlet, displayName, arg0, arg1, arg2);
} catch (Throwable t) {
if (Logging.TRACE_ENABLED) {
Logging.trace(t,
"Exception calling MIDletSuiteLoader.execute");
}
MIDletSuiteUtils.displayException(displayEventHandler,
Resource.getString(
ResourceConstants.AMS_MIDLETSUITELDR_CANT_EXE_NEXT_MIDLET) +
"\n\n" + t.getMessage());
}
| static void | startListening(com.sun.midp.security.SecurityToken token, com.sun.midp.lcdui.DisplayEventHandler theDisplayEventHandler, com.sun.midp.events.EventQueue eventQueue)Start listening for execute MIDlet events.
classSecurityToken = token;
displayEventHandler = theDisplayEventHandler;
eventQueue.registerEventListener(EventTypes.EXECUTE_MIDLET_EVENT,
new ExecuteMIDletEventListener());
|
|