NOTICKET: Cleanup Views to look Better & Be easier to work with
All checks were successful
Quality Check / Qualty Check (push) Successful in 12s
Quality Check / Qualty Check (pull_request) Successful in 12s

Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
This commit is contained in:
Dominik Säume 2024-04-29 00:20:53 +02:00
parent 8cb52b4162
commit 765d0c8dd2
Signed by: SZUT-Dominik
GPG key ID: 67D15BB250B41E7C
6 changed files with 252 additions and 193 deletions

View file

@ -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 -> {

View file

@ -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();
}

View file

@ -1,6 +1 @@
/* https://materialui.co/colors */
.tabs{
-fx-background-color: #1565C0;
-fx-padding: 4px;
-fx-spacing: 4px;
}

View file

@ -1,44 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<BorderPane
fx:id="mainBorderPane"
maxHeight="-Infinity"
maxWidth="-Infinity"
minHeight="-Infinity"
minWidth="-Infinity"
prefHeight="688.0"
prefWidth="926.0"
xmlns="http://javafx.com/javafx/10.0.2-internal"
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.layout.AnchorPane?>
<TabPane
tabClosingPolicy="UNAVAILABLE"
xmlns="http://javafx.com/javafx/17.0.2-ea"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="de.hitec.nhplus.main.MainWindowController">
<top>
<HBox id="tabs" alignment="CENTER_LEFT" styleClass="tabs" stylesheets="@Application.css">
<children>
<Button
alignment="CENTER"
contentDisplay="CENTER"
mnemonicParsing="false"
onAction="#handleShowAllPatient"
prefWidth="105.0"
text="Patienten"
>
<opaqueInsets>
<Insets/>
</opaqueInsets>
</Button>
<Button
alignment="CENTER"
contentDisplay="CENTER"
mnemonicParsing="false"
onAction="#handleShowAllTreatments"
prefWidth="105.0"
text="Behandlungen"
></Button>
</children>
</HBox>
</top>
</BorderPane>
fx:controller="de.hitec.nhplus.main.MainWindowController"
>
<Tab fx:id="patientTab" text="Patienten">
<AnchorPane fx:id="patientPage"/>
</Tab>
<Tab fx:id="treatmentTab" text="Behandlungen">
<AnchorPane fx:id="treatmentPage"/>
</Tab>
</TabPane>

View file

@ -3,44 +3,72 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.Font?>
<AnchorPane
prefHeight="500.0"
prefWidth="855.0"
<BorderPane
xmlns="http://javafx.com/javafx/11.0.1"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="de.hitec.nhplus.patient.AllPatientController">
<children>
fx:controller="de.hitec.nhplus.patient.AllPatientController"
>
<padding>
<Insets top="8" left="8" bottom="8" right="8"/>
</padding>
<center>
<TableView
fx:id="tableView"
editable="true" layoutX="31.0"
layoutY="120.0" prefHeight="287.0"
prefWidth="825.0"
AnchorPane.bottomAnchor="100.0"
AnchorPane.leftAnchor="15.0"
AnchorPane.rightAnchor="15.0"
AnchorPane.topAnchor="80.0">
editable="true"
>
<columns>
<TableColumn fx:id="columnId" maxWidth="-1.0" minWidth="40.0" prefWidth="5.0" text="ID"/>
<TableColumn fx:id="columnSurname" maxWidth="-1.0" minWidth="140.0" onEditCommit="#handleOnEditSurname"
prefWidth="100.0" text="Nachname"/>
<TableColumn fx:id="columnFirstName" maxWidth="-1.00" minWidth="140.0"
onEditCommit="#handleOnEditFirstname" prefWidth="75.0" text="Vorname"/>
<TableColumn fx:id="columnDateOfBirth" maxWidth="-1.0" minWidth="140.0"
onEditCommit="#handleOnEditDateOfBirth" prefWidth="75.0" text="Geburtstag"/>
<TableColumn fx:id="columnCareLevel" maxWidth="-1.0" minWidth="140.0"
onEditCommit="#handleOnEditCareLevel" prefWidth="75.0" text="Pflegegrad"/>
<TableColumn fx:id="columnRoomNumber" maxWidth="-1.0" minWidth="140.0"
onEditCommit="#handleOnEditRoomNumber" prefWidth="75.0" text="Raum"/>
<TableColumn
fx:id="columnId"
minWidth="40.0"
text="ID"
/>
<TableColumn
fx:id="columnSurname"
minWidth="140.0"
onEditCommit="#handleOnEditSurname"
text="Nachname"
/>
<TableColumn
fx:id="columnFirstName"
minWidth="140.0"
onEditCommit="#handleOnEditFirstname"
text="Vorname"
/>
<TableColumn
fx:id="columnDateOfBirth"
minWidth="140.0"
onEditCommit="#handleOnEditDateOfBirth"
text="Geburtstag"
/>
<TableColumn
fx:id="columnCareLevel"
minWidth="140.0"
onEditCommit="#handleOnEditCareLevel"
prefWidth="75.0"
text="Pflegegrad"
/>
<TableColumn
fx:id="columnRoomNumber"
minWidth="140.0"
onEditCommit="#handleOnEditRoomNumber"
text="Raum"
/>
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/>
</columnResizePolicy>
</TableView>
<HBox layoutX="623.0" layoutY="419.3999938964844" spacing="10.0" AnchorPane.bottomAnchor="15.0"
AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0">
<children>
<GridPane hgap="10.0" vgap="10.0">
</center>
<bottom>
<BorderPane>
<BorderPane.margin>
<Insets top="8.0"/>
</BorderPane.margin>
<center>
<GridPane hgap="8.0" vgap="8.0">
<padding>
<Insets right="48.0"/>
</padding>
<columnConstraints>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" prefWidth="200.0"/>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="200.0" prefWidth="200.0"/>
@ -50,48 +78,65 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<TextField fx:id="textFieldFirstName" minWidth="200.0" prefHeight="26.0" prefWidth="200.0"
promptText="Vorname"/>
<TextField fx:id="textFieldSurname" minWidth="200.0" prefHeight="26.0" prefWidth="200.0"
promptText="Nachname" GridPane.columnIndex="1"/>
<TextField fx:id="textFieldDateOfBirth" minWidth="160.0" prefWidth="160.0"
promptText="Geburtstag" GridPane.columnIndex="2"/>
<TextField fx:id="textFieldCareLevel" prefHeight="26.0" prefWidth="200.0"
promptText="Pflegegrad" GridPane.rowIndex="1"/>
<TextField fx:id="textFieldRoomNumber" prefHeight="26.0" prefWidth="200.0" promptText="Raum"
GridPane.columnIndex="1" GridPane.rowIndex="1"/>
</children>
<padding>
<Insets right="10.0"/>
</padding>
<HBox.margin>
<Insets/>
</HBox.margin>
<TextField
fx:id="textFieldFirstName"
minWidth="200.0"
prefHeight="26.0"
prefWidth="200.0"
promptText="Vorname"
/>
<TextField
fx:id="textFieldSurname"
minWidth="200.0"
prefHeight="26.0"
prefWidth="200.0"
promptText="Nachname"
GridPane.columnIndex="1"
/>
<TextField
fx:id="textFieldDateOfBirth"
minWidth="160.0"
prefWidth="160.0"
promptText="Geburtstag"
GridPane.columnIndex="2"
/>
<TextField
fx:id="textFieldCareLevel"
prefHeight="26.0"
prefWidth="200.0"
promptText="Pflegegrad"
GridPane.rowIndex="1"
/>
<TextField
fx:id="textFieldRoomNumber"
prefHeight="26.0"
prefWidth="200.0"
promptText="Raum"
GridPane.columnIndex="1"
GridPane.rowIndex="1"
/>
</GridPane>
<HBox alignment="TOP_CENTER" prefWidth="190.0" spacing="10.0">
<children>
<Button fx:id="buttonAdd" mnemonicParsing="false" onAction="#handleAdd" prefWidth="90.0"
text="Hinzufügen"/>
<Button fx:id="buttonDelete" mnemonicParsing="false" onAction="#handleDelete" prefWidth="90.0"
text="Löschen"/>
</children>
</HBox>
</children>
</HBox>
<HBox alignment="TOP_CENTER" layoutX="10.0" layoutY="10.0" prefWidth="200.0" spacing="25.0"
AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="5.0">
<children>
<Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Patienten"
textAlignment="CENTER">
<font>
<Font size="36.0"/>
</font>
</Label>
</children>
</HBox>
</children>
<padding>
<Insets top="10.0"/>
</padding>
</AnchorPane>
</center>
<right>
<VBox spacing="8.0">
<Button
fx:id="buttonAdd"
mnemonicParsing="false"
onAction="#handleAdd"
prefWidth="90.0"
text="Hinzufügen"
/>
<Button
fx:id="buttonDelete"
mnemonicParsing="false"
onAction="#handleDelete"
prefWidth="90.0"
text="Löschen"
/>
</VBox>
</right>
</BorderPane>
</bottom>
</BorderPane>

View file

