Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tiles.impl.mgmt
Class DefinitionManager

    java.lang.Object
      org.apache.tiles.impl.mgmt.DefinitionManager

    public class DefinitionManager

extends java.lang.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(java.lang.String definitionsAttributeName)` Constructor.

Method Summary
`void` | `addDefinition(Definition definition, TilesRequestContext request)` Adds a definition to the set of custom ones.
`Definition` | `getDefinition(java.lang.String definition, TilesRequestContext request)` Returns a definition by name.
`protected java.util.Map<java.lang.String,Definition>` | `getDefinitions(TilesRequestContext request)` Returns the map with custom definitions for the current request.
`DefinitionsFactory` | `getFactory()` Returns the used definitions factory.
`protected java.lang.String` | `getNextUniqueDefinitionName(java.util.Map<java.lang.String,Definition> definitions)` Create a unique definition name usable to store anonymous definitions.
`protected java.util.Map<java.lang.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(java.lang.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(java.lang.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 java.util.Map<java.lang.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 java.util.Map<java.lang.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 java.lang.String getNextUniqueDefinitionName(java.util.Map<java.lang.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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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