Class ShadowInfo
- All Implemented Interfaces:
Serializable,NodeInfo,Condition
- Since:
- 8.0.0
- Author:
- jumperchen
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionShadowInfo(NodeInfo parent, ComponentDefinition compdef, String tag, ConditionImpl cond) Creates a shadow. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnnotation(String propName, String annotName, Map<String, String[]> annotAttrs, org.zkoss.util.resource.Location loc) Adds an annotation to the specified property of this component info.voidaddProperty(String name, String value, ConditionImpl cond) Adds a property initializer.voidappendChild(NodeInfo child) Adds a child.voidApplies the custom attributes.voidapplyProperties(Component comp) Applies the event handlers and properties to the specified component.voidvoidReturns the annotation map defined in this info, or null if no annotation is ever defined.Returns a readonly list of children.Returns the component definition, or null if it is PageDefinition.Returns the effectiveness condition.Returns the evaluator.Returns the evaluator reference.Returns the language definition thatgetComponentDefinition()belongs to, or null if the component definition is temporary.Returns the page definition, i.e., the root node, or null if not available.Returns the parent, or null if it has no parent.Returns a readonly list of properties (Property) (never null).booleanbooleanbooleanisEffective(Component comp) Used to evaluate whether it is effective.booleanisEffective(Page page) Used to evaluate whether it is effective.newInstance(Page page) Creates a shadow element based on this info (never null).newInstance(Page page, Component parent) Creates an component based on this info (never null).booleanremoveChild(NodeInfo child) Removes a child.voidsetAnnotationNamespacedRoot(boolean annotationNamespacedRoot) Sets whether this ShadowInfo is the first ShadowInfo that has annotation namespace or binding annotation.voidsetCondition(ConditionImpl cond) Sets the effectiveness condition.toString()booleanTests if the condition is set
-
Constructor Details
-
ShadowInfo
Creates a shadow.- Parameters:
parent- the parent node (never null)compdef- the component definition; never nulltag- the tag name; Note: if component implementsDynamicTag, this argument must be specified. IfDynamicTagis not implemented, this argument is optional.
-
-
Method Details
-
getAnnotationMap
Returns the annotation map defined in this info, or null if no annotation is ever defined. -
applyProperties
Applies the event handlers and properties to the specified component.It also invokes
ComponentDefinition.applyProperties(org.zkoss.zk.ui.Component).Note: annotations are applied to the component when a component is created. So, this method doesn't and need not to copy them. See also
AbstractComponent(boolean). -
addAnnotation
public void addAnnotation(String propName, String annotName, Map<String, String[]> annotAttrs, org.zkoss.util.resource.Location loc) Adds an annotation to the specified property of this component info.- Parameters:
propName- the property name. If null, the annotation is associated with the whole component rather than a particular property.annotName- the annotation name (never null, nor empty).annotAttrs- a map of attributes, or null if no attribute at all. The attribute must be in a pair of strings (String name, String value), or (String name, String[] value).loc- the location information of the annotation in the document, or null if not available.
-
apply
Applies the custom attributes.Note: this method does nothing if
Condition.isEffective(org.zkoss.zk.ui.Component)returns false. -
newInstance
Creates a shadow element based on this info (never null). It is the same as newInstance(page, null).If the implementation class doesn't have any EL expression, or its EL expression doesn't have reference to the self variable, the result is the same.
This method is preserved for backward compatibility. It is better to use
newInstance(Page, Component). -
newInstance
Creates an component based on this info (never null).Like
ComponentDefinition.newInstance(org.zkoss.zk.ui.Page, java.lang.String), this method doesn't invokeapplyProperties(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 callingapplyProperties(org.zkoss.zk.ui.Component). -
getLanguageDefinition
Returns the language definition thatgetComponentDefinition()belongs to, or null if the component definition is temporary. -
getComponentDefinition
Returns the component definition, or null if it is PageDefinition. -
getProperties
Returns a readonly list of properties (Property) (never null). -
addProperty
Adds a property initializer. It will initialize a component when created with this info.- Parameters:
name- the member name. The component must have a valid setter for it.value- the value. It might contain expressions (${}).
-
appendChild
Adds a child.- Specified by:
appendChildin interfaceNodeInfo- Throws:
IllegalStateException- if this is not an instance ofTemplateInfoandShadowInfo.
-
toString
-
hasBindingAnnotation
public boolean hasBindingAnnotation() -
enableBindingAnnotation
public void enableBindingAnnotation() -
disableBindingAnnotation
public void disableBindingAnnotation() -
isAnnotationNamespacedRoot
public boolean isAnnotationNamespacedRoot()- Returns:
- whether this ShadowInfo is the first ShadowInfo that has annotation namespace or binding annotation.
- Since:
- 8.5.2
-
setAnnotationNamespacedRoot
public void setAnnotationNamespacedRoot(boolean annotationNamespacedRoot) Sets whether this ShadowInfo is the first ShadowInfo that has annotation namespace or binding annotation.- Parameters:
annotationNamespacedRoot-- Since:
- 8.5.2
-
getCondition
Returns the effectiveness condition. -
setCondition
Sets the effectiveness condition. -
withCondition
public boolean withCondition()Tests if the condition is set -
removeChild
Description copied from interface:NodeInfoRemoves a child.- Specified by:
removeChildin interfaceNodeInfo
-
getChildren
Description copied from interface:NodeInfoReturns a readonly list of children.Note: the returned list is readonly. To modify, please use
NodeInfo.appendChild(org.zkoss.zk.ui.metainfo.NodeInfo)andNodeInfo.removeChild(org.zkoss.zk.ui.metainfo.NodeInfo)instead.- Specified by:
getChildrenin interfaceNodeInfo
-
isEffective
Description copied from interface:ConditionUsed to evaluate whether it is effective.- Specified by:
isEffectivein interfaceCondition- Parameters:
comp- used as the self variable. Ignored if null.
-
isEffective
Description copied from interface:ConditionUsed to evaluate whether it is effective.- Specified by:
isEffectivein interfaceCondition- Parameters:
page- used as the self variable. Ignored if null.
-
getEvaluatorRef
Description copied from interface:NodeInfoReturns the evaluator reference.- Specified by:
getEvaluatorRefin interfaceNodeInfo
-
getPageDefinition
Description copied from interface:NodeInfoReturns the page definition, i.e., the root node, or null if not available.- Specified by:
getPageDefinitionin interfaceNodeInfo
-
getEvaluator
Description copied from interface:NodeInfoReturns the evaluator.All nodes in the same ZUML tree has the same evaluator reference (inherited from the root node,
PageDefinition.getEvaluatorRef()).- Specified by:
getEvaluatorin interfaceNodeInfo
-
getParent
Description copied from interface:NodeInfoReturns the parent, or null if it has no parent.
-