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

PAB : clonage d'éléments

parent cf9c88b7
No related branches found
No related tags found
1 merge request!49Resolve "Ajout du module de calcul d'une passe à bassins"
......@@ -67,7 +67,7 @@
<button mat-raised-button type="submit" color="warn" (click)="applyValues()"
[disabled]="buttonDisabled(valueToSetRef, deltaRef)">
{{ uitextSave }}
{{ uitextValidate }}
</button>
</div>
......
......@@ -183,8 +183,8 @@ export class DialogEditPabComponent {
return this.intlService.localizeText("ERROR_PARAM_MUST_BE_A_NUMBER");
}
public get uitextSave() {
return this.intlService.localizeText("INFO_OPTION_SAVE");
public get uitextValidate() {
return this.intlService.localizeText("INFO_OPTION_VALIDATE");
}
public get uitextCancel() {
......
......@@ -780,10 +780,63 @@ export class PabTableComponent implements /* DoCheck, AfterViewInit, */ OnInit {
console.log("Add !!!");
/* const newChild = undefined;
this.selectedItem.parent.addChild(newChild, this.selectedItem.findPositionInParent()); */
/* for (let i = 0; i < this.childrenToAdd; i++) {
this.selectedItem.parent.addChild()
} */
/* let msg: string;
if (this.childrenToAdd === 1) {
msg = this.i18nService.localizeText("INFO_FSC_FS_ADDED");
} else {
msg = sprintf(this.i18nService.localizeText("INFO_FSC_FS_ADDED_N_TIMES"), this.childrenToAdd);
}
this.notifService.notify(msg); */
this.childrenToAdd = 1; // reinit to avoid confusion
}
public onCopyClick() {
console.log("Copy !!!");
for (let i = 0; i < this.childrenToAdd; i++) {
const newChild = Session.getInstance().createNub(
this.selectedItem.properties.clone(),
this.selectedItem.parent
);
// copy parameter values
for (const p of this.selectedItem.prms) {
newChild.getParameter(p.symbol).singleValue = p.singleValue;
}
// copy children
if (this.selectedItem instanceof ParallelStructure) {
for (const c of this.selectedItem.getChildren()) {
const newGrandChild = Session.getInstance().createNub(
c.properties.clone(),
newChild
);
// copy children parameters values
for (const p of c.prms) {
newGrandChild.getParameter(p.symbol).singleValue = p.singleValue;
}
// add to parent
newChild.addChild(
newGrandChild,
c.findPositionInParent()
);
}
}
// add to parent
this.selectedItem.parent.addChild(
newChild,
this.selectedItem.findPositionInParent()
);
}
this.refresh();
/* const pos = (this._fieldSet.parent as FieldsetContainer).getFieldsetPosition(this._fieldSet) + 1;
let msg: string;
if (this.childrenToAdd === 1) {
msg = sprintf(this.i18nService.localizeText("INFO_FSC_FS_COPIED"), pos);
} else {
msg = sprintf(this.i18nService.localizeText("INFO_FSC_FS_COPIED_N_TIMES"), pos, this.childrenToAdd);
}
this.notifService.notify(msg); */
this.childrenToAdd = 1; // reinit to avoid confusion
}
public onMoveUpClick() {
......
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