org.zkoss.zk.ui.util
Interface Composer

All Known Implementing Classes:
GenericAutowireComposer, GenericComposer, GenericForwardComposer, MultiComposer

public interface Composer

Represents a composer to initialize a component (or a component of tree) when ZK loader is composing a component. It is the controller in the MVC pattern, while the component is the view.

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

  1. Invoke ComposerExt.doBeforeCompose(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.metainfo.ComponentInfo), if the composer also implements ComposerExt.
  2. Create the component (by use of UiFactory.newComponent(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.metainfo.ComponentInfo), which creates and initializes the component accordingly).
  3. Invokes ComposerExt.doBeforeComposeChildren(org.zkoss.zk.ui.Component), if ComposerExt is also implemented.
  4. Composes all children, if any, of this component defined in the ZUML page.
  5. Invokes doAfterCompose(org.zkoss.zk.ui.Component) after all children are, if any, composed.
  6. Posts the onCreate event if necessary.

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

Since:
3.0.0
Author:
tomyeh
See Also:
AfterCompose, ComposerExt, FullComposer, Initiator

Method Summary
 void doAfterCompose(Component comp)
          Invokes after ZK loader creates this component, initializes it and composes all its children, if any.
 

Method Detail

doAfterCompose

void doAfterCompose(Component comp)
                    throws java.lang.Exception
Invokes after ZK loader creates this component, initializes it and composes all its children, if any.

Parameters:
comp - the component has been composed
Throws:
java.lang.Exception


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