97 lines
2.9 KiB
Java
97 lines
2.9 KiB
Java
package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
|
|
|
|
import eu.eudat.file.transformer.entities.definition.DefinitionSerializable;
|
|
import eu.eudat.file.transformer.entities.xml.XmlSerializable;
|
|
import eu.eudat.file.transformer.enums.FieldDataComboBoxType;
|
|
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
|
|
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.ComboBoxOption;
|
|
import org.w3c.dom.Document;
|
|
import org.w3c.dom.Element;
|
|
|
|
public abstract class ComboBoxDataEntity<T extends ComboBoxDataEntity, U extends BaseFieldData> extends BaseFieldDataEntity<T, U> {
|
|
|
|
public abstract FieldDataComboBoxType getFieldSubType();
|
|
|
|
public static class Option implements DefinitionSerializable<Option, ComboBoxOption> {
|
|
private String label;
|
|
private String value;
|
|
private String source;
|
|
private String uri;
|
|
|
|
public String getLabel() {
|
|
return label;
|
|
}
|
|
public void setLabel(String label) {
|
|
this.label = label;
|
|
}
|
|
|
|
public String getValue() {
|
|
return value;
|
|
}
|
|
public void setValue(String value) {
|
|
this.value = value;
|
|
}
|
|
|
|
public String getSource() {
|
|
return source;
|
|
}
|
|
public void setSource(String source) {
|
|
this.source = source;
|
|
}
|
|
|
|
public String getUri() {
|
|
return uri;
|
|
}
|
|
|
|
public void setUri(String uri) {
|
|
this.uri = uri;
|
|
}
|
|
|
|
/*@Override
|
|
public Element toXml(Document doc) {
|
|
Element option = doc.createElement("option");
|
|
option.setAttribute("label", this.label);
|
|
option.setAttribute("value", this.value);
|
|
option.setAttribute("source", this.source);
|
|
option.setAttribute("uri", this.uri);
|
|
return option;
|
|
}
|
|
|
|
@Override
|
|
public Option fromXml(Element item) {
|
|
this.label = item.getAttribute("label");
|
|
this.value = item.getAttribute("value");
|
|
this.source = item.getAttribute("source");
|
|
this.uri = item.getAttribute("uri");
|
|
return this;
|
|
}*/
|
|
|
|
@Override
|
|
public Option fromDefinition(ComboBoxOption object) {
|
|
this.label = object.getLabel();
|
|
this.value = object.getValue();
|
|
this.source = object.getSource();
|
|
this.uri = object.getUri();
|
|
return this;
|
|
}
|
|
}
|
|
|
|
/*@Override
|
|
public Element toXml(Document doc) {
|
|
Element root = super.toXml(doc);
|
|
root.setAttribute("type", this.getFieldSubType().toString());
|
|
return root;
|
|
}
|
|
|
|
@Override
|
|
public T fromXml(Element item) {
|
|
super.fromXml(item);
|
|
return (T) this;
|
|
}*/
|
|
|
|
public T fromDefinition(U object) {
|
|
super.fromDefinition(object);
|
|
return (T) this;
|
|
}
|
|
}
|