From 98ef46b83a21bd312d96d32c763effe25cba4d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Fri, 19 Apr 2024 15:27:23 +0200 Subject: [PATCH] Adapt Product Gamesystem Editor for Productsystems with identical innersystems --- .../product-state-editor.component.html | 4 ++-- .../product-state-editor.component.ts | 23 ++++++++++++++++++- .../product-transition-editor.component.ts | 16 +++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html index 96ad526..69a13cd 100644 --- a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.html @@ -5,8 +5,8 @@ - - + +
{{col}}{{displayedColumns[i]}} {{getLeafState(state, i).stateLabel}} diff --git a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts index 066e478..1c7a7e8 100644 --- a/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts +++ b/src/app/editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component.ts @@ -29,6 +29,8 @@ export class ProductStateEditorComponent implements OnInit{ @Input() templateElement: TemplateElement | undefined @Output('onOpenGamesystemEditor') openGamesystemEditorEmitter = new EventEmitter(); displayedColumns: string[] = []; + internalColumnNames: string[] = [] + expandedColumns: string[] = [] datasource = new MatTableDataSource(); @@ -38,7 +40,12 @@ export class ProductStateEditorComponent implements OnInit{ this.gamesystem!.generateFromChildsystems(); this.generateColumnNamesRecursively(this.gamesystem!, ""); this.displayedColumns.push('Initial'); - this.expandedColumns = [...this.displayedColumns, 'expand']; + + this.internalColumnNames = this.displayedColumns.concat(); + + this.renameDuplicateColumnNames(this.internalColumnNames) + + this.expandedColumns = [...this.internalColumnNames, 'expand']; if(this.templateElement == undefined) { this.datasource.data = this.gamesystem!.states; @@ -52,6 +59,20 @@ export class ProductStateEditorComponent implements OnInit{ } } + private renameDuplicateColumnNames(columnNames: string[]) { + for(let i=0; i { if(innerGamesystem instanceof SimpleGamesystem) { diff --git a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts index 6c12eec..8bf42e1 100644 --- a/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts +++ b/src/app/editor/gamesystem-editor/transition-editor/product-transition-editor/product-transition-editor.component.ts @@ -50,6 +50,8 @@ export class ProductTransitionEditorComponent implements OnInit{ const leafGamesystems: SimpleGamesystem[] = LeafGamesystemCalculator.calcLeafGeamesystems(this.gamesystem); this.displayedColumns = leafGamesystems.map(leafGamesystem => new DisplayedColumnName(leafGamesystem.componentName, leafGamesystem.componentName + "-start")); this.displayedColumns = this.displayedColumns.concat( leafGamesystems.map(leafGamesystem => new DisplayedColumnName(leafGamesystem.componentName, leafGamesystem.componentName + "-end"))); + this.renameDuplicateColumnNames(this.displayedColumns) + this.numberLeafSystems = leafGamesystems.length; this.columns = this.displayedColumns.map(column => column.internalName) @@ -72,6 +74,20 @@ export class ProductTransitionEditorComponent implements OnInit{ } } + private renameDuplicateColumnNames(columnNames: DisplayedColumnName[]) { + for(let i=0; i