public class Apply extends TemplateBasedShadowElement implements DynamicPropertied
There are two ways to pass parameters to the apply shadow:
First, you can use setDynamicProperty(java.lang.String, java.lang.Object)
, or, in ZUL,
<apply templateURI="/WEB-INF/mypage" arg="something"/>
Second, you can use the query string:
<apply templateURI="/WEB-INF/mypage?arg=something"/>
With the query string, you can pass only the String values.
and the parameter can be accessed by Execution.getArg()
Or, you can access it with the arg variable in EL expressions.
HtmlShadowElement.Direction
AbstractComponent.Children
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,java.lang.Object> |
_props |
_dirtyBinding, FOREACH_RENDERED_COMPONENTS, ON_BINDING_READY, SHADOW_VARIABLE
_afterComposed, _dynamicValue, BIND_ANNO, BINDER, INIT_ANNO, LOAD_ANNO, ON_REBUILD_SHADOW_TREE_LATER, REFERENCE_ANNO, SAVE_ANNO, SKIP_DISTRIBUTED_CHILDREN_PROPERTY_CHANGE
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
Constructor and Description |
---|
Apply() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Clones the component.
|
protected void |
compose(Component host)
Composes from template name and then template uri, if any.
|
java.util.Map<java.lang.String,java.lang.Object> |
getDynamicProperties() |
java.lang.Object |
getDynamicProperty(java.lang.String name)
Returns the property value of the specified name.
|
PropertyAccess |
getPropertyAccess(java.lang.String prop)
Returns the corresponding property access object from the given property
name, if any.
|
java.lang.String |
getTemplate()
Returns the template name
Default: empty string
|
java.lang.String |
getTemplateURI() |
boolean |
hasDynamicProperty(java.lang.String name)
Returns whether a dynamic property is defined.
|
protected boolean |
isEffective()
Returns whether the shadow element is effective
|
protected Template |
resolveTemplate()
Return the template, if any, the default implementation will look up
the template where in its parent shadow or its
shadow host.
|
java.lang.Object |
resolveVariable(Component child,
java.lang.String name,
boolean recurse)
Returns the variable associated with this base component or null if not found.
|
void |
setDynamicProperty(java.lang.String name,
java.lang.Object value)
Sets a property with the specified name and value.
|
void |
setTemplate(java.lang.String template)
Sets the template name to apply.
|
void |
setTemplateURI(java.lang.String templateURI)
Sets the template uri.
|
addBindingListener, afterCompose, detach, docheck0, isBindingReady, isDirtyBinding, isDynamicValue, onChildAdded, onChildRemoved, rebuildSubShadowTree, removeBindingListener
afterHostChildAdded, afterHostChildRemoved, asShadow, beforeChildAdded, beforeHostChildAdded, beforeHostChildRemoved, beforeHostParentChanged, beforeParentChanged, clearChildren, getDistributedChildren, getFirstInsertion, getLastInsertion, getNextInsertion, getNextInsertionComponentIfAny, getPreviousInsertion, getPreviousInsertionComponentIfAny, getShadowHost, getShadowHostIfAny, inRange, invalidate, isDynamicValue, mergeSubTree, mergeToHost, onHostAttached, onHostChildAdded, onHostChildRemoved, onHostDetached, recreate, removeFromParent, setDynamicValue, setParent, setPrevInsertion, setShadowHost, shrinkRange, stretchRange, toString, updateSubBindingAnnotationCount
addAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildRemoved, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getExtraCtrl, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, invalidatePartial, isChildable, isInitialized, isInvalidated, isListenerAvailable, isVisible, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderProperties, replace, response, response, response, service, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, updateByClient, willPassivate, willPassivate, willSerialize, willSerialize
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
invalidatePartial
public java.lang.String getTemplate()
Default: empty string
public void setTemplate(java.lang.String template)
One cannot set both template and template URI in the same time.
Notice that, the template enclosed with <apply> tag will be created only when both template and template URI are not set.
public void setTemplateURI(java.lang.String templateURI)
If templateURI is changed, the whole shadow is recreated. One cannot set both template and template URI in the same time.
Notice that, the template enclosed with <apply> tag will be created only when both template and template URI are not set.
templateURI
- the template URI. If null or empty, nothing is applied.
You can specify the template URI with the query string and they
will become a map of parameters that is accessible by the arg variable
in EL, or by Execution.getArg()
.
For example, if "/a.zul?b=c" is specified, you can access
the parameter with ${arg.b} in a.zul.setDynamicProperty(java.lang.String, java.lang.Object)
public java.lang.String getTemplateURI()
protected Template resolveTemplate()
public java.lang.Object resolveVariable(Component child, java.lang.String name, boolean recurse)
ShadowElementCtrl
Notice that it doesn't check any variable defined in
VariableResolver
(of Page.addVariableResolver(org.zkoss.xel.VariableResolver)
).
resolveVariable
in interface ShadowElementCtrl
resolveVariable
in class HtmlShadowElement
child
- the child component of the shadow hostrecurse
- whether to look up the parent shadow for the
existence of the variable.protected void compose(Component host)
compose
in class TemplateBasedShadowElement
host
- the shadow host component, never null.protected boolean isEffective()
HtmlShadowElement
isEffective
in class TemplateBasedShadowElement
public boolean hasDynamicProperty(java.lang.String name)
DynamicPropertied
hasDynamicProperty
in interface DynamicPropertied
public java.lang.Object getDynamicProperty(java.lang.String name)
DynamicPropertied
getDynamicProperty
in interface DynamicPropertied
public java.util.Map<java.lang.String,java.lang.Object> getDynamicProperties()
public void setDynamicProperty(java.lang.String name, java.lang.Object value) throws WrongValueException
DynamicPropertied
If a component supports only String-type values, it could use org.zkoss.lang.Objects.toString() to convert the value to a String instance.
setDynamicProperty
in interface DynamicPropertied
WrongValueException
public PropertyAccess getPropertyAccess(java.lang.String prop)
ComponentCtrl
getPropertyAccess
in interface ComponentCtrl
getPropertyAccess
in class AbstractComponent
prop
- the name of the propertypublic java.lang.Object clone()
Component
clone
in interface Component
clone
in class TemplateBasedShadowElement
Copyright © 2005-2021 Potix Corporation. All Rights Reserved.