org.zkoss.zml
Class XmlMacroComponent

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zml.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

public class XmlMacroComponent
extends org.zkoss.zk.ui.AbstractComponent
implements org.zkoss.zk.ui.ext.Macro

The implementation of a macro component for XML output.

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.


        
                org.zkoss.zk.ui.macro.autowire.convention
                true
        
 

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..


        
                org.zkoss.zk.ui.macro.autowire.disabled
                true
        
 

Since:
3.0.0
Author:
tomyeh
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.AbstractComponent.Children
 
Field Summary
protected  List<org.zkoss.xel.VariableResolver> _resolvers
          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_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
XmlMacroComponent()
           
 
Method Summary
 void afterCompose()
          Creates the child components after apply dynamic properties setDynamicProperty(java.lang.String, java.lang.Object).
 Object clone()
           
protected  void compose()
          Composes the macro component.
 Object getDynamicProperty(String name)
           
 String getMacroURI()
           
 boolean hasDynamicProperty(String name)
           
protected  boolean isChildable()
           
 boolean isInline()
           
 void recreate()
           
 void redraw(Writer out)
           
 void setDynamicProperty(String name, Object value)
           
 boolean setInlineParent(org.zkoss.zk.ui.Component parent, org.zkoss.zk.ui.Component beforeSibling)
           
 void setMacroURI(String uri)
           
 void setPage(org.zkoss.zk.ui.Page page)
          Changes the page.
 void setParent(org.zkoss.zk.ui.Component parent)
          Changes the parent.
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addScopeListener, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableClientUpdate, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getChildren, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getExtraCtrl, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getStubonly, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasFellow, hasFellow, insertBefore, invalidate, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, removeScopeListener, render, render, render, renderProperties, replace, response, response, response, service, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setDefinition, setDefinition, setId, setMold, setPageBefore, setStubonly, setStubonly, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, willPassivate, willPassivate, willSerialize, willSerialize
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.zkoss.zk.ui.IdSpace
getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, hasFellow, hasFellow
 
Methods inherited from interface org.zkoss.zk.ui.ext.Scope
addScopeListener, getAttribute, getAttribute, getAttributes, hasAttribute, hasAttribute, removeAttribute, removeAttribute, removeScopeListener, setAttribute, setAttribute
 

Field Detail

_resolvers

protected final List<org.zkoss.xel.VariableResolver> _resolvers
A list of resolvers (never null). A variable resolver is added automatically if org.zkoss.zk.ui.select.annotation.VariableResolver was annotated.

Constructor Detail

XmlMacroComponent

public XmlMacroComponent()
Method Detail

afterCompose

public void afterCompose()
Creates the child components after apply dynamic properties setDynamicProperty(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) or setPage(org.zkoss.zk.ui.Page) called

Specified by:
afterCompose in interface org.zkoss.zk.ui.ext.AfterCompose

compose

protected void compose()
Composes the macro component. It is called by afterCompose(), and others to do the rendering based on getMacroURI().

Since:
5.0.5

setMacroURI

public void setMacroURI(String uri)
Specified by:
setMacroURI in interface org.zkoss.zk.ui.ext.Macro

getMacroURI

public String getMacroURI()
Specified by:
getMacroURI in interface org.zkoss.zk.ui.ext.Macro

recreate

public void recreate()
Specified by:
recreate in interface org.zkoss.zk.ui.ext.Macro

isInline

public boolean isInline()
Specified by:
isInline in interface org.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:
setParent in interface org.zkoss.zk.ui.Component
Overrides:
setParent in class org.zkoss.zk.ui.AbstractComponent

setInlineParent

public boolean setInlineParent(org.zkoss.zk.ui.Component parent,
                               org.zkoss.zk.ui.Component beforeSibling)
Specified by:
setInlineParent in interface org.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:
setPage in interface org.zkoss.zk.ui.Component
Overrides:
setPage in class org.zkoss.zk.ui.AbstractComponent

isChildable

protected boolean isChildable()
Overrides:
isChildable in class org.zkoss.zk.ui.AbstractComponent

redraw

public void redraw(Writer out)
            throws IOException
Specified by:
redraw in interface org.zkoss.zk.ui.sys.ComponentCtrl
Overrides:
redraw in class org.zkoss.zk.ui.AbstractComponent
Throws:
IOException

clone

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

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

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


Copyright © 2015. All rights reserved.