Class ActionBuilder
- java.lang.Object
-
- net.sf.jguiraffe.gui.builder.action.ActionBuilder
-
- All Implemented Interfaces:
SimpleBeanStoreImpl.BeanContributor
public class ActionBuilder extends Object implements SimpleBeanStoreImpl.BeanContributor
A central data class used during the action builder process.
This class holds all information needed during the processing of Jelly scripts with actions and related tags. An instance is stored in the Jelly context and can be accessed by all interested components. The role of this class is almost analogous to the
ComponentBuilderDataclass in the form builder package.By implementing the
BeanContributorinterface this class makes some of its managed objects available to the dependency injection framework. These are the following:- All actions stored in the associated
can be accessed under their name with the prefix "action:".ActionStore - The
itself is available under the name "ACTION_STORE".ActionStore - The instance of this class can be queried under the name "ACTION_BUILDER".
- Version:
- $Id: ActionBuilder.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Field Summary
Fields Modifier and Type Field Description static StringKEY_ACTION_BUILDERConstant for the key for accessing the instance of this class from the builder's bean context.static StringKEY_ACTION_PREFIXConstant for the prefix used for accessing actions.static StringKEY_ACTION_STOREConstant for the key for accessing the action store from the builder's bean context.
-
Constructor Summary
Constructors Constructor Description ActionBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeanNames(Set<String> names)Obtains the names of the beans supported by this bean contributor.static ActionBuilderget(org.apache.commons.jelly.JellyContext context)Returns the instance of this class stored in the specified Jelly context.ActionManagergetActionManager()Returns a reference to the action manager.ActionStoregetActionStore()Returns a reference to the current action store.ObjectgetBean(String name)Returns the bean with the given name.org.apache.commons.jelly.JellyContextgetContext()Returns the currentJellyContextthis object lives in.voidinitBeanStore(SimpleBeanStoreImpl store)Initializes the specified bean store object.booleanisMenuIcon()Returns the value of the menu icon flag.booleanisToolbarText()Returns the value of the toolbar text flag.voidput(org.apache.commons.jelly.JellyContext context)Stores this object in the given Jelly context.voidsetActionManager(ActionManager actionManager)Sets the action manager.voidsetActionStore(ActionStore actionStore)Sets the action store.voidsetMenuIcon(boolean menuIcon)Sets the value of the menu icon flag.voidsetToolbarText(boolean toolbarText)Sets the value of the toolbar text flag.
-
-
-
Field Detail
-
KEY_ACTION_STORE
public static final String KEY_ACTION_STORE
Constant for the key for accessing the action store from the builder's bean context.- See Also:
- Constant Field Values
-
KEY_ACTION_BUILDER
public static final String KEY_ACTION_BUILDER
Constant for the key for accessing the instance of this class from the builder's bean context.- See Also:
- Constant Field Values
-
KEY_ACTION_PREFIX
public static final String KEY_ACTION_PREFIX
Constant for the prefix used for accessing actions.- See Also:
- Constant Field Values
-
-
Method Detail
-
getActionStore
public ActionStore getActionStore()
Returns a reference to the current action store.- Returns:
- the action store
-
setActionStore
public void setActionStore(ActionStore actionStore)
Sets the action store. Newly created actions will be stored in this objects. If actions are requested, they will be looked up here, too.- Parameters:
actionStore- the action store
-
getActionManager
public ActionManager getActionManager()
Returns a reference to the action manager.- Returns:
- the action manager
-
setActionManager
public void setActionManager(ActionManager actionManager)
Sets the action manager. This is a GUI library specific component that knows how to create all affected objects.- Parameters:
actionManager- the action manager to use
-
isMenuIcon
public boolean isMenuIcon()
Returns the value of the menu icon flag.- Returns:
- the menu icon flag
-
setMenuIcon
public void setMenuIcon(boolean menuIcon)
Sets the value of the menu icon flag. If this flag is set, menu items will have an icon if one is defined. If set to false, these icons will be suppressed.- Parameters:
menuIcon- the value of the flag
-
isToolbarText
public boolean isToolbarText()
Returns the value of the toolbar text flag.- Returns:
- the toolbar text flag
-
setToolbarText
public void setToolbarText(boolean toolbarText)
Sets the value of the toolbar text flag. If this flag is set, toolbar buttons will display a text if one is defined. Otherwise the text is suppressed.- Parameters:
toolbarText- the value of the flag
-
getContext
public org.apache.commons.jelly.JellyContext getContext()
Returns the currentJellyContextthis object lives in. This property is initialized when this instance is stored in a context.- Returns:
- the current
JellyContext - Since:
- 1.3
-
beanNames
public void beanNames(Set<String> names)
Obtains the names of the beans supported by this bean contributor. This implementation returns the names of the actions stored in the internal action store and some other helper objects.- Specified by:
beanNamesin interfaceSimpleBeanStoreImpl.BeanContributor- Parameters:
names- the set to which to add the names
-
getBean
public Object getBean(String name)
Returns the bean with the given name.- Specified by:
getBeanin interfaceSimpleBeanStoreImpl.BeanContributor- Parameters:
name- the name of the bean- Returns:
- the bean with this name
- Throws:
NoSuchElementException- if an unknown action is requested
-
initBeanStore
public void initBeanStore(SimpleBeanStoreImpl store)
Initializes the specified bean store object. This method is called by the builder when theBeanContextused during the builder operation is constructed. This implementation will add the static beans to the given store and register this object asBeanContributor.- Parameters:
store- the store to be initialized
-
put
public void put(org.apache.commons.jelly.JellyContext context)
Stores this object in the given Jelly context.- Parameters:
context- the context (must not be null)- Throws:
IllegalArgumentException- if the context is null
-
get
public static ActionBuilder get(org.apache.commons.jelly.JellyContext context)
Returns the instance of this class stored in the specified Jelly context. If no instance can be found, null will be returned.- Parameters:
context- the Jelly context- Returns:
- the instance found in this context
-
-