1 16 package org.apache.cocoon.woody.binding; 17 18 import org.apache.cocoon.woody.formmodel.AggregateField; 19 import org.apache.cocoon.woody.formmodel.Widget; 20 import org.apache.commons.jxpath.JXPathContext; 21 22 33 public class AggregateJXPathBinding extends ComposedJXPathBindingBase { 34 35 private final String xpath; 36 37 private final String widgetId; 38 39 45 public AggregateJXPathBinding( 46 JXPathBindingBuilderBase.CommonAttributes commonAtts, 47 String widgetId, String xpath, JXPathBindingBase[] childBindings) { 48 super(commonAtts, childBindings); 49 this.widgetId = widgetId; 50 this.xpath = xpath; 51 } 52 53 58 public void doLoad(Widget frmModel, 59 JXPathContext jxpc) throws BindingException { 60 AggregateField aggregate = 61 (AggregateField)frmModel.getWidget(this.widgetId); 62 JXPathContext subContext = 63 jxpc.getRelativeContext(jxpc.getPointer(this.xpath)); 64 super.doLoad(aggregate, subContext); 65 aggregate.combineFields(); 66 if (getLogger().isDebugEnabled()) { 67 getLogger().debug("Done loading " + toString()); 68 } 69 } 70 71 76 public void doSave(Widget frmModel, 77 JXPathContext jxpc) throws BindingException { 78 AggregateField aggregate = 79 (AggregateField) frmModel.getWidget(this.widgetId); 80 JXPathContext subContext = 81 jxpc.getRelativeContext(jxpc.getPointer(this.xpath)); 82 super.doSave(aggregate, subContext); 83 if (getLogger().isDebugEnabled()) { 84 getLogger().debug("Done saving " + toString()); 85 } 86 } 87 88 public String toString() { 89 return "AggregateJXPathBinding [widget=" + this.widgetId + 90 ", xpath=" + this.xpath + "]"; 91 } 92 } 93 | Popular Tags |