Package net.sf.jguiraffe.gui.app
Class ApplicationBuilderData
- java.lang.Object
-
- net.sf.jguiraffe.gui.app.ApplicationBuilderData
-
- All Implemented Interfaces:
BuilderData
public class ApplicationBuilderData extends Object implements BuilderData
The application specific default implementation of the
BuilderData
interface.This class provides meaningful implementations of all methods required by the
BuilderData
interface. An instance can be obtained from theApplicationContext
class that is already initialized with predefined values for many fields. So a client need not bother with all of the data supported by this interface, but has only to set the values it is specially interested in.Implementation note: this class is not thread-safe. The typical usage scenario is that an instance is requested from
ApplicationContext
, initialized with the properties required by the application and passed to a builder.- Version:
- $Id: ApplicationBuilderData.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
- See Also:
ApplicationContext.initBuilderData()
-
-
Field Summary
-
Fields inherited from interface net.sf.jguiraffe.gui.builder.BuilderData
KEY_RESULT_WINDOW
-
-
Constructor Summary
Constructors Constructor Description ApplicationBuilderData()
Creates a new instance ofApplicationBuilderData
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBeanCreationListener(BeanCreationListener l)
Adds the specifiedBeanCreationListener
to this object.void
addBeanCreationListeners(Collection<? extends BeanCreationListener> listeners)
Adds allBeanCreationListener
objects contained in the given collection to this object.void
addProperty(String key, Object value)
Adds an additional property for the builder operation.ActionStore
getActionStore()
Returns the action store.BeanBuilderResult
getBeanBuilderResult()
Returns the result object from the bean builder.Collection<BeanCreationListener>
getBeanCreationListeners()
Returns a collection withBeanCreationListener
objects to be registered at theBeanContext
created by the builder.BindingStrategy
getBindingStrategy()
Returns theBindingStrategy
used by the current form.Builder
getBuilder()
Returns a reference to theBuilder
instance that processed this object.BeanContext
getBuilderContext()
Returns the bean context used by the builder.String
getBuilderName()
Returns the name of the builder.CommandQueue
getCommandQueue()
Returns theCommandQueue
.Object
getDefaultResourceGroup()
Returns the default resource group.Object
getFormBean()
Returns the form bean.FormValidator
getFormValidator()
Returns theFormValidator
for validating the current form.InvocationHelper
getInvocationHelper()
Returns theInvocationHelper
.MessageOutput
getMessageOutput()
Returns theMessageOutput
object.BeanContext
getParentContext()
Returns the parent bean context.Window
getParentWindow()
Returns the parent window.Map<String,Object>
getProperties()
Returns a map with additional properties for the builder operation.BeanStore
getRootStore()
Returns the root store populated by the builder.TransformerContext
getTransformerContext()
Returns the transformer context.boolean
isAutoRelease()
Returns the auto release flag.boolean
isMenuIcon()
Returns the menu icon flag.boolean
isToolbarText()
Returns the toolbar text flag.void
setActionStore(ActionStore actionStore)
Sets the action store.void
setAutoRelease(boolean autoRelease)
Sets the auto release flag.void
setBeanBuilderResult(BeanBuilderResult res)
Sets the result object for the bean builder.void
setBindingStrategy(BindingStrategy strat)
Sets theBindingStrategy
to be used by the current form.void
setBuilder(Builder builder)
Sets theBuilder
that processed this object.void
setBuilderContext(BeanContext ctx)
Sets the bean context used by the builder.void
setBuilderName(String builderName)
Sets a name for the builder.void
setCommandQueue(CommandQueue commandQueue)
Sets theCommandQueue
.void
setDefaultResourceGroup(Object defaultResourceGroup)
Sets the default resource group.void
setFormBean(Object formBean)
Sets the form bean.void
setFormValidator(FormValidator validator)
Sets theFormValidator
for validating the current form.void
setInvocationHelper(InvocationHelper invocationHelper)
Sets theInvocationHelper
.void
setMenuIcon(boolean menuIcon)
Sets the menu icon flag.void
setMessageOutput(MessageOutput messageOutput)
Sets theMessageOutput
object.void
setParentContext(BeanContext ctx)
Sets the parent bean context.void
setParentWindow(Window parentWindow)
Sets the parent window.void
setProperties(Map<String,Object> props)
Sets additional properties for the builder operation.void
setToolbarText(boolean toolbarText)
Sets the toolbar text flag.void
setTransformerContext(TransformerContext transformerContext)
Sets the transformer context.
-
-
-
Method Detail
-
getActionStore
public ActionStore getActionStore()
Returns the action store.- Specified by:
getActionStore
in interfaceBuilderData
- Returns:
- the action store
-
setActionStore
public void setActionStore(ActionStore actionStore)
Sets the action store.- Parameters:
actionStore
- the actionStore
-
getDefaultResourceGroup
public Object getDefaultResourceGroup()
Returns the default resource group.- Specified by:
getDefaultResourceGroup
in interfaceBuilderData
- Returns:
- the default resource group
-
setDefaultResourceGroup
public void setDefaultResourceGroup(Object defaultResourceGroup)
Sets the default resource group.- Parameters:
defaultResourceGroup
- the default resource group
-
getFormBean
public Object getFormBean()
Returns the form bean.- Specified by:
getFormBean
in interfaceBuilderData
- Returns:
- the form bean
-
setFormBean
public void setFormBean(Object formBean)
Sets the form bean.- Parameters:
formBean
- the form bean
-
getBindingStrategy
public BindingStrategy getBindingStrategy()
Returns theBindingStrategy
used by the current form.- Specified by:
getBindingStrategy
in interfaceBuilderData
- Returns:
- the
BindingStrategy
- See Also:
BuilderData.getFormBean()
-
setBindingStrategy
public void setBindingStrategy(BindingStrategy strat)
Sets theBindingStrategy
to be used by the current form.- Parameters:
strat
- theBindingStrategy
-
getFormValidator
public FormValidator getFormValidator()
Returns theFormValidator
for validating the current form.- Specified by:
getFormValidator
in interfaceBuilderData
- Returns:
- the
FormValidator
-
setFormValidator
public void setFormValidator(FormValidator validator)
Sets theFormValidator
for validating the current form. If noFormValidator
is set, no form-level validation is performed. The form's fields may be validated though if corresponding validators have been defined.- Parameters:
validator
- theFormValidator
-
isMenuIcon
public boolean isMenuIcon()
Returns the menu icon flag.- Specified by:
isMenuIcon
in interfaceBuilderData
- Returns:
- the menu icon flag
-
setMenuIcon
public void setMenuIcon(boolean menuIcon)
Sets the menu icon flag.- Parameters:
menuIcon
- the flag value
-
getParentWindow
public Window getParentWindow()
Returns the parent window.- Specified by:
getParentWindow
in interfaceBuilderData
- Returns:
- the parent window
-
setParentWindow
public void setParentWindow(Window parentWindow)
Sets the parent window.- Parameters:
parentWindow
- the parent window
-
isToolbarText
public boolean isToolbarText()
Returns the toolbar text flag.- Specified by:
isToolbarText
in interfaceBuilderData
- Returns:
- the toolbar text flag
-
setToolbarText
public void setToolbarText(boolean toolbarText)
Sets the toolbar text flag.- Parameters:
toolbarText
- the toolbar text flag
-
getTransformerContext
public TransformerContext getTransformerContext()
Returns the transformer context.- Specified by:
getTransformerContext
in interfaceBuilderData
- Returns:
- the transformer context
-
setTransformerContext
public void setTransformerContext(TransformerContext transformerContext)
Sets the transformer context.- Parameters:
transformerContext
- the transformer context
-
getBeanBuilderResult
public BeanBuilderResult getBeanBuilderResult()
Returns the result object from the bean builder.- Specified by:
getBeanBuilderResult
in interfaceBuilderData
- Returns:
- the results of the bean builder
-
setBeanBuilderResult
public void setBeanBuilderResult(BeanBuilderResult res)
Sets the result object for the bean builder.- Specified by:
setBeanBuilderResult
in interfaceBuilderData
- Parameters:
res
- the results of the bean builder
-
getParentContext
public BeanContext getParentContext()
Returns the parent bean context.- Specified by:
getParentContext
in interfaceBuilderData
- Returns:
- the parent bean context
-
setParentContext
public void setParentContext(BeanContext ctx)
Sets the parent bean context.- Parameters:
ctx
- the parent bean context
-
getRootStore
public BeanStore getRootStore()
Returns the root store populated by the builder. This method can only be called after the builder operation.- Specified by:
getRootStore
in interfaceBuilderData
- Returns:
- the root store returned from the builder
- Throws:
IllegalStateException
- if no builder results are available yet- See Also:
BuilderData.getBeanBuilderResult()
-
getBuilderContext
public BeanContext getBuilderContext()
Returns the bean context used by the builder.- Specified by:
getBuilderContext
in interfaceBuilderData
- Returns:
- the builder's bean context
-
setBuilderContext
public void setBuilderContext(BeanContext ctx)
Sets the bean context used by the builder.- Specified by:
setBuilderContext
in interfaceBuilderData
- Parameters:
ctx
- the builder's bean context
-
getInvocationHelper
public InvocationHelper getInvocationHelper()
Returns theInvocationHelper
.- Specified by:
getInvocationHelper
in interfaceBuilderData
- Returns:
- the
InvocationHelper
-
setInvocationHelper
public void setInvocationHelper(InvocationHelper invocationHelper)
Sets theInvocationHelper
.- Parameters:
invocationHelper
- theInvocationHelper
-
getMessageOutput
public MessageOutput getMessageOutput()
Returns theMessageOutput
object.- Specified by:
getMessageOutput
in interfaceBuilderData
- Returns:
- the message output object
-
setMessageOutput
public void setMessageOutput(MessageOutput messageOutput)
Sets theMessageOutput
object.- Parameters:
messageOutput
- the message output object
-
getCommandQueue
public CommandQueue getCommandQueue()
Returns theCommandQueue
.- Specified by:
getCommandQueue
in interfaceBuilderData
- Returns:
- the command queue
-
setCommandQueue
public void setCommandQueue(CommandQueue commandQueue)
Sets theCommandQueue
.- Parameters:
commandQueue
- the command queue
-
getBeanCreationListeners
public Collection<BeanCreationListener> getBeanCreationListeners()
Returns a collection withBeanCreationListener
objects to be registered at theBeanContext
created by the builder. Note: this collection cannot be modified.- Specified by:
getBeanCreationListeners
in interfaceBuilderData
- Returns:
- a collection with
BeanCreationListener
objects
-
addBeanCreationListener
public void addBeanCreationListener(BeanCreationListener l)
Adds the specifiedBeanCreationListener
to this object. It will be registered at theBeanContext
created by the builder and thus notified for all bean created by the dependency injection framework.- Parameters:
l
- theBeanCreationListener
to be added (must not be null)- Throws:
IllegalArgumentException
- if theBeanCreationListener
is null
-
addBeanCreationListeners
public void addBeanCreationListeners(Collection<? extends BeanCreationListener> listeners)
Adds allBeanCreationListener
objects contained in the given collection to this object. They will be registered at theBeanContext
created by the builder and thus notified for all bean created by the dependency injection framework.- Parameters:
listeners
- the collection withBeanCreationListener
objects (must not be null)- Throws:
IllegalArgumentException
- if the collection is null or contains null elements
-
getBuilder
public Builder getBuilder()
Returns a reference to theBuilder
instance that processed this object. This value is available only after theBuilder
was called.- Specified by:
getBuilder
in interfaceBuilderData
- Returns:
- the
Builder
that processed thisBuilderData
object
-
setBuilder
public void setBuilder(Builder builder)
Sets theBuilder
that processed this object. This method is called by theBuilder
instance during the builder operation.- Specified by:
setBuilder
in interfaceBuilderData
- Parameters:
builder
- theBuilder
-
getBuilderName
public String getBuilderName()
Returns the name of the builder.- Specified by:
getBuilderName
in interfaceBuilderData
- Returns:
- the name of the builder
-
setBuilderName
public void setBuilderName(String builderName)
Sets a name for the builder. This name is available during the build process (through theComponentBuilderData
object). It can be used for conditional execution of builder scripts.- Parameters:
builderName
- the name of the builder
-
isAutoRelease
public boolean isAutoRelease()
Returns the auto release flag.- Specified by:
isAutoRelease
in interfaceBuilderData
- Returns:
- the auto release flag
-
setAutoRelease
public void setAutoRelease(boolean autoRelease)
Sets the auto release flag. This flag is evaluated if a window is generated during the builder operation. A value of true means that this object and all resources referenced by it should be freed automatically when the window is closed. This is done by invokingBuilder.release(BuilderData)
on theBuilder
responsible. Note that the default value of this flag is true, so auto release is enabled per default.- Parameters:
autoRelease
- the value of the auto release flag
-
getProperties
public Map<String,Object> getProperties()
Returns a map with additional properties for the builder operation. This implementation either returns the map set bysetProperties(Map)
or the one that was created automatically when#addProperty()
was called. Result may also be null if no properties have been set.- Specified by:
getProperties
in interfaceBuilderData
- Returns:
- a map with additional properties for the builder operation
- See Also:
setProperties(Map)
,addProperty(String, Object)
-
setProperties
public void setProperties(Map<String,Object> props)
Sets additional properties for the builder operation. The map passed to this method is directly stored and passed to the builder.- Parameters:
props
- the map with additional properties
-
addProperty
public void addProperty(String key, Object value)
Adds an additional property for the builder operation. This method can be used to populate the map with additional properties that is returned bygetProperties()
. If no map with properties has been set yet, a new one is created (getProperties()
will return this new map). Otherwise, the property is added to the existing map.- Parameters:
key
- the key of the propertyvalue
- the value of the property
-
-