org.zkoss.bind.impl
Class BinderImpl

java.lang.Object
  extended by org.zkoss.bind.impl.BinderImpl
All Implemented Interfaces:
Binder, BinderCtrl
Direct Known Subclasses:
AnnotateBinderImpl

public class BinderImpl
extends java.lang.Object
implements Binder, BinderCtrl

Implementation of Binder.

Author:
henrichen

Field Summary
static java.lang.String BINDCTX
           
static java.lang.String BINDER
           
static java.lang.String BINDING
           
static java.lang.String IGNORE_TRACKER
           
static java.lang.String NOTIFYS
           
static java.lang.String QUE
           
static java.lang.String SRCPATH
           
static java.lang.String VALIDATES
           
static java.lang.String VAR
           
static java.lang.String VM
           
 
Constructor Summary
BinderImpl(Component comp, java.lang.Object vm, java.lang.String qname, java.lang.String qscope)
           
 
Method Summary
 void addCommandBinding(Component comp, java.lang.String evtnm, java.lang.String commandExpr, java.util.Map<java.lang.String,java.lang.Object> args)
          Add a new command bindins.
 void addFormAssociatedSaveBinding(Component associatedComp, java.lang.String formId, SaveBinding saveBinding)
          Add a association between formId and a associated save binding(save binding inside a form), the form has to exist in the parent components
 void addFormBindings(Component comp, java.lang.String idScript, java.lang.String initExpr, java.lang.String[] loadExprs, java.lang.String[] saveExprs, java.lang.String validator, java.util.Map<java.lang.String,java.lang.Object> args, java.util.Map<java.lang.String,java.lang.Object> validatorArgs)
          Add new form Bindings.
 void addPropertyBinding(Component comp, java.lang.String attr, java.lang.String initExpr, java.lang.String[] loadExprs, java.lang.String[] saveExprs, java.lang.String converter, java.lang.String validator, java.util.Map<java.lang.String,java.lang.Object> args, java.util.Map<java.lang.String,java.lang.Object> converterArgs, java.util.Map<java.lang.String,java.lang.Object> validatorArgs)
          Add new property Bindings.
 Converter getConverter(java.lang.String name)
          Returns the _converter of the given _converter name.
 BindEvaluatorX getEvaluatorX()
          Returns the BindEvaluatorX used by this Binder.
protected  EventQueue<Event> getEventQueue()
           
 java.util.Set<SaveBinding> getFormAssociatedSaveBindings(Component comp)
          Get associated save bindings of a form in a component
protected  java.lang.Object getRenderer(java.lang.String name)
           
 Tracker getTracker()
          Returns associated dependency tracker of this binder.
 Validator getValidator(java.lang.String name)
          Returns the _validator of the given _validator name.
 java.lang.Object getViewModel()
          Returns associated ViewModel of this binder.
 void loadComponent(Component comp)
          Internal Use only.
 void notifyChange(java.lang.Object base, java.lang.String attr)
          Notify change of the property.
 void postCommand(java.lang.String command, java.util.Map<java.lang.String,java.lang.Object> args)
          post command this binder, binder will queue the command, and fired later.
 void removeBindings(Component comp)
          Remove all bindings that associated with the specified component.
 void removeBindings(Component comp, java.lang.String key)
          Remove all bindings that associated with the specified component and key (_fieldExpr|evtnm|formid).
 void sendCommand(java.lang.String command, java.util.Map<java.lang.String,java.lang.Object> args)
          send command fired to this binder and process the command immediately
 void setPhaseListener(PhaseListener listener)
          Sets the associated phase listener to intervene the binding life cycle.
 void setViewModel(java.lang.Object vm)
          Sets associated ViewModel of this binder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BINDING

public static final java.lang.String BINDING
See Also:
Constant Field Values

BINDER

public static final java.lang.String BINDER
See Also:
Constant Field Values

BINDCTX

public static final java.lang.String BINDCTX
See Also:
Constant Field Values

VAR

public static final java.lang.String VAR
See Also:
Constant Field Values

VM

public static final java.lang.String VM
See Also:
Constant Field Values

QUE

public static final java.lang.String QUE
See Also:
Constant Field Values

NOTIFYS

public static final java.lang.String NOTIFYS
See Also:
Constant Field Values

VALIDATES

public static final java.lang.String VALIDATES
See Also:
Constant Field Values

SRCPATH

public static final java.lang.String SRCPATH
See Also:
Constant Field Values

IGNORE_TRACKER

public static final java.lang.String IGNORE_TRACKER
See Also:
Constant Field Values
Constructor Detail

BinderImpl

public BinderImpl(Component comp,
                  java.lang.Object vm,
                  java.lang.String qname,
                  java.lang.String qscope)
Method Detail

setViewModel

public void setViewModel(java.lang.Object vm)
Description copied from interface: Binder
Sets associated ViewModel of this binder.

Specified by:
setViewModel in interface Binder
Parameters:
vm - the associated view model of this binder.

getViewModel

public java.lang.Object getViewModel()
Description copied from interface: Binder
Returns associated ViewModel of this binder.

Specified by:
getViewModel in interface Binder
Returns:
associated ViewModel of this binder.

getConverter

public Converter getConverter(java.lang.String name)
Description copied from interface: Binder
Returns the _converter of the given _converter name.

Specified by:
getConverter in interface Binder
Parameters:
name - _converter name
Returns:
the _converter of the given _converter name.

getValidator

public Validator getValidator(java.lang.String name)
Description copied from interface: Binder
Returns the _validator of the given _validator name.

Specified by:
getValidator in interface Binder
Parameters:
name - _validator name
Returns:
the _validator of the given _validator name.

getRenderer

protected java.lang.Object getRenderer(java.lang.String name)

getEvaluatorX

public BindEvaluatorX getEvaluatorX()
Description copied from interface: Binder
Returns the BindEvaluatorX used by this Binder.

Specified by:
getEvaluatorX in interface Binder
Returns:
the EvaluatorX.

addFormBindings

public void addFormBindings(Component comp,
                            java.lang.String idScript,
                            java.lang.String initExpr,
                            java.lang.String[] loadExprs,
                            java.lang.String[] saveExprs,
                            java.lang.String validator,
                            java.util.Map<java.lang.String,java.lang.Object> args,
                            java.util.Map<java.lang.String,java.lang.Object> validatorArgs)
Description copied from interface: Binder
Add new form Bindings.

Specified by:
addFormBindings in interface Binder
Parameters:
comp - the associated component, must not null
idScript - the form id, must not null
initExpr - init expressions ; null to ignore it ; the return value of initExpr must be a Form instance
loadExprs - load expressions
saveExprs - save expressions
validator - the provided validator expression; null to ignore it
args - args key-value pairs for binding.
validatorArgs - args key-value pairs for validator

addPropertyBinding

public void addPropertyBinding(Component comp,
                               java.lang.String attr,
                               java.lang.String initExpr,
                               java.lang.String[] loadExprs,
                               java.lang.String[] saveExprs,
                               java.lang.String converter,
                               java.lang.String validator,
                               java.util.Map<java.lang.String,java.lang.Object> args,
                               java.util.Map<java.lang.String,java.lang.Object> converterArgs,
                               java.util.Map<java.lang.String,java.lang.Object> validatorArgs)
Description copied from interface: Binder
Add new property Bindings.

Specified by:
addPropertyBinding in interface Binder
Parameters:
comp - the associated component, must not null
attr - the associated attribute of the component; ex label, style
initExpr - init expressions ; null to ignore it
loadExprs - load expressions
saveExprs - save expressions
converter - the provided converter expression; null to ignore it.
validator - the provided validator expression; null to ignore it.
args - args key-value pairs for binding.
converterArgs - args key-value pairs for converter
validatorArgs - args key-value pairs for validator

addCommandBinding

public void addCommandBinding(Component comp,
                              java.lang.String evtnm,
                              java.lang.String commandExpr,
                              java.util.Map<java.lang.String,java.lang.Object> args)
Description copied from interface: Binder
Add a new command bindins.

Specified by:
addCommandBinding in interface Binder
Parameters:
comp - the associated component
evtnm - the associated component event name
commandExpr - the command expression
args - other key-value pairs pairs for command

sendCommand

public void sendCommand(java.lang.String command,
                        java.util.Map<java.lang.String,java.lang.Object> args)
Description copied from interface: Binder
send command fired to this binder and process the command immediately

Specified by:
sendCommand in interface Binder
Parameters:
command - command name
args - , arguments when notifing this command, it will be passed as a arguments of execution method of vm

postCommand

public void postCommand(java.lang.String command,
                        java.util.Map<java.lang.String,java.lang.Object> args)
Description copied from interface: Binder
post command this binder, binder will queue the command, and fired later.

Specified by:
postCommand in interface Binder
Parameters:
command - command name
args - , arguments when notifing this command, it will be passed as a arguments of execution method of vm

removeBindings

public void removeBindings(Component comp)
Remove all bindings that associated with the specified component.

Specified by:
removeBindings in interface Binder
Parameters:
comp - the component

removeBindings

public void removeBindings(Component comp,
                           java.lang.String key)
Remove all bindings that associated with the specified component and key (_fieldExpr|evtnm|formid).

Specified by:
removeBindings in interface Binder
Parameters:
comp - the component
key - can be component attribute, event name, or form id

getTracker

public Tracker getTracker()
Description copied from interface: Binder
Returns associated dependency tracker of this binder.

Specified by:
getTracker in interface Binder
Returns:
associated dependency tracker of this binder.

loadComponent

public void loadComponent(Component comp)
Internal Use only.


notifyChange

public void notifyChange(java.lang.Object base,
                         java.lang.String attr)
Description copied from interface: Binder
Notify change of the property.

Specified by:
notifyChange in interface Binder
Parameters:
base - the backing bean object.
attr - the property of the bean that change the value

setPhaseListener

public void setPhaseListener(PhaseListener listener)
Description copied from interface: Binder
Sets the associated phase listener to intervene the binding life cycle.

Specified by:
setPhaseListener in interface Binder
Parameters:
listener - the associated phase listener.

getEventQueue

protected EventQueue<Event> getEventQueue()

addFormAssociatedSaveBinding

public void addFormAssociatedSaveBinding(Component associatedComp,
                                         java.lang.String formId,
                                         SaveBinding saveBinding)
Description copied from interface: BinderCtrl
Add a association between formId and a associated save binding(save binding inside a form), the form has to exist in the parent components

Specified by:
addFormAssociatedSaveBinding in interface BinderCtrl
Parameters:
associatedComp - associated component inside a form binding
formId - the form id
saveBinding - the nested save binding in side a form binding

getFormAssociatedSaveBindings

public java.util.Set<SaveBinding> getFormAssociatedSaveBindings(Component comp)
Description copied from interface: BinderCtrl
Get associated save bindings of a form in a component

Specified by:
getFormAssociatedSaveBindings in interface BinderCtrl
Parameters:
comp - the component that contains the form
Returns:
all associated save binding in the form


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