org.zkoss.zkdemo.userguide
Class MainLayoutComposer

java.lang.Object
  extended by org.zkoss.zk.ui.event.GenericEventListener
      extended by org.zkoss.zk.ui.util.GenericComposer
          extended by org.zkoss.zk.ui.util.GenericAutowireComposer
              extended by org.zkoss.zk.ui.util.GenericForwardComposer
                  extended by org.zkoss.zkdemo.userguide.MainLayoutComposer
All Implemented Interfaces:
EventListener, ComponentCloneListener, Composer, ComposerExt, MainLayoutAPI

public class MainLayoutComposer
extends GenericForwardComposer
implements MainLayoutAPI, ComposerExt

Author:
jumperchen

Field Summary
 
Fields inherited from class org.zkoss.zk.ui.util.GenericAutowireComposer
_separator, application, applicationScope, arg, componentScope, desktop, desktopScope, execution, page, pageScope, param, requestScope, self, session, sessionScope, spaceOwner, spaceScope
 
Constructor Summary
MainLayoutComposer()
           
 
Method Summary
 void doAfterCompose(Component comp)
          Auto forward events and wire accessible variables of the specified component into a controller Java object; a subclass that override this method should remember to call super.doAfterCompose(comp) or it will not work.
 ComponentInfo doBeforeCompose(Page page, Component parent, ComponentInfo compInfo)
          Invokes before composing a component.
 void doBeforeComposeChildren(Component comp)
          Invokes after the component is instantiated and initialized, but before composing any child.
 boolean doCatch(java.lang.Throwable ex)
          Called when an exception occurs when composing the component.
 void doFinally()
          Called after the component has been composed completely.
 Category[] getCategories()
           
 ListitemRenderer getItemRenderer()
           
 ListModel getSelectedModel()
           
 void onBookmarkChange$main(BookmarkEvent event)
           
 void onCategorySelect(ForwardEvent event)
           
 void onChanging$searchBox(InputEvent event)
           
 void onCtrlKey$searchBox(KeyEvent event)
           
 void onMainCreate(Event event)
           
 void onSelect$itemList(SelectEvent event)
           
 
Methods inherited from class org.zkoss.zk.ui.util.GenericAutowireComposer
alert, clone
 
Methods inherited from class org.zkoss.zk.ui.event.GenericEventListener
bindComponent, getController, onEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MainLayoutComposer

public MainLayoutComposer()
Method Detail

onCategorySelect

public void onCategorySelect(ForwardEvent event)

onBookmarkChange$main

public void onBookmarkChange$main(BookmarkEvent event)

onSelect$itemList

public void onSelect$itemList(SelectEvent event)

onMainCreate

public void onMainCreate(Event event)

onCtrlKey$searchBox

public void onCtrlKey$searchBox(KeyEvent event)

onChanging$searchBox

public void onChanging$searchBox(InputEvent event)

getCategories

public Category[] getCategories()
Specified by:
getCategories in interface MainLayoutAPI

getItemRenderer

public ListitemRenderer getItemRenderer()
Specified by:
getItemRenderer in interface MainLayoutAPI

getSelectedModel

public ListModel getSelectedModel()
Specified by:
getSelectedModel in interface MainLayoutAPI

doAfterCompose

public void doAfterCompose(Component comp)
                    throws java.lang.Exception
Description copied from class: GenericForwardComposer
Auto forward events and wire accessible variables of the specified component into a controller Java object; a subclass that override this method should remember to call super.doAfterCompose(comp) or it will not work.

Specified by:
doAfterCompose in interface Composer
Overrides:
doAfterCompose in class GenericForwardComposer
Parameters:
comp - the component has been composed
Throws:
java.lang.Exception

doBeforeCompose

public ComponentInfo doBeforeCompose(Page page,
                                     Component parent,
                                     ComponentInfo compInfo)
Description copied from interface: ComposerExt
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.

Specified by:
doBeforeCompose in interface ComposerExt
Overrides:
doBeforeCompose in class GenericComposer
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.
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.

doBeforeComposeChildren

public void doBeforeComposeChildren(Component comp)
                             throws java.lang.Exception
Description copied from interface: ComposerExt
Invokes after the component is instantiated and initialized, but before composing any child.

Specified by:
doBeforeComposeChildren in interface ComposerExt
Overrides:
doBeforeComposeChildren in class GenericComposer
Parameters:
comp - the component being composed
Throws:
java.lang.Exception

doCatch

public boolean doCatch(java.lang.Throwable ex)
                throws java.lang.Exception
Description copied from interface: ComposerExt
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.

Specified by:
doCatch in interface ComposerExt
Overrides:
doCatch in class GenericComposer
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:
java.lang.Exception

doFinally

public void doFinally()
               throws java.lang.Exception
Description copied from interface: ComposerExt
Called after the component has been composed completely. It is the last step of the composing.

Note: it is always called even if ComposerExt.doCatch(java.lang.Throwable), ComposerExt.doBeforeComposeChildren(org.zkoss.zk.ui.Component) or Composer.doAfterCompose(org.zkoss.zk.ui.Component) 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.

Specified by:
doFinally in interface ComposerExt
Overrides:
doFinally in class GenericComposer
Throws:
java.lang.Exception


Copyright © 2005-2009 Potix Corporation. All Rights Reserved.