@ -3,70 +3,93 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.Font?>
<AnchorPane prefHeight="500.0" prefWidth="855.0" xmlns="http://javafx.com/javafx/11.0.1"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.treatment.AllTreatmentController">
<children>
<TableView fx:id="tableView" editable="true" layoutX="31.0" layoutY="35.0" onMouseClicked="#handleMouseClick"
prefHeight="364.0" prefWidth="825.0" AnchorPane.bottomAnchor="75.0" AnchorPane.leftAnchor="15.0"
AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="80.0">
<BorderPane
xmlns="http://javafx.com/javafx/11.0.1"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="de.hitec.nhplus.treatment.AllTreatmentController"
>
<padding>
<Insets top="8" left="8" bottom="8" right="8"/>
</padding>
<center>
<TableView
fx:id="tableView"
editable="true"
onMouseClicked="#handleMouseClick"
>
<columns>
<TableColumn fx:id="columnId" maxWidth="-1.0" minWidth="40.0" prefWidth="50.0" text="ID"/>
<TableColumn fx:id="columnPatientId" maxWidth="-1.0" minWidth="40.0" prefWidth="120.0"
text="PatientID"/>
<TableColumn fx:id="columnDate" maxWidth="-1.0" minWidth="140.0" prefWidth="150.0" text="Datum"/>
<TableColumn fx:id="columnBegin" maxWidth="-1.0" minWidth="140.0" prefWidth="150.0" text="Beginn"/>
<TableColumn fx:id="columnEnd" maxWidth="-1.0" minWidth="140.0" prefWidth="150.0" text="Ende"/>
<TableColumn fx:id="columnDescription" maxWidth="-1.0" minWidth="200.0" prefWidth="300.0"
text="Kurzbeschreibung"/>
<TableColumn
fx:id="columnId"
minWidth="40.0"
text="ID"
/>
<TableColumn
fx:id="columnPatientId"
minWidth="40.0"
text="PatientID"
/>
<TableColumn
fx:id="columnDate"
maxWidth="-1.0"
minWidth="140.0"
prefWidth="150.0"
text="Datum"
/>
<TableColumn
fx:id="columnBegin"
minWidth="140.0"
text="Beginn"
/>
<TableColumn
fx:id="columnEnd"
minWidth="140.0"
text="Ende"
/>
<TableColumn
fx:id="columnDescription"
minWidth="200.0"
text="Kurzbeschreibung"
/>
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/>
</columnResizePolicy>
</TableView>
<HBox layoutX="623.0" layoutY="419.3999938964844" spacing="10.0" AnchorPane.bottomAnchor="15.0"
AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0">
<children>
<GridPane hgap="10.0" vgap="10.0">
<columnConstraints>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" prefWidth="200.0"/>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="200.0" prefWidth="200.0"/>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="10.0" prefWidth="160.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<Button fx:id="buttonNewTreament" mnemonicParsing="false" onAction="#handleNewTreatment"
prefWidth="200.0" text="neue Behandlung anlegen" GridPane.columnIndex="1"/>
<ComboBox fx:id="comboBoxPatientSelection" minWidth="160.0" onAction="#handleComboBox"
prefWidth="200.0"/>
<Button fx:id="buttonDelete" mnemonicParsing="false" onAction="#handleDelete" prefWidth="200.0"
text="Löschen" GridPane.columnIndex="2"/>
</children>
<padding>
<Insets right="10.0"/>
</padding>
<HBox.margin>
<Insets/>
</HBox.margin>
</GridPane>
<HBox prefWidth="190.0" spacing="10.0"/>
</children>
</HBox>
<HBox alignment="TOP_CENTER" layoutX="10.0" layoutY="10.0" prefWidth="200.0" spacing="25.0"
AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="5.0">
<children>
<Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Behandlungen"
textAlignment="CENTER">
<font>
<Font size="36.0"/>
</font>
</Label>
</children>
</HBox>
</children>
<padding>
<Insets top="10.0"/>
</padding>
</AnchorPane>
</center>
<bottom>
<BorderPane>
<BorderPane.margin>
<Insets top="8.0"/>
</BorderPane.margin>
<center>
<HBox spacing="8.0">
<Button
fx:id="buttonNewTreament"
mnemonicParsing="false"
onAction="#handleNewTreatment"
prefWidth="200.0"
text="neue Behandlung anlegen"
GridPane.columnIndex="1"
/>
<ComboBox
fx:id="comboBoxPatientSelection"
minWidth="160.0"
onAction="#handleComboBox"
prefWidth="200.0"/>
</HBox>
</center>
<right>
<Button
fx:id="buttonDelete"
mnemonicParsing="false"
onAction="#handleDelete"
prefWidth="200.0"
text="Löschen"
GridPane.columnIndex="2"
/>
</right>
</BorderPane>
</bottom>
</BorderPane>