// Path: src/main/java/org/dynaform/xml/form/FormElement.java
// public interface FormElement<E> extends Form, Data<E>, Labeled {
// 	
//   Data<E> getData();
//   
//   Restrictions<E> getRestrictions();
//   
// 	String getLabel();
// 	void setLabel(String label);
// 	
// 	Control getControl();
// 	void setControl(Control control);
// 	
// 	boolean isReadOnly();
// 	void setReadOnly(boolean readOnly);
// 	
// 	boolean isRequired();
// 	void setRequired(boolean required);
// 	
// 	boolean isDisabled();
// 	void setDisabled(boolean disabled);
// 	
// 	// Listeners
// 	
//   void addListener(ElementChangeListener<E> listener);
//   void removeListener(ElementChangeListener<E> listener);
//   
//   public interface ElementChangeListener<E> {
//     void onSetValue(FormElement<E> element);
//     void onSetLabel(FormElement<E> element);
//     void onSetControl(FormElement<E> element);
//     void onSetReadOnly(FormElement<E> element);
//     void onSetRequired(FormElement<E> element);
//     void onSetDisabled(FormElement<E> element);
//   }	
// 	
// }
// 
// Path: src/main/java/org/dynaform/xml/form/restriction/Choice.java
// public interface Choice<E> {
// 
//   String getLabel();
//   void setLabel(String label);
//   
//   E getValue();
//   void setValue(E value);
//   
// }


import org.dynaform.xml.form.FormElement;
import org.dynaform.xml.form.control.Control;
import org.dynaform.xml.form.data.Data;
import org.dynaform.xml.form.data.DateData;
import org.dynaform.xml.form.restriction.Choice;
import org.dynaform.xml.form.restriction.Restrictions;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.araneaframework.uilib.form.control.CheckboxControl;
import org.araneaframework.uilib.form.control.DateControl;
import org.araneaframework.uilib.form.control.DateTimeControl;
import org.araneaframework.uilib.form.control.DisplayControl;
import org.araneaframework.uilib.form.control.FloatControl;
import org.araneaframework.uilib.form.control.NumberControl;
import org.araneaframework.uilib.form.control.SelectControl;
import org.araneaframework.uilib.form.control.TextControl;
import org.araneaframework.uilib.form.control.TextareaControl;
import org.araneaframework.uilib.form.control.TimeControl;
import org.araneaframework.uilib.support.DisplayItem;

    final Map<String, String> tagAttributes = new HashMap<String, String>();
    final String tag;
    final Class<?> arType = type;
    Converter converter = Converters.NOP;
    
    if (control instanceof Control.RadioSelectBox) {
      tag = "radioSelect";
      tagAttributes.put("type", "vertical");
      arControl.addItem(new DisplayItem(RADIO_SELECT_BOX_NULL_VALUE, RADIO_SELECT_BOX_NULL_LABEL));
      converter = new Converter() {
        public Object convert(Object value) {
          return value == null ? RADIO_SELECT_BOX_NULL_VALUE : value;
        }
        public Object deconvert(Object value) {
          return RADIO_SELECT_BOX_NULL_VALUE.equals(value) ? null : value;
        }
      };
    }
    else {
      tag = "select";
      arControl.addItem(new DisplayItem(SELECT_BOX_NULL_VALUE, SELECT_BOX_NULL_LABEL));
      
      if (control instanceof Control.SelectBox) {
        Control.SelectBox selectbox = (Control.SelectBox) control;
        Integer size = selectbox.getSize();
        if (size == null) size = Math.min(arControl.getDisplayItems().size(), SELECT_BOX_MAX_SIZE);
        tagAttributes.put("size", "" + size);
      }
    }
    

// Path: src/main/java/org/dynaform/xml/form/FormElement.java
// public interface FormElement<E> extends Form, Data<E>, Labeled {
// 	
//   Data<E> getData();
//   
//   Restrictions<E> getRestrictions();
//   
// 	String getLabel();
// 	void setLabel(String label);
// 	
// 	Control getControl();
// 	void setControl(Control control);
// 	
// 	boolean isReadOnly();
// 	void setReadOnly(boolean readOnly);
// 	
// 	boolean isRequired();
// 	void setRequired(boolean required);
// 	
// 	boolean isDisabled();
// 	void setDisabled(boolean disabled);
// 	
// 	// Listeners
// 	
//   void addListener(ElementChangeListener<E> listener);
//   void removeListener(ElementChangeListener<E> listener);
//   
//   public interface ElementChangeListener<E> {
//     void onSetValue(FormElement<E> element);
//     void onSetLabel(FormElement<E> element);
//     void onSetControl(FormElement<E> element);
//     void onSetReadOnly(FormElement<E> element);
//     void onSetRequired(FormElement<E> element);
//     void onSetDisabled(FormElement<E> element);
//   }	
// 	
// }
// 
// Path: src/main/java/org/dynaform/xml/form/restriction/Choice.java
// public interface Choice<E> {
// 
//   String getLabel();
//   void setLabel(String label);
//   
//   E getValue();
//   void setValue(E value);
//   
// }


// Path: src/main/java/org/dynaform/web/form/builder/ControlBuilder.java
import org.dynaform.xml.form.FormElement;
import org.dynaform.xml.form.control.Control;
import org.dynaform.xml.form.data.Data;
import org.dynaform.xml.form.data.DateData;
import org.dynaform.xml.form.restriction.Choice;
import org.dynaform.xml.form.restriction.Restrictions;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.araneaframework.uilib.form.control.CheckboxControl;
import org.araneaframework.uilib.form.control.DateControl;
import org.araneaframework.uilib.form.control.DateTimeControl;
import org.araneaframework.uilib.form.control.DisplayControl;
import org.araneaframework.uilib.form.control.FloatControl;
import org.araneaframework.uilib.form.control.NumberControl;
import org.araneaframework.uilib.form.control.SelectControl;
import org.araneaframework.uilib.form.control.TextControl;
import org.araneaframework.uilib.form.control.TextareaControl;
import org.araneaframework.uilib.form.control.TimeControl;
import org.araneaframework.uilib.support.DisplayItem;

    final Map<String, String> tagAttributes = new HashMap<String, String>();
    final String tag;
    final Class<?> arType = type;
    Converter converter = Converters.NOP;
    
    if (control instanceof Control.RadioSelectBox) {
      tag = "radioSelect";
      tagAttributes.put("type", "vertical");
      arControl.addItem(new DisplayItem(RADIO_SELECT_BOX_NULL_VALUE, RADIO_SELECT_BOX_NULL_LABEL));
      converter = new Converter() {
        public Object convert(Object value) {
          return value == null ? RADIO_SELECT_BOX_NULL_VALUE : value;
        }
        public Object deconvert(Object value) {
          return RADIO_SELECT_BOX_NULL_VALUE.equals(value) ? null : value;
        }
      };
    }
    else {
      tag = "select";
      arControl.addItem(new DisplayItem(SELECT_BOX_NULL_VALUE, SELECT_BOX_NULL_LABEL));
      
      if (control instanceof Control.SelectBox) {
        Control.SelectBox selectbox = (Control.SelectBox) control;
        Integer size = selectbox.getSize();
        if (size == null) size = Math.min(arControl.getDisplayItems().size(), SELECT_BOX_MAX_SIZE);
        tagAttributes.put("size", "" + size);
      }
    }
    

    List<Choice<E>> choices = restrictions.getChoices();
