Class Apply
- All Implemented Interfaces:
Serializable,Cloneable,Component,AfterCompose,DynamicPropertied,Scope,ShadowElement,ShadowElementCtrl,ComponentCtrl
Passing Parameters
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.
- Since:
- 8.0.0
- Author:
- jumperchen
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlShadowElement
HtmlShadowElement.DirectionNested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
AbstractComponent.Children, AbstractComponent.ForwardInfo, AbstractComponent.TargetInfo -
Field Summary
FieldsFields inherited from class org.zkoss.zuti.zul.TemplateBasedShadowElement
_dirtyBinding, FOREACH_RENDERED_COMPONENTS, ON_BINDING_READY, SHADOW_VARIABLEFields inherited from class org.zkoss.zk.ui.HtmlShadowElement
_afterComposed, _dynamicValue, BIND_ANNO, BINDER, FOREACH_IN_RENDER, INIT_ANNO, LOAD_ANNO, ON_REBUILD_SHADOW_TREE_LATER, REFERENCE_ANNO, SAVE_ANNO, SKIP_DISTRIBUTED_CHILDREN_PROPERTY_CHANGEFields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPEFields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_CLONED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Clones the component.protected voidComposes from template name and then template uri, if any.Returns all available dynamic properties.getDynamicProperty(String name) Returns the property value of the specified name.getPropertyAccess(String prop) Returns the corresponding property access object from the given property name, if any.Returns the template namebooleanhasDynamicProperty(String name) Returns whether a dynamic property is defined.protected booleanReturns whether the shadow element is effectiveprotected TemplateReturn the template, if any, the default implementation will look up the template where in its parent shadow or its shadow host.resolveVariable(Component child, String name, boolean recurse) Returns the variable associated with this base component or null if not found.voidsetDynamicProperty(String name, Object value) Sets a property with the specified name and value.voidsetTemplate(String template) Sets the template name to apply.voidsetTemplateURI(String templateURI) Sets the template uri.Methods inherited from class org.zkoss.zuti.zul.TemplateBasedShadowElement
addBindingListener, afterCompose, detach, docheck0, isBindingReady, isDirtyBinding, isDynamicValue, onChildAdded, onChildRemoved, rebuildSubShadowTree, removeBindingListenerMethods inherited from class org.zkoss.zk.ui.HtmlShadowElement
afterHostChildAdded, afterHostChildRemoved, asShadow, beforeChildAdded, beforeHostChildAdded, beforeHostChildRemoved, beforeHostParentChanged, beforeParentChanged, clearChildren, destroyIndexCacheMap, getDistributedChildren, getFirstInsertion, getIndex, getIndexCacheMap, getLastInsertion, getNextInsertion, getNextInsertionComponentIfAny, getPreviousInsertion, getPreviousInsertionComponentIfAny, getShadowHost, getShadowHostIfAny, initClone, initIndexCacheMap, inRange, invalidate, isDynamicValue, mergeSubTree, mergeToHost, onHostAttached, onHostChildAdded, onHostChildRemoved, onHostDetached, recreate, removeFromParent, setDynamicValue, setParent, setPrevInsertion, setShadowHost, shrinkRange, stretchRange, toString, updateFirstInsertion, updateLastInsertion, updateNextInsertion, updatePreviousInsertion, updateSubBindingAnnotationCountMethods inherited from class org.zkoss.zk.ui.AbstractComponent
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, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, 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, getForwards, getId, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getStubonlyDescendants, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, isChildable, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onPageAttached, onPageDetached, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderProperties, renderPropertiesOnly, replace, response, response, response, service, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setStubonly, setStubonly, setStubonlyDescendants, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, updateByClient, willPassivate, willPassivate, willSerialize, willSerialize
-
Field Details
-
_props
-
-
Constructor Details
-
Apply
public Apply()
-
-
Method Details
-
getTemplate
Returns the template nameDefault: empty string
-
setTemplate
Sets the template name to apply.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.
-
setTemplateURI
Sets the template uri.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.
- Parameters:
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 byExecution.getArg(). For example, if "/a.zul?b=c" is specified, you can access the parameter with ${arg.b} in a.zul.- See Also:
-
getTemplateURI
-
resolveTemplate
Return the template, if any, the default implementation will look up the template where in its parent shadow or its shadow host.- Returns:
- Template
-
resolveVariable
Description copied from interface:ShadowElementCtrlReturns the variable associated with this base component or null if not found.Notice that it doesn't check any variable defined in
VariableResolver(ofPage.addVariableResolver(org.zkoss.xel.VariableResolver)).- Specified by:
resolveVariablein interfaceShadowElementCtrl- Overrides:
resolveVariablein classHtmlShadowElement- Parameters:
child- the child component of the shadow hostrecurse- whether to look up the parent shadow for the existence of the variable.
If recurse is true, it will look up all parents until found.
-
compose
Composes from template name and then template uri, if any.- Overrides:
composein classTemplateBasedShadowElement- Parameters:
host- the shadow host component, never null.
-
isEffective
protected boolean isEffective()Description copied from class:HtmlShadowElementReturns whether the shadow element is effective- Overrides:
isEffectivein classTemplateBasedShadowElement
-
hasDynamicProperty
Description copied from interface:DynamicPropertiedReturns whether a dynamic property is defined.- Specified by:
hasDynamicPropertyin interfaceDynamicPropertied
-
getDynamicProperty
Description copied from interface:DynamicPropertiedReturns the property value of the specified name.- Specified by:
getDynamicPropertyin interfaceDynamicPropertied
-
getDynamicProperties
Description copied from interface:DynamicPropertiedReturns all available dynamic properties.- Specified by:
getDynamicPropertiesin interfaceDynamicPropertied
-
setDynamicProperty
Description copied from interface:DynamicPropertiedSets a property with the specified name and value.If a component supports only String-type values, it could use org.zkoss.lang.Objects.toString() to convert the value to a String instance.
- Specified by:
setDynamicPropertyin interfaceDynamicPropertied- Throws:
WrongValueException
-
getPropertyAccess
Description copied from interface:ComponentCtrlReturns the corresponding property access object from the given property name, if any.- Specified by:
getPropertyAccessin interfaceComponentCtrl- Overrides:
getPropertyAccessin classAbstractComponent- Parameters:
prop- the name of the property- Returns:
- null it means not to support for the property name.
-
clone
Description copied from interface:ComponentClones the component. All of its children and descendants are cloned. Also, ID are preserved.- Specified by:
clonein interfaceComponent- Overrides:
clonein classTemplateBasedShadowElement- Returns:
- the new component. Notice that it doesn't belong to any page, nor desktop. It doesn't have a parent, either.
-