1 16 package org.apache.cocoon.forms.binding; 17 18 import org.apache.cocoon.forms.util.DomHelper; 19 import org.w3c.dom.Element ; 20 21 35 public class GroupJXPathBindingBuilder 36 extends JXPathBindingBuilderBase { 37 38 public JXPathBindingBase buildBinding(Element bindingElm, JXPathBindingManager.Assistant assistant) 39 throws BindingException { 40 try { 41 String widgetId = DomHelper.getAttribute(bindingElm, "id",null); 42 CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElm); 43 String xpath = DomHelper.getAttribute(bindingElm, "path",null); 44 45 JXPathBindingBase[] childBindings = new JXPathBindingBase[0]; 46 47 GroupJXPathBinding otherBinding = (GroupJXPathBinding)assistant.getContext().getSuperBinding(); 49 if(otherBinding!=null) { 50 childBindings = otherBinding.getChildBindings(); 51 commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts); 52 53 if(xpath==null) 54 xpath = otherBinding.getXPath(); 55 if(widgetId==null) 56 widgetId = otherBinding.getId(); 57 } 58 59 childBindings = assistant.makeChildBindings(bindingElm, childBindings); 60 61 GroupJXPathBinding groupBinding = 62 new GroupJXPathBinding(commonAtts, widgetId, xpath, childBindings); 63 return groupBinding; 64 } catch (BindingException e) { 65 throw e; 66 } catch (Exception e) { 67 throw new BindingException("Error building group binding defined at " + DomHelper.getLocation(bindingElm), e); 68 } 69 } 70 } 71 | Popular Tags |