UIEvolutin Inc.
UJML Language Reference
Running Files

UJML manages application loading and unloading using a history stack.

UJML runs an application by loading its compiled byte code into memory and executing it. See Application Files, Byte Code Files. UJML applications may be run from the device operating system, the method for which varies from device to device. UJML applications may also run other UJML applications, in which case the running application is unloaded and the new application file is loaded into memory and executed. 

UJML applications may unload themselves. If the application was started from the device operating system and an application unloads itself, then control is returned to the device. However, if the current application was started by another UJML application, the previous application may be reloaded and restarted. This is done using something called the 'history stack'.

The application history stack

UJML maintains a list of the programs which have run in the current session. This list works like a stack of dinner plates with new applications going on top of the stack when they are loaded and coming off of the stack when they are unloaded. When an application is unloaded and there is another application below it on the stack, that application is loaded and started. When the last application on the stack is unloaded the session is over and control is returned to the device. 

An application reloaded from the stack is restarted from scratch in its initial state. If you want your application to 'remember what it was doing' you will need to implement some way of saving and restoring application state. One way to do this uses the property bag functions and the UNLOAD event. See Property Bag Functions, UNLOAD event.

Application management functions

UJML provides a rich set of functions to run and unload applications, with fine control over the history stack.

Function 
Description 
History Stack Action 
Loads and runs a new application file. 
Pushes the current application onto the stack. 
Loads and runs a new application file. 
Replaces the current application on the stack. 
Stops and unloads the current application, even if called from a partition file. 
Removes the current application from the stack. 
Stops and unloads the current application if called from an application file. Unloads the partition if called from a partition file, in which case the current application continues to run. See Partition Files, Linking Files
Removes the current application from the stack.
Note: No stack action if called from a partition file. 

The following example shows how to run the application referred to by the URL variable. It is part of the apprunner.ujml sample.

_run(url);

 

The following example shows how to unload the current application. It is part of the visualelements.ujml sample.

_unload();
Copyright (c) 2000-2007 UIEvolution, Inc. All rights reserved.
What do you think about this topic? Send feedback!