org.zkoss.zuti.zul
Class Apply

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zk.ui.HtmlShadowElement
          extended by org.zkoss.zuti.zul.TemplateBasedShadowElement
              extended by org.zkoss.zuti.zul.Apply
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Component, AfterCompose, DynamicPropertied, Scope, ShadowElement, ShadowElementCtrl, ComponentCtrl

public class Apply
extends TemplateBasedShadowElement
implements 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:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlShadowElement
HtmlShadowElement.Direction
 
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
AbstractComponent.Children
 
Field Summary
protected  java.util.Map<java.lang.String,java.lang.Object> _props
           
 
Fields inherited from class org.zkoss.zuti.zul.TemplateBasedShadowElement
_dirtyBinding, FOREACH_RENDERED_COMPONENTS, ON_BINDING_READY, SHADOW_VARIABLE
 
Fields inherited from class org.zkoss.zk.ui.HtmlShadowElement
_afterComposed, BIND_ANNO, BINDER, INIT_ANNO, LOAD_ANNO, ON_REBUILD_SHADOW_TREE_LATER, REFERENCE_ANNO, SAVE_ANNO
 
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
CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
 
Constructor Summary
Apply()
           
 
Method Summary
 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.
 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.
 
Methods inherited from class org.zkoss.zuti.zul.TemplateBasedShadowElement
addBindingListener, afterCompose, detach, docheck0, isBindingReady, isDynamicValue, onChildAdded, onChildRemoved, rebuildSubShadowTree, removeBindingListener
 
Methods inherited from class org.zkoss.zk.ui.HtmlShadowElement
afterHostChildAdded, afterHostChildRemoved, asShadow, beforeChildAdded, beforeHostChildAdded, beforeHostChildRemoved, beforeHostParentChanged, beforeParentChanged, getDistributedChildren, getFirstInsertion, getLastInsertion, getNextInsertion, getNextInsertionComponentIfAny, getPreviousInsertion, getPreviousInsertionComponentIfAny, getShadowHost, getShadowHostIfAny, inRange, invalidate, isDynamicValue, mergeSubTree, mergeToHost, onHostAttached, onHostChildAdded, onHostChildRemoved, onHostDetached, recreate, setParent, setPrevInsertion, setShadowHost, shrinkRange, stretchRange, toString, updateSubBindingAnnotationCount
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildRemoved, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getChildren, getClientAttribute, 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, getShadowRoots, 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, isChildable, isInvalidated, isListenerAvailable, isVisible, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, 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, 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
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_props

protected transient java.util.Map<java.lang.String,java.lang.Object> _props
Constructor Detail

Apply

public Apply()
Method Detail

getTemplate

public java.lang.String getTemplate()
Returns the template name

Default: empty string


setTemplate

public void setTemplate(java.lang.String template)
Sets the template name to apply


setTemplateURI

public void setTemplateURI(java.lang.String templateURI)
Sets the template uri.

If templateURI is changed, the whole shadow is recreated.

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:
setDynamicProperty(java.lang.String, java.lang.Object)

getTemplateURI

public java.lang.String getTemplateURI()

resolveTemplate

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.

Returns:
Template

resolveVariable

public java.lang.Object resolveVariable(Component child,
                                        java.lang.String name,
                                        boolean recurse)
Description copied from interface: ShadowElementCtrl
Returns the variable associated with this base component or null if not found.

Notice that it doesn't check any variable defined in VariableResolver (of Page.addVariableResolver(org.zkoss.xel.VariableResolver)).

Specified by:
resolveVariable in interface ShadowElementCtrl
Overrides:
resolveVariable in class HtmlShadowElement
Parameters:
child - the child component of the shadow host
recurse - 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

protected void compose(Component host)
Composes from template name and then template uri, if any.

Overrides:
compose in class TemplateBasedShadowElement
Parameters:
host - the shadow host component, never null.

isEffective

protected boolean isEffective()
Description copied from class: HtmlShadowElement
Returns whether the shadow element is effective

Overrides:
isEffective in class TemplateBasedShadowElement

hasDynamicProperty

public boolean hasDynamicProperty(java.lang.String name)
Description copied from interface: DynamicPropertied
Returns whether a dynamic property is defined.

Specified by:
hasDynamicProperty in interface DynamicPropertied

getDynamicProperty

public java.lang.Object getDynamicProperty(java.lang.String name)
Description copied from interface: DynamicPropertied
Returns the property value of the specified name.

Specified by:
getDynamicProperty in interface DynamicPropertied

getDynamicProperties

public java.util.Map<java.lang.String,java.lang.Object> getDynamicProperties()

setDynamicProperty

public void setDynamicProperty(java.lang.String name,
                               java.lang.Object value)
                        throws WrongValueException
Description copied from interface: DynamicPropertied
Sets 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:
setDynamicProperty in interface DynamicPropertied
Throws:
WrongValueException

clone

public java.lang.Object clone()
Description copied from interface: Component
Clones the component. All of its children and descendants are cloned. Also, ID are preserved.

Specified by:
clone in interface Component
Overrides:
clone in class TemplateBasedShadowElement
Returns:
the new component. Notice that it doesn't belong to any page, nor desktop. It doesn't have a parent, either.


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