This project has retired. For details please refer to its Attic page.
DefinitionManager (Tiles 2 2.2.2 API)

org.apache.tiles.impl.mgmt
Class DefinitionManager

Package class diagram package DefinitionManager
java.lang.Object
  extended by org.apache.tiles.impl.mgmt.DefinitionManager

public class DefinitionManager
extends Object

Manages custom and configured definitions, so they can be used by the container, instead of using a simple DefinitionsFactory.

Version:
$Rev: 791161 $ $Date: 2009-07-04 20:53:36 +0200 (sab, 04 lug 2009) $

Constructor Summary
DefinitionManager()
          Constructor.
DefinitionManager(String definitionsAttributeName)
          Constructor.
 
Method Summary
 void addDefinition(Definition definition, TilesRequestContext request)
          Adds a definition to the set of custom ones.
 Definition getDefinition(String definition, TilesRequestContext request)
          Returns a definition by name.
protected  Map<String,Definition> getDefinitions(TilesRequestContext request)
          Returns the map with custom definitions for the current request.
 DefinitionsFactory getFactory()
          Returns the used definitions factory.
protected  String getNextUniqueDefinitionName(Map<String,Definition> definitions)
          Create a unique definition name usable to store anonymous definitions.
protected  Map<String,Definition> getOrCreateDefinitions(TilesRequestContext request)
          Returns a map of type "definition name -> definition" and, if it has not been defined before, creates one.
protected  void overload(Definition parent, Definition child)
          Deprecated. Use BasicAttributeContext.inherit(org.apache.tiles.BasicAttributeContext).
protected  void resolveInheritance(Definition definition, TilesRequestContext request)
          Resolve inheritance.
 void setFactory(DefinitionsFactory factory)
          Sets the definitions factory to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefinitionManager

public DefinitionManager()
Constructor.


DefinitionManager

public DefinitionManager(String definitionsAttributeName)
Constructor.

Parameters:
definitionsAttributeName - The name of the attribute in which storing custom definitions.
Method Detail

getFactory

public DefinitionsFactory getFactory()
Returns the used definitions factory.

Returns:
The used definitions factory.

setFactory

public void setFactory(DefinitionsFactory factory)
Sets the definitions factory to use.

Parameters:
factory - The definitions factory.

getDefinition

public Definition getDefinition(String definition,
                                TilesRequestContext request)
Returns a definition by name.

Parameters:
definition - The name of the definition.
request - The current request.
Returns:
The requested definition, either main or custom.
Throws:
DefinitionsFactoryException - If something goes wrong when obtaining a main definition.

addDefinition

public void addDefinition(Definition definition,
                          TilesRequestContext request)
Adds a definition to the set of custom ones.

Parameters:
definition - The definition to add.
request - The current request.
Throws:
DefinitionsFactoryException - If something goes wrong during the addition.

resolveInheritance

protected void resolveInheritance(Definition definition,
                                  TilesRequestContext request)
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.

Parameters:
definition - The definition that needs to have its inheritances resolved.
request - The current request.
Throws:
DefinitionsFactoryException - If an inheritance can not be solved.

overload

protected void overload(Definition parent,
                        Definition child)
Deprecated. Use BasicAttributeContext.inherit(org.apache.tiles.BasicAttributeContext).

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.

getDefinitions

protected Map<String,Definition> getDefinitions(TilesRequestContext request)
Returns the map with custom definitions for the current request.

Parameters:
request - The current request.
Returns:
A map that connects a definition name to a definition.

getOrCreateDefinitions

protected Map<String,Definition> getOrCreateDefinitions(TilesRequestContext request)
Returns a map of type "definition name -> definition" and, if it has not been defined before, creates one.

Parameters:
request - The current request.
Returns:
A map that connects a definition name to a definition.

getNextUniqueDefinitionName

protected String getNextUniqueDefinitionName(Map<String,Definition> definitions)
Create a unique definition name usable to store anonymous definitions.

Parameters:
definitions - The already created definitions.
Returns:
The unique definition name to be used to store the definition.
Since:
2.1.0


Copyright © 2001-2010 Apache Software Foundation. All Rights Reserved.