diff --git a/src/com/app/MainApp.kt b/src/com/app/MainApp.kt index faeb4a3..f5ad868 100644 --- a/src/com/app/MainApp.kt +++ b/src/com/app/MainApp.kt @@ -88,8 +88,18 @@ class MainApp : Application() { try { val loader = FXMLLoader() loader.location = MainApp.javaClass.getResource("/com/app/view/WorkersOverview.fxml") - rootLayout.center = loader.load() as AnchorPane - loader.getController().mainApp = this + val pane = loader.load() as AnchorPane + val workerDetailsLoader = FXMLLoader() + workerDetailsLoader.location = MainApp.javaClass.getResource("/com/app/view/WorkerEditDialog.fxml") + val overViewPane = workerDetailsLoader.load() as AnchorPane + (pane.children[0] as SplitPane).items[1] = overViewPane + rootLayout.center = pane + val workerDetailsController = workerDetailsLoader.getController() + workerDetailsController.edited = false + val controller = loader.getController() + controller.mainApp = this + controller.workerDetailsController = workerDetailsController + workerDetailsController.workerOverviewController = controller } catch (e: Exception) { e.printStackTrace() } @@ -110,13 +120,14 @@ class MainApp : Application() { dialogStage.initOwner(primaryStage) dialogStage.scene = Scene(loader.load()) val controller = loader.getController() + controller.edited = true controller.dialogStage = dialogStage dialogStage.showAndWait() return controller.createWorker() } /** - * Открытие диалога реедактирования работника + * Открытие диалога редактирования работника * @return AbstractWorker * @see AbstractWorker */ @@ -129,6 +140,7 @@ class MainApp : Application() { dialogStage.initOwner(primaryStage) dialogStage.scene = Scene(loader.load()) val controller = loader.getController() + controller.edited = true controller.worker = worker controller.dialogStage = dialogStage dialogStage.showAndWait() diff --git a/src/com/app/view/WorkerEditDialog.fxml b/src/com/app/view/WorkerEditDialog.fxml index f699087..2e240ce 100644 --- a/src/com/app/view/WorkerEditDialog.fxml +++ b/src/com/app/view/WorkerEditDialog.fxml @@ -1,13 +1,8 @@ - - - - - - - - + + +