com.sptci.echo2
Class Application

java.lang.Object
  extended by nextapp.echo2.app.ApplicationInstance
      extended by com.sptci.echo2.Application
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Application

public class Application
extends ApplicationInstance

A base class that extends ApplicationInstance and can serve as the base class for the application specific global application instance.

Copyright 2006 Sans Pareil Technologies, Inc.

Version:
$Id: Application.java 3321 2007-06-07 17:53:13Z rakesh $
Author:
Rakesh Vidyadharan 2006-11-23
See Also:
Serialized Form

Field Summary
protected  String contentPane
          The fully qualified name of the ContentPane class that will be set as the content of window.
protected static Logger logger
          The logger to use to log errors/messages to.
static int MINIMUM_INTERVAL
          The minimum interval at which tasks will be enqueued.
protected  int pollingInterval
          The polling interval as which any tasks in updateTasks will be executed.
protected  String styleSheet
          The fully qualified name of the StyleSheet class that will be set for the application.
private  TaskQueueHandle taskQueue
          The task queue handle for this application instance.
static Map<String,TimeZone> TIME_ZONES
          A map that is used to store the time offsets from UTC and their corresponding time zone short names.
protected  TimeZone timeZone
          The time zone for the client browser.
private  Map<Controller.Updater,Runnable> updateTasks
          A container used to store all the tasks that have been queued for the current application session.
protected  User user
          The value object that represents the user currently logged on to the application.
protected  Window window
          The Window instance that will be controlled by this application.
 
Fields inherited from class nextapp.echo2.app.ApplicationInstance
FOCUSED_COMPONENT_CHANGED_PROPERTY, ID_STRING, LOCALE_CHANGED_PROPERTY, MODAL_COMPONENTS_CHANGED_PROPERTY, WINDOWS_CHANGED_PROPERTY
 
Constructor Summary
Application()
          Default constructor.
 
Method Summary
 void addPane(FloatingPane pane)
          Add the specified FloatingPane to the ContentPane of window with an appropriate z-index.
protected  void addTask(Controller.Updater updater, Runnable runnable)
          Add the specified updater task to the task queue.
static Application getApplication()
          Convenience method to return the active application as a properly typed object.
 String getContentPane()
          Return contentPane, the fully qualified name of the ContentPane used in window.
 Locale[] getLocales()
          Return the Locales specified by the client browser for the current session.
static String getOffset(int offset)
          Parse the specified offset from UTC in milliseconds and return it in HHmm format.
static View getParentView(Component component)
          Return the view component that is the parent of the specified component.
 String getStyleSheet()
          Return styleSheet.
 TimeZone getTimeZone()
          Return the timezone of the client browser.
 User getUser()
          Returns user.
 Window getWindow()
          Returns window.
protected  int getZIndex()
          Get the z-index value to use for the next FloatingPane component to be added.
 boolean hasQueuedTasks()
          Over-ridden to enqueue each task in updateTasks.
 Window init()
          The mandatory initialisation method.
 void processFatalException(Throwable t)
          A global handler for exceptions encountered while updating the display.
 void removePane(FloatingPane pane)
          Remove the specified FloatingPane from the ContentPane of window.
protected  void removeTask(Controller.Updater updater)
          Remove the specified updater task from the task queue.
 void setContentPane(String contentPane)
          Sets the values of contentPane to the fully qualified name of the ContentPane class.
 void setStyleSheet(String styleSheet)
          Sets the value of styleSheet.
 void setUser(User user)
          Set user.
protected  void updatePollingInterval()
          Update pollingInterval to the maximum value in the intervals for all the tasks that are queued.
 
Methods inherited from class nextapp.echo2.app.ApplicationInstance
activate, activated, addPropertyChangeListener, createTaskQueue, deactivating, dispose, doInit, doValidation, enqueueCommand, enqueueTask, firePropertyChange, generateId, generateSystemId, getActive, getComponentByRenderId, getContextProperty, getDefaultWindow, getFocusedComponent, getLayoutDirection, getLocale, getModalContextRoot, getStyle, getUpdateManager, hasTaskQueues, passivate, processInput, processQueuedTasks, removePropertyChangeListener, removeTaskQueue, setActive, setContextProperty, setFocusedComponent, setLocale, setStyleSheet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Logger logger
The logger to use to log errors/messages to.


MINIMUM_INTERVAL

public static final int MINIMUM_INTERVAL
The minimum interval at which tasks will be enqueued.

See Also:
Constant Field Values

TIME_ZONES

public static final Map<String,TimeZone> TIME_ZONES
A map that is used to store the time offsets from UTC and their corresponding time zone short names.


taskQueue

private TaskQueueHandle taskQueue
The task queue handle for this application instance.


updateTasks

private Map<Controller.Updater,Runnable> updateTasks
A container used to store all the tasks that have been queued for the current application session.


pollingInterval

protected int pollingInterval
The polling interval as which any tasks in updateTasks will be executed.


timeZone

protected TimeZone timeZone
The time zone for the client browser.


window

protected Window window
The Window instance that will be controlled by this application.


contentPane

protected String contentPane
The fully qualified name of the ContentPane class that will be set as the content of window.


styleSheet

protected String styleSheet
The fully qualified name of the StyleSheet class that will be set for the application.


user

protected User user
The value object that represents the user currently logged on to the application.

Constructor Detail

Application

public Application()
Default constructor. No actions required.

Method Detail

getApplication

public static Application getApplication()
Convenience method to return the active application as a properly typed object.

Returns:
The currently active Application instance.

init

public Window init()
The mandatory initialisation method. Initialises window and returns it.

Specified by:
init in class ApplicationInstance
Returns:
Window The properly initialised window.
See Also:
ServerDelayMessage, setStyleSheet(java.lang.String), Window.setContent(nextapp.echo2.app.ContentPane)

processFatalException

public void processFatalException(Throwable t)
A global handler for exceptions encountered while updating the display.

Parameters:
t - The fatal exception

getWindow

public Window getWindow()
Returns window.

Returns:
Window The value/reference of/to window.

addPane

public void addPane(FloatingPane pane)
Add the specified FloatingPane to the ContentPane of window with an appropriate z-index.

Parameters:
pane - The window pane that is to be added.
See Also:
getZIndex()

removePane

public void removePane(FloatingPane pane)
Remove the specified FloatingPane from the ContentPane of window.

Parameters:
pane - The pane window pane that is to be removed.

getZIndex

protected int getZIndex()
Get the z-index value to use for the next FloatingPane component to be added.


addTask

protected void addTask(Controller.Updater updater,
                       Runnable runnable)
Add the specified updater task to the task queue.


removeTask

protected void removeTask(Controller.Updater updater)
Remove the specified updater task from the task queue.


updatePollingInterval

protected void updatePollingInterval()
Update pollingInterval to the maximum value in the intervals for all the tasks that are queued.


hasQueuedTasks

public boolean hasQueuedTasks()
Over-ridden to enqueue each task in updateTasks.

Overrides:
hasQueuedTasks in class ApplicationInstance

getLocales

public Locale[] getLocales()
Return the Locales specified by the client browser for the current session. The getLocale method inherited from ApplicationInstance returns only the locale of the server.

Returns:
The locales specified by the client browser.

getTimeZone

public TimeZone getTimeZone()
Return the timezone of the client browser. Initialises timeZone lazily.

Returns:
The timezone of the client browser.

getOffset

public static String getOffset(int offset)
Parse the specified offset from UTC in milliseconds and return it in HHmm format. This is used to lookup TimeZone instances.

Parameters:
offset - The offset from UTC in milliseconds.
Returns:
The string representation in proper format.

getParentView

public static View getParentView(Component component)
Return the view component that is the parent of the specified component.

Parameters:
component - The component whose parent view is to be returned.
Returns:
The parent view or null if no parent that is an instance of view exists.

getContentPane

public String getContentPane()
Return contentPane, the fully qualified name of the ContentPane used in window.

Returns:
The fully qualified name of the content pane.

setContentPane

public void setContentPane(String contentPane)
Sets the values of contentPane to the fully qualified name of the ContentPane class.

Parameters:
contentPane - The value to set.

getStyleSheet

public String getStyleSheet()
Return styleSheet.

Returns:
The fully qualified name being used.

setStyleSheet

public void setStyleSheet(String styleSheet)
Sets the value of styleSheet.

Parameters:
styleSheet - The fully qualified name to set.

getUser

public User getUser()
Returns user.

Returns:
The value/reference of/to user.

setUser

public void setUser(User user)
Set user.

Parameters:
user - The value to set.