Skip to content
Snippets Groups Projects
Commit 8982439a authored by francois.grand's avatar francois.grand
Browse files

modifs induites par le commit 17ba38b2

parent 17ba38b2
No related branches found
No related tags found
No related merge requests found
......@@ -44,21 +44,33 @@ export class NgBaseParam extends Observable {
templateUrl: "../generic-input/generic-input.component.html",
})
export class BaseParamInputComponent extends GenericInputComponent {
constructor(private intlService: InternationalisationService) {
super();
}
/**
* paramètre géré
*/
private get _paramDef(): NgBaseParam {
return this._model;
}
/**
* managed parameter
* valeur intermédiaire nécessitée par le fait que toutes les valeurs numériques ne sont pas légales
* pour NgParameter (l'affecter peut provoquer une exception) et qui permet de faire fonctionner la validation du modèle
*/
@Input('param')
private _paramDef: NgBaseParam;
private _tmp: number;
constructor(private intlService: InternationalisationService) {
super();
protected afterSetModel() {
this._tmp = this._paramDef.getValue();
}
protected getModelValue(): any {
return this._paramDef.getValue();
return this._tmp;
}
protected setModelValue(v: any) {
this._tmp = v;
try {
this._paramDef.setValue(v);
}
......
......@@ -10,11 +10,8 @@ export class CalculatorNameComponent extends GenericInputComponent {
/**
* formulaire géré
*/
private _form: FormulaireDefinition;
public set formulaire(f: FormulaireDefinition) {
this._form = f;
this.updateAndValidateUI();
private get _form(): FormulaireDefinition {
return this._model;
}
/**
......
......@@ -18,25 +18,45 @@ export class NgParamInputComponent extends GenericInputComponent implements Obse
/**
* paramètre géré
*/
@Input('param')
private _paramDef: NgParameter;
private get _paramDef(): NgParameter {
return this.model;
}
/**
* valeur intermédiaire nécessitée par le fait que toutes les valeurs numériques ne sont pas légales
* pour NgParameter (l'affecter peut provoquer une exception) et qui permet de faire fonctionner la validation du modèle
*/
private _model: number;
private _tmp: number;
constructor(private intlService: InternationalisationService) {
super();
}
/**
* appelé avant le changement de modèle
*/
protected beforeSetModel() {
if (this._paramDef != undefined)
this._paramDef.removeObserver(this);
}
/**
* appelé après le changement de modèle
*/
protected afterSetModel() {
if (this._paramDef != undefined) {
if (this._paramDef.isDefined)
this._tmp = this._paramDef.getValue();
this._paramDef.addObserver(this);
}
}
protected getModelValue(): any {
return this._model;
return this._tmp;
}
protected setModelValue(v: any) {
this._model = v;
this._tmp = v;
try {
this._paramDef.setValue(v);
}
......@@ -84,17 +104,9 @@ export class NgParamInputComponent extends GenericInputComponent implements Obse
return +ui;
}
protected afterFirstViewChecked() {
if (this._paramDef != undefined)
if (this._paramDef.isDefined)
this._model = this._paramDef.getValue();
super.afterFirstViewChecked();
this._paramDef.addObserver(this);
}
public update(sender: IObservable, data: any): void {
if (data["action"] == "value") {
this._model = data["value"];
this._tmp = data["value"];
this.updateAndValidateUI();
}
}
......
......@@ -11,13 +11,17 @@ import { NgParameter } from "../../formulaire/ngparam";
templateUrl: "../generic-input/generic-input.component.html"
})
export class NgParamMaxComponent extends GenericInputComponent {
@Input("param")
private _param: NgParameter;
constructor(private intlService: InternationalisationService) {
super();
}
/**
* paramètre géré
*/
private get _param(): NgParameter {
return this._model;
}
protected getModelValue(): any {
return this._param.maxValue;
}
......
......@@ -11,13 +11,17 @@ import { NgParameter } from "../../formulaire/ngparam";
templateUrl: "../generic-input/generic-input.component.html"
})
export class NgParamMinComponent extends GenericInputComponent {
@Input("param")
private _param: NgParameter;
constructor(private intlService: InternationalisationService) {
super();
}
/**
* paramètre géré
*/
private get _param(): NgParameter {
return this._model;
}
protected getModelValue(): any {
return this._param.minValue;
}
......
......@@ -11,13 +11,17 @@ import { NgParameter } from "../../formulaire/ngparam";
templateUrl: "../generic-input/generic-input.component.html"
})
export class NgParamStepComponent extends GenericInputComponent {
@Input("param")
private _param: NgParameter;
constructor(private intlService: InternationalisationService) {
super();
}
/**
* paramètre géré
*/
private get _param(): NgParameter {
return this._model;
}
protected getModelValue(): any {
return this._param.stepValue;
}
......
......@@ -10,13 +10,17 @@ import { Message } from "jalhyd";
templateUrl: "../generic-input/generic-input.component.html"
})
export class ValueListComponent extends GenericInputComponent {
@Input("param")
private _param: NgParameter;
constructor(private intlService: InternationalisationService) {
super();
}
/**
* paramètre géré
*/
private get _param(): NgParameter {
return this._model;
}
protected getModelValue(): any {
return this._param.valueList;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment