1 16 package org.apache.cocoon.woody.binding; 17 18 import java.util.HashMap ; 19 20 import org.apache.avalon.framework.logger.Logger; 21 import org.apache.cocoon.woody.formmodel.Widget; 22 import org.apache.commons.jxpath.JXPathContext; 23 24 31 public class ComposedJXPathBindingBase extends JXPathBindingBase { 32 private final JXPathBindingBase[] subBindings; 33 34 39 protected ComposedJXPathBindingBase(JXPathBindingBuilderBase.CommonAttributes commonAtts, JXPathBindingBase[] childBindings) { 40 super(commonAtts); 41 this.subBindings = childBindings; 42 if (this.subBindings != null) { 43 for (int i = 0; i < this.subBindings.length; i++) { 44 this.subBindings[i].setParent(this); 45 } 46 } 47 } 48 49 53 public void enableLogging(Logger logger) { 54 super.enableLogging(logger); 55 if (this.subBindings != null) { 56 for (int i = 0; i < this.subBindings.length; i++) { 57 this.subBindings[i].enableLogging(logger); 58 } 59 } 60 } 61 62 66 public Binding getClass(String id) { 67 if (classes == null) { 68 classes = new HashMap (); 69 if (this.subBindings != null) { 70 for (int i = 0; i < this.subBindings.length; i++) { 71 Binding binding = this.subBindings[i]; 72 String bindingId = binding.getId(); 73 if (bindingId != null) 74 classes.put(bindingId, binding); 75 } 76 } 77 } 78 return super.getClass(id); 79 } 80 81 84 public JXPathBindingBase[] getChildBindings() { 85 return subBindings; 86 } 87 88 92 public void doLoad(Widget frmModel, JXPathContext jxpc) throws BindingException { 93 if (this.subBindings != null) { 94 int size = this.subBindings.length; 95 for (int i = 0; i < size; i++) { 96 this.subBindings[i].loadFormFromModel(frmModel, jxpc); 97 } 98 } 99 } 100 101 105 public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException { 106 if (this.subBindings != null) { 107 int size = this.subBindings.length; 108 for (int i = 0; i < size; i++) { 109 this.subBindings[i].saveFormToModel(frmModel, jxpc); 110 } 111 } 112 } 113 } 114 | Popular Tags |