org.apache.tiles.definition
Class ComponentDefinition

Package class diagram package ComponentDefinition
java.lang.Object
  extended by org.apache.tiles.mgmt.TileDefinition
      extended by org.apache.tiles.definition.ComponentDefinition
All Implemented Interfaces:
java.io.Serializable

public class ComponentDefinition
extends org.apache.tiles.mgmt.TileDefinition
implements java.io.Serializable

TileDefinition of a template / component attributes. Attributes of a component can be defined with the help of this class. An instance of this class can be used as a bean, and passed to 'insert' tag.

See Also:
Serialized Form

Field Summary
protected static org.apache.commons.logging.Log log
          Commons Logging instance.
 
Fields inherited from class org.apache.tiles.mgmt.TileDefinition
attributes, inherit, name, preparer, role, template
 
Constructor Summary
ComponentDefinition()
          Constructor.
ComponentDefinition(java.lang.String name, java.lang.String template, java.util.Map<java.lang.String,org.apache.tiles.ComponentAttribute> attributes)
          Constructor.
ComponentDefinition(org.apache.tiles.mgmt.TileDefinition definition)
          Copy Constructor.
 
Method Summary
 void addAttribute(org.apache.tiles.ComponentAttribute attribute)
          Add an attribute to this component.
 boolean isExtending()
          Get extends flag.
 boolean isIsVisited()
          Returns the visit flag, used during inheritance resolution.
 void put(java.lang.String name, java.lang.Object content)
          Put an attribute in component / template definition.
 void put(java.lang.String name, java.lang.Object content, java.lang.String role)
          Put an attribute in template definition.
 void put(java.lang.String name, java.lang.Object content, java.lang.String type, java.lang.String role)
          Put an attribute in template definition.
 void putAttribute(java.lang.String key, org.apache.tiles.ComponentAttribute value)
          Put a new attribute in this component
 void setIsVisited(boolean isVisited)
          Sets the visit flag, used during inheritance resolution.
 java.lang.String toString()
          Returns a description of the attributes.
 
Methods inherited from class org.apache.tiles.mgmt.TileDefinition
getAttribute, getAttributes, getExtends, getName, getPreparer, getRole, getTemplate, setExtends, setName, setPreparer, setRole, setTemplate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
Commons Logging instance.

Constructor Detail

ComponentDefinition

public ComponentDefinition()
Constructor.


ComponentDefinition

public ComponentDefinition(org.apache.tiles.mgmt.TileDefinition definition)
Copy Constructor. Create a new definition initialized with parent definition. Do a shallow copy : attributes are shared between copies, but not the Map containing attributes.


ComponentDefinition

public ComponentDefinition(java.lang.String name,
                           java.lang.String template,
                           java.util.Map<java.lang.String,org.apache.tiles.ComponentAttribute> attributes)
Constructor.

Method Detail

putAttribute

public void putAttribute(java.lang.String key,
                         org.apache.tiles.ComponentAttribute value)
Put a new attribute in this component

Parameters:
key - String key for attribute
value - Attibute value.

put

public void put(java.lang.String name,
                java.lang.Object content)
Put an attribute in component / template definition. Attribute can be used as content for tag get.

Parameters:
name - Attribute name
content - Attribute value

put

public void put(java.lang.String name,
                java.lang.Object content,
                java.lang.String role)
Put an attribute in template definition. Attribute can be used as content for tag get.

Parameters:
name - Attribute name
content - Attribute value
role - Determine if content is used by get tag. If user is in role, content is used.

put

public void put(java.lang.String name,
                java.lang.Object content,
                java.lang.String type,
                java.lang.String role)
Put an attribute in template definition. Attribute can be used as content for tag get.

Parameters:
name - Attribute name
content - Attribute value
type - attribute type: template, string, definition
role - Determine if content is used by get tag. If user is in role, content is used.

toString

public java.lang.String toString()
Returns a description of the attributes.

Overrides:
toString in class java.lang.Object

addAttribute

public void addAttribute(org.apache.tiles.ComponentAttribute attribute)
Add an attribute to this component.

This method is used by Digester to load definitions.

Parameters:
attribute - Attribute to add.

isExtending

public boolean isExtending()
Get extends flag.


setIsVisited

public void setIsVisited(boolean isVisited)
Sets the visit flag, used during inheritance resolution.

Parameters:
isVisited - true is the definition has been visited.

isIsVisited

public boolean isIsVisited()
Returns the visit flag, used during inheritance resolution.

Returns:
isVisited true is the definition has been visited.