|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jguiraffe.gui.app.ApplicationContextImpl
public class ApplicationContextImpl
A default implementation of the ApplicationContext interface.
This class is used by the Application class to store global
information that is needed by different components of an application. Because
an ApplicationContext implementation also implements the
TransformerContext interface instances can also be passed to
transformer objects.
TransformerContext| Constructor Summary | |
|---|---|
ApplicationContextImpl()
Creates a new instance of ApplicationContextImpl. |
|
ApplicationContextImpl(java.util.Locale locale)
Creates a new instance of ApplicationContextImpl and sets
the current locale. |
|
ApplicationContextImpl(java.util.Locale locale,
ResourceManager resMan)
Creates a new instance of ApplicationContextImpl and sets
the current locale and the resource manager to use. |
|
| Method Summary | ||
|---|---|---|
protected BindingStrategy |
fetchBindingStrategy()
Obtains the BindingStrategy for a builder operation. |
|
ActionStore |
getActionStore()
Returns the application's ActionStore. |
|
BeanContext |
getBeanContext()
Returns the global bean context. |
|
ClassLoaderProvider |
getClassLoaderProvider()
Returns the class loader provider. |
|
org.apache.commons.configuration.Configuration |
getConfiguration()
Returns a reference to the global configuration. |
|
GUISynchronizer |
getGUISynchronizer()
Returns the GUISynchronizer. |
|
java.util.Locale |
getLocale()
Returns the actual locale. |
|
Window |
getMainWindow()
Returns the application's main window. |
|
MessageOutput |
getMessageOutput()
Returns a reference to the object for displaying messages. |
|
java.lang.Object |
getResource(Message msg)
Convenience method for looking up a resource that is specified as a Message object. |
|
java.lang.Object |
getResource(java.lang.Object resID)
Convenience method for looking up a resource. |
|
java.lang.Object |
getResource(java.lang.Object groupID,
java.lang.Object resID)
Convenience method for looking up a resource specified as group and resource ID. |
|
ResourceManager |
getResourceManager()
Returns the actual resource manager. |
|
java.lang.String |
getResourceText(Message msg)
Convenience method for looking up the text of a resource specified as a Message object. |
|
java.lang.String |
getResourceText(java.lang.Object resID)
Convenience method for looking up the text of a specified resource. |
|
java.lang.String |
getResourceText(java.lang.Object groupID,
java.lang.Object resID)
Convenience method for looking up the text of a resource specified as group and resource ID. |
|
|
getTypedProperty(java.lang.Class<T> propCls)
Returns the value of the specified typed property or null if it cannot be found. |
|
ValidationMessageHandler |
getValidationMessageHandler()
Returns the ValidationMessageHandler. |
|
ApplicationBuilderData |
initBuilderData()
Returns an initialized ApplicationBuilderData object that
can be used for calling the GUI builder. |
|
int |
messageBox(java.lang.Object resMsg,
java.lang.Object resTitle,
int msgType,
int btnType)
A convenience method for displaying a message box. |
|
Builder |
newBuilder()
Returns a new instance. |
|
java.util.Map<java.lang.String,java.lang.Object> |
properties()
Returns a map with properties maintained by this context. |
|
void |
setActionStore(ActionStore actionStore)
Sets the application's ActionStore. |
|
void |
setBeanContext(BeanContext beanContext)
Sets the global bean context. |
|
void |
setClassLoaderProvider(ClassLoaderProvider classLoaderProvider)
Sets the ClassLoaderProvider. |
|
void |
setConfiguration(org.apache.commons.configuration.Configuration configuration)
Sets the global configuration. |
|
void |
setLocale(java.util.Locale locale)
Sets the actual 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 resourceManager)
Sets the resource manager. |
|
|
setTypedProperty(java.lang.Class<T> propCls,
T value)
Sets the value of the given typed property. |
|
void |
setValidationMessageHandler(ValidationMessageHandler validationMessageHandler)
Sets the ValidationMessageHandler. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ApplicationContextImpl()
ApplicationContextImpl. The
instance is not yet initialized.
public ApplicationContextImpl(java.util.Locale locale)
ApplicationContextImpl and sets
the current locale.
locale - the Locale
public ApplicationContextImpl(java.util.Locale locale,
ResourceManager resMan)
ApplicationContextImpl and sets
the current locale and the resource manager to use.
locale - the LocaleresMan - the ResourceManager to use| Method Detail |
|---|
public java.util.Locale getLocale()
getLocale in interface TransformerContextLocalepublic void setLocale(java.util.Locale locale)
setLocale in interface ApplicationContextlocale - the new Localepublic ResourceManager getResourceManager()
getResourceManager in interface TransformerContextResourceManager for accessing resourcespublic void setResourceManager(ResourceManager resourceManager)
setResourceManager in interface ApplicationContextresourceManager - the ResourceManagerpublic java.util.Map<java.lang.String,java.lang.Object> properties()
properties in interface TransformerContextpublic org.apache.commons.configuration.Configuration getConfiguration()
getConfiguration in interface ApplicationContextpublic void setConfiguration(org.apache.commons.configuration.Configuration configuration)
setConfiguration in interface ApplicationContextconfiguration - the configuration objectpublic BeanContext getBeanContext()
getBeanContext in interface ApplicationContextpublic void setBeanContext(BeanContext beanContext)
beanContext - the new bean contextpublic ClassLoaderProvider getClassLoaderProvider()
getClassLoaderProvider in interface ApplicationContextClassLoaderProviderpublic void setClassLoaderProvider(ClassLoaderProvider classLoaderProvider)
ClassLoaderProvider.
setClassLoaderProvider in interface ApplicationContextclassLoaderProvider - the new class loader providerpublic ValidationMessageHandler getValidationMessageHandler()
ValidationMessageHandler.
getValidationMessageHandler in interface TransformerContextValidationMessageHandlerpublic void setValidationMessageHandler(ValidationMessageHandler validationMessageHandler)
ValidationMessageHandler. This object can be
queried by validators to obtain a specific validation message.
validationMessageHandler - the new
ValidationMessageHandler (must not be null)
java.lang.IllegalArgumentException - if the passed validation message handler
is nullpublic MessageOutput getMessageOutput()
getMessageOutput in interface ApplicationContextpublic void setMessageOutput(MessageOutput msg)
setMessageOutput in interface ApplicationContextmsg - the new MessageOutput object
public java.lang.Object getResource(java.lang.Object groupID,
java.lang.Object resID)
getResource in interface ApplicationContextgroupID - the resource group IDresID - the resource ID
java.util.MissingResourceException - if the resource cannot be foundpublic java.lang.Object getResource(Message msg)
Message object.
getResource in interface ApplicationContextmsg - the resource definition (must not be null)
java.util.MissingResourceException - if the resource cannot be found
java.lang.IllegalArgumentException - if then message is undefinedpublic java.lang.Object getResource(java.lang.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.
getResource in interface ApplicationContextresID - the resource ID
java.util.MissingResourceException - if the resource cannot be found
public java.lang.String getResourceText(java.lang.Object groupID,
java.lang.Object resID)
getResourceText in interface ApplicationContextgroupID - the resource group IDresID - the resource ID
java.util.MissingResourceException - if the resource cannot be foundpublic java.lang.String getResourceText(Message msg)
Message object.
getResourceText in interface ApplicationContextmsg - defines the resource (must not be null)
java.util.MissingResourceException - if the resource cannot be found
java.lang.IllegalArgumentException - if the message is undefinedpublic java.lang.String getResourceText(java.lang.Object resID)
getResourceText(Object),
especially the passed in object can be an instance of
Message.
getResourceText in interface ApplicationContextresID - defines the requested resource
java.util.MissingResourceException - if the resource cannot be found
public int messageBox(java.lang.Object resMsg,
java.lang.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.
messageBox in interface ApplicationContextresMsg - 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)MessageOutputpublic GUISynchronizer getGUISynchronizer()
GUISynchronizer. This implementation obtains
the synchronizer from the bean context.
getGUISynchronizer in interface ApplicationContextGUISynchronizerpublic Window getMainWindow()
getMainWindow in interface ApplicationContextpublic void setMainWindow(Window mainWindow)
setMainWindow in interface ApplicationContextmainWindow - the new main windowpublic ActionStore getActionStore()
ActionStore.
getActionStore in interface ApplicationContextpublic void setActionStore(ActionStore actionStore)
ActionStore. This object contains
the definitions for all top level actions known to the application.
setActionStore in interface ApplicationContextactionStore - the new action storepublic Builder newBuilder()
Builder instance. This
implementation obtains the builder instance from the global bean context.
newBuilder in interface ApplicationContextBuilder instancepublic ApplicationBuilderData 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. The following properties have already been
initialized with information available directly in this object or from
the configuration:
ActionStore managed by this object is empty, it is
directly used. Otherwise a new ActionStore instance is
created with the managed ActionStore as parent. This has
the effect that the first builder script will populate the global action
store. Further scripts use their own store.MessageOutput objectCommandQueueBindingStrategyBeanCreationListener is set that can inject a reference to
the central Application object into beans implementing the
ApplicationClient interface
initBuilderData in interface ApplicationContextpublic <T> T getTypedProperty(java.lang.Class<T> propCls)
getTypedProperty in interface TransformerContextT - the type of the propertypropCls - the property class
public <T> void setTypedProperty(java.lang.Class<T> propCls,
T value)
setTypedProperty in interface ApplicationContextT - the type of the propertypropCls - the property class (must not be null)value - the new value (null for clearing this property)
java.lang.IllegalArgumentException - if the property class is nullprotected BindingStrategy fetchBindingStrategy()
BindingStrategy for a builder operation. This method
is invoked by initBuilderData() for populating the bindingStrategy property of the ApplicationBuilderData object.
The default algorithm looks up the BindingStrategy from the
global BeanContext.
BindingStrategy
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||