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

Trigo / SPP : empty results on property change

parent e0e477d0
No related branches found
Tags 4.1.0
1 merge request!69Resolve "Module y = a.x + b"
......@@ -4,30 +4,34 @@ import { FieldSet } from "../../fieldset";
import { FormulaireNode } from "../../formulaire-node";
import { FieldsetContainer } from "../../fieldset-container";
import { SPP, Nub, Props, Session, YAXN } from "jalhyd";
import { SPP, Nub, Props, Session, YAXN, IObservable } from "jalhyd";
/**
* Formulaire pour "somme / produit de puissances"
*/
export class FormulaireSPP extends FormulaireBase {
/* constructor() {
super();
this._formResult = new FormResultPab(this);
// remove obsolete observer set by super()
this.removeObserver(this._formCompute);
this._formCompute = new FormComputePab(this, (this._formResult as FormResultPab));
} */
/* public get pabNub(): Pab {
return this.currentNub as Pab;
} */
/** id of select configuring operation */
private _operationSelectId: string;
public get sppNub(): SPP {
return this.currentNub as SPP;
}
protected parseOptions(json: {}) {
super.parseOptions(json);
this._operationSelectId = this.getOption(json, "operationSelectId");
}
public afterParseFieldset(fs: FieldSet) {
if (this._operationSelectId) {
const sel = fs.getFormulaireNodeById(this._operationSelectId);
if (sel) {
fs.properties.addObserver(this);
}
}
}
private createYaxnNub(templ: FieldsetTemplate): Nub {
const params = {};
params["calcType"] = templ.calcTypeFromConfig;
......@@ -129,6 +133,15 @@ export class FormulaireSPP extends FormulaireBase {
} else { super.removeFieldset(fs); }
}
// interface Observer
public update(sender: IObservable, data: any) {
super.update(sender, data);
if (data.action === "propertyChange") {
this.reset();
}
}
private get fieldsetContainer(): FieldsetContainer {
const n = this.getFormulaireNodeById("yaxn_container");
if (n === undefined || !(n instanceof FieldsetContainer)) {
......
......@@ -2,7 +2,6 @@ import { IObservable } from "jalhyd";
import { FormulaireBase } from "./form-base";
import { FieldSet } from "../../fieldset";
import { FormResultFixedVar } from "../form-result-fixedvar";
/**
* Formulaire pour les fonctions trigonométriques
......@@ -41,13 +40,7 @@ export class FormulaireTrigo extends FormulaireBase {
public update(sender: IObservable, data: any) {
super.update(sender, data);
if (data.action === "propertyChange") {
/* if (data.name === "gridType") {
this.reset();
// Inclined grids have more input fields (OEntH and cIncl)
this.getFieldsetById("fs_grille").updateFields();
// Alpha and Beta are not always shown
this.getFieldsetById("fs_plan").updateFields();
} */
this.reset();
}
}
}
......@@ -42,6 +42,7 @@ import { FormulaireBief } from "../formulaire/definition/concrete/form-bief";
import { FormulaireSolveur } from "../formulaire/definition/concrete/form-solveur";
import { AppComponent } from "../app.component";
import { FormulaireSPP } from "../formulaire/definition/concrete/form-spp";
import { FormulaireTrigo } from "../formulaire/definition/concrete/form-trigo";
@Injectable()
export class FormulaireService extends Observable {
......@@ -344,6 +345,10 @@ export class FormulaireService extends Observable {
f = new FormulaireSPP();
break;
case CalculatorType.Trigo:
f = new FormulaireTrigo();
break;
default:
f = new FormulaireBase();
}
......
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