1 16 package org.apache.cocoon.woody.formmodel; 17 18 import org.apache.cocoon.woody.Constants; 19 import org.apache.cocoon.woody.util.DomHelper; 20 import org.w3c.dom.Element ; 21 22 27 public class FormDefinitionBuilder extends AbstractWidgetDefinitionBuilder { 28 29 public WidgetDefinition buildWidgetDefinition(Element formElement) throws Exception { 30 FormDefinition formDefinition = new FormDefinition(); 31 setLocation(formElement, formDefinition); 32 formDefinition.setId(""); 33 setDisplayData(formElement, formDefinition); 34 setValidators(formElement, formDefinition); 35 36 Element widgetsElement = DomHelper.getChildElement(formElement, Constants.WD_NS, "widgets", true); 37 Element [] widgetElements = DomHelper.getChildElements(widgetsElement, Constants.WD_NS); 39 for (int i = 0; i < widgetElements.length; i++) { 40 Element widgetElement = widgetElements[i]; 41 WidgetDefinition widgetDefinition = buildAnotherWidgetDefinition(widgetElement); 42 formDefinition.addWidgetDefinition(widgetDefinition); 43 } 44 45 formDefinition.resolve(); 46 47 return formDefinition; 48 } 49 } 50 | Popular Tags |