no message

This commit is contained in:
annabakouli 2018-01-03 16:19:38 +02:00
parent 71aebdae7d
commit b99502237a
7 changed files with 34 additions and 27 deletions

View File

@ -41,7 +41,7 @@
<div *ngSwitchCase="'booleanDecision'">
<booleanDecision-component [form]="form" [dataModel]="dataModel"></booleanDecision-component>
</div>
<div *ngSwitchCase="'checkbox'">
<div *ngSwitchCase="'checkBox'">
<checkbox-component [form]="form" [dataModel]="dataModel"></checkbox-component>
</div>
</div>

View File

@ -1,16 +1,14 @@
import { DatasetProfileService } from 'app/services/dataset-profile.service';
import { Section } from '../../models/DataSetProfile/Section';
import { JsonSerializer } from '../../utilities/JsonSerializer';
import { DatasetProfileService } from '../../services/dataset-profile.service';
import { RestBase } from '../../services/rest-base';
import { DatasetProfileModel } from '../../models/DataSetProfile/DatasetProfileModel';
import { Page } from '../../models/DataSetProfile/Page';
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormControl } from '@angular/forms';
import { JsonSerializer } from 'app/utilities/JsonSerializer';
import { SectionFormComponent } from '../section-form/section-form.component';
import { Section } from 'app/models/DataSetProfile/Section';
import { FieldGroup } from 'app/models/DataSetProfile/FieldGroup';
import { DatasetProfileModel } from 'app/models/DataSetProfile/DatasetProfileModel';
import { TestModel } from 'app/testModel/testModel';
import { FormArray } from '@angular/forms/src/model';
import { RestBase } from 'app/services/rest-base';
import { Router, ActivatedRoute, ParamMap, Params } from '@angular/router';
import { Page } from 'app/models/DataSetProfile/Page'
import { PageFormComponent } from '../page-form/page-component'
@Component({

View File

@ -1,4 +1,8 @@
import { RadioBoxData } from '../DataField/RadioBoxData';
import { BooleanDecisionData } from '../DataField/BooleanDecisionData';
import { FreeTextData } from '../DataField/FreeTextData';
import { TextArea } from '../DataField/TextArea';
import { CheckBoxData } from '../DataField/CheckBoxData';
import { RadioBoxData } from '../DataField/RadioBoxData';
import { WordListData } from '../DataField/WordListData';
import { AutocompleteData } from '../DataField/AutocompleteData';
import { DataField } from '../DataField/DataField';
@ -40,6 +44,10 @@ export class Field extends BaseModel implements Serializable<Field>,FormGenerato
if(item.data.type === "wordlist")this.data = new JsonSerializer<WordListData>().fromJSONObject(item.data,WordListData);
}else{
if(this.viewStyle.renderStyle === "radiobox") this.data = new JsonSerializer<RadioBoxData>().fromJSONObject(item.data,RadioBoxData);
if(this.viewStyle.renderStyle === "checkBox") this.data = new JsonSerializer<CheckBoxData>().fromJSONObject(item.data,CheckBoxData);
if(this.viewStyle.renderStyle === "textarea") this.data = new JsonSerializer<TextArea>().fromJSONObject(item.data,TextArea);
if(this.viewStyle.renderStyle === "freetext") this.data = new JsonSerializer<FreeTextData>().fromJSONObject(item.data,FreeTextData);
if(this.viewStyle.renderStyle === "booleanDecision") this.data = new JsonSerializer<BooleanDecisionData>().fromJSONObject(item.data,BooleanDecisionData);
}
}
return this;

View File

@ -1,5 +1,5 @@
import { FormGroup } from '@angular/forms';
import { JsonSerializer } from 'app/utilities/JsonSerializer';
import { JsonSerializer } from '../../utilities/JsonSerializer';
import { FormGroup } from '@angular/forms';
import { Serializable } from '../interfaces/Serializable';
import { BaseModel } from '../BaseModel';
import {Field} from './Field'

View File

@ -1,10 +1,10 @@
import { BaseModel } from '../BaseModel';
import { JsonSerializer } from '../../utilities/JsonSerializer';
import { FieldSet } from './FieldSet';
import { BaseModel } from '../BaseModel';
import { FormGenerator } from '../interfaces/FormGenerator';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { JsonSerializer } from 'app/utilities/JsonSerializer';
import { Serializable } from '../interfaces/Serializable';
import { FieldGroup } from './FieldGroup';
import { FieldSet } from 'app/models/DataSetProfile/FieldSet';
export class Section extends BaseModel implements Serializable<Section>, FormGenerator<FormGroup>{
public sections: Array<Section> = new Array<Section>();

View File

@ -33,7 +33,7 @@ public class FreeTextData extends FieldData<FreeTextData> {
@Override
public FreeTextData fromXml(Element item) {
item.setAttribute("label",this.getLabel());
this.setLabel(item.getAttribute("label"));
return this;
}
}

View File

@ -63,20 +63,20 @@ public class ModelBuilder {
return list;
}
public <U extends FieldData<U>> U toFieldData(Object data,String type,Element dataElement){
public <U> FieldData<U> toFieldData(Object data,String type,Element dataElement){
if(type.equals("combobox")){
if(dataElement!=null){
if(dataElement.getAttribute("type").equals("autocomplete")){
return (U) new AutoCompleteData().fromData(data);
return (FieldData<U>) new AutoCompleteData().fromData(data);
}else if(dataElement.getAttribute("type").equals("wordlist"))
return (U) new WordListData().fromData(data);
return (FieldData<U>) new WordListData().fromData(data);
}
}
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 (U) new FreeTextData().fromData(data);
if(type.equals("textarea"))return (U) new TextAreaData().fromData(data);
if(type.equals("booleanDecision"))return (FieldData<U>) new BooleanDecisionData().fromData(data);
if(type.equals("radiobox"))return (FieldData<U>) new RadioBoxData().fromData(data);
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);
return null;
}
@ -88,10 +88,11 @@ public class ModelBuilder {
}else if(comboboxType.equals("wordlist"))
return (FieldData<U>) new WordListData().fromData(data);
}
if(type.equals("booleanDecision"))return null;
if(type.equals("booleanDecision"))return (FieldData<U>) new BooleanDecisionData().fromData(data);
if(type.equals("radiobox"))return (FieldData<U>) new RadioBoxData().fromData(data);
if(type.equals("checkBox"))return (FieldData<U>) new CheckBoxData().fromData(data);
if(type.equals("freetext"))return null;
if(type.equals("freetext"))return (FieldData<U>) new FreeTextData().fromData(data);
if(type.equals("textarea"))return (FieldData<U>) new TextAreaData().fromData(data);
return null;
}