org.apache.cocoon.forms.binding
Class RepeaterJXPathBinding

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.forms.binding.JXPathBindingBase
          extended by org.apache.cocoon.forms.binding.RepeaterJXPathBinding
All Implemented Interfaces:
LogEnabled, Binding
Direct Known Subclasses:
EnhancedRepeaterJXPathBinding

public class RepeaterJXPathBinding
extends JXPathBindingBase

RepeaterJXPathBinding provides an implementation of a Binding that allows for bidirectional binding of a repeater-widget to/from repeating structures in the back-end object model.

Version:
$Id: RepeaterJXPathBinding.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Field Summary
 
Fields inherited from class org.apache.cocoon.forms.binding.JXPathBindingBase
classes, parent
 
Constructor Summary
RepeaterJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts, String repeaterId, String repeaterPath, String rowPath, String rowPathForInsert, JXPathBindingBase[] childBindings, JXPathBindingBase insertBinding, JXPathBindingBase[] deleteBindings, JXPathBindingBase[] identityBindings)
          Constructs RepeaterJXPathBinding
 
Method Summary
 void doLoad(Widget frmModel, org.apache.commons.jxpath.JXPathContext jxpc)
          Binds the unique-id of the repeated rows, and narrows the context on objectModelContext and Repeater to the repeated rows before handing over to the actual binding-children.
 void doSave(Widget frmModel, org.apache.commons.jxpath.JXPathContext jxpc)
          Uses the mapped identity of each row to detect if rows have been updated, inserted or removed.
 void enableLogging(Logger logger)
           
 ComposedJXPathBindingBase getDeleteRowBinding()
           
 String getId()
          Returns binding definition id.
protected  List getIdentity(org.apache.commons.jxpath.JXPathContext rowContext)
          Get the identity of the given row context.
protected  List getIdentity(Repeater.RepeaterRow row)
          Get the identity of the given row.
 ComposedJXPathBindingBase getIdentityBinding()
           
 JXPathBindingBase getInsertRowBinding()
           
 String getInsertRowPath()
           
 String getRepeaterPath()
           
 ComposedJXPathBindingBase getRowBinding()
           
 String getRowPath()
           
protected  boolean hasNonNullElements(List list)
          Tests if any of the elements in a List is not null.
 String toString()
           
 
Methods inherited from class org.apache.cocoon.forms.binding.JXPathBindingBase
getClass, getCommonAtts, getEnclosingLibrary, getLocation, isValid, loadFormFromModel, loadFormFromModel, saveFormToModel, saveFormToModel, selectWidget, setEnclosingLibrary, setParent
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RepeaterJXPathBinding

public RepeaterJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts,
                             String repeaterId,
                             String repeaterPath,
                             String rowPath,
                             String rowPathForInsert,
                             JXPathBindingBase[] childBindings,
                             JXPathBindingBase insertBinding,
                             JXPathBindingBase[] deleteBindings,
                             JXPathBindingBase[] identityBindings)
Constructs RepeaterJXPathBinding

Method Detail

enableLogging

public void enableLogging(Logger logger)
Specified by:
enableLogging in interface LogEnabled
Overrides:
enableLogging in class AbstractLogEnabled

getId

public String getId()
Description copied from class: JXPathBindingBase
Returns binding definition id.

Specified by:
getId in interface Binding
Overrides:
getId in class JXPathBindingBase

getRepeaterPath

public String getRepeaterPath()

getRowPath

public String getRowPath()

getInsertRowPath

public String getInsertRowPath()

getRowBinding

public ComposedJXPathBindingBase getRowBinding()

getDeleteRowBinding

public ComposedJXPathBindingBase getDeleteRowBinding()

getIdentityBinding

public ComposedJXPathBindingBase getIdentityBinding()

getInsertRowBinding

public JXPathBindingBase getInsertRowBinding()

doLoad

public void doLoad(Widget frmModel,
                   org.apache.commons.jxpath.JXPathContext jxpc)
            throws BindingException
Binds the unique-id of the repeated rows, and narrows the context on objectModelContext and Repeater to the repeated rows before handing over to the actual binding-children.

Specified by:
doLoad in class JXPathBindingBase
Throws:
BindingException

doSave

public void doSave(Widget frmModel,
                   org.apache.commons.jxpath.JXPathContext jxpc)
            throws BindingException
Uses the mapped identity of each row to detect if rows have been updated, inserted or removed. Depending on what happened the appropriate child-bindings are allowed to visit the narrowed contexts.

Specified by:
doSave in class JXPathBindingBase
Throws:
BindingException

hasNonNullElements

protected boolean hasNonNullElements(List list)
Tests if any of the elements in a List is not null.

Parameters:
list -

getIdentity

protected List getIdentity(org.apache.commons.jxpath.JXPathContext rowContext)
Get the identity of the given row context. That's infact a list of all the values of the fields in the bean or XML that constitute the identity.

Parameters:
rowContext -
Returns:
List the identity of the row context

getIdentity

protected List getIdentity(Repeater.RepeaterRow row)
Get the identity of the given row. That's in fact a list of all the values of the fields in the form model that constitute the identity.

Parameters:
row -
Returns:
List the identity of the row

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.