org.apache.shale.clay.config.beans
Class ComponentBean

java.lang.Object
  extended by org.apache.shale.clay.config.beans.AbstractBean
      extended by org.apache.shale.clay.config.beans.ComponentBean
All Implemented Interfaces:
Serializable, Comparable
Direct Known Subclasses:
InnerComponentBean

public class ComponentBean
extends AbstractBean
implements Comparable, Serializable

This is the base class of most of the metadata that is used by the Clay component to build a component subtree.

There are three sources that populate this object:
ClayXmlParser - from XML config files
Builder - extending classes
Clay - shapeValidator a validator style of event method binding

See Also:
Serialized Form

Constructor Summary
ComponentBean()
           
 
Method Summary
 void addActionListener(ActionListenerBean bean)
          Adds an ActionListenerBean to the actionListeners set.
 void addAttribute(AttributeBean obj)
          Adds a AttributeBean to the attributes Map collection where the name property is the key identifier in the value pair relationship.
 void addChild(ElementBean obj)
          Adds a child ElementBean to the children set and fixes up the composition parent relationship.
 void addConverter(ConverterBean bean)
          Adds a ConverterBean and assigns the composition parent.
 void addSymbol(SymbolBean symbol)
          Adds a symbol identified by the SymbolBean to the symbols collection.
 void addValidator(ValidatorBean bean)
          Adds a ValidatorBean and assigns the composition parent.
 void addValueChangeListener(ValueChangeListenerBean bean)
          Adds a ValueChangeListenerBean to the set where each instance is uniquely identified by jsfid.
 int compareTo(Object obj)
          This Comparable implementation makes the jsfid attribute the unique identifier for the object in a set.
 Iterator getActionListenerIterator()
          Returns an Iterator for the actionListeners set of ActionListenerBean.
 Collection getActionListeners()
          Returns a Collection of ActionListenerBean.
 String getAllowBody()
          This property only applies when using the Clay template features.
 AttributeBean getAttribute(String key)
          Returns a AttributeBean by the classes name property.
 Iterator getAttributeIterator()
          This inner class provides implementation for an Iterator handeling AttributeBean objects in the attributes collection.
 Map getAttributes()
          Returns the a Map collection of AttributeBean objects.
 Collection getChildren()
          Returns a set of children that are instances of ElementBean.
 Iterator getChildrenIterator()
          Returns a Iterator to the children set.
 String getComponentType()
          Returns the component type that is used to instantiate the associated JSF component.
 ComponentBean getConverter()
          Gets a meta converter bean used to instantiate a jsf Converter.
 String getExtends()
          Returns the jsfid of the meta component that this instance inherits from.
 String getFacetName()
          Returns the facet name that will be used as the identifier when adding the component to the parent facets collection.
 StringBuffer getHasAClientId()
          Returns a xpath like string describing how this component fits into the overall composition.
 ComponentBean getHasAParent()
          Returns the parent component that aggregates this object.
 String getId()
          Returns the identifier that will populate the JSF UIComponent.id property and is used to name the component within the tree.
 StringBuffer getIsAClientId()
          Returns an xpath like string that describes the heritage of this component.
 ComponentBean getIsAParent()
          Returns the parent component that generalizes this object.
 boolean getIsBodyAllowed()
          Returns a boolean representation of the allowBody property.
 String getJsfid()
          Returns the unique meta component identifier.
 long getJspId()
          Returns a unique id that will stick to the config bean.
 SymbolBean getSymbol(String name)
          Returns a SymbolBean from the symbols Map by name.
 Map getSymbols()
          Returns the replacement symbols assigned to the component.
 Iterator getValidatorIterator()
          Returns a Iterator to the validator set.
 Collection getValidators()
          Returns a Collection of meta validators used to create jsf Validator object instances.
 Iterator getValueChangeListenerIterator()
          Returns a Iterator for the valueChangeListener set of ValueChangeListenerBean.
 Collection getValueChangeListeners()
          Returns a Iterator to the valueChangeListeners set.
 boolean isInheritanceFinal()
          Returns a boolean flag indicating that the meta inheritances has been resolved.
 void setActionListeners(Collection collection)
          Merges two collections where items in the source collection will override those in the target collection of ActionListenerBean by the jsfid property.
 void setAllowBody(String allowBody)
          This property only applies when using the Clay template features.
 void setAttributes(Map map)
          Merges a set of AttributeBean where items in the source collection override items in the target collection by the object's jsfid property.
 void setChildren(Collection collection)
          Merges two sets of children ElementBean.
 void setComponentType(String componentType)
          Sets the component type uses by abstract factories to instantiate associated JSF resources.
 void setExtends(String extendsElementId)
          Sets the jsfid of the meta component that this meta component inherits from.
 void setFacetName(String facetName)
          Sets the facet name that will be used as the identifier when adding the component to the parent facets collection.
 void setHasAParent(ComponentBean bean)
          Sets the parent that owns this component.
 void setId(String id)
          Sets the identifier that is used to populate the JSF UIComponent.id property.
 void setInheritanceFinal(boolean b)
          Sets a boolean flag indicating that the meta inheritances have been resolved.
 void setIsAParent(ComponentBean bean)
          Sets the component that this instance extends.
 void setJsfid(String jsfid)
          Sets the unique meta component identifier.
 void setValidators(Collection collection)
          Adds a collection of ValidatorBean to the validator set.
 void setValueChangeListeners(Collection collection)
          Merges a collection of ValueChangeListenerBean where items in the source collection with the same jsfid will override items in the target set with the same identifier.
 String toString()
           
 
