diff --git a/src/main/java/de/hitec/nhplus/main/MainWindowController.java b/src/main/java/de/hitec/nhplus/main/MainWindowController.java index 9642299..728a254 100644 --- a/src/main/java/de/hitec/nhplus/main/MainWindowController.java +++ b/src/main/java/de/hitec/nhplus/main/MainWindowController.java @@ -33,14 +33,14 @@ public class MainWindowController { @FXML private Tab treatmentTab; @FXML + private TabPane treatmentTabPane; + @FXML private Tab activeTreatmentTab; @FXML private AnchorPane lockedTreatmentPage; @FXML private Tab lockedTreatmentTab; @FXML - private TabPane treatmentPane; - @FXML private Tab nurseTab; @FXML private TabPane nurseTabPane; @@ -66,15 +66,21 @@ public class MainWindowController { mainTabPane.getSelectionModel().select(patientTab); patientTab.setOnSelectionChanged(event -> loadPatientPage()); - treatmentTab.setOnSelectionChanged(event -> loadTreatmentsPage()); - nurseTab.setOnSelectionChanged(event -> loadNursePage()); medicationTab.setOnSelectionChanged(event -> loadMedicationPage()); + nurseTab.setOnSelectionChanged(event -> loadNursePage()); nurseTabPane.getSelectionModel().select(activeNurseTab); activeNurseTab.setOnSelectionChanged(event -> loadActiveNursePage()); lockedNurseTab.setOnSelectionChanged(event -> loadLockedNursePage()); + + treatmentTab.setOnSelectionChanged(event -> loadTreatmentPage()); + treatmentTabPane.getSelectionModel().select(activeTreatmentTab); + + activeTreatmentTab.setOnSelectionChanged(event -> loadActiveTreatmentPage()); + lockedTreatmentTab.setOnSelectionChanged(event -> loadLockedTreatmentPage()); + } /** @@ -98,12 +104,38 @@ public class MainWindowController { /** * Loads the {@link } page into its tab. */ - private void loadTreatmentsPage() { + private void loadTreatmentPage() { + SelectionModel selectionModel = treatmentTabPane.getSelectionModel(); + Tab selectedTab = selectionModel.getSelectedItem(); + if (selectedTab == activeTreatmentTab) { + loadActiveTreatmentPage(); + } + if (selectedTab == lockedTreatmentTab) { + loadLockedTreatmentPage(); + } + } + + private void loadActiveTreatmentPage() { try { - BorderPane treatmentsPane = FXMLLoader.load( + BorderPane activeTreatmentPane = FXMLLoader.load( Objects.requireNonNull(Main.class.getResource("/de/hitec/nhplus/treatment/AllTreatmentView.fxml")) ); - activeTreatmentPage.getChildren().setAll(treatmentsPane); + activeTreatmentPage.getChildren().setAll(activeTreatmentPane); + AnchorPane.setTopAnchor(activeTreatmentPane, 0d); + AnchorPane.setBottomAnchor(activeTreatmentPane, 0d); + AnchorPane.setLeftAnchor(activeTreatmentPane, 0d); + AnchorPane.setRightAnchor(activeTreatmentPane, 0d); + } catch (IOException exception) { + exception.printStackTrace(); + } + } + + private void loadLockedTreatmentPage() { + try { + BorderPane treatmentsPane = FXMLLoader.load( + Objects.requireNonNull(Main.class.getResource("/de/hitec/nhplus/treatment/LockedTreatmentView.fxml")) + ); + lockedTreatmentPage.getChildren().setAll(treatmentsPane); AnchorPane.setTopAnchor(treatmentsPane, 0d); AnchorPane.setBottomAnchor(treatmentsPane, 0d); AnchorPane.setLeftAnchor(treatmentsPane, 0d); @@ -115,15 +147,14 @@ public class MainWindowController { /** * Loads the nurse page into its tab. - * */ private void loadNursePage() { SelectionModel selectionModel = nurseTabPane.getSelectionModel(); Tab selectedTab = selectionModel.getSelectedItem(); - if(selectedTab == activeNurseTab){ + if (selectedTab == activeNurseTab) { loadActiveNursePage(); } - if(selectedTab == lockedNurseTab){ + if (selectedTab == lockedNurseTab) { loadLockedNursePage(); } } diff --git a/src/main/java/de/hitec/nhplus/treatment/LockedTreatmentController.java b/src/main/java/de/hitec/nhplus/treatment/LockedTreatmentController.java index 3ed77bf..1cf0526 100644 --- a/src/main/java/de/hitec/nhplus/treatment/LockedTreatmentController.java +++ b/src/main/java/de/hitec/nhplus/treatment/LockedTreatmentController.java @@ -17,6 +17,7 @@ import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import java.sql.SQLException; +import java.time.LocalDate; /** * Controller for all locked treatments. @@ -69,8 +70,15 @@ public class LockedTreatmentController { } } + @FXML + private void unlockTreatment() + { + + } + } + /* Button zum entsperren Column fürs Datum, wann es gesperrt wird, ID(zum später löschen) diff --git a/src/main/resources/de/hitec/nhplus/main/MainWindowView.fxml b/src/main/resources/de/hitec/nhplus/main/MainWindowView.fxml index 81db422..fdb8bef 100644 --- a/src/main/resources/de/hitec/nhplus/main/MainWindowView.fxml +++ b/src/main/resources/de/hitec/nhplus/main/MainWindowView.fxml @@ -13,7 +13,7 @@ - + diff --git a/src/main/resources/de/hitec/nhplus/treatment/LockedTreatmentView.fxml b/src/main/resources/de/hitec/nhplus/treatment/LockedTreatmentView.fxml index 213b602..4505be7 100644 --- a/src/main/resources/de/hitec/nhplus/treatment/LockedTreatmentView.fxml +++ b/src/main/resources/de/hitec/nhplus/treatment/LockedTreatmentView.fxml @@ -4,15 +4,56 @@ - +
- + - + + + +
+ + + + + +
+ + + + + +
+ + + 8.0 +