Class XmlMacroComponent
- 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.Macro,org.zkoss.zk.ui.ext.Scope,org.zkoss.zk.ui.IdSpace,org.zkoss.zk.ui.sys.ComponentCtrl
By default, compose() will wire members by use
of Selectors. In other words, it will wire annotated members
the same way as SelectorComposer does.
If you prefer to wire the members based on the name convention
as GenericForwardComposer does (i.e.,
backward compatible with ZK 5), you could specify a library property
called org.zkoss.zk.ui.macro.autowire.convention to true
in WEB-INF/zk.xml as follows.
<library-property>
<name>org.zkoss.zk.ui.macro.autowire.convention</name>
<value>true</value>
</library-property>
If you prefer not to wire at all (neither by-selector nor by-convention),
you could specify a library property called
org.zkoss.zk.ui.macro.autowire.disabled to true
in WEB-INF/zk.xml as follows..
<library-property>
<name>org.zkoss.zk.ui.macro.autowire.disabled</name>
<value>true</value>
</library-property>
- Since:
- 3.0.0
- Author:
- tomyeh
- See Also:
-
Nested Class Summary
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
FieldsModifier and TypeFieldDescriptionprotected final List<org.zkoss.xel.VariableResolver>A list of resolvers (never null).Fields 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 TypeMethodDescriptionvoidCreates the child components after apply dynamic propertiessetDynamicProperty(java.lang.String, java.lang.Object).clone()protected voidcompose()Composes the macro component.getDynamicProperty(String name) booleanhasDynamicProperty(String name) protected booleanbooleanisInline()voidrecreate()voidvoidsetDynamicProperty(String name, Object value) booleansetInlineParent(org.zkoss.zk.ui.Component parent, org.zkoss.zk.ui.Component beforeSibling) voidsetMacroURI(String uri) voidsetPage(org.zkoss.zk.ui.Page page) Changes the page.voidsetParent(org.zkoss.zk.ui.Component parent) Changes the parent.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, beforeChildAdded, beforeChildRemoved, beforeParentChanged, destroyIndexCacheMap, detach, 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, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getPropertyAccess, 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, initIndexCacheMap, insertBefore, invalidate, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onParentChanged, onWrongValue, query, queryAll, 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, setPageBefore, setStubonly, setStubonly, setStubonlyDescendants, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerializeMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.zkoss.zk.ui.IdSpace
getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, hasFellow, hasFellowMethods inherited from interface org.zkoss.zk.ui.ext.Scope
addScopeListener, getAttribute, hasAttribute, removeAttribute, removeScopeListener, setAttribute
-
Field Details
-
_resolvers
A list of resolvers (never null). A variable resolver is added automatically ifVariableResolverwas annotated.
-
-
Constructor Details
-
XmlMacroComponent
public XmlMacroComponent()
-
-
Method Details
-
afterCompose
public void afterCompose()Creates the child components after apply dynamic propertiessetDynamicProperty(java.lang.String, java.lang.Object).The second invocation is ignored. If you want to recreate child components, use
recreate()instead.If a macro component is created by ZK loader, this method is invoked automatically. Developers need to invoke this method only if they create a macro component manually.
If this is an line macro, this method is invoked automatically if
setParent(org.zkoss.zk.ui.Component)orsetPage(org.zkoss.zk.ui.Page)called- Specified by:
afterComposein interfaceorg.zkoss.zk.ui.ext.AfterCompose
-
compose
protected void compose()Composes the macro component. It is called byafterCompose(), and others to do the rendering based ongetMacroURI().- Since:
- 5.0.5
-
setMacroURI
- Specified by:
setMacroURIin interfaceorg.zkoss.zk.ui.ext.Macro
-
getMacroURI
- Specified by:
getMacroURIin interfaceorg.zkoss.zk.ui.ext.Macro
-
recreate
public void recreate()- Specified by:
recreatein interfaceorg.zkoss.zk.ui.ext.Macro
-
isInline
public boolean isInline()- Specified by:
isInlinein interfaceorg.zkoss.zk.ui.ext.Macro
-
setParent
public void setParent(org.zkoss.zk.ui.Component parent) Changes the parent.Note: if this is an inline macro (
isInline()), this method actually changes the parent of all components created from the macro URI. In other word, an inline macro behaves like a controller of the components it created. It doesn't belong to any page or parent. Moreover,afterCompose()is called automatically if it is not called (and this is an inline macro).- Specified by:
setParentin interfaceorg.zkoss.zk.ui.Component- Overrides:
setParentin classorg.zkoss.zk.ui.AbstractComponent
-
setInlineParent
public boolean setInlineParent(org.zkoss.zk.ui.Component parent, org.zkoss.zk.ui.Component beforeSibling) - Specified by:
setInlineParentin interfaceorg.zkoss.zk.ui.ext.Macro
-
setPage
public void setPage(org.zkoss.zk.ui.Page page) Changes the page.Note: if this is an inline macro (
isInline()), this method actually changes the page of all components created from the macro URI. In other word, an inline macro behaves like a controller of the components it created. It doesn't belong to any page or parent. Moreover,afterCompose()is called automatically if it is not called (and this is an inline macro).- Specified by:
setPagein interfaceorg.zkoss.zk.ui.Component- Overrides:
setPagein classorg.zkoss.zk.ui.AbstractComponent
-
isChildable
protected boolean isChildable()- Overrides:
isChildablein classorg.zkoss.zk.ui.AbstractComponent
-
redraw
- Specified by:
redrawin interfaceorg.zkoss.zk.ui.sys.ComponentCtrl- Overrides:
redrawin classorg.zkoss.zk.ui.AbstractComponent- Throws:
IOException
-
clone
- Specified by:
clonein interfaceorg.zkoss.zk.ui.Component- Overrides:
clonein classorg.zkoss.zk.ui.AbstractComponent
-
hasDynamicProperty
- Specified by:
hasDynamicPropertyin interfaceorg.zkoss.zk.ui.ext.DynamicPropertied
-
getDynamicProperties
- Specified by:
getDynamicPropertiesin interfaceorg.zkoss.zk.ui.ext.DynamicPropertied
-
getDynamicProperty
- Specified by:
getDynamicPropertyin interfaceorg.zkoss.zk.ui.ext.DynamicPropertied
-
setDynamicProperty
public void setDynamicProperty(String name, Object value) throws org.zkoss.zk.ui.WrongValueException - Specified by:
setDynamicPropertyin interfaceorg.zkoss.zk.ui.ext.DynamicPropertied- Throws:
org.zkoss.zk.ui.WrongValueException
-