Methods inherited from class org.apache.shale.clay.config.beans.AbstractBean
getDescription, setDescription
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComponentBean

public ComponentBean()
Method Detail

getJspId

public long getJspId()

Returns a unique id that will stick to the config bean. It represents its compositional relationship within the subtree. This is clay's version of the JspIdConsumer in JSP 2.1.

Returns:
unique id for a view element

getAllowBody

public String getAllowBody()

This property only applies when using the Clay template features. A true value is returned if the HTML child nodes under the node that this meta component is bound to should be rendered; otherwise, a "false" value is returned indicating the child nodes should be ignored.

Returns:
literal string "true" if allow body is on

setAllowBody

public void setAllowBody(String allowBody)

This property only applies when using the Clay template features. Sets a Boolean string value that indicating if the child HTML nodes under the node that this component is bound to should render or ignore its child nodes.

Parameters:
allowBody - indicates how the child markup nodes are processed

getIsBodyAllowed

public boolean getIsBodyAllowed()

Returns a boolean representation of the allowBody property. The default is true

Returns:
true if allowBody has a literal string value of "true"

getFacetName

public String getFacetName()

Returns the facet name that will be used as the identifier when adding the component to the parent facets collection.

Returns:
facetName

setFacetName

public void setFacetName(String facetName)

Sets the facet name that will be used as the identifier when adding the component to the parent facets collection.

Parameters:
facetName - component grouping

toString

public String toString()
Overrides:
toString in class Object
Returns:
a value list of the object's state

getComponentType

public String getComponentType()

Returns the component type that is used to instantiate the associated JSF component.

Returns:
component type

getExtends

public String getExtends()

Returns the jsfid of the meta component that this instance inherits from.

Returns:
extended jsfid

setComponentType

public void setComponentType(String componentType)

Sets the component type uses by abstract factories to instantiate associated JSF resources.

Parameters:
componentType - used to create a JSF resource

setExtends

public void setExtends(String extendsElementId)

Sets the jsfid of the meta component that this meta component inherits from.

Parameters:
extendsElementId - extending jsfid

getChildrenIterator

public Iterator getChildrenIterator()

Returns a Iterator to the children set. Each item in the set is uniquely identified by its renderId property and an instance of ElementBean.

Returns:
iterator for the children collection

getChildren

public Collection getChildren()

Returns a set of children that are instances of ElementBean.

Returns:
children collection

setChildren

public void setChildren(Collection collection)

Merges two sets of children ElementBean. Items in the source collection will replace those in the target with the same renderId

Parameters:
collection - of child components

addChild

public void addChild(ElementBean obj)

Adds a child ElementBean to the children set and fixes up the composition parent relationship.

Parameters:
obj - element bean added as a child

compareTo

public int compareTo(Object obj)

This Comparable implementation makes the jsfid attribute the unique identifier for the object in a set.

Specified by:
compareTo in interface Comparable
Parameters:
obj - target object to compare to
Returns:
weighted value based on the jsfid property

getConverter

public ComponentBean getConverter()

Gets a meta converter bean used to instantiate a jsf Converter.

Returns:
converter assigned to the component

addConverter

public void addConverter(ConverterBean bean)

Adds a ConverterBean and assigns the composition parent.

Parameters:
bean - converter assigned to this component

getValidators

public Collection getValidators()

Returns a Collection of meta validators used to create jsf Validator object instances.

Returns:
collection of validators

setValidators

public void setValidators(Collection collection)

Adds a collection of ValidatorBean to the validator set. Each instance is uniquely identified in the collection by the jsfid.

Parameters:
collection - of validators added to the component

getValidatorIterator

public Iterator getValidatorIterator()

Returns a Iterator to the validator set. Each object will be an instance of ValidatorBean.

Returns:
Iterator of the components validators collection

addValidator

public void addValidator(ValidatorBean bean)

Adds a ValidatorBean and assigns the composition parent.

Parameters:
bean - validator to add to the component

getValueChangeListeners

