no message

This commit is contained in:
annabakouli 2018-01-03 15:43:21 +02:00
parent a20f9c2e01
commit 71aebdae7d
37 changed files with 405 additions and 100 deletions

View File

@ -1,9 +1,19 @@
import { BrowserModule } from '@angular/platform-browser';
import { CheckBoxComponent } from './components/checkbox/checkbox-component';
import { FreeTextData } from './models/DataField/FreeTextData';
import { BooleanDecisionComponent } from './components/booleanDecision/booleanDecision-component';
import { FreeTextComponent } from './components/freetext/freetext-component';
import { TextAreaComponent } from './components/textarea/textarea-component';
import { RadioBoxComponent } from './components/radiobox/radiobox-component';
import { WordlistComponent } from './components/wordlist/wordlist-component';
import { AutocompleteComponent } from './components/autocomplete/autocomplete-component';
import { ComboboxComponent } from './components/combobox/combobox-component';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule, Routes } from '@angular/router';
import { NgModule } from '@angular/core';
//import { HttpModule, Http, Response, RequestOptions, RequestMethod, Headers, URLSearchParams } from '@angular/http';
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
import { HttpModule} from '@angular/http';
import { HttpModule } from '@angular/http';
import { DataTableModule } from "angular2-datatable";
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { DialogService } from "ng2-bootstrap-modal";
@ -27,7 +37,7 @@ import { DatarepoService } from './services/datarepo-service';
import { GlobalInterceptor } from './services/interceptor';
import { Toolbox } from './services/toolbox';
import { DataFilterPipe } from './pipes/data-filter.pipe';
import { DataFilterPipe } from './pipes/data-filter.pipe';
import { DatasetProfileTableFilterPipe } from './pipes/datasetprofile-table-filter.pipe';
import { DmpTableFilterPipe } from './pipes/dmp-table-filter.pipe';
import { ServiceTableFilterPipe } from './pipes/service-table-filter.pipe';
@ -68,10 +78,7 @@ import { RuleFormComponent } from './dataset-profile-form/rule-component/rule.co
import { SectionFormComponent } from './dataset-profile-form/section-form/section-form.component';
import { PageFormComponent } from './dataset-profile-form/page-form/page-component';
import { CompositeFieldFormComponent } from './dataset-profile-form/compositefield-form/compositefield-form.component';
import { ComboboxComponent } from './combobox/combobox-component';
import { AutocompleteComponent } from './autocomplete/autocomplete-component';
import { WordlistComponent } from './wordlist/wordlist-component';
import { RadioBoxComponent } from './radiobox/radiobox-component';
@ -87,15 +94,15 @@ import { RadioBoxComponent } from './radiobox/radiobox-component';
ServiceTableFilterPipe,
ResearcherTableFilterPipe,
DatarepoTableFilterPipe,
AppComponent,
GooggleSignInComponent,
FieldFormComponent,
FormComponent,
GroupFieldFormComponent,
RuleFormComponent,
SectionFormComponent,
PageFormComponent,
SectionFormComponent,
PageFormComponent,
CompositeFieldFormComponent,
ComboboxComponent,
AutocompleteComponent,
@ -117,7 +124,11 @@ import { RadioBoxComponent } from './radiobox/radiobox-component';
ResearcherEditorComponent,
DatareposEditorComponent,
DatasetprofileEditorComponent,
DatasetProfileGUIEditorComponent
DatasetProfileGUIEditorComponent,
TextAreaComponent,
CheckBoxComponent,
BooleanDecisionComponent,
FreeTextComponent
],
imports: [
BrowserModule,
@ -132,13 +143,13 @@ import { RadioBoxComponent } from './radiobox/radiobox-component';
AppRouting
],
providers: [{
provide: HTTP_INTERCEPTORS,
useClass: GlobalInterceptor,
multi: true,
},
DatasetsServiceService, TokenService, DmpsServiceService, ResearcherService,
DialogService, DatasetProfileService, ProjectService, OrganisationService, DatarepoService,
DmpProfileService, RegistryService, ServiceService, NativeLoginService, HttpModule, Toolbox, HttpClient, RestBase],
provide: HTTP_INTERCEPTORS,
useClass: GlobalInterceptor,
multi: true,
},
DatasetsServiceService, TokenService, DmpsServiceService, ResearcherService,
DialogService, DatasetProfileService, ProjectService, OrganisationService, DatarepoService,
DmpProfileService, RegistryService, ServiceService, NativeLoginService, HttpModule, Toolbox, HttpClient, RestBase],
bootstrap: [AppComponent]
})
export class AppModule { }

View File

@ -0,0 +1,13 @@
<div [formGroup]="form">
<div formGroupName="data" class="form-row">
<div class="form-group col-md-12" >
<label>Label</label>
<input type="string" class="form-control" formControlName="label">
</div>
<div class="form-group col-md-12" >
<label>Url</label>
<input type="string" class="form-control" formControlName="url">
</div>
</div>
</div>

View File

@ -1,9 +1,8 @@
import { FormGroup } from '@angular/forms';
import { Field } from 'app/models/DataSetProfile/Field';
import { AutocompleteData } from '../../models/DataField/AutocompleteData';
import { Field } from '../../models/DataSetProfile/Field';
import { FormGroup } from '@angular/forms';
import { Component, Input, OnInit } from '@angular/core';
import { AutocompleteData } from 'app/models/DataField/AutocompleteData';
import { FormArray } from '@angular/forms/src/model';
import { JsonSerializer } from 'app/utilities/JsonSerializer';
@Component({
selector: 'autocomplete-component',

View File

@ -1,8 +1,8 @@
<div [formGroup]="form">
<div formGroupName="data" class="form-row">
<div class="form-group col-md-12" >
<label>Url</label>
<input type="string" class="form-control" formControlName="url">
<label>Label</label>
<input type="string" class="form-control" formControlName="label">
</div>
</div>

View File

@ -0,0 +1,19 @@
import { Field } from '../../models/DataSetProfile/Field';
import { BooleanDecisionData } from '../../models/DataField/BooleanDecisionData';
import { FormGroup } from '@angular/forms';
import { Component, Input, OnInit } from '@angular/core';
import { FormArray } from '@angular/forms/src/model';
@Component({
selector: 'booleanDecision-component',
templateUrl: './booleanDecision-component.html'
})
export class BooleanDecisionComponent implements OnInit{
@Input() dataModel: Field;
@Input() form: FormGroup;
private data:BooleanDecisionData = new BooleanDecisionData();
ngOnInit(){
this.form.addControl("data", this.data.buildForm());
}
}

View File

@ -0,0 +1,9 @@
<div [formGroup]="form">
<div formGroupName="data" class="form-row">
<div class="form-group col-md-12" >
<label>Label</label>
<input type="string" class="form-control" formControlName="label">
</div>
</div>
</div>

View File

@ -0,0 +1,20 @@
import { Field } from '../../models/DataSetProfile/Field';
import { CheckBoxData } from '../../models/DataField/CheckBoxData';
import { BooleanDecisionData } from '../../models/DataField/BooleanDecisionData';
import { FormGroup } from '@angular/forms';
import { Component, Input, OnInit } from '@angular/core';
import { FormArray } from '@angular/forms/src/model';
@Component({
selector: 'checkbox-component',
templateUrl: './checkbox-component.html'
})
export class CheckBoxComponent implements OnInit{
@Input() dataModel: Field;
@Input() form: FormGroup;
private data:CheckBoxData = new CheckBoxData();
ngOnInit(){
this.form.addControl("data", this.data.buildForm());
}
}

View File

@ -1,5 +1,5 @@
import { FormGroup } from '@angular/forms';
import { Field } from 'app/models/DataSetProfile/Field';
import { Field } from '../../models/DataSetProfile/Field';
import { FormGroup } from '@angular/forms';
import { Component, Input, OnInit } from '@angular/core';
@Component({

View File

@ -0,0 +1,9 @@
<div [formGroup]="form">
<div formGroupName="data" class="form-row">
<div class="form-group col-md-12" >
<label>Label</label>
<input type="string" class="form-control" formControlName="label">
</div>
</div>
</div>

View File

@ -0,0 +1,21 @@
import { Field } from '../../models/DataSetProfile/Field';
import { FreeTextData } from '../../models/DataField/FreeTextData';
import { CheckBoxData } from '../../models/DataField/CheckBoxData';
import { BooleanDecisionData } from '../../models/DataField/BooleanDecisionData';
import { FormGroup } from '@angular/forms';
import { Component, Input, OnInit } from '@angular/core';
import { FormArray } from '@angular/forms/src/model';
@Component({
selector: 'freetext-component',
templateUrl: './freetext-component.html'
})
export class FreeTextComponent implements OnInit{
@Input() dataModel: Field;
@Input() form: FormGroup;
private data:FreeTextData = new FreeTextData();
ngOnInit(){
this.form.addControl("data", this.data.buildForm());
}
}

View File

@ -0,0 +1,28 @@
<div [formGroup]="form" class="form-row">
<div class="form-group col-md-12">
<label>Label</label>
<input type="string" class="form-control" formControlName="label">
</div>
<div formGroupName="data">
<div formArrayName="options">
<div *ngFor="let option of form.get('data').get('options').controls index as i">
<div [formGroupName]="i">
<div class="form-group col-md-6">
<label>Label</label>
<input type="text" class="form-control" formControlName="label">
</div>
<div class="form-group col-md-6">
<label>Value</label>
<input type="text" class="form-control" formControlName="value">
</div>
</div>
</div>
</div>
</div>
<div>
<a (click)="addNewRow(form)" style="cursor: pointer">
Add +
</a>
</div>
</div>

View File

@ -1,10 +1,10 @@
import { FormGroup } from '@angular/forms';
import { Field } from '../models/DataSetProfile/Field';
import { Field } from '../../models/DataSetProfile/Field';
import { Component, Input, OnInit } from '@angular/core';
import { RadioBoxData } from '../models/DataField/RadioBoxData';
import { RadioBoxData } from '../../models/DataField/RadioBoxData';
import { FormArray } from '@angular/forms/src/model';
import { ListingItem } from '../models/Commons/ListingItem';
import { JsonSerializer } from '../utilities/JsonSerializer';
import { ListingItem } from '../../models/Commons/ListingItem';
import { JsonSerializer } from '../../utilities/JsonSerializer';
@Component({
selector: 'radiobox-component',

View File

@ -0,0 +1,9 @@
<div [formGroup]="form">
<div formGroupName="data" class="form-row">
<div class="form-group col-md-12" >
<label>Label</label>
<input type="string" class="form-control" formControlName="label">
</div>
</div>
</div>

View File

@ -0,0 +1,22 @@
import { Field } from '../../models/DataSetProfile/Field';
import { TextArea } from '../../models/DataField/TextArea';
import { FreeTextData } from '../../models/DataField/FreeTextData';
import { CheckBoxData } from '../../models/DataField/CheckBoxData';
import { BooleanDecisionData } from '../../models/DataField/BooleanDecisionData';
import { FormGroup } from '@angular/forms';
import { Component, Input, OnInit } from '@angular/core';
import { FormArray } from '@angular/forms/src/model';
@Component({
selector: 'textarea-component',
templateUrl: './textarea-component.html'
})
export class TextAreaComponent implements OnInit{
@Input() dataModel: Field;
@Input() form: FormGroup;
private data:TextArea = new TextArea();
ngOnInit(){
this.form.addControl("data", this.data.buildForm());
}
}

View File

@ -1,5 +1,9 @@
<div [formGroup]="form" class="form-row">
<div formGroupName="data">
<div class="form-group col-md-12" >
<label>Label</label>
<input type="string" class="form-control" formControlName="label">
</div>
<div formArrayName="options">
<div *ngFor="let option of form.get('data').get('options').controls index as i">
<div [formGroupName]="i">

View File

@ -1,10 +1,10 @@
import { FormGroup } from '@angular/forms';
import { Field } from '../models/DataSetProfile/Field';
import { Field } from '../../models/DataSetProfile/Field';
import { Component, Input, OnInit } from '@angular/core';
import { WordListData } from '../models/DataField/WordListData';
import { WordListData } from '../../models/DataField/WordListData';
import { FormArray } from '@angular/forms/src/model';
import { ListingItem } from '../models/Commons/ListingItem';
import { JsonSerializer } from '../utilities/JsonSerializer';
import { ListingItem } from '../../models/Commons/ListingItem';
import { JsonSerializer } from '../../utilities/JsonSerializer';
@Component({
selector: 'wordlist-component',

View File

@ -32,6 +32,18 @@
<div *ngSwitchCase="'radiobox'">
<radiobox-component [form]="form" [dataModel]="dataModel"></radiobox-component>
</div>
<div *ngSwitchCase="'freetext'">
<freetext-component [form]="form" [dataModel]="dataModel"></freetext-component>
</div>
<div *ngSwitchCase="'textarea'">
<textarea-component [form]="form" [dataModel]="dataModel"></textarea-component>
</div>
<div *ngSwitchCase="'booleanDecision'">
<booleanDecision-component [form]="form" [dataModel]="dataModel"></booleanDecision-component>
</div>
<div *ngSwitchCase="'checkbox'">
<checkbox-component [form]="form" [dataModel]="dataModel"></checkbox-component>
</div>
</div>
<!-- <div class="row">
<div class="form-group col-md-6">

View File

@ -1,10 +1,7 @@
import { Component, Input } from '@angular/core';
import { FormGroup, FormControl } from '@angular/forms';
import { Field } from 'app/models/DataSetProfile/Field';
import { Rule } from 'app/models/DataSetProfile/Rule';
import { Multiplicity } from 'app/models/DataSetProfile/Multiplicity';
import { FormArray } from '@angular/forms/src/model';
import { ComboboxComponent } from 'app/combobox/combobox-component';
import { Field } from '../../models/DataSetProfile/Field';
import { Rule } from '../../models/DataSetProfile/Rule';
import { Component, Input } from '@angular/core';
import { FormGroup, FormControl, FormArray } from '@angular/forms';
@Component({
selector: 'field-form',

View File

@ -8,6 +8,7 @@ export class AutocompleteData extends DataField<AutocompleteData>{
buildForm():FormGroup{
return this.formBuilder.group({
label:[this.label],
type:[this.type],
url:[this.url]
})
@ -16,6 +17,7 @@ export class AutocompleteData extends DataField<AutocompleteData>{
fromJSONObject(item:any):AutocompleteData{
this.type = item.type;
this.url = item.url;
this.label = item.label;
return this;
}
}

View File

@ -0,0 +1,16 @@
import { DataField } from './DataField';
import { FormGroup } from '@angular/forms';
export class BooleanDecisionData extends DataField<BooleanDecisionData>{
buildForm():FormGroup{
let formGroup = this.formBuilder.group({
label:this.label
});
return formGroup;
}
fromJSONObject(item:any):BooleanDecisionData{
this.label = item.label
return this;
}
}

View File

@ -0,0 +1,16 @@
import { DataField } from './DataField';
import { FormGroup } from '@angular/forms';
export class CheckBoxData extends DataField<CheckBoxData>{
buildForm():FormGroup{
let formGroup = this.formBuilder.group({
label:this.label
});
return formGroup;
}
fromJSONObject(item:any):CheckBoxData{
this.label = item.label
return this;
}
}

View File

@ -3,6 +3,7 @@ import { FormGenerator } from '../interfaces/FormGenerator';
import { Serializable } from '../interfaces/Serializable';
import { FormGroup } from '@angular/forms'
export abstract class DataField<T> extends BaseModel implements Serializable<T>,FormGenerator<FormGroup>{
public label:string;
buildForm():FormGroup{
throw new Error("Build Form Is not not correctly overriden");

View File

@ -0,0 +1,16 @@
import { DataField } from './DataField';
import { FormGroup } from '@angular/forms';
export class FreeTextData extends DataField<FreeTextData>{
buildForm():FormGroup{
let formGroup = this.formBuilder.group({
label:this.label
});
return formGroup;
}
fromJSONObject(item:any):FreeTextData{
this.label = item.label
return this;
}
}

View File

@ -7,7 +7,9 @@ export class RadioBoxData extends DataField<RadioBoxData>{
public options:Array<ListingItem>;
buildForm():FormGroup{
let formGroup = this.formBuilder.group({});
let formGroup = this.formBuilder.group({
label:[this.label]
});
let optionsFormArray = new Array<FormGroup>();
if (this.options) {
this.options.forEach(item => {
@ -21,6 +23,7 @@ export class RadioBoxData extends DataField<RadioBoxData>{
fromJSONObject(item:any):RadioBoxData{
this.options = new JsonSerializer<ListingItem>().fromJSONArray(item.options,ListingItem);
this.label = item.label
return this;
}
}

View File

@ -0,0 +1,16 @@
import { DataField } from './DataField';
import { FormGroup } from '@angular/forms';
export class TextArea extends DataField<TextArea>{
buildForm(): FormGroup {
let formGroup = this.formBuilder.group({
label: this.label
});
return formGroup;
}
fromJSONObject(item: any): TextArea {
this.label = item.label
return this;
}
}

View File

@ -8,7 +8,8 @@ export class WordListData extends DataField<WordListData>{
public options:Array<ListingItem>;
buildForm():FormGroup{
let formGroup = this.formBuilder.group({
type:[this.type]
type:[this.type],
label:[this.label]
});
let optionsFormArray = new Array<FormGroup>();
if (this.options) {
@ -25,6 +26,7 @@ export class WordListData extends DataField<WordListData>{
fromJSONObject(item:any):WordListData{
this.type = item.type;
this.options = new JsonSerializer<ListingItem>().fromJSONArray(item.options,ListingItem);
this.label = item.label;
return this;
}
}

View File

@ -1,24 +0,0 @@
<div [formGroup]="form" class="form-row">
<div formGroupName="data">
<div formArrayName="options">
<div *ngFor="let option of form.get('data').get('options').controls index as i">
<div [formGroupName]="i">
<div class="form-group col-md-6">
<label>Label</label>
<input type="text" class="form-control" formControlName="label">
</div>
<div class="form-group col-md-6">
<label>Value</label>
<input type="text" class="form-control" formControlName="value">
</div>
</div>
</div>
</div>
</div>
<div>
<a (click)="addNewRow(form)" style="cursor: pointer">
Add +
</a>
</div>
</div>

View File

@ -32,7 +32,6 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData>{
Element root = super.toXml(doc);
root.setAttribute("url", this.url);
Element element = doc.createElement("option");
element.setAttribute("label", this.autoCompleteOptions.getLabel());
element.setAttribute("value", autoCompleteOptions.getValue());
@ -44,7 +43,6 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData>{
super.fromXml(item);
this.url = item.getAttribute("url");
Element optionElement = (Element)item.getElementsByTagName("option").item(0);
if(optionElement!=null){
this.autoCompleteOptions = new Option();
this.autoCompleteOptions.setLabel(optionElement.getAttribute("label"));
@ -63,7 +61,6 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData>{
this.autoCompleteOptions.setLabel(options.get("label"));
this.autoCompleteOptions.setValue(options.get("value"));
}
}
return this;

View File

@ -3,10 +3,14 @@ package eu.eudat.models.components.commons.datafield;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.Map;
public class BooleanDecisionData extends FieldData<BooleanDecisionData>{
@Override
public BooleanDecisionData fromData(Object data) {
this.setLabel((String)((Map<String,Object>)data).get("label"));
return this;
}
@ -17,13 +21,14 @@ public class BooleanDecisionData extends FieldData<BooleanDecisionData>{
@Override
public Element toXml(Document doc) {
return doc.createElement("data");
Element element = doc.createElement("data");
element.setAttribute("label",this.getLabel());
return element;
}
@Override
public BooleanDecisionData fromXml(Element item) {
// TODO Auto-generated method stub
this.setLabel(item.getAttribute("label"));
return this;
}

View File

@ -6,34 +6,24 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class CheckBoxData extends FieldData<CheckBoxData>{
private String label;
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.label);
root.setAttribute("label", this.getLabel());
return root;
}
@Override
public CheckBoxData fromXml(Element item) {
this.label = item!=null?item.getAttribute("label"):""; //TODO
this.setLabel(item!=null?item.getAttribute("label"):"");
return this;
}
@Override
public CheckBoxData fromData(Object data) {
if(data!=null){
this.label= (String)((Map<String,Object>)data).get("label");
this.setLabel((String)((Map<String,Object>)data).get("label"));
}
return this;
}

View File

@ -56,11 +56,12 @@ public abstract class ComboBoxData<T> extends FieldData<T>{
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("type", this.type);
root.setAttribute("label",this.getLabel());
return root;
}
@Override
public T fromXml(Element item) {
this.setLabel(item.getAttribute("label"));
this.type = item.getAttribute("type");
return (T)this;
}
@ -69,6 +70,7 @@ public abstract class ComboBoxData<T> extends FieldData<T>{
if(data!=null){
this.type = (String)((Map<String,Object>)data).get("type");
this.setLabel((String)((Map<String,Object>)data).get("label"));
}
return (T)this;

View File

@ -6,6 +6,16 @@ import org.w3c.dom.Element;
import eu.eudat.utilities.XmlSerializable;
public abstract class FieldData<T> implements XmlSerializable<T>{
private String label;
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public T fromData(Object data) {
return null;
}

View File

@ -0,0 +1,39 @@
package eu.eudat.models.components.commons.datafield;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.List;
import java.util.Map;
/**
* Created by ikalyvas on 1/3/2018.
*/
public class FreeTextData extends FieldData<FreeTextData> {
@Override
public FreeTextData 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 FreeTextData fromXml(Element item) {
item.setAttribute("label",this.getLabel());
return this;
}
}

View File

@ -13,37 +13,42 @@ import eu.eudat.utilities.XmlSerializable;
public class RadioBoxData extends FieldData<RadioBoxData>{
private class Option implements XmlSerializable<Option>{
private class Option implements XmlSerializable<Option> {
private String label;
private String value;
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;
}
@Override
public Element toXml(Document doc) {
Element option = doc.createElement("option");
option.setAttribute("label", this.label);
option.setAttribute("value",this.value);
option.setAttribute("value", this.value);
return option;
}
@Override
public Option fromXml(Element item) {
this.label = item.getAttribute("label");
this.value = item.getAttribute("value");
return this;
}
}
private List<Option> options;
public List<Option> getOptions() {
@ -65,6 +70,7 @@ public class RadioBoxData extends FieldData<RadioBoxData>{
newOption.setValue(map.get("value"));
this.options.add(newOption);
}
this.setLabel(((Map<String,String>)data).get("label"));
}
return this;
}
@ -82,6 +88,7 @@ public class RadioBoxData extends FieldData<RadioBoxData>{
for(Option option : this.options){
element.appendChild(option.toXml(doc));
}
root.setAttribute("label",this.getLabel());
root.appendChild(element);
return root;
}
@ -91,7 +98,7 @@ public class RadioBoxData extends FieldData<RadioBoxData>{
this.options = new LinkedList<>();
Element optionsElement = (Element)item.getElementsByTagName("options").item(0);
this.setLabel(item.getAttribute("label"));
if(optionsElement!=null){
NodeList optionElements = optionsElement.getChildNodes();
for (int temp = 0; temp < optionElements.getLength(); temp++) {

View File

@ -0,0 +1,37 @@
package eu.eudat.models.components.commons.datafield;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.Map;
/**
* Created by ikalyvas on 1/3/2018.
*/
public class TextAreaData extends FieldData<TextAreaData>{
@Override
public TextAreaData 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 TextAreaData fromXml(Element item) {
item.setAttribute("label",this.getLabel());
return this;
}
}

View File

@ -4,15 +4,11 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import eu.eudat.models.components.commons.datafield.*;
import org.w3c.dom.Element;
import eu.eudat.entities.xmlmodels.modeldefinition.DatabaseModelDefinition;
import eu.eudat.entities.xmlmodels.datasetprofiledefinition.DatabaseViewStyleDefinition;
import eu.eudat.models.components.commons.datafield.AutoCompleteData;
import eu.eudat.models.components.commons.datafield.CheckBoxData;
import eu.eudat.models.components.commons.datafield.FieldData;
import eu.eudat.models.components.commons.datafield.RadioBoxData;
import eu.eudat.models.components.commons.datafield.WordListData;
import eu.eudat.utilities.ModelDefinition;
import eu.eudat.utilities.ViewStyleDefinition;
@ -76,10 +72,11 @@ public class ModelBuilder {
return (U) new WordListData().fromData(data);
}
}
if(type.equals("booleanDecision"))return null;
if(type.equals("booleanDecision"))return (U) new BooleanDecisionData().fromData(data);
if(type.equals("radiobox"))return (U) new RadioBoxData().fromData(data);
if(type.equals("checkBox"))return (U) new CheckBoxData().fromData(data);
if(type.equals("freetext"))return null;
if(type.equals("freetext"))return (U) new FreeTextData().fromData(data);
if(type.equals("textarea"))return (U) new TextAreaData().fromData(data);
return null;
}