1 16 package org.apache.cocoon.forms.formmodel; 17 18 import org.apache.cocoon.forms.FormsConstants; 19 import org.apache.cocoon.forms.util.DomHelper; 20 import org.w3c.dom.Element ; 21 22 27 28 public abstract class AbstractContainerDefinitionBuilder extends AbstractWidgetDefinitionBuilder { 29 30 protected void setupContainer(Element element, String widgetsElementName, AbstractContainerDefinition definition) throws Exception { 31 32 Element widgetsElement = DomHelper.getChildElement(element, FormsConstants.DEFINITION_NS, widgetsElementName, false); 33 34 if (widgetsElement == null) 36 return; 37 38 Element [] widgetElements = DomHelper.getChildElements(widgetsElement, FormsConstants.DEFINITION_NS); 40 WidgetDefinitionBuilderContext oldContext = this.context; 41 42 for (int i = 0; i < widgetElements.length; i++) { 43 Element widgetElement = widgetElements[i]; 44 45 this.context = new WidgetDefinitionBuilderContext(oldContext); 46 this.context.setSuperDefinition(null); 47 48 String newId = DomHelper.getAttribute(widgetElement, "extends", null); 49 WidgetDefinition def = null; 50 if (newId != null) { 51 if ((def = this.context.getLocalLibrary().getDefinition(newId)) != null) 52 this.context.setSuperDefinition(def); 53 else if ((def = definition.getWidgetDefinition(newId)) != null) 54 this.context.setSuperDefinition(def); 55 } 58 59 WidgetDefinition widgetDefinition = buildAnotherWidgetDefinition(widgetElement); 60 61 if (widgetDefinition != null) 62 definition.addWidgetDefinition(widgetDefinition); 63 64 } 65 66 this.context = oldContext; 67 } 68 } 69 | Popular Tags |