public interface ApplicationContext
RWT.getApplicationContext()
. It can be used to store any data that is shared between all
UI sessions of an application, and to acquire application-scoped instances of framework services
such as the resource manager.
The application context is bound to the servlet context of the hosting web application. It is
destroyed when the web application ends (i.e. the servlet context is destroyed) or when the
application is explicitly stopped by calling ApplicationRunner.stop()
.
The application context is thread safe, it can be accessed concurrently from different threads.
RWT
Modifier and Type | Method and Description |
---|---|
boolean |
addApplicationContextListener(ApplicationContextListener listener)
Adds an
ApplicationContextListener to this application context. |
void |
addUIThreadListener(UIThreadListener listener)
Adds a
UIThreadListener to this application context. |
java.lang.Object |
getAttribute(java.lang.String name)
Returns the value which is stored under the given name in this application context.
|
ResourceManager |
getResourceManager()
Returns the instance of the resource manager for this application context.
|
ServiceManager |
getServiceManager()
Returns the instance of the service manager for this application context.
|
boolean |
removeApplicationContextListener(ApplicationContextListener listener)
Removes an
ApplicationContextListener from this application context. |
void |
removeAttribute(java.lang.String name)
Removes the object which is stored under the given name in this application context.
|
void |
removeUIThreadListener(UIThreadListener listener)
Removes a
UIThreadListener from this application context. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Stores the given value in this application context, associated with the given name.
|
void setAttribute(java.lang.String name, java.lang.Object value)
name
- the name to associate the value withvalue
- the object to be storedjava.lang.Object getAttribute(java.lang.String name)
name
- the name whose associated value is requestednull
if no object has been stored by that
namevoid removeAttribute(java.lang.String name)
void addUIThreadListener(UIThreadListener listener)
UIThreadListener
to this application context. UIThreadListeners are used to
receive a notification before the UIThread is entered and after it is left. If the given
listener was already added the method has no effect.listener
- the listener to be addedvoid removeUIThreadListener(UIThreadListener listener)
UIThreadListener
from this application context. UIThreadListeners are
used to receive a notification before the UIThread is entered and after it is left. If the
given listener was not added to this application context before, this method has no effect.listener
- the listener to be removedboolean addApplicationContextListener(ApplicationContextListener listener)
ApplicationContextListener
to this application context.
ApplicationContextListeners are used to receive a notification before the application context
is destroyed. If the given listener was already added the method has no effect.
If the ApplicationContext is already deactivated or is about to be deactivated, the listener
will not be added and this method will return false
. A return value of
true
asserts that this listener is registered and will be called on destroy.
listener
- the listener to be addedtrue
if the listener is registered, false
if notboolean removeApplicationContextListener(ApplicationContextListener listener)
ApplicationContextListener
from this application context.
ApplicationContextListeners are used to receive a notification before the application context
is destroyed. If the given listener was not added to this application context before, this
method has no effect.
If the ApplicationContext is already deactivated or is about to be deactivated, the listener
will not be removed and this method will return false
. A return value of
true
asserts that this listener is not registered and will not be called anymore.
listener
- the listener to be removedResourceManager getResourceManager()
ResourceManager
ServiceManager getServiceManager()
ServiceManager
,
ServiceHandler
Copyright (c) EclipseSource and others 2002, 2018.
All rights reserved. This program and the accompanying materials
are made available under the terms of the
Eclipse Public License v1.0