public interface Composer<T extends Component>
To initialize a component, you can implement this interface and then specify the class or an instance of it with the apply attribute as follows.
<window apply="my.MyComposer"/>
<window apply="${a_composer}"/>
Then, ZK loader will
ComposerExt.doBeforeCompose(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.metainfo.ComponentInfo)
, if the composer
also implements ComposerExt
.UiFactory.newComponent(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.metainfo.ComponentInfo, org.zkoss.zk.ui.Component)
, which creates
and initializes the component accordingly).
ComposerExt.doBeforeComposeChildren(T)
, if
ComposerExt
is also implemented.doAfterCompose(T)
after all children are, if any,
composed.To intercept the lifecycle of the creation of a page,
implement Initiator
and specify the class with the init directive.
Note: AfterCompose
has to be implemented
as part of a component, while Composer
is a controller used
to initialize a component (that might or might not implement
AfterCompose
).
Alternatives: in most cases, you don't implement Composer
directly.
Rather, you can extend from one of the following skeletons.
SelectorComposer
SelectorComposer
.GenericForwardComposer
AfterCompose
,
ComposerExt
,
FullComposer
,
Initiator
Modifier and Type | Method and Description |
---|---|
void |
doAfterCompose(T comp)
Invokes after ZK loader creates this component,
initializes it and composes all its children, if any.
|
void doAfterCompose(T comp) throws java.lang.Exception
comp
- the component has been composedjava.lang.Exception
Copyright © 2005-2023 Potix Corporation. All Rights Reserved.