Package org.zkoss.zul

Interface RendererCtrl


  • public interface RendererCtrl
    This interface defines the methods components like Listbox use to notify the renderer for several circumstance.

    Though ListitemRenderer.render(org.zkoss.zul.Listitem, T, int) is called one item a timer, a request might have several items to render. And, if the renderer implements this interface, doTry() will be called before any rendering, and doFinally() will be called after all rendering. If any exception occurs, doCatch(java.lang.Throwable) will be called.

    A typical use is to start a transaction and use it for rendering all items from the same request.

    Author:
    tomyeh
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void doCatch​(java.lang.Throwable ex)
      Called if any exception occurs when rendering items.
      void doFinally()
      Invoked after all rendering are done successfully or an exception occurs.
      void doTry()
      Called before rendering any item.
    • Method Detail

      • doTry

        void doTry()
        Called before rendering any item.

        Example, you could start an transaction here.

      • doCatch

        void doCatch​(java.lang.Throwable ex)
              throws java.lang.Throwable
        Called if any exception occurs when rendering items. Note: this method won't be called if exception occurs in doTry().

        If this method doesn't throw exception, ex is 'eaten' though rendering is terminating. Thus, if you want to bubble up the exception, you could throw it again.

        Example, you could roll back the transaction.

        Throws:
        java.lang.Throwable
      • doFinally

        void doFinally()
        Invoked after all rendering are done successfully or an exception occurs.

        If an exception occurs, doCatch(java.lang.Throwable) will be invoked first and then doFinally().