1 16 package org.apache.cocoon.woody.binding; 17 18 import org.apache.cocoon.woody.formmodel.Struct; 19 import org.apache.cocoon.woody.formmodel.Widget; 20 import org.apache.commons.jxpath.JXPathContext; 21 22 34 public class StructJXPathBinding extends ComposedJXPathBindingBase { 35 36 private final String xpath; 37 38 private final String widgetId; 39 40 46 public StructJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts, String widgetId, String xpath, JXPathBindingBase[] childBindings) { 47 super(commonAtts, childBindings); 48 this.widgetId = widgetId; 49 this.xpath = xpath; 50 } 51 52 57 public void doLoad(Widget frmModel, JXPathContext jxpc) throws BindingException { 58 Struct structWidget = (Struct)getWidget(frmModel, this.widgetId); 59 JXPathContext subContext = jxpc.getRelativeContext(jxpc.getPointer(this.xpath)); 60 super.doLoad(structWidget, subContext); 61 if (getLogger().isDebugEnabled()) { 62 getLogger().debug("done loading " + toString()); 63 } 64 } 65 66 71 public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException { 72 Struct structWidget = (Struct)frmModel.getWidget(this.widgetId); 73 JXPathContext subContext = jxpc.getRelativeContext(jxpc.getPointer(this.xpath)); 74 super.doSave(structWidget, subContext); 75 if (getLogger().isDebugEnabled()) { 76 getLogger().debug("done saving " + toString()); 77 } 78 } 79 80 public String toString() { 81 return "StructJXPathBinding [widget=" + this.widgetId + ", xpath=" + this.xpath + "]"; 82 } 83 } 84 | Popular Tags |