net.sf.jguiraffe.gui.builder.action
Class ActionBuilder

java.lang.Object
  extended by net.sf.jguiraffe.gui.builder.action.ActionBuilder
All Implemented Interfaces:
SimpleBeanStoreImpl.BeanContributor

public class ActionBuilder
extends java.lang.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 ComponentBuilderData class in the form builder package.

By implementing the BeanContributor interface this class makes some of its managed objects available to the dependency injection framework. These are the following:

Version:
$Id: ActionBuilder.java 156 2009-03-03 21:04:47Z oheger $
Author:
Oliver Heger

Field Summary
static java.lang.String KEY_ACTION_BUILDER
          Constant for the key for accessing the instance of this class from the builder's bean context.
static java.lang.String KEY_ACTION_PREFIX
          Constant for the prefix used for accessing actions.
static java.lang.String KEY_ACTION_STORE
          Constant for the key for accessing the action store from the builder's bean context.
 
Constructor Summary
ActionBuilder()
           
 
Method Summary
 void beanNames(java.util.Set<java.lang.String> names)
          Obtains the names of the beans supported by this bean contributor.
static ActionBuilder get(org.apache.commons.jelly.JellyContext context)
          Returns the instance of this class stored in the specified Jelly context.
 ActionManager getActionManager()
          Returns a reference to the action manager.
 ActionStore getActionStore()
          Returns a reference to the current action store.
 java.lang.Object getBean(java.lang.String name)
          Returns the bean with the given name.
 void initBeanStore(SimpleBeanStoreImpl store)
          Initializes the specified bean store object.
 boolean isMenuIcon()
          Returns the value of the menu icon flag.
 boolean isToolbarText()
          Returns the value of the toolbar text flag.
 void put(org.apache.commons.jelly.JellyContext context)
          Stores this object in the given Jelly context.
 void setActionManager(ActionManager actionManager)
          Sets the action manager.
 void setActionStore(ActionStore actionStore)
          Sets the action store.
 void setMenuIcon(boolean menuIcon)
          Sets the value of the menu icon flag.
 void setToolbarText(boolean toolbarText)
          Sets the value of the toolbar text flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_ACTION_STORE

public static final java.lang.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 java.lang.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 java.lang.String KEY_ACTION_PREFIX
Constant for the prefix used for accessing actions.

See Also:
Constant Field Values
Constructor Detail

ActionBuilder

public ActionBuilder()
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

beanNames

public void beanNames(java.util.Set<java.lang.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:
beanNames in interface SimpleBeanStoreImpl.BeanContributor
Parameters:
names - a set, in which to store the names of the available beans

getBean

public java.lang.Object getBean(java.lang.String name)
Returns the bean with the given name.

Specified by:
getBean in interface SimpleBeanStoreImpl.BeanContributor
Parameters:
name - the name of the bean
Returns:
the bean with this name
Throws:
java.util.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 the BeanContext used during the builder operation is constructed. This implementation will add the static beans to the given store and register this object as BeanContributor.

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:
java.lang.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


Copyright © 2009 The JGUIraffe Team. All Rights Reserved.