public interface ApplicationContext extends TransformerContext
Definition of an interface for accessing application global information.
This interface defines a context of the actual running application. This context stores some important information and helper objects that are usually needed by many components in the application. The main application class of this framework will provide access to the global context object so the information stored here can be obtained from everywhere.
Modifier and Type | Method and Description |
---|---|
ActionStore |
getActionStore()
Returns the application's
ActionStore . |
BeanContext |
getBeanContext()
Returns the application global
BeanContext . |
ClassLoaderProvider |
getClassLoaderProvider()
Returns the
ClassLoaderProvider to be used. |
org.apache.commons.configuration.Configuration |
getConfiguration()
Returns a reference to the configuration data of the running application.
|
GUISynchronizer |
getGUISynchronizer()
Returns the GUI synchronizer.
|
Window |
getMainWindow()
Returns the application's main window.
|
MessageOutput |
getMessageOutput()
Returns a reference to the object for displaying messages.
|
Object |
getResource(Message msg)
Convenience method for looking up a resource that is specified as a
Message object. |
Object |
getResource(Object resID)
Convenience method for looking up a resource.
|
Object |
getResource(Object groupID,
Object resID)
Convenience method for looking up a resource specified as group and
resource ID.
|
String |
getResourceText(Message msg)
Convenience method for looking up the text of a resource specified as a
Message object. |
String |
getResourceText(Object resID)
Convenience method for looking up the text of a specified resource.
|
String |
getResourceText(Object groupID,
Object resID)
Convenience method for looking up the text of a resource specified as
group and resource ID.
|
ApplicationBuilderData |
initBuilderData()
Returns an initialized
ApplicationBuilderData object that
can be used for calling the GUI builder. |
int |
messageBox(Object resMsg,
Object resTitle,
int msgType,
int btnType)
A convenience method for displaying a message box.
|
Builder |
newBuilder()
Returns a new
instance. |
void |
setActionStore(ActionStore actionStore)
Sets the application's
ActionStore . |
void |
setClassLoaderProvider(ClassLoaderProvider provider)
Sets the
ClassLoaderProvider to be used. |
void |
setConfiguration(org.apache.commons.configuration.Configuration configuration)
Sets the global configuration object of this application.
|
void |
setLocale(Locale locale)
Allows to set the current locale.
|
void |
setMainWindow(Window mainWindow)
Allows to set the application's main window.
|
void |
setMessageOutput(MessageOutput msg)
Sets the message output object to be used by this application.
|
void |
setResourceManager(ResourceManager rm)
Sets the resource manager.
|
<T> void |
setTypedProperty(Class<T> propCls,
T value)
Sets the value of a typed property.
|
getLocale, getResourceManager, getTypedProperty, getValidationMessageHandler, properties
void setLocale(Locale locale)
locale
- the locale of the actual uservoid setResourceManager(ResourceManager rm)
rm
- the resource manager to useorg.apache.commons.configuration.Configuration getConfiguration()
void setConfiguration(org.apache.commons.configuration.Configuration configuration)
configuration
- the configuration objectBeanContext getBeanContext()
BeanContext
. This is the
main entry point into the dependency injection framework. From
this object the globally defined beans can be obtained.ClassLoaderProvider getClassLoaderProvider()
ClassLoaderProvider
to be used.ClassLoaderProvider
void setClassLoaderProvider(ClassLoaderProvider provider)
ClassLoaderProvider
to be used. This object is
consulted when a class is to be resolved by name.provider
- the class loader provider to be usedMessageOutput getMessageOutput()
void setMessageOutput(MessageOutput msg)
msg
- the new MessageOutput
objectint messageBox(Object resMsg, Object resTitle, int msgType, int btnType)
MessageOutput
object. Before
that the passed in resource IDs (which can be either resource IDs or
instances of the Message
class) will be resolved.resMsg
- the resource defining the message to be displayedresTitle
- the resource defining the message box's title (can be
null)msgType
- the message type (one of the MESSAGE_XXX
constants of MessageOutput
)btnType
- the button type (one of the BTN_XXX
constants
of MessageOutput
)RET_XXX
constants of MessageOutput
)MessageOutput
GUISynchronizer getGUISynchronizer()
GUISynchronizer
objectWindow getMainWindow()
void setMainWindow(Window mainWindow)
mainWindow
- the new main windowBuilder newBuilder()
Builder
instance. This instance can
be used for processing a builder definition file. Note that the returned
Builder
object should only be used by a single thread.Builder
instanceApplicationBuilderData initBuilderData()
ApplicationBuilderData
object that
can be used for calling the GUI builder. Most of the properties of the
returned object are already set to default values, so only specific
settings must be performed.Object getResource(Object groupID, Object resID)
groupID
- the resource group IDresID
- the resource IDMissingResourceException
- if the resource cannot be foundObject getResource(Message msg)
Message
object.msg
- the resource definition (must not be null)MissingResourceException
- if the resource cannot be foundIllegalArgumentException
- if then message is undefinedObject getResource(Object resID)
Message
. If
this is the case, the resource group and the resource ID are extracted
from this object. Otherwise the passed in object is interpreted as
resource ID and the default resource group will be used.resID
- the resource IDMissingResourceException
- if the resource cannot be foundString getResourceText(Object groupID, Object resID)
groupID
- the resource group IDresID
- the resource IDMissingResourceException
- if the resource cannot be foundString getResourceText(Message msg)
Message
object.msg
- defines the resource (must not be null)MissingResourceException
- if the resource cannot be foundIllegalArgumentException
- if the message is undefinedString getResourceText(Object resID)
getResourceText(Object)
,
especially the passed in object can be an instance of
Message
.resID
- defines the requested resourceMissingResourceException
- if the resource cannot be foundActionStore getActionStore()
ActionStore
.void setActionStore(ActionStore actionStore)
ActionStore
. This object contains
the definitions for all top level actions known to the application.actionStore
- the new action store<T> void setTypedProperty(Class<T> propCls, T value)
TransformerContext.getTypedProperty(Class)
method. This provides type-safe access to arbitrary properties. A use
case for this method is the storage of application-global data in the
ApplicationContext
. All components that have access to an ApplicationContext
can also obtain or manipulate the data stored in
these properties. Because the ApplicationContext
can be accessed
from multiple threads (e.g. the event dispatch thread and the worker
thread used by the application to execute background tasks) an
implementation should ensure a proper synchronization. A typed property
can be cleared by passing the value null. The property class must
not be null, otherwise an exception is thrown.T
- the type of the propertypropCls
- the property classvalue
- the new value for this propertyIllegalArgumentException
- if the property class is nullCopyright © 2016 The JGUIraffe Team. All rights reserved.