Added rich text area field type for response in dataset > chapter > section > questions.
1. RichTextAreaData.java: [NEW] file to extend FieldData. 2. ModelBuilder.java: Added case for richTextarea type. 3. ExportXmlBuilderDatasetProfile.java: Added case for RICH_TEXT_AREA. 4. ViewStyle.java: Define RICH_TEXT_AREA("richTextarea").
This commit is contained in:
parent
193e7410a8
commit
7fefdd6aad
|
@ -84,6 +84,7 @@ public class ModelBuilder {
|
|||
if (type.equals("checkBox")) return (FieldData<U>) new CheckBoxData().fromData(data);
|
||||
if (type.equals("freetext")) return (FieldData<U>) new FreeTextData().fromData(data);
|
||||
if (type.equals("textarea")) return (FieldData<U>) new TextAreaData().fromData(data);
|
||||
if (type.equals("richTextarea")) return (FieldData<U>) new RichTextAreaData().fromData(data);
|
||||
if (type.equals("datePicker")) return (FieldData<U>) new DatePickerData().fromData(data);
|
||||
if (type.equals("externalDatasets")) return (FieldData<U>) new ExternalDatasetsData().fromData(data);
|
||||
if (type.equals("dataRepositories")) return (FieldData<U>) new DataRepositoriesData().fromData(data);
|
||||
|
@ -123,6 +124,7 @@ public class ModelBuilder {
|
|||
if (type.equals("checkBox")) return (FieldData<U>) new CheckBoxData().fromData(data);
|
||||
if (type.equals("freetext")) return (FieldData<U>) new FreeTextData().fromData(data);
|
||||
if (type.equals("textarea")) return (FieldData<U>) new TextAreaData().fromData(data);
|
||||
if (type.equals("richTextarea")) return (FieldData<U>) new RichTextAreaData().fromData(data);
|
||||
if (type.equals("datePicker")) return (FieldData<U>) new DatePickerData().fromData(data);
|
||||
if (type.equals("externalDatasets")) return (FieldData<U>) new ExternalDatasetsData().fromData(data);
|
||||
if (type.equals("dataRepositories")) return (FieldData<U>) new DataRepositoriesData().fromData(data);
|
||||
|
|
|
@ -260,6 +260,7 @@ public class ExportXmlBuilderDatasetProfile {
|
|||
case CHECK_BOX:
|
||||
case FREE_TEXT:
|
||||
case TEXT_AREA:
|
||||
case RICH_TEXT_AREA:
|
||||
case DATE_PICKER:
|
||||
case DATASET_IDENTIFIER:
|
||||
case CURRENCY:
|
||||
|
|
|
@ -28,6 +28,7 @@ public class ViewStyle {
|
|||
CHECK_BOX("checkBox"),
|
||||
FREE_TEXT("freetext"),
|
||||
TEXT_AREA("textarea"),
|
||||
RICH_TEXT_AREA("richTextarea"),
|
||||
DATE_PICKER("datePicker"),
|
||||
EXTERNAL_DATASETS("externalDatasets"),
|
||||
DATA_REPOSITORIES("dataRepositories"),
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package eu.eudat.models.data.components.commons.datafield;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class RichTextAreaData extends FieldData<RichTextAreaData> {
|
||||
@Override
|
||||
public RichTextAreaData fromData(Object data) {
|
||||
if (data != null) {
|
||||
this.setLabel(((Map<String, String>) data).get("label"));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object toData() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element root = doc.createElement("data");
|
||||
root.setAttribute("label", this.getLabel());
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RichTextAreaData fromXml(Element item) {
|
||||
this.setLabel(item.getAttribute("label"));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> toMap(Element item) {
|
||||
HashMap dataMap = new HashMap();
|
||||
dataMap.put("label", item != null ? item.getAttribute("label") : "");
|
||||
return dataMap;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue