org.zkoss.zk.ui.metainfo
Class AttributesInfo

java.lang.Object
  extended by org.zkoss.zk.ui.metainfo.AttributesInfo
All Implemented Interfaces:
java.io.Serializable, NodeInfo, Condition

public class AttributesInfo
extends java.lang.Object

Represents a map of custom attributes of a component definition (ComponentDefinition). It is equivalent to the custom-attributes element.

Note: it is serializable.

Author:
tomyeh
See Also:
Serialized Form

Constructor Summary
AttributesInfo(NodeInfo parent, java.util.Map<java.lang.String,java.lang.String> attrs, java.lang.String scope, ConditionImpl cond)
          The same as AttributesInfo(parent, attrs, scope, "none", cond).
AttributesInfo(NodeInfo parent, java.util.Map<java.lang.String,java.lang.String> attrs, java.lang.String scope, java.lang.String composite, ConditionImpl cond)
          Constructor.
 
Method Summary
 void appendChild(NodeInfo child)
          Append a child
 void apply(Component comp)
          Applies the custom attributes.
 void apply(Page page)
          Applies the custom attributes.
 java.util.List<NodeInfo> getChildren()
          Returns a readonly list of children.
 java.lang.String getComposite()
          Returns the composite type: "none", "list" or "map".
 Evaluator getEvaluator()
          Returns the evaluator.
 EvaluatorRef getEvaluatorRef()
          Returns the evaluator reference.
 PageDefinition getPageDefinition()
          Returns the page definition, i.e., the root node, or null if not available.
 NodeInfo getParent()
          Returns the parent, or null if it has no parent.
 java.lang.String getScope()
          Returns the scope, or null if it is not assoicated with a scope.
 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.
 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

AttributesInfo

public AttributesInfo(NodeInfo parent,
                      java.util.Map<java.lang.String,java.lang.String> attrs,
                      java.lang.String scope,
                      java.lang.String composite,
                      ConditionImpl cond)
Constructor.

Parameters:
attrs - the custom attributes (String name, String value). Once called, the caller shall not access attrs again -- it belongs to this object.
scope - specifies the scope.
composite - indicates the composite type. It can be one of "none", "list" or "map". If null or empty, "none" is assumed.
Throws:
java.lang.IllegalArgumentException - if the composite type is illegal.
Since:
3.0.6

AttributesInfo

public AttributesInfo(NodeInfo parent,
                      java.util.Map<java.lang.String,java.lang.String> attrs,
                      java.lang.String scope,
                      ConditionImpl cond)
The same as AttributesInfo(parent, attrs, scope, "none", cond).

Parameters:
attrs - the custom attributes (String name, String value). Once called, the caller shall not access attrs again -- it belongs to this object.
scope - specifies the scope.
Method Detail

getScope

public java.lang.String getScope()
Returns the scope, or null if it is not assoicated with a scope.

Notice that, prior to 5.0.8, "component" is returned if it is not associated with a scope (which is not correct since this info might be associated with a page).

Since:
3.0.6

getComposite

public java.lang.String getComposite()
Returns the composite type: "none", "list" or "map".

Since:
3.0.6

apply

public void apply(Component comp)
Applies the custom attributes.

Note: this method does nothing if isEffective(org.zkoss.zk.ui.Component) returns false.


apply

public void apply(Page page)
Applies the custom attributes.

Note: this method does nothing if isEffective(org.zkoss.zk.ui.Component) returns false.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setCondition

public void setCondition(ConditionImpl cond)
Sets the effectiveness condition.


withCondition

public boolean withCondition()
Tests if the condition is set


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

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

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


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo