Package org.zkoss.zk.ui.metainfo

## Class TemplateInfo

- java.lang.Object
- - org.zkoss.zk.ui.metainfo.TemplateInfo

- All Implemented Interfaces:
    `java.io.Serializable`, `NodeInfo`, `Condition`

      public class TemplateInfo
      extends java.lang.Object

  Represent a template element.
  Since:
    6.0.0
  Author:
    tomyeh
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TemplateInfo​(NodeInfo parent, java.lang.String name, java.lang.String src, java.util.Map<java.lang.String,​java.lang.String> params, ConditionImpl cond)` | Creates a template.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `appendChild​(NodeInfo child)` | Append a child
    `java.util.List<NodeInfo>` | `getChildren()` | Returns a readonly list of children.
    `ConditionImpl` | `getCondition()` | Returns the effectiveness condition.
    `Evaluator` | `getEvaluator()` | Returns the evaluator.
    `EvaluatorRef` | `getEvaluatorRef()` | Returns the evaluator reference.
    `java.lang.String` | `getName()` | Returns the name of the template info.
    `PageDefinition` | `getPageDefinition()` | Returns the page definition, i.e., the root node, or null if not available.
    `java.util.Map<java.lang.String,​ExValue>` | `getParameters()` | Returns a readonly map of the parameters that are assigned to the template.
    `NodeInfo` | `getParent()` | Returns the parent, or null if it has no parent.
    `java.lang.String` | `getSrc​(Component comp)` | Returns the URI to create the template from, or null if not specified.
    `boolean` | `isAnnotationNamespacedRoot()` |
    `boolean` | `isEffective​(Component comp)` | Used to evaluate whether it is effective.
    `boolean` | `isEffective​(Page page)` | Used to evaluate whether it is effective.
    `boolean` | `removeChild​(NodeInfo child)` | Removes a child.
    `java.util.Map<java.lang.String,​java.lang.Object>` | `resolveParameters​(Component comp)` | Evaluates and returns a readonly map of parameters assigned to this template (never null).
    `void` | `setAnnotationNamespacedRoot​(boolean annotationNamespacedRoot)` | Sets whether this TemplateInfo is the first TemplateInfo that has annotation namespace or binding annotation.
    `void` | `setCondition​(ConditionImpl cond)` | Sets the effectiveness condition.
    `java.lang.String` | `toString()` |
    `boolean` | `withCondition()` | Tests if the condition is set

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### TemplateInfo

          public TemplateInfo​(NodeInfo parent,
                              java.lang.String name,
                              java.lang.String src,
                              java.util.Map<java.lang.String,​java.lang.String> params,
                              ConditionImpl cond)

      Creates a template.
      Parameters:
        `parent` - the parent node (never null)
        `name` - the name of the template (never null)
        `params` - the map of parameters. Igored if null.

  - ### Method Detail

    - #### getName

          public java.lang.String getName()

      Returns the name of the template info.

    - #### getSrc

          public java.lang.String getSrc​(Component comp)

      Returns the URI to create the template from, or null if not specified.

    - #### getParameters

          public java.util.Map<java.lang.String,​ExValue> getParameters()

      Returns a readonly map of the parameters that are assigned to the template.
      Since:
        10.0.0

    - #### resolveParameters

          public java.util.Map<java.lang.String,​java.lang.Object> resolveParameters​(Component comp)

      Evaluates and returns a readonly map of parameters assigned to this template (never null).

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### isAnnotationNamespacedRoot

          public boolean isAnnotationNamespacedRoot()

      Returns:
        whether this TemplateInfo is the first TemplateInfo that has annotation namespace or binding annotation.
      Since:
        8.5.2

    - #### setAnnotationNamespacedRoot

          public void setAnnotationNamespacedRoot​(boolean annotationNamespacedRoot)

      Sets whether this TemplateInfo is the first TemplateInfo that has annotation namespace or binding annotation.
      Parameters:
        `annotationNamespacedRoot` -
      Since:
        8.5.2

    - #### getCondition

          public ConditionImpl getCondition()

      Returns the effectiveness condition.

    - #### setCondition

          public void setCondition​(ConditionImpl cond)

      Sets the effectiveness condition.

    - #### withCondition

          public boolean withCondition()

      Tests if the condition is set

    - #### appendChild

          public void appendChild​(NodeInfo child)

      Description copied from interface: `NodeInfo`
      Append a child
      Specified by:
        `appendChild` in interface `NodeInfo`

    - #### removeChild

          public boolean removeChild​(NodeInfo child)

      Description copied from interface: `NodeInfo`
      Removes a child.
      Specified by:
        `removeChild` in interface `NodeInfo`

    - #### getChildren

          public java.util.List<NodeInfo> getChildren()

      Description copied from interface: `NodeInfo`
      Returns a readonly list of children.

      Note: the returned list is readonly. To modify, please use `NodeInfo.appendChild(org.zkoss.zk.ui.metainfo.NodeInfo)` and `NodeInfo.removeChild(org.zkoss.zk.ui.metainfo.NodeInfo)` instead.

      Specified by:
        `getChildren` in interface `NodeInfo`

    - #### isEffective

          public boolean isEffective​(Component comp)

      Description copied from interface: `Condition`
      Used to evaluate whether it is effective.
      Specified by:
        `isEffective` in interface `Condition`
      Parameters:
        `comp` - used as the self variable. Ignored if null.

    - #### isEffective

          public boolean isEffective​(Page page)

      Description copied from interface: `Condition`
      Used to evaluate whether it is effective.
      Specified by:
        `isEffective` in interface `Condition`
      Parameters:
        `page` - used as the self variable. Ignored if null.

    - #### getEvaluatorRef

          public EvaluatorRef getEvaluatorRef()

      Description copied from interface: `NodeInfo`
      Returns the evaluator reference.
      Specified by:
        `getEvaluatorRef` in interface `NodeInfo`

    - #### getPageDefinition

          public PageDefinition getPageDefinition()

      Description copied from interface: `NodeInfo`
      Returns the page definition, i.e., the root node, or null if not available.
      Specified by:
        `getPageDefinition` in interface `NodeInfo`

    - #### getEvaluator

          public Evaluator getEvaluator()

      Description copied from interface: `NodeInfo`
      Returns the evaluator.

      All nodes in the same ZUML tree has the same evaluator reference (inherited from the root node, `PageDefinition.getEvaluatorRef()`).

      Specified by:
        `getEvaluator` in interface `NodeInfo`

    - #### getParent

          public NodeInfo getParent()

      Description copied from interface: `NodeInfo`
      Returns the parent, or null if it has no parent.
      Specified by:
        `getParent` in interface `NodeInfo`