|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.application.AbstractBean
org.jdesktop.application.ApplicationContext
public class ApplicationContext
A singleton that manages shared objects, like actions, resources, and tasks,
for Applications
.
Applications
use the ApplicationContext
singleton to find global values and services. The majority of the
Swing Application Framework API can be accessed through ApplicationContext
. The static getInstance
method returns
the singleton Typically it's only called after the application has
been launched
, however it is always safe
to call getInstance
.
Application
Constructor Summary | |
---|---|
protected |
ApplicationContext()
|
Method Summary | |
---|---|
void |
addTaskService(TaskService taskService)
|
ActionManager |
getActionManager()
|
ApplicationActionMap |
getActionMap()
Returns the shared ActionMap chain for the entire Application . |
ApplicationActionMap |
getActionMap(java.lang.Class actionsClass,
java.lang.Object actionsObject)
Returns the ApplicationActionMap chain for the specified
actions class and target object. |
ApplicationActionMap |
getActionMap(java.lang.Object actionsObject)
Defined as getActionMap(actionsObject.getClass(), actionsObject) . |
Application |
getApplication()
The Application singleton, or null if launch hasn't
been called yet. |
java.lang.Class |
getApplicationClass()
Returns the application's class or null if the application hasn't been launched and this property hasn't been set. |
java.awt.datatransfer.Clipboard |
getClipboard()
A shared Clipboard . |
javax.swing.JComponent |
getFocusOwner()
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. the value of the
applicationClass property. |
ResourceMap |
getResourceMap(java.lang.Class cls)
Returns a chain of two or
more ResourceMaps. |
ResourceMap |
getResourceMap(java.lang.Class startClass,
java.lang.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. the one named "default": return getTaskService("default") . |
TaskService |
getTaskService(java.lang.String name)
|
java.util.List<TaskService> |
getTaskServices()
Returns a read-only view of the complete list of TaskServices. |
void |
removeTaskService(TaskService taskService)
|
protected void |
setActionManager(ActionManager actionManager)
Change this application's ActionManager . |
void |
setApplicationClass(java.lang.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. |
Methods inherited from class org.jdesktop.application.AbstractBean |
---|
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ApplicationContext()
Method Detail |
---|
public final java.lang.Class getApplicationClass()
getApplication().getClass()
.
setApplicationClass(java.lang.Class)
,
getApplication()
public final void setApplicationClass(java.lang.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.
getApplicationClass()
public final Application getApplication()
Application
singleton, or null if launch
hasn't
been called yet.
Application.launch(java.lang.Class, 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(java.lang.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 ResourceBundles
ResourceMap
that contains resources loaded from
ResourceBundles
found in the resources subpackage of the
specified class's package.ResourceManager.getResourceMap(Class)
public final ResourceMap getResourceMap(java.lang.Class startClass, java.lang.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 included
ResourceMap
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(java.lang.Class actionsClass, java.lang.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)
ActionMap
chain for the entire Application
.ActionManager.getActionMap(Class, Object)
public final ApplicationActionMap getActionMap(java.lang.Object actionsObject)
getActionMap(actionsObject.getClass(), 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 java.awt.datatransfer.Clipboard getClipboard()
Clipboard
.
public javax.swing.JComponent getFocusOwner()
public void addTaskService(TaskService taskService)
public void removeTaskService(TaskService taskService)
public TaskService getTaskService(java.lang.String name)
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.
ApplicationContext.getInstance().getTaskService().execute(myTask);
getTaskService(String)
public java.util.List<TaskService> getTaskServices()
addTaskService(org.jdesktop.application.TaskService)
,
removeTaskService(org.jdesktop.application.TaskService)
public final TaskMonitor getTaskMonitor()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |