public abstract class ApplicationInstance
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
FOCUSED_COMPONENT_CHANGED_PROPERTY |
static java.lang.String |
ID_STRING
The name and version of the Echo API in use.
|
static java.lang.String |
LOCALE_CHANGED_PROPERTY |
static java.lang.String |
MODAL_COMPONENTS_CHANGED_PROPERTY |
static java.lang.String |
STYLE_SHEET_CHANGED_PROPERTY |
static java.lang.String |
WINDOWS_CHANGED_PROPERTY |
| Constructor and Description |
|---|
ApplicationInstance()
Creates an
ApplicationInstance. |
| Modifier and Type | Method and Description |
|---|---|
void |
activate()
Invoked after the application has been passivated (such that its state may
be persisted or moved amongst VMs) and is about to be reactivated.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds a
PropertyChangeListener to receive notification of
application-level property changes. |
TaskQueueHandle |
createTaskQueue()
Creates a new task queue.
|
void |
dispose()
Invoked when the application is disposed and will not be used again.
|
Window |
doInit()
Initializes the
ApplicationInstance. |
void |
doValidation()
Validates all components registered with the application.
|
void |
enqueueCommand(Command command)
Queues the given stateless
Command for execution on the
current client/server synchronization. |
void |
enqueueTask(TaskQueueHandle taskQueue,
java.lang.Runnable task)
Enqueues a task to be run during the next client/server
synchronization.
|
protected void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Reports a bound property change.
|
java.lang.String |
generateId()
Generates an identifier which is unique within this
ApplicationInstance. |
static java.lang.String |
generateSystemId()
Generates a system-level identifier (an identifier which is unique to all
ApplicationInstances). |
static ApplicationInstance |
getActive()
Returns a reference to the
ApplicationInstance that is
relevant to the current thread, or null if no instance is relevant. |
Component |
getComponentByRenderId(java.lang.String renderId)
Retrieves the component currently registered with the application
with the specified render id.
|
java.lang.Object |
getContextProperty(java.lang.String propertyName)
Returns the value of a contextual property.
|
Window |
getDefaultWindow()
Returns the default window of the application.
|
Component |
getFocusedComponent()
Returns the presently focused component, if known.
|
LayoutDirection |
getLayoutDirection()
Returns the application instance's default
LayoutDirection. |
java.util.Locale |
getLocale()
Returns the application instance's default
Locale. |
Component |
getModalContextRoot()
Retrieves the root component of the current modal context, or null
if no modal context exists.
|
Style |
getStyle(java.lang.Class componentClass,
java.lang.String styleName)
Retrieves the style for the specified specified class of
component / style name.
|
StyleSheet |
getStyleSheet()
Returns the application-wide
StyleSheet, if present. |
UpdateManager |
getUpdateManager()
Retrieves the
UpdateManager being used to manage the
client/server synchronization of this ApplicationInstance |
boolean |
hasQueuedTasks()
Determines if there are any queued tasks in any of the task
queues associated with this
ApplicationInstance. |
boolean |
hasTaskQueues()
Determines if this
ApplicationInstance currently has any
active tasks queues, which might be monitoring external events. |
abstract Window |
init()
Invoked to initialize the application, returning the default window.
|
void |
passivate()
Invoked before the application is passivated (such that its state may
be persisted or moved amongst VMs).
|
void |
processInput(java.lang.String propertyName,
java.lang.Object propertyValue)
Processes client input specific to the
ApplicationInstance
received from the UpdateManager. |
void |
processQueuedTasks()
Processes all queued tasks.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a
PropertyChangeListener from receiving
notification of application-level property changes. |
void |
removeTaskQueue(TaskQueueHandle taskQueueHandle)
Removes the task queue described the specified
TaskQueueHandle. |
static void |
setActive(ApplicationInstance applicationInstance)
Sets the
ApplicationInstance that is relevant to the
current thread. |
void |
setContextProperty(java.lang.String propertyName,
java.lang.Object propertyValue)
Sets a contextual property.
|
void |
setFocusedComponent(Component newValue)
Sets the presently focused component.
|
void |
setLocale(java.util.Locale newValue)
Sets the default locale of the application.
|
void |
setStyleSheet(StyleSheet newValue)
Sets the
StyleSheet of this
ApplicationInstance. |
public static final java.lang.String ID_STRING
public static final java.lang.String FOCUSED_COMPONENT_CHANGED_PROPERTY
public static final java.lang.String LOCALE_CHANGED_PROPERTY
public static final java.lang.String MODAL_COMPONENTS_CHANGED_PROPERTY
public static final java.lang.String STYLE_SHEET_CHANGED_PROPERTY
public static final java.lang.String WINDOWS_CHANGED_PROPERTY
public static final java.lang.String generateSystemId()
ApplicationInstances).generateId()public static final ApplicationInstance getActive()
ApplicationInstance that is
relevant to the current thread, or null if no instance is relevant.ApplicationInstancepublic static final void setActive(ApplicationInstance applicationInstance)
ApplicationInstance that is relevant to the
current thread. This method should be invoked with a null
argument when the previously set ApplicationInstance is
no longer relevant.
This method should only be invoked by the application container.
applicationInstance - the relevant ApplicationInstancepublic void activate()
super.activate().public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
PropertyChangeListener to receive notification of
application-level property changes.l - the listener to addpublic TaskQueueHandle createTaskQueue()
removeTaskQueue() method. Developers must
take care to invoke removeTaskQueue() on any created
task queues.TaskQueueHandler representing the created task
queueremoveTaskQueue(TaskQueueHandle)public void dispose()
super.dispose().public final Window doInit()
ApplicationInstance. This method is
invoked by the application container.Window of the applicationjava.lang.IllegalStateException - in the event that the current thread is not
permitted to update the state of the user interfacepublic final void doValidation()
public void enqueueCommand(Command command)
Command for execution on the
current client/server synchronization.command - the Command to executepublic void enqueueTask(TaskQueueHandle taskQueue, java.lang.Runnable task)
taskQueue - the TaskQueueHandle representing the
queue into which this task should be placedtask - the task to run on client/server synchronizationprotected void firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
propertyName - the name of the changed propertyoldValue - the previous value of the propertynewValue - the present value of the propertypublic java.lang.String generateId()
ApplicationInstance. This identifier should not be
used outside of the context of this ApplicationInstance.generateSystemId()public java.lang.Object getContextProperty(java.lang.String propertyName)
propertyName - the name of the objectpublic Component getComponentByRenderId(java.lang.String renderId)
renderId - the render id of the componentpublic Window getDefaultWindow()
Windowpublic Component getFocusedComponent()
public LayoutDirection getLayoutDirection()
LayoutDirection.Localepublic java.util.Locale getLocale()
Locale.Localepublic Component getModalContextRoot()
public Style getStyle(java.lang.Class componentClass, java.lang.String styleName)
componentClass - the component ClassstyleName - the component's specified style namepublic StyleSheet getStyleSheet()
StyleSheet, if present.StyleSheetpublic UpdateManager getUpdateManager()
UpdateManager being used to manage the
client/server synchronization of this ApplicationInstanceUpdateManagerpublic final boolean hasTaskQueues()
ApplicationInstance currently has any
active tasks queues, which might be monitoring external events.public boolean hasQueuedTasks()
ApplicationInstance.
This method may be overridden by an application in order to check
on the status of long-running operations and enqueue tasks
just-in-time. In such cases tasks should be enqueued
and the value of super.hasQueuedTasks() should be
returned. This method is not invoked by a user-interface thread and
thus the component hierarchy may not be modified in
overriding implementations.
public abstract Window init()
public void passivate()
super.passivate().public void processInput(java.lang.String propertyName,
java.lang.Object propertyValue)
ApplicationInstance
received from the UpdateManager.
Derivative implementations should take care to invoke
super.processInput().public void processQueuedTasks()
UpdateManager. Tasks are removed from queues
once they have been processed.public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
PropertyChangeListener from receiving
notification of application-level property changes.l - the listener to removepublic void removeTaskQueue(TaskQueueHandle taskQueueHandle)
TaskQueueHandle.taskQueueHandle - the TaskQueueHandle specifying the
task queue to removecreateTaskQueue()public void setContextProperty(java.lang.String propertyName,
java.lang.Object propertyValue)
propertyName - the property namepropertyValue - the property valuegetContextProperty(java.lang.String)public void setFocusedComponent(Component newValue)
newValue - the component to be focusedpublic void setLocale(java.util.Locale newValue)
newValue - the new localepublic void setStyleSheet(StyleSheet newValue)
StyleSheet of this
ApplicationInstance. Components
registered with this instance will retrieve
properties from the StyleSheet
when property values are not specified directly
in a Component or in its specified Style.
Note that setting the style sheet should be done sparingly, given that doing so forces the entire client state to be updated. Generally style sheets should only be reconfigured at application initialization and/or when the user changes the visual theme of a theme-capable application.
newValue - the new style sheet