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

MacroRugoCompound: added ZRL, ZRR, BR for inclined apron

parent 7fbdbd75
No related branches found
No related tags found
1 merge request!57WIP: Resolve "Ajout du module "Passe à macro-rugosités complexe""
......@@ -33,12 +33,16 @@
"id": "select_pass_type",
"type": "select",
"source": "mrc_pass_type"
}
},
"ZRL",
"ZRR",
"BR"
]
},
{
"type": "options",
"idCal": "Q",
"apronTypeSelectId": "select_pass_type",
"help": "pam/macrorugo-compound"
}
]
\ No newline at end of file
......@@ -11,6 +11,9 @@
"PBD": "Diameter",
"PBH": "Height",
"Cd0": "Shape (1 for round, 2 for square)",
"ZRL": "Left apron elevation",
"ZRR": "Right apron elevation",
"BR": "Total width",
"select_pass_type_0": "Multiple aprons",
"select_pass_type_1": "Inclined apron"
......
......@@ -10,6 +10,9 @@
"PBD": "Diamètre",
"PBH": "Hauteur",
"Cd0": "Forme (1 pour rond, 2 pour carré)",
"ZRL": "Cote de radier gauche",
"ZRR": "Cote de radier droite",
"BR": "Largeur totale",
"select_pass_type_0": "Radiers multiples",
"select_pass_type_1": "Radier incliné"
......
......@@ -3,25 +3,63 @@
import { FormulaireBase } from "./form-base";
import { FormResultFixedVar } from "../form-result-fixedvar";
import { FormComputeFixedVar } from "../form-compute-fixedvar";
import { IObservable } from 'jalhyd';
import { FieldSet } from '../../fieldset';
/**
* Formulaire pour les passes à macrorugosités complexes
*/
export class FormulaireMacrorugoCompound extends FormulaireBase {
/** id of select configuring apron type */
private _apronTypeSelectId: string;
constructor() {
super();
this._formResult = new FormResultFixedVar(this);
// default properties
this._props["inclinedApron"] = "1";
this._props["inclinedApron"] = false;
// remove obsolete observer set by super()
this.removeObserver(this._formCompute);
this._formCompute = new FormComputeFixedVar(this, (this._formResult as FormResultFixedVar));
}
protected parseOptions(json: {}) {
super.parseOptions(json);
this._apronTypeSelectId = this.getOption(json, "apronTypeSelectId");
}
/* public get pabNub(): Pab {
return this.currentNub as Pab;
} */
public afterParseFieldset(fs: FieldSet) {
// if Fieldset contains apron type selector
if (this._apronTypeSelectId) {
const sel = fs.getFormulaireNodeById(this._apronTypeSelectId);
if (sel) {
// on abonne le formulaire aux propriétés du FieldSet
fs.properties.addObserver(this);
}
}
}
// interface Observer
update(sender: IObservable, data: any) {
if (sender instanceof FieldSet && data.action === "propertyChange") {
switch (data.name) {
case "inclinedApron":
// reflect changes in GUI
for (const fs of this.allFieldsets) {
// show / hide dependent fields
fs.updateFields();
}
this.reset();
break;
}
}
}
}
......@@ -246,7 +246,6 @@ export class FieldSet extends FormulaireElement implements Observer {
}
const selectElement = selectField.getSelectedEntryFromValue(propVal);
try {
console.log(`setting propval ${propVal} (propKey ${propertyKey}) on select ${selectId}`, selectElement, selectField);
selectField.setValue(selectElement);
} catch (e) {
console.error(`setSelectValueFromProperty: cannot set value ${propVal} on <select> ${selectId}`);
......
......@@ -159,8 +159,8 @@ export class SelectField extends Field {
break;
case "mrc_pass_type": // macrorugo complexe: type de radier
this.addEntry(new SelectEntry(this._entriesBaseId + "0", "0"));
this.addEntry(new SelectEntry(this._entriesBaseId + "1", "1"));
this.addEntry(new SelectEntry(this._entriesBaseId + "0", false));
this.addEntry(new SelectEntry(this._entriesBaseId + "1", true));
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