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