org.apache.tiles.definition
Class Definition

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

public class Definition
extends TileDefinition
implements java.io.Serializable

A definition, i.e. a template with (completely or not) filled attributes. Attributes of a template 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
Definition()
          Constructor.
Definition(java.lang.String name, java.lang.String template, java.util.Map<java.lang.String,Attribute> attributes)
          Constructor.
Definition(TileDefinition definition)
          Copy Constructor.
 
Method Summary
 boolean hasAttributeValue(java.lang.String key)
          Checks whether the key attribute has been set.
 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 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 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
addAttribute, getAttribute, getAttributes, getExtends, getName, getPreparer, getRole, getTemplate, putAttribute, 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

Definition

public Definition()
Constructor.


Definition

public Definition(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.

Parameters:
definition - The definition to copy.

Definition

public Definition(java.lang.String name,
                  java.lang.String template,
                  java.util.Map<java.lang.String,Attribute> attributes)
Constructor.

Parameters:
name - The name of the definition.
template - The template of the definition.
attributes - The attribute map of the definition.
Method Detail

hasAttributeValue

public boolean hasAttributeValue(java.lang.String key)
Checks whether the key attribute has been set.

Parameters:
key - The attribute key to check.
Returns:
true if the attribute has a value.

put

public void put(java.lang.String name,
                java.lang.Object content)
Put an attribute in 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
Returns:
A string representation of the content of this definition.

isExtending

public boolean isExtending()
Get extends flag.

Returns:
true if this definition extends another.

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.