public class ApplicationContext extends AbstractBean
Applications.
Applications use ApplicationContext,
via Application.getContext(), to access global values and services.
The majority of the Swing Application Framework API can be accessed through ApplicationContext.
Application| Modifier | Constructor and Description |
|---|---|
protected |
ApplicationContext() |
| Modifier and Type | Method and Description |
|---|---|
void |
addTaskService(TaskService taskService)
Register a new TaskService with the application.
|
ActionManager |
getActionManager()
Return this application's ActionManager.
|
ApplicationActionMap |
getActionMap()
Returns the shared
ActionMap chain for the entire Application. |
ApplicationActionMap |
getActionMap(Class actionsClass,
Object actionsObject)
Returns the
ApplicationActionMap chain for the specified
actions class and target object. |
ApplicationActionMap |
getActionMap(Object actionsObject)
Defined as
getActionMap(actionsObject.getClass(), actionsObject). |
Application |
getApplication()
The
Application singleton, or null if launch hasn't
been called yet. |
Class |
getApplicationClass()
Returns the application's class or null if the application
hasn't been launched and this property hasn't been set.
|
Clipboard |
getClipboard()
Return a shared
Clipboard. |
JComponent |
getFocusOwner()
Returns the application's focus owner.
|
LocalStorage |
getLocalStorage()
The shared
LocalStorage object. |
ResourceManager |
getResourceManager()
The application's
ResourceManager provides
read-only cached access to resources in ResourceBundles via the
ResourceMap class. |
ResourceMap |
getResourceMap()
Returns the
chain of ResourceMaps
that's shared by the entire application, beginning with the one
defined for the Application class, i.e. |
ResourceMap |
getResourceMap(Class cls)
Returns a
chain of two or
more ResourceMaps. |
ResourceMap |
getResourceMap(Class startClass,
Class stopClass)
Returns a
chain of two or more
ResourceMaps. |
SessionStorage |
getSessionStorage()
The shared
SessionStorage object. |
TaskMonitor |
getTaskMonitor()
Returns a shared TaskMonitor object.
|
TaskService |
getTaskService()
Returns the default TaskService, i.e.
|
TaskService |
getTaskService(String name)
Look up a task service by name.
|
List<TaskService> |
getTaskServices()
Returns a read-only view of the complete list of TaskServices.
|
void |
removeTaskService(TaskService taskService)
Unregister a previously registered TaskService.
|
protected void |
setActionManager(ActionManager actionManager)
Change this application's
ActionManager. |
void |
setApplicationClass(Class applicationClass)
Called by
Application.launch() to
record the application's class. |
protected void |
setLocalStorage(LocalStorage localStorage)
The shared
LocalStorage object. |
protected void |
setResourceManager(ResourceManager resourceManager)
Change this application's
ResourceManager. |
protected void |
setSessionStorage(SessionStorage sessionStorage)
The shared
SessionStorage object. |
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerpublic final Class getApplicationClass()
getApplication().getClass().setApplicationClass(java.lang.Class),
getApplication()public final void setApplicationClass(Class applicationClass)
Application.launch() to
record the application's class.
This method is only intended for testing, or design time configuration. Normal applications shouldn't need to call it directly.
applicationClass - getApplicationClass()public final Application getApplication()
Application singleton, or null if launch hasn't
been called yet.Application.launch(java.lang.Class<T>, java.lang.String[])public final ResourceManager getResourceManager()
ResourceManager provides
read-only cached access to resources in ResourceBundles via the
ResourceMap class.getResourceMap(Class, Class)protected void setResourceManager(ResourceManager resourceManager)
ResourceManager. An
ApplicationContext subclass that
wanted to fundamentally change the way ResourceMaps were
created and cached could replace this property in its constructor.
Throws an IllegalArgumentException if resourceManager is null.
resourceManager - the new value of the resourceManager property.getResourceMap(Class, Class),
getResourceManager()public final ResourceMap getResourceMap(Class cls)
chain of two or
more ResourceMaps. The first encapsulates the ResourceBundles
defined for the specified class, and its parent
encapsulates the ResourceBundles defined for the entire application.
This is just a convenience method that calls
ResourceManager.getResourceMap(). It's defined as:
return getResourceManager().getResourceMap(cls, cls);
cls - the class that defines the location of ResourceBundlesResourceMap that contains resources loaded from
ResourceBundles found in the resources subpackage of the
specified class's package.ResourceManager.getResourceMap(Class)public final ResourceMap getResourceMap(Class startClass, Class stopClass)
chain of two or more
ResourceMaps. The first encapsulates the ResourceBundles
defined for the all of the classes between startClass
and stopClass inclusive. It's parent encapsulates the
ResourceBundles defined for the entire application.
This is just a convenience method that calls
ResourceManager.getResourceMap(). It's defined as:
return getResourceManager().getResourceMap(startClass, stopClass);
startClass - the first class whose ResourceBundles will be includedstopClass - the last class whose ResourceBundles will be includedResourceMap that contains resources loaded from
ResourceBundles found in the resources subpackage of the
specified class's package.ResourceManager.getResourceMap(Class, Class)public final ResourceMap getResourceMap()
chain of ResourceMaps
that's shared by the entire application, beginning with the one
defined for the Application class, i.e. the value of the
applicationClass property.
This is just a convenience method that calls
ResourceManager.getResourceMap(). It's defined as:
return getResourceManager().getResourceMap();
ResourceManager.getResourceMap(),
getApplicationClass()public final ActionManager getActionManager()
getActionMap(Object)protected void setActionManager(ActionManager actionManager)
ActionManager. An
ApplicationContext subclass that
wanted to fundamentally change the way ActionManagers were
created and cached could replace this property in its constructor.
Throws an IllegalArgumentException if actionManager is null.
actionManager - the new value of the actionManager property.getActionManager(),
getActionMap(Object)public final ApplicationActionMap getActionMap()
ActionMap chain for the entire Application.
This is just a convenience method that calls
ActionManager.getActionMap(). It's defined as:
return getActionManager().getActionMap()
ActionMap chain for the entire Application.ActionManager.getActionMap()public final ApplicationActionMap getActionMap(Class actionsClass, Object actionsObject)
ApplicationActionMap chain for the specified
actions class and target object.
This is just a convenience method that calls
ActionManager.getActionMap(Class, Object). It's defined as:
return getActionManager().getActionMap(actionsClass, actionsObject)
actionsClass - actionsObject - ActionMap chain for the entire Application.ActionManager.getActionMap(Class, Object)public final ApplicationActionMap getActionMap(Object actionsObject)
getActionMap(actionsObject.getClass(), actionsObject).actionsObject - ActionMap for the specified objectgetActionMap(Class, Object)public final LocalStorage getLocalStorage()
LocalStorage object.LocalStorage object.protected void setLocalStorage(LocalStorage localStorage)
LocalStorage object.localStorage - the shared LocalStorage object.public final SessionStorage getSessionStorage()
SessionStorage object.SessionStorage object.protected void setSessionStorage(SessionStorage sessionStorage)
SessionStorage object.sessionStorage - the shared SessionStorage object.public Clipboard getClipboard()
Clipboard.Clipboard.public JComponent getFocusOwner()
public void addTaskService(TaskService taskService)
getTaskService(String).taskService - Task service to registerpublic void removeTaskService(TaskService taskService)
taskService - TaskService to unregisterpublic TaskService getTaskService(String name)
name - Name of the task service to retrieve.public final TaskService getTaskService()
return getTaskService("default"). The
ApplicationAction actionPerformed
method executes background Tasks on the default
TaskService. Application's can launch Tasks in the same way, e.g.
Application.getInstance().getContext().getTaskService().execute(myTask);
getTaskService(String)public List<TaskService> getTaskServices()
addTaskService(org.jdesktop.application.TaskService),
removeTaskService(org.jdesktop.application.TaskService)public final TaskMonitor getTaskMonitor()
Copyright © 2009–2016. All rights reserved.