From 765d0c8dd224a14a5fe628bc382597d4e56e0490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20S=C3=A4ume?= Date: Mon, 29 Apr 2024 00:20:53 +0200 Subject: [PATCH] NOTICKET: Cleanup Views to look Better & Be easier to work with MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dominik Säume --- src/main/java/de/hitec/nhplus/Main.java | 5 +- .../nhplus/main/MainWindowController.java | 45 +++-- .../resources/de/hitec/nhplus/Application.css | 5 - .../de/hitec/nhplus/MainWindowView.fxml | 56 ++---- .../hitec/nhplus/patient/AllPatientView.fxml | 189 +++++++++++------- .../nhplus/treatment/AllTreatmentView.fxml | 145 ++++++++------ 6 files changed, 252 insertions(+), 193 deletions(-) diff --git a/src/main/java/de/hitec/nhplus/Main.java b/src/main/java/de/hitec/nhplus/Main.java index 9a7eac5..54ef1bc 100644 --- a/src/main/java/de/hitec/nhplus/Main.java +++ b/src/main/java/de/hitec/nhplus/Main.java @@ -6,6 +6,7 @@ import javafx.application.Application; import javafx.application.Platform; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; +import javafx.scene.control.TabPane; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; @@ -23,12 +24,12 @@ public class Main extends Application { public void mainWindow() { try { FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/MainWindowView.fxml")); - BorderPane pane = loader.load(); + TabPane pane = loader.load(); Scene scene = new Scene(pane); this.primaryStage.setTitle("NHPlus"); this.primaryStage.setScene(scene); - this.primaryStage.setResizable(false); + this.primaryStage.setResizable(true); this.primaryStage.show(); this.primaryStage.setOnCloseRequest(event -> { diff --git a/src/main/java/de/hitec/nhplus/main/MainWindowController.java b/src/main/java/de/hitec/nhplus/main/MainWindowController.java index 6205eca..d76ea67 100644 --- a/src/main/java/de/hitec/nhplus/main/MainWindowController.java +++ b/src/main/java/de/hitec/nhplus/main/MainWindowController.java @@ -1,37 +1,58 @@ package de.hitec.nhplus.main; import de.hitec.nhplus.Main; -import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; +import javafx.scene.control.Tab; +import javafx.scene.layout.AnchorPane; import javafx.scene.layout.BorderPane; import java.io.IOException; public class MainWindowController { - @FXML - private BorderPane mainBorderPane; + private AnchorPane patientPage; + @FXML + private Tab patientTab; + @FXML + private AnchorPane treatmentPage; + @FXML + private Tab treatmentTab; + @FXML public void initialize() { - handleShowAllPatient(null); + loadPatientPage(); + loadTreatmentsPage(); + + patientTab.setOnSelectionChanged(event -> loadPatientPage()); + treatmentTab.setOnSelectionChanged(event -> loadTreatmentsPage()); } - @FXML - private void handleShowAllPatient(ActionEvent event) { - FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/patient/AllPatientView.fxml")); + private void loadPatientPage() { try { - mainBorderPane.setCenter(loader.load()); + BorderPane patientsPane = FXMLLoader.load( + Main.class.getResource("/de/hitec/nhplus/patient/AllPatientView.fxml") + ); + patientPage.getChildren().setAll(patientsPane); + AnchorPane.setTopAnchor(patientsPane, 0d); + AnchorPane.setBottomAnchor(patientsPane, 0d); + AnchorPane.setLeftAnchor(patientsPane, 0d); + AnchorPane.setRightAnchor(patientsPane, 0d); } catch (IOException exception) { exception.printStackTrace(); } } - @FXML - private void handleShowAllTreatments(ActionEvent event) { - FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/treatment/AllTreatmentView.fxml")); + private void loadTreatmentsPage() { try { - mainBorderPane.setCenter(loader.load()); + BorderPane treatmentsPane = FXMLLoader.load( + Main.class.getResource("/de/hitec/nhplus/treatment/AllTreatmentView.fxml") + ); + treatmentPage.getChildren().setAll(treatmentsPane); + AnchorPane.setTopAnchor(treatmentsPane, 0d); + AnchorPane.setBottomAnchor(treatmentsPane, 0d); + AnchorPane.setLeftAnchor(treatmentsPane, 0d); + AnchorPane.setRightAnchor(treatmentsPane, 0d); } catch (IOException exception) { exception.printStackTrace(); } diff --git a/src/main/resources/de/hitec/nhplus/Application.css b/src/main/resources/de/hitec/nhplus/Application.css index feaa0ee..b7e3076 100644 --- a/src/main/resources/de/hitec/nhplus/Application.css +++ b/src/main/resources/de/hitec/nhplus/Application.css @@ -1,6 +1 @@ /* https://materialui.co/colors */ -.tabs{ - -fx-background-color: #1565C0; - -fx-padding: 4px; - -fx-spacing: 4px; -} diff --git a/src/main/resources/de/hitec/nhplus/MainWindowView.fxml b/src/main/resources/de/hitec/nhplus/MainWindowView.fxml index 861efcc..00eab26 100644 --- a/src/main/resources/de/hitec/nhplus/MainWindowView.fxml +++ b/src/main/resources/de/hitec/nhplus/MainWindowView.fxml @@ -1,44 +1,18 @@ - - - - - + + + - - - - - - - - - + fx:controller="de.hitec.nhplus.main.MainWindowController" +> + + + + + + + diff --git a/src/main/resources/de/hitec/nhplus/patient/AllPatientView.fxml b/src/main/resources/de/hitec/nhplus/patient/AllPatientView.fxml index a7908fa..e1a2e5a 100644 --- a/src/main/resources/de/hitec/nhplus/patient/AllPatientView.fxml +++ b/src/main/resources/de/hitec/nhplus/patient/AllPatientView.fxml @@ -3,44 +3,72 @@ - - - + fx:controller="de.hitec.nhplus.patient.AllPatientController" +> + + + +
+ editable="true" + > - - - - - - + + + + + + - - - +
+ + + + + +
+ + + + @@ -50,48 +78,65 @@ - - - - - - - - - - - - - + + + + + - - -
+ + +