Class Apply

java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlShadowElement
All Implemented Interfaces:
Serializable, Cloneable, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.ext.AfterCompose, org.zkoss.zk.ui.ext.DynamicPropertied, org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.ShadowElement, org.zkoss.zk.ui.ShadowElementCtrl, org.zkoss.zk.ui.sys.ComponentCtrl

public class Apply extends TemplateBasedShadowElement implements org.zkoss.zk.ui.ext.DynamicPropertied
The apply tag allows you to choose which template to be applied. You specify the template's name using the template attribute or the template's URI using the templateURI attribute.

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

    org.zkoss.zk.ui.HtmlShadowElement.Direction

    Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent

    org.zkoss.zk.ui.AbstractComponent.Children, org.zkoss.zk.ui.AbstractComponent.ForwardInfo, org.zkoss.zk.ui.AbstractComponent.TargetInfo
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Map<String,Object>
     

    Fields 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_CHANGE

    Fields inherited from interface org.zkoss.zk.ui.Component

    APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE

    Fields 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    protected void
    compose(org.zkoss.zk.ui.Component host)
    Composes from template name and then template uri, if any.
     
     
    org.zkoss.zk.ui.sys.PropertyAccess
     
    Returns the template name
     
    boolean
     
    protected boolean
     
    protected org.zkoss.zk.ui.util.Template
    Return the template, if any, the default implementation will look up the template where in its parent shadow or its shadow host.
    resolveVariable(org.zkoss.zk.ui.Component child, String name, boolean recurse)
     
    void
     
    void
    setTemplate(String template)
    Sets the template name to apply.
    void
    setTemplateURI(String templateURI)
    Sets the template uri.

    Methods 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, updateSubBindingAnnotationCount

    Methods 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, 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, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, updateByClient, willPassivate, willPassivate, willSerialize, willSerialize

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • Apply

      public Apply()
  • Method Details

    • getTemplate

      public String getTemplate()
      Returns the template name

      Default: empty string

    • setTemplate

      public void setTemplate(String template)
      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

      public void setTemplateURI(String templateURI)
      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 by Execution.getArg(). For example, if "/a.zul?b=c" is specified, you can access the parameter with ${arg.b} in a.zul.
      See Also:
    • getTemplateURI

      public String getTemplateURI()
    • resolveTemplate

      protected org.zkoss.zk.ui.util.Template 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

      public Object resolveVariable(org.zkoss.zk.ui.Component child, String name, boolean recurse)
      Specified by:
      resolveVariable in interface org.zkoss.zk.ui.ShadowElementCtrl
      Overrides:
      resolveVariable in class org.zkoss.zk.ui.HtmlShadowElement
    • compose

      protected void compose(org.zkoss.zk.ui.Component host)
      Composes from template name and then template uri, if any.
      Overrides:
      compose in class TemplateBasedShadowElement
    • isEffective

      protected boolean isEffective()
      Overrides:
      isEffective in class TemplateBasedShadowElement
    • hasDynamicProperty

      public boolean hasDynamicProperty(String name)
      Specified by:
      hasDynamicProperty in interface org.zkoss.zk.ui.ext.DynamicPropertied
    • getDynamicProperty

      public Object getDynamicProperty(String name)
      Specified by:
      getDynamicProperty in interface org.zkoss.zk.ui.ext.DynamicPropertied
    • getDynamicProperties

      public Map<String,Object> getDynamicProperties()
      Specified by:
      getDynamicProperties in interface org.zkoss.zk.ui.ext.DynamicPropertied
    • setDynamicProperty

      public void setDynamicProperty(String name, Object value) throws org.zkoss.zk.ui.WrongValueException
      Specified by:
      setDynamicProperty in interface org.zkoss.zk.ui.ext.DynamicPropertied
      Throws:
      org.zkoss.zk.ui.WrongValueException
    • getPropertyAccess

      public org.zkoss.zk.ui.sys.PropertyAccess getPropertyAccess(String prop)
      Specified by:
      getPropertyAccess in interface org.zkoss.zk.ui.sys.ComponentCtrl
      Overrides:
      getPropertyAccess in class org.zkoss.zk.ui.AbstractComponent
    • clone

      public Object clone()
      Specified by:
      clone in interface org.zkoss.zk.ui.Component
      Overrides:
      clone in class TemplateBasedShadowElement