org.zkoss.zkplus.databind
Class AnnotateDataBinderInit

java.lang.Object
  extended by org.zkoss.zkplus.databind.AnnotateDataBinderInit
All Implemented Interfaces:
org.zkoss.zk.ui.util.Initiator, org.zkoss.zk.ui.util.InitiatorExt

Deprecated. As of release 7.0.0, replace with new ZK binding.

public class AnnotateDataBinderInit
extends Object
implements org.zkoss.zk.ui.util.Initiator, org.zkoss.zk.ui.util.InitiatorExt

This initiator class do following things:

  1. New an AnnotateDataBinder instance.
  2. Set the AnnotateDataBinder instance as a custom attribute with the name as specified in arg2 (default to "binder") and store it in the component as specified in arg0 "component-path".(if arg0 is not specified, use Page instead.)
  3. call DataBinder.loadAll() in to doAfterCompose(Page, Component[]) and initiate all UI components from the associated data bean.

Put the init PI as follows:

 <?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" 
        [root="component|component-path"] 
  [loadDefault="true|false"]
  [name="binder's name"]
  [loadOnSave="true|false"] ?>
 

Where the root attribute is the component itself (via EL expression) or the component path that specifies the component the AnnotateDataBinder covers. You can use absolute path that starts with "//" (search from Desktop) or "/" (search from Page); or you can use relative path(supported since ZK 3.0.8) that starts with "./" or "../" (relative to the Id Space of the root component). If the root attribute is not specified or set to string "page", the AnnotateDataBinder will default to cover the whole page.

Where the loadDefault attribute is used to decide whether to load default binding configuration defined in lang-addon.xml. If the loadDefault attribute is not specified it is default to true.

(since 3.6.2) Where the name attribute is used to specify the created DataBinder's name (default to "binder") which you can access it via EL or component.getAttribute(name) later.

(since 5.0.5) Where the loadOnSave attribute(default to true) is used to specify whether DataBinder shall automatically "load" associated binding value back into UI component after doing a "save" operation to the binding bean.

For application design to run ZK prior to 3.6.2, it can use arg0 instead of root, and arg1 instead of loadDefault.

Note that since 5.0, the created DataBinder is stored in component scope of the root component rather than in the IdSpace scope of the root component. If that is important to you, you can specify compatible library property in WEB-INF/zk.xml to true to make it work as it was prior version 5; i.e. store the created DataBinder in IdSpace scope of the root component.

        <library-property>
                <name>org.zkoss.zkplus.databind.AnnotateDataBinderInit.compatible</name>
                <value>true</value>
        </library-property>
 

Author:
Henri Chen
See Also:
AnnotateDataBinder

Field Summary
protected  AnnotateDataBinder _binder
          Deprecated. The AnnotateDataBinder created in doAfterCompose()
 
Constructor Summary
AnnotateDataBinderInit()
          Deprecated.  
 
Method Summary
 void doAfterCompose(org.zkoss.zk.ui.Page page, org.zkoss.zk.ui.Component[] comps)
          Deprecated.  
 boolean doCatch(Throwable ex)
          Deprecated.  
 void doFinally()
          Deprecated.  
 void doInit(org.zkoss.zk.ui.Page page, Map args)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_binder

protected AnnotateDataBinder _binder
Deprecated. 
The AnnotateDataBinder created in doAfterCompose()

Constructor Detail

AnnotateDataBinderInit

public AnnotateDataBinderInit()
Deprecated. 
Method Detail

doCatch

public boolean doCatch(Throwable ex)
Deprecated. 
Specified by:
doCatch in interface org.zkoss.zk.ui.util.InitiatorExt

doFinally

public void doFinally()
Deprecated. 
Specified by:
doFinally in interface org.zkoss.zk.ui.util.InitiatorExt

doInit

public void doInit(org.zkoss.zk.ui.Page page,
                   Map args)
Deprecated. 
Specified by:
doInit in interface org.zkoss.zk.ui.util.Initiator

doAfterCompose

public void doAfterCompose(org.zkoss.zk.ui.Page page,
                           org.zkoss.zk.ui.Component[] comps)
                    throws Exception
Deprecated. 
Specified by:
doAfterCompose in interface org.zkoss.zk.ui.util.InitiatorExt
Throws:
Exception


Copyright © 2014. All rights reserved.