diff --git a/src/app/components/dialog-edit-pab/dialog-edit-pab.component.html b/src/app/components/dialog-edit-pab/dialog-edit-pab.component.html index e96cc7807839a60dd10cd6fc0a8b7f3b024d6032..8674eb361f97173fe01467f1e8a70671864751e7 100644 --- a/src/app/components/dialog-edit-pab/dialog-edit-pab.component.html +++ b/src/app/components/dialog-edit-pab/dialog-edit-pab.component.html @@ -67,7 +67,7 @@ <button mat-raised-button type="submit" color="warn" (click)="applyValues()" [disabled]="buttonDisabled(valueToSetRef, deltaRef)"> - {{ uitextSave }} + {{ uitextValidate }} </button> </div> diff --git a/src/app/components/dialog-edit-pab/dialog-edit-pab.component.ts b/src/app/components/dialog-edit-pab/dialog-edit-pab.component.ts index 0be09d40f61e6926ad12ec3364a4d218c50c6554..ba3986a127aafa0f69422d61c870e66ea81bc9db 100644 --- a/src/app/components/dialog-edit-pab/dialog-edit-pab.component.ts +++ b/src/app/components/dialog-edit-pab/dialog-edit-pab.component.ts @@ -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() { diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts index 48d1086577a5a1b8ad8e89294e7a71ab0e714fe6..104699b8a881c77a96091934b7ba57b7f422c02d 100644 --- a/src/app/components/pab-table/pab-table.component.ts +++ b/src/app/components/pab-table/pab-table.component.ts @@ -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() {