FormBuilderInternal formBuilderInternal,
FormFillerInternal formFillerInternal) {
String type = item.getFormbuildertype();
HtmlFormBuilderSpan res = new HtmlFormBuilderSpan(item);
HtmlFormBuilderItem comp = null;
HtmlDialog diag = null;
switch (type) {
case TYPE_HR:
comp = new HtmlFormBuilderHorizontalRule();
break;
case TYPE_INPUT:
comp = new HtmlFormBuilderInput();
break;
case TYPE_NUMBER:
comp = new HtmlFormBuilderNumber();
break;
case TYPE_LABEL:
comp = new HtmlFormBuilderLabel();
break;
case TYPE_SELECT:
comp = new HtmlFormBuilderSelect();
break;
case TYPE_CHECKBOX:
comp = new HtmlFormBuilderCheckbox();
break;
case TYPE_LISTBOX:
comp = new HtmlFormBuilderListbox();
break;
case TYPE_RADIO:
comp = new HtmlFormBuilderRadio();
break;
case TYPE_HEADING:
comp = new HtmlFormBuilderHeading();
break;
case TYPE_TEXTAREA:
comp = new HtmlFormBuilderTextarea();
break;
case TYPE_SPACE:
comp = new HtmlFormBuilderSpace();
break;
case TYPE_UPLOAD:
comp = new HtmlFormBuilderUpload();
break;
case TYPE_IMAGE:
comp = new HtmlFormBuilderImage();
break;
case TYPE_DATE:
comp = new HtmlFormBuilderDate();
break;
case TYPE_TIME:
comp = new HtmlFormBuilderTime();
break;
case TYPE_FORMATAREA:
comp = new HtmlFormBuilderFormatArea();
break;
case TYPE_CONSTRAINT:
if (formBuilderInternal != null) {
comp = new HtmlFormBuilderConstraint(formBuilderInternal.getWorkflowStates(),
formBuilderInternal.getConstraintClients(),
item.getConstraints());
} else {
comp = new HtmlFormBuilderConstraint();
}
break;
case TYPE_PAGEBREAK:
comp = new HtmlFormBuilderPagebreak();
break;
case TYPE_DOWNLOAD:
comp = new HtmlFormBuilderDownload();
break;
case TYPE_METADATA:
if (formBuilderInternal != null) {
comp = new HtmlFormBuilderMetaData(formBuilderInternal.getMetaDataObject(),
formBuilderInternal.getMetaDataFetcher());
} else if(formFillerInternal != null) {
comp = new HtmlFormBuilderMetaData(formFillerInternal.getMetaDataObject(),
formFillerInternal.getMetaDataFetcher());
} else {
comp = new HtmlFormBuilderMetaData();
}
break;
}
if (comp != null) {
BeanUtils.copyProperties(item.getProperties(), comp.getProperties());
item.getProperties().setMaximise(Boolean.FALSE);
//Create properties dialog
if (!comp.getClass().isAnnotationPresent(SkipDialog.class)) {
diag = new HtmlDialog(item);
}
//Set data of html object
if (data != null) {
comp.setValue(data.getValue());
comp.setNumberValue(data.getNumberValue());