You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2004/02/29 13:50:06 UTC

cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding SimpleRepeaterJXPathBinding.java

antonio     2004/02/29 04:50:06

  Modified:    src/blocks/woody/java/org/apache/cocoon/woody/binding
                        SimpleRepeaterJXPathBinding.java
  Log:
  Formatting code
  
  Revision  Changes    Path
  1.9       +23 -16    cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/SimpleRepeaterJXPathBinding.java
  
  Index: SimpleRepeaterJXPathBinding.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/SimpleRepeaterJXPathBinding.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SimpleRepeaterJXPathBinding.java	3 Feb 2004 12:26:21 -0000	1.8
  +++ SimpleRepeaterJXPathBinding.java	29 Feb 2004 12:50:06 -0000	1.9
  @@ -78,7 +78,10 @@
       private final boolean deleteIfEmpty;
   
       public SimpleRepeaterJXPathBinding(
  -            JXPathBindingBuilderBase.CommonAttributes commonAtts, String repeaterId, String repeaterPath, String rowPath, boolean clearOnLoad, boolean deleteIfEmpty, JXPathBindingBase rowBinding) {
  +            JXPathBindingBuilderBase.CommonAttributes commonAtts,
  +            String repeaterId, String repeaterPath, String rowPath,
  +            boolean clearOnLoad, boolean deleteIfEmpty,
  +            JXPathBindingBase rowBinding) {
           super(commonAtts);
           this.repeaterId = repeaterId;
           this.repeaterPath = repeaterPath;
  @@ -88,9 +91,10 @@
           this.deleteIfEmpty = deleteIfEmpty;
       }
   
  -    public void doLoad(Widget frmModel, JXPathContext jctx) throws BindingException {
  +    public void doLoad(Widget frmModel, JXPathContext jctx)
  +            throws BindingException {
           // Find the repeater and clear it
  -        Repeater repeater = (Repeater) frmModel.getWidget(this.repeaterId);
  +        Repeater repeater = (Repeater)frmModel.getWidget(this.repeaterId);
   
           if (this.clearOnLoad) {
               repeater.removeRows();
  @@ -124,39 +128,42 @@
                   this.rowBinding.loadFormFromModel(thisRow, rowContext);
               }
           }
  -
  -        if (getLogger().isDebugEnabled())
  +        if (getLogger().isDebugEnabled()) {
               getLogger().debug("done loading rows " + toString());
  +        }
       }
   
  -    public void doSave(Widget frmModel, JXPathContext jctx) throws BindingException {
  +    public void doSave(Widget frmModel, JXPathContext jctx)
  +            throws BindingException {
           // Find the repeater
  -        Repeater repeater = (Repeater) frmModel.getWidget(this.repeaterId);
  +        Repeater repeater = (Repeater)frmModel.getWidget(this.repeaterId);
   
           if (repeater.getSize() == 0 && this.deleteIfEmpty) {
               // Repeater is empty : erase all
               jctx.removeAll(this.repeaterPath);
  -
           } else {
               // Repeater is not empty
  -
               // Move to repeater context and create the path if needed
  -            JXPathContext repeaterContext = jctx.getRelativeContext(jctx.createPath(this.repeaterPath));
  +            JXPathContext repeaterContext =
  +                jctx.getRelativeContext(jctx.createPath(this.repeaterPath));
   
               // Delete all that is already present
               repeaterContext.removeAll(this.rowPath);
   
               for (int i = 0; i < repeater.getSize(); i++) {
  -                String path = this.rowPath + '[' + (i+1) + ']';
  -                Pointer rowPtr = repeaterContext.createPath(path);
  -                JXPathContext rowContext = repeaterContext.getRelativeContext(rowPtr);
  -                this.rowBinding.saveFormToModel(repeater.getRow(i), rowContext);
  +                Pointer rowPtr = repeaterContext.createPath(
  +                        this.rowPath + '[' + (i+1) + ']');
  +                JXPathContext rowContext =
  +                    repeaterContext.getRelativeContext(rowPtr);
  +                this.rowBinding.saveFormToModel(repeater.getRow(i),
  +                        rowContext);
               }
           }
       }
   
       public String toString() {
  -        return "SimpleRepeaterJXPathBinding [widget=" + this.repeaterId + ", xpath=" + this.repeaterPath + "]";
  +        return this.getClass().getName()+ " [widget=" + this.repeaterId +
  +            ", xpath=" + this.repeaterPath + "]";
       }
   
       public void enableLogging(Logger logger) {