brf.j2me.dynaworks
Class Application

java.lang.Object
  |
  +--brf.j2me.dynaworks.Application

public class Application
extends java.lang.Object

The Application class is the abstract base class for all DynaWorks-based applications. It manages one or more Page objects that represent the different views of the application.

Using the Application class
Normally - which means you are not planning to use nasty tricks within your application - you don't need to derive from this class to build your application. Indeed the start-up code for an application looks like:

public static void main (String[] args) {

Environment.setImpl (new J9Impl ());
Application theApp = new Application ("MyApp");
theApp.addPage (new MyPage ("MyPage"));
theApp.run ("MyPage");
}

So every display and user interaction only take place in Page objects. You add one ore more page objects to the application before calling the run method of the application telling it which page to load (first). For more information on how to switch from one page to another see the description for the Page class.

Version:
1.0
Author:
Bernd R. Fix
See Also:
Page, Environment

Field Summary
private  Page active
          Reference to active page
private  java.util.Vector callstack
          stack for nested pages
private  DataDictionary dict
          Data dictionary for this application
private  EventQueue events
          Event queue for this application.
private static java.util.Hashtable os
          object store for data used by all applications running DynaPage.
private  java.util.Hashtable pages
          list of pages managed by this application
 
Constructor Summary
Application(java.lang.String name)
          constructor.
 
Method Summary
(package private) static void ()
          static initialization of class.
 boolean addPage(Page p)
          add a Page object to the list.
 boolean addPage(java.lang.String name, java.lang.Class cl)
          add a Page class to the list.
 boolean addVariable(java.lang.String name, java.lang.Object data)
          add a object variable to the application data store.
 java.lang.Object getVariable(java.lang.String name)
          return an object variable from the application data store.
 boolean removePage(Page p)
          remove a Page object to the list.
 boolean removePage(java.lang.String name)
          remove a Page object to the list by name.
 boolean removeVariable(java.lang.String name)
          remove an object variable from the application data store.
 void run(java.lang.String name)
          run the application by starting a specific page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

events

private EventQueue events
Event queue for this application.


dict

private DataDictionary dict
Data dictionary for this application


pages

private java.util.Hashtable pages
list of pages managed by this application


os

private static java.util.Hashtable os
object store for data used by all applications running DynaPage.


callstack

private java.util.Vector callstack
stack for nested pages


active

private Page active
Reference to active page

Constructor Detail

Application

public Application(java.lang.String name)
constructor.

Parameters:
name - String - unique application name.
Method Detail

static void ()
static initialization of class.


addPage

public boolean addPage(Page p)
add a Page object to the list.

Parameters:
p - Page - page object to be added to list.
Returns:
boolean - status of operation
See Also:
Page, removePage(brf.j2me.dynaworks.Page)

addPage

public boolean addPage(java.lang.String name,
                       java.lang.Class cl)
add a Page class to the list.

Parameters:
cl - Class - class of page to be added to list.
Returns:
boolean - status of operation
See Also:
Page, removePage(brf.j2me.dynaworks.Page)

removePage

public boolean removePage(Page p)
remove a Page object to the list.

Parameters:
p - Page - page object to be removed from list.
Returns:
boolean - status of the operation.
See Also:
Page, addPage(brf.j2me.dynaworks.Page)

removePage

public boolean removePage(java.lang.String name)
remove a Page object to the list by name.

Parameters:
name - String - name of the page object to be removed from list.
Returns:
boolean - status of the operation.
See Also:
Page, addPage(brf.j2me.dynaworks.Page)

run

public void run(java.lang.String name)
run the application by starting a specific page.

Parameters:
name - String - name of the page to be executed.

addVariable

public boolean addVariable(java.lang.String name,
                           java.lang.Object data)
add a object variable to the application data store.

Parameters:
name - String - name of the variable
data - Object - data object to be added
Returns:
boolean - successfull operation?
See Also:
DataDictionary, removeVariable(java.lang.String), getVariable(java.lang.String)

removeVariable

public boolean removeVariable(java.lang.String name)
remove an object variable from the application data store.

Parameters:
name - String - name of the variable to be removed.
Returns:
boolean - successful operation?
See Also:
DataDictionary, addVariable(java.lang.String, java.lang.Object), getVariable(java.lang.String)

getVariable

public java.lang.Object getVariable(java.lang.String name)
return an object variable from the application data store.

Parameters:
name - String - name of the variable.
Returns:
Object - data object (or null)
See Also:
DataDictionary, addVariable(java.lang.String, java.lang.Object), removeVariable(java.lang.String)