org.zkoss.zk.ui.metainfo
Class NativeInfo

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

public class NativeInfo
extends ComponentInfo

Represents the component information about the native components.

Note:it is not thread-safe.

Since:
3.0.0
Author:
tomyeh
See Also:
Serialized Form

Constructor Summary
NativeInfo(EvaluatorRef evlar, ComponentDefinition compdef, java.lang.String tag)
          Constructs a native info without a parent.
NativeInfo(NodeInfo parent, ComponentDefinition compdef, java.lang.String tag)
          Constructs a native info with a parent.
 
Method Summary
 void addDeclaredNamespace(Namespace ns)
          Adds a declared namespace.
 void addEpilogChild(NodeInfo child)
          Adds an epilog child.
 void addPrologChild(NodeInfo child)
          Adds a prolog child.
 java.util.List<NodeInfo> getChildren()
          Returns a readonly list of children.
 ConditionImpl getCondition()
          Returns the effectiveness condition.
 java.util.List<Namespace> getDeclaredNamespaces()
          Returns a readonly list of the declared namespaces (never null).
 java.util.List<NodeInfo> getEpilogChildren()
          Returns a readonly list of the epilog children (NativeInfo).
 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.util.List<NodeInfo> getPrologChildren()
          Returns a readonly list of the prolog children (NativeInfo).
 NativeInfo getSplitChild()
          Returns the split child, or null if not available.
 boolean isEffective(Component comp)
          Used to evaluate whether it is effective.
 boolean isEffective(Page page)
          Used to evaluate whether it is effective.
 Component newInstance(Page page, Component parent)
          Creates an component based on this info (never null).
 boolean removeChild(NodeInfo child)
          Removes a child.
 ForEach resolveForEach(Page page, Component comp)
          Returns the forEach object if the forEach attribute is defined (or setForEach(java.lang.String, java.lang.String, java.lang.String) is called).
 void setCondition(ConditionImpl cond)
          Sets the effectiveness condition.
 void setForEach(java.lang.String expr, java.lang.String begin, java.lang.String end)
          Sets the forEach attribute, which is usually an expression.
 void setSplitChild(NativeInfo child)
          Sets the split kid.
 boolean withCondition()
          Tests if the condition is set
 boolean withForEach()
          Returns whether the forEach condition is defined.
 
Methods inherited from class org.zkoss.zk.ui.metainfo.ComponentInfo
addAnnotation, addEventHandler, addProperty, addProperty, addWidgetAttribute, addWidgetListener, addWidgetOverride, appendChild, applyProperties, duplicate, evalProperties, getAnnotationMap, getApply, getComponentDefinition, getEventHandlerNames, getForward, getFulfill, getImplementation, getLanguageDefinition, getProperties, getReplaceableText, getTag, getTextAs, getWidgetClass, isBlankPreserved, isChildAllowedInTextAs, newInstance, resolveComposer, resolveImplementationClass, resolveImplementationClass, resolveWidgetClass, setApply, setForward, setFulfill, setImplementation, setReplaceableText, setWidgetClass, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NativeInfo

public NativeInfo(NodeInfo parent,
                  ComponentDefinition compdef,
                  java.lang.String tag)
Constructs a native info with a parent.

Parameters:
parent - the parent info (never null).
compdef - the component definition (never null).
tag - the name of the tag

NativeInfo

public NativeInfo(EvaluatorRef evlar,
                  ComponentDefinition compdef,
                  java.lang.String tag)
Constructs a native info without a parent.

Parameters:
evlar - the evaluator (never null).
compdef - the component definition (never null).
tag - the name of the tag
Since:
3.5.0
Method Detail

getDeclaredNamespaces

public java.util.List<Namespace> getDeclaredNamespaces()
Returns a readonly list of the declared namespaces (never null).


addDeclaredNamespace

public void addDeclaredNamespace(Namespace ns)
Adds a declared namespace.


getPrologChildren

public java.util.List<NodeInfo> getPrologChildren()
Returns a readonly list of the prolog children (NativeInfo). A prolog child is a special child of NativeInfo. (it is not part of getChildren() that is used to optimize the native components such that ZK can use one native components to represent several NativeInfo. In other words, a prolog child won't be created as part of

The prolog children must be rendered before getChildren().


getEpilogChildren

public java.util.List<NodeInfo> getEpilogChildren()
Returns a readonly list of the epilog children (NativeInfo). The epilog children must be rendered after getChildren().


addPrologChild

public void addPrologChild(NodeInfo child)
Adds a prolog child.

Note: if child belong to other ComponentInfo, you have to remove them first before calling this method. Otherwise, the result is unpredictable.

Parameters:
child - the prolog child.
See Also:
getPrologChildren()

addEpilogChild

public void addEpilogChild(NodeInfo child)
Adds an epilog child.

Parameters:
child - the epilog child. If child belongs to getChildren(), it will be removed first.
See Also:
getPrologChildren()

getSplitChild

public NativeInfo getSplitChild()
Returns the split child, or null if not available. Each native info has at most one split child. If a native info has a single child and the child is also a native info, we can merge them by making the child as the split child.

Since:
3.0.0

setSplitChild

public void setSplitChild(NativeInfo child)
Sets the split kid.

Since:
3.0.0
See Also:
getSplitChild()

newInstance

public Component newInstance(Page page,
                             Component parent)
Description copied from class: ComponentInfo
Creates an component based on this info (never null).

Like ComponentDefinition.newInstance(org.zkoss.zk.ui.Page, java.lang.String), this method doesn't invoke ComponentInfo.applyProperties(org.zkoss.zk.ui.Component). It is caller's job to invoke them if necessary. Since the value of properties might depend on the component tree, it is better to assign the component with a proper parent before calling ComponentInfo.applyProperties(org.zkoss.zk.ui.Component).

Overrides:
newInstance in class ComponentInfo

resolveForEach

public ForEach resolveForEach(Page page,
                              Component comp)
Returns the forEach object if the forEach attribute is defined (or setForEach(java.lang.String, java.lang.String, java.lang.String) is called).

If comp is not null, both pagedef and page are ignored. If comp is null, page must be specified.

Parameters:
page - the page. It is used only if comp is null.
comp - the component.
Returns:
the forEach object to iterate this info multiple times, or null if this info shall be interpreted only once.

setForEach

public void setForEach(java.lang.String expr,
                       java.lang.String begin,
                       java.lang.String end)
Sets the forEach attribute, which is usually an expression.

Parameters:
expr - the expression to return a collection of objects, or null/empty to denote no iteration.

withForEach

public boolean withForEach()
Returns whether the forEach condition is defined.


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


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


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