org.apache.tiles.definition
Class ComponentDefinitionsImpl

Package class diagram package ComponentDefinitionsImpl
java.lang.Object
  extended by org.apache.tiles.definition.ComponentDefinitionsImpl
All Implemented Interfaces:
ComponentDefinitions

public class ComponentDefinitionsImpl
extends java.lang.Object
implements ComponentDefinitions


Constructor Summary
ComponentDefinitionsImpl()
          Creates a new instance of ComponentDefinitionsImpl
 
Method Summary
 void addDefinitions(java.util.Map<java.lang.String,ComponentDefinition> defsMap)
          Adds new ComponentDefinition objects to the internal collection and resolves inheritance attraibutes.
 void addDefinitions(java.util.Map<java.lang.String,ComponentDefinition> defsMap, java.util.Locale locale)
          Adds new locale-specific ComponentDefinition objects to the internal collection and resolves inheritance attraibutes.
 java.util.Map getBaseDefinitions()
          Returns base definitions collection;
 ComponentDefinition getDefinition(java.lang.String name)
          Returns a ComponentDefinition object that matches the given name.
 ComponentDefinition getDefinition(java.lang.String name, java.util.Locale locale)
          Returns a ComponentDefinition object that matches the given name and locale.
protected  void overload(ComponentDefinition parent, ComponentDefinition child)
          Overloads a child definition with a given parent.
 void reset()
          Clears definitions.
 void resolveAttributeDependencies()
           
 void resolveAttributeDependencies(java.util.Locale locale)
           
protected  void resolveInheritance(ComponentDefinition definition)
          Resolve inheritance.
protected  void resolveInheritance(ComponentDefinition definition, java.util.Locale locale)
          Resolve locale-specific inheritance.
 void resolveInheritances()
          Resolve extended instances.
 void resolveInheritances(java.util.Locale locale)
          Resolve locale-specific extended instances.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentDefinitionsImpl

public ComponentDefinitionsImpl()
Creates a new instance of ComponentDefinitionsImpl

Method Detail

getDefinition

public ComponentDefinition getDefinition(java.lang.String name)
Returns a ComponentDefinition object that matches the given name.

Specified by:
getDefinition in interface ComponentDefinitions
Parameters:
name - The name of the ComponentDefinition to return.
Returns:
the ComponentDefinition matching the given name or null if none is found.

addDefinitions

public void addDefinitions(java.util.Map<java.lang.String,ComponentDefinition> defsMap)
                    throws NoSuchDefinitionException
Adds new ComponentDefinition objects to the internal collection and resolves inheritance attraibutes.

Specified by:
addDefinitions in interface ComponentDefinitions
Parameters:
defsMap - The new definitions to add.
Throws:
NoSuchDefinitionException

addDefinitions

public void addDefinitions(java.util.Map<java.lang.String,ComponentDefinition> defsMap,
                           java.util.Locale locale)
                    throws NoSuchDefinitionException
Adds new locale-specific ComponentDefinition objects to the internal collection and resolves inheritance attraibutes.

Specified by:
addDefinitions in interface ComponentDefinitions
Parameters:
defsMap - The new definitions to add.
locale - The locale to add the definitions to.
Throws:
NoSuchDefinitionException - if a ComponentDefinition extends from one that doesn't exist.

getDefinition

public ComponentDefinition getDefinition(java.lang.String name,
                                         java.util.Locale locale)
Returns a ComponentDefinition object that matches the given name and locale.

Specified by:
getDefinition in interface ComponentDefinitions
Parameters:
name - The name of the ComponentDefinition to return.
locale - The locale to use to resolve the definition.
Returns:
the ComponentDefinition matching the given name or null if none is found.

resolveInheritances

public void resolveInheritances()
                         throws NoSuchDefinitionException
Resolve extended instances.

Specified by:
resolveInheritances in interface ComponentDefinitions
Throws:
NoSuchDefinitionException

resolveInheritances

public void resolveInheritances(java.util.Locale locale)
                         throws NoSuchDefinitionException
Resolve locale-specific extended instances.

Specified by:
resolveInheritances in interface ComponentDefinitions
Throws:
NoSuchDefinitionException

reset

public void reset()
Clears definitions.

Specified by:
reset in interface ComponentDefinitions

getBaseDefinitions

public java.util.Map getBaseDefinitions()
Returns base definitions collection;

Specified by:
getBaseDefinitions in interface ComponentDefinitions

resolveAttributeDependencies

public void resolveAttributeDependencies()

resolveAttributeDependencies

public void resolveAttributeDependencies(java.util.Locale locale)

resolveInheritance

protected void resolveInheritance(ComponentDefinition definition)
                           throws NoSuchDefinitionException
Resolve inheritance. First, resolve parent's inheritance, then set template to the parent's template. Also copy attributes setted in parent, and not set in child If instance doesn't extend anything, do nothing.

Throws:
NoSuchDefinitionException - If an inheritance can not be solved.

resolveInheritance

protected void resolveInheritance(ComponentDefinition definition,
                                  java.util.Locale locale)
                           throws NoSuchDefinitionException
Resolve locale-specific inheritance. First, resolve parent's inheritance, then set template to the parent's template. Also copy attributes setted in parent, and not set in child If instance doesn't extend anything, do nothing.

Throws:
NoSuchDefinitionException - If an inheritance can not be solved.

overload

protected void overload(ComponentDefinition parent,
                        ComponentDefinition child)
Overloads a child definition with a given parent. All attributes present in child are kept. All missing attributes are copied from the parent. Special attribute 'template','role' and 'extends' are overloaded in child if not defined

Parameters:
parent - The parent definition.
child - The child that will be overloaded.