1 16 17 package org.apache.cocoon.woody.formmodel; 18 19 import org.w3c.dom.Element ; 20 import org.apache.cocoon.woody.util.DomHelper; 21 import org.apache.cocoon.woody.Constants; 22 import org.apache.cocoon.woody.datatype.Datatype; 23 24 29 public class OutputDefinitionBuilder extends AbstractDatatypeWidgetDefinitionBuilder { 30 public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception { 31 OutputDefinition definition = new OutputDefinition(); 32 setLocation(widgetElement, definition); 33 setId(widgetElement, definition); 34 35 Element datatypeElement = DomHelper.getChildElement(widgetElement, Constants.WD_NS, "datatype"); 36 if (datatypeElement == null) 37 throw new Exception ("A nested datatype element is required for the widget specified at " + DomHelper.getLocation(widgetElement)); 38 39 Datatype datatype = datatypeManager.createDatatype(datatypeElement, false); 40 definition.setDatatype(datatype); 41 42 setDisplayData(widgetElement, definition); 43 44 return definition; 45 } 46 } 47 | Popular Tags |