Interface ComposerExt<T extends Component>

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

public interface ComposerExt<T extends Component>
An addition interface implemented with Composer to provide more control.

Note: any class that implements ComposerExt must implement Composer, but not vice-versa.

Since:
3.0.0, Composer
Author:
tomyeh
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    doBeforeCompose(Page page, Component parent, ComponentInfo compInfo)
    Invokes before composing a component.
    void
    Invokes after the component is instantiated and initialized, but before composing any child.
    boolean
    Called when an exception occurs when composing the component.
    void
    Called after the component has been composed completely.
  • Method Details

    • doBeforeCompose

      ComponentInfo doBeforeCompose(Page page, Component parent, ComponentInfo compInfo) throws Exception
      Invokes before composing a component. If you want to manipulate the specified component info, you can use ComponentInfo.duplicate() to make a copy and then modify it such that it won't affect the default behavior.
      Parameters:
      page - the page for composing this component.
      parent - the parent component, or null if it is the root component.
      compInfo - the component info used to instantiate the component. Notice that it is null if the page is rendered as ZK JSP, since ComponentInfo is not available under ZK JSP.
      Returns:
      the component info used to instantiate the component. In most case, it shall return compInfo. If null is returned, the component won't be instantiated. In other words, it is ignored.
      Throws:
      Exception
    • doBeforeComposeChildren

      void doBeforeComposeChildren(T comp) throws Exception
      Invokes after the component is instantiated and initialized, but before composing any child.
      Parameters:
      comp - the component being composed
      Throws:
      Exception
    • doCatch

      boolean doCatch(Throwable ex) throws Exception
      Called when an exception occurs when composing the component.

      If you don't want to handle the exception, simply returns false. boolean doCatch(Throwable ex) {return false;}

      An exception thrown in this method is simply logged. It has no effect on the execution. If you want to ignore the exception, just return true.

      Parameters:
      ex - the exception being thrown
      Returns:
      whether to ignore the exception. If false is returned, the exception will be re-thrown. Note: once a composer's doCatch returns true, the exception will be ignored and it means doCatch of the following composers won't be called.
      Throws:
      Exception
    • doFinally

      void doFinally() throws Exception
      Called after the component has been composed completely. It is the last step of the composing.

      Note: it is always called even if doCatch(java.lang.Throwable), doBeforeComposeChildren(T) or Composer.doAfterCompose(T) is not called (due to exceptions).

      Note: it is called after the onCreate event is posted, but before the onCreate and any other events are handled.

      An exception thrown in this method is simply logged. It has no effect on the execution.

      Throws:
      Exception