From 48a221848ae94d710dc35f0c7cbe2766306123d5 Mon Sep 17 00:00:00 2001 From: Dorian Nemec Date: Tue, 21 May 2024 08:24:27 +0200 Subject: [PATCH] #24 Fixed UI not being correctly updated --- db/nursingHome.db | Bin 28672 -> 28672 bytes .../nhplus/main/MainWindowController.java | 18 ++++++++++++++++-- .../medication/AllMedicationController.java | 5 +++-- .../DeprecatedMedicationController.java | 3 ++- .../treatment/AllTreatmentController.java | 3 ++- .../de/hitec/nhplus/main/MainWindowView.fxml | 2 +- 6 files changed, 24 insertions(+), 7 deletions(-) diff --git a/db/nursingHome.db b/db/nursingHome.db index 3bff57f726f8dd562b34d439ff1a3f3262111f5c..ccbada552254d42fbc0d69be87ef43280cc1778e 100644 GIT binary patch delta 492 zcmZXQF;5#o5QQ1WwtP0+g5qG1i9kXq1#*E>BubZDpu)kD0S6KT8++|rd2iR+TU(e0 z+H|06C=rT~C=-hO076GcMS;X`NSP|@U?~bTBR$QVH{Z65Dj{WV!WrQj8m=JSqVGkHuLwGh=pi*+9L}t|n zSoQzK*_G&cYrImj{~GkDsM=q&d=<8QYEp~nZ7ykegCvUZJz~v+-=X<{A^F4=`aCiwv6{xn(G&-<3=@b)+S&Ak5*qh&wE?%nDVy<$&=&;7JF8Lx`~ngc^oi z%3fQ#0Hv&3NnKqjj=0~XLMFFe?pCCeR>bUR24Tucl@eCVa@wUy)kPwdZW$qiha&1W z+<%H5`oUGh9HL)Y(;d;!YBYs@E#xy&{vntE^cPpT-O(l%YT%)_BdLvOoNjFr$o5~T bCGh*N)qPjJ&9z*J*=uv loadActiveNursePage()); lockedNurseTab.setOnSelectionChanged(event -> loadLockedNursePage()); - medicationTab.setOnSelectionChanged(event -> loadMedicationPage()); + availableMedicationTab.setOnSelectionChanged(event -> loadAvailableMedicationPage()); deprecatedMedicationTab.setOnSelectionChanged(event -> loadDeprecatedMedicationPage()); nurseTabPane.getSelectionModel().select(activeNurseTab); @@ -164,10 +166,22 @@ public class MainWindowController { } } + private void loadMedicationPage() + { + SelectionModel selectionModel = medicationTabPane.getSelectionModel(); + Tab selectedTab = selectionModel.getSelectedItem(); + if(selectedTab == availableMedicationTab){ + loadAvailableMedicationPage(); + } + if(selectedTab == deprecatedMedicationTab){ + loadDeprecatedMedicationPage(); + } + } + /** * Loads the medication page into its tab. */ - private void loadMedicationPage() { + private void loadAvailableMedicationPage() { try { BorderPane medicationPane = FXMLLoader.load( Objects.requireNonNull(Main.class.getResource("/de/hitec/nhplus/medication/AllMedicationView.fxml")) diff --git a/src/main/java/de/hitec/nhplus/medication/AllMedicationController.java b/src/main/java/de/hitec/nhplus/medication/AllMedicationController.java index f85fa77..5e57089 100644 --- a/src/main/java/de/hitec/nhplus/medication/AllMedicationController.java +++ b/src/main/java/de/hitec/nhplus/medication/AllMedicationController.java @@ -60,7 +60,7 @@ public class AllMedicationController { */ @FXML public void initialize() { - readAllAndShowInTableView(); + this.readAllAndShowInTableView(); this.columnId.setCellValueFactory(new PropertyValueFactory<>("id")); this.columnName.setCellValueFactory(new PropertyValueFactory<>("name")); @@ -85,6 +85,7 @@ public class AllMedicationController { this.columnCurrentStock.setCellValueFactory(new PropertyValueFactory<>("currentStock")); this.tableView.setItems(this.medications); + } /** @@ -136,7 +137,7 @@ public class AllMedicationController { } catch (SQLException exception) { exception.printStackTrace(); } - readAllAndShowInTableView(); + this.readAllAndShowInTableView(); } /** diff --git a/src/main/java/de/hitec/nhplus/medication/DeprecatedMedicationController.java b/src/main/java/de/hitec/nhplus/medication/DeprecatedMedicationController.java index 2c11d02..8d36f59 100644 --- a/src/main/java/de/hitec/nhplus/medication/DeprecatedMedicationController.java +++ b/src/main/java/de/hitec/nhplus/medication/DeprecatedMedicationController.java @@ -64,6 +64,7 @@ public class DeprecatedMedicationController { this.columnCurrentStock.setCellValueFactory(new PropertyValueFactory<>("currentStock")); this.tableView.setItems(this.medications); + } /** @@ -91,7 +92,7 @@ public class DeprecatedMedicationController { } catch (SQLException exception) { exception.printStackTrace(); } - readAllAndShowInTableView(); + this.readAllAndShowInTableView(); } } diff --git a/src/main/java/de/hitec/nhplus/treatment/AllTreatmentController.java b/src/main/java/de/hitec/nhplus/treatment/AllTreatmentController.java index 3384c3f..04018bc 100644 --- a/src/main/java/de/hitec/nhplus/treatment/AllTreatmentController.java +++ b/src/main/java/de/hitec/nhplus/treatment/AllTreatmentController.java @@ -75,7 +75,7 @@ public class AllTreatmentController { */ @FXML public void initialize() { - readAllAndShowInTableView(); + comboBoxPatientSelection.setItems(patientSelection); comboBoxPatientSelection.getSelectionModel().select("alle"); @@ -109,6 +109,7 @@ public class AllTreatmentController { ); this.createComboBoxData(); + readAllAndShowInTableView(); } /** diff --git a/src/main/resources/de/hitec/nhplus/main/MainWindowView.fxml b/src/main/resources/de/hitec/nhplus/main/MainWindowView.fxml index d4db00c..c22810a 100644 --- a/src/main/resources/de/hitec/nhplus/main/MainWindowView.fxml +++ b/src/main/resources/de/hitec/nhplus/main/MainWindowView.fxml @@ -27,7 +27,7 @@ - +