Skip to content
Snippets Groups Projects
Commit ed1cb2f0 authored by mathias.chouet's avatar mathias.chouet
Browse files

Màj jalhyd: utilisation de ParamDefinition au lieu de BaseParam

parent 14bff02c
No related branches found
No related tags found
1 merge request!31Resolve "Simplification du code (jalhyd#58)"
...@@ -152,7 +152,7 @@ and then : ...@@ -152,7 +152,7 @@ and then :
- dans _src/app/calculators/ma-calculette_ : - dans _src/app/calculators/ma-calculette_ :
Créer _ma-calculette.config.json_ sur le modèle des autres. Créer _ma-calculette.config.json_ sur le modèle des autres.
Les ids utilisés doivent correspondre au symbole fourni à classe _BaseParam_ (1er paramètre du constructeur) Les ids utilisés doivent correspondre au symbole fourni à classe _ParamDefinition_ (1er paramètre du constructeur)
Ne pas oublier de spécifier : Ne pas oublier de spécifier :
- éventuellement le type de noeud par défaut de la calculette dans les options avec le champ "_defaultNodeType_". Si ce champ est absent, sa valeur est "_ComputeNodeType.None_". Ce champ sert par ex pour les sections paramétrées à déterminer le type de section à afficher lors de la création de la calculette. - éventuellement le type de noeud par défaut de la calculette dans les options avec le champ "_defaultNodeType_". Si ce champ est absent, sa valeur est "_ComputeNodeType.None_". Ce champ sert par ex pour les sections paramétrées à déterminer le type de section à afficher lors de la création de la calculette.
......
// cf. https://blog.thoughtram.io/angular/2016/07/27/custom-form-controls-in-angular-2.html // cf. https://blog.thoughtram.io/angular/2016/07/27/custom-form-controls-in-angular-2.html
import { Component, Input, forwardRef, OnInit, DoCheck, ChangeDetectorRef } from "@angular/core"; import { Component, ChangeDetectorRef } from "@angular/core";
import { ControlValueAccessor, NG_VALUE_ACCESSOR, NG_VALIDATORS, FormControl } from "@angular/forms";
import { BaseParam, NumericalString, Message, ParamDomain, ParamDomainValue, Observable } from "jalhyd"; import { NumericalString, Message, ParamDefinition, ParamDomain, ParamDomainValue, Observable } from "jalhyd";
import { InternationalisationService, LanguageCode } from "../../services/internationalisation/internationalisation.service"; import { InternationalisationService } from "../../services/internationalisation/internationalisation.service";
import { GenericInputComponent } from "../generic-input/generic-input.component"; import { GenericInputComponent } from "../generic-input/generic-input.component";
export class NgBaseParam extends Observable { export class NgBaseParam extends Observable {
private _param: BaseParam; private _param: ParamDefinition;
constructor(symb: string, d: ParamDomain | ParamDomainValue, val: number) { constructor(symb: string, d: ParamDomain | ParamDomainValue, val: number) {
super(); super();
this._param = new BaseParam(symb, d, val); this._param = new ParamDefinition(symb, d, val);
} }
public get symbol() { public get symbol() {
......
...@@ -360,7 +360,7 @@ export class TestInputComponent extends GenericInputComponent { ...@@ -360,7 +360,7 @@ export class TestInputComponent extends GenericInputComponent {
// exemple où le modèle est une classe dont on ne gère qu'un membre // exemple où le modèle est une classe dont on ne gère qu'un membre
import { BaseParam } from "jalhyd"; import { ParamDefinition } from "jalhyd";
@Component({ @Component({
selector: "test2-input", selector: "test2-input",
...@@ -376,7 +376,7 @@ export class Test2InputComponent extends GenericInputComponent { ...@@ -376,7 +376,7 @@ export class Test2InputComponent extends GenericInputComponent {
} }
// paramètre géré // paramètre géré
private get _param(): BaseParam { private get _param(): ParamDefinition {
return this._model; return this._model;
} }
......
...@@ -387,7 +387,7 @@ export class NgParameter extends InputField implements Observer { ...@@ -387,7 +387,7 @@ export class NgParameter extends InputField implements Observer {
public update(sender: any, data: any) { public update(sender: any, data: any) {
switch (data["action"]) { switch (data["action"]) {
case "baseparamAfterValue": // changement de valeur envoyé par l'objet référencé case "paramdefinitionAfterValue": // changement de valeur envoyé par l'objet référencé
this.notifyValueModified(sender); this.notifyValueModified(sender);
break; break;
} }
......
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