public Collection getValueChangeListeners()

Returns a Iterator to the valueChangeListeners set. Each ValueChangeListenerBean in the collection is uniquely identified by jsfid.

Returns:
collection of value change listeners

setValueChangeListeners

public void setValueChangeListeners(Collection collection)

Merges a collection of ValueChangeListenerBean where items in the source collection with the same jsfid will override items in the target set with the same identifier.

Parameters:
collection - of value change listeners added to the component

getValueChangeListenerIterator

public Iterator getValueChangeListenerIterator()

Returns a Iterator for the valueChangeListener set of ValueChangeListenerBean.

Returns:
iterator for the collection of value change listeners

addValueChangeListener

public void addValueChangeListener(ValueChangeListenerBean bean)

Adds a ValueChangeListenerBean to the set where each instance is uniquely identified by jsfid.

Parameters:
bean - value change listener added to the components collection of listeners

getActionListeners

public Collection getActionListeners()

Returns a Collection of ActionListenerBean.

Returns:
collection of the component's action listeners

setActionListeners

public void setActionListeners(Collection collection)

Merges two collections where items in the source collection will override those in the target collection of ActionListenerBean by the jsfid property.

Parameters:
collection - of action listeners added to the components set

getActionListenerIterator

public Iterator getActionListenerIterator()

Returns an Iterator for the actionListeners set of ActionListenerBean.

Returns:
iterator of the component's action listeners set

addActionListener

public void addActionListener(ActionListenerBean bean)

Adds an ActionListenerBean to the actionListeners set. Each instance is uniquely identified by the jsfid property.

Parameters:
bean - action listener added to the component

getAttributeIterator

public Iterator getAttributeIterator()

This inner class provides implementation for an Iterator handeling AttributeBean objects in the attributes collection.

Returns:
iterator for the components attributes Map

getAttribute

public AttributeBean getAttribute(String key)

Returns a AttributeBean by the classes name property.

Parameters:
key - attribute name
Returns:
attribute bean for the key

addAttribute

public void addAttribute(AttributeBean obj)

Adds a AttributeBean to the attributes Map collection where the name property is the key identifier in the value pair relationship.

Parameters:
obj - attribute bean added to the attributes Map

getAttributes

public Map getAttributes()

Returns the a Map collection of AttributeBean objects.

Returns:
attributes map

getJsfid

public String getJsfid()

Returns the unique meta component identifier.

Returns:
jsfid

setAttributes

public void setAttributes(Map map)

Merges a set of AttributeBean where items in the source collection override items in the target collection by the object's jsfid property.

Parameters:
map - of attributes to be merged

setJsfid

public void setJsfid(String jsfid)

Sets the unique meta component identifier.

Parameters:
jsfid - identifier

getHasAParent

public ComponentBean getHasAParent()

Returns the parent component that aggregates this object.

Returns:
composition parent

getIsAParent

public ComponentBean getIsAParent()

Returns the parent component that generalizes this object.

Returns:
inheritance parent

setHasAParent

public void setHasAParent(ComponentBean bean)

Sets the parent that owns this component.

Parameters:
bean - composition parent

setIsAParent

public void setIsAParent(ComponentBean bean)

Sets the component that this instance extends.

Parameters:
bean - inheritance parent

getHasAClientId

public StringBuffer getHasAClientId()

Returns a xpath like string describing how this component fits into the overall composition.

Returns:
composition client id

getIsAClientId

public StringBuffer getIsAClientId()

Returns an xpath like string that describes the heritage of this component.

Returns:
inheritance client id

isInheritanceFinal

public boolean isInheritanceFinal()

Returns a boolean flag indicating that the meta inheritances has been resolved.

Returns:
true if inheritance has been resolved

setInheritanceFinal

public void setInheritanceFinal(boolean b)

Sets a boolean flag indicating that the meta inheritances have been resolved.

Parameters:
b - true if inheritance has been resolved

getId

public String getId()

Returns the identifier that will populate the JSF UIComponent.id property and is used to name the component within the tree.

Returns:
component's id

setId

public void setId(String id)

Sets the identifier that is used to populate the JSF UIComponent.id property.

Parameters:
id - component's identifier

addSymbol

public void addSymbol(SymbolBean symbol)

Adds a symbol identified by the SymbolBean to the symbols collection.

Parameters:
symbol - added to the symbols Map

getSymbols

public Map getSymbols()

Returns the replacement symbols assigned to the component. The key value represents the literal replacement string. The value Map property represents target SymbolBean.

Returns:
map of symbols

getSymbol

public SymbolBean getSymbol(String name)

Returns a SymbolBean from the symbols Map by name. Prepends a '@' character to the name if it doesn't exist.

Parameters:
name - of the symbol
Returns:
symbol bean identified by name


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.