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 ClassJXPathBindingBuilder 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 44 JXPathBindingBase[] childBindings = new JXPathBindingBase[0]; 45 46 ClassJXPathBinding otherBinding = (ClassJXPathBinding)assistant.getContext().getSuperBinding(); 48 if(otherBinding!=null) { 49 childBindings = otherBinding.getChildBindings(); 50 commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts); 51 52 if(widgetId==null) 53 widgetId = otherBinding.getId(); 54 } 55 56 childBindings = assistant.makeChildBindings(bindingElm,childBindings); 57 58 59 ClassJXPathBinding classBinding = 60 new ClassJXPathBinding(commonAtts, widgetId, childBindings); 61 return classBinding; 62 } catch (BindingException e) { 63 throw e; 64 } catch (Exception e) { 65 throw new BindingException("Error building class binding defined at " + DomHelper.getLocation(bindingElm), e); 66 } 67 } 68 } 69 | Popular Tags |