Refaktoring #21

Merged
SZUT-Dominik merged 12 commits from refactor into main 2024-04-30 12:21:17 +00:00
5 changed files with 35 additions and 10 deletions
Showing only changes of commit 271387e88e - Show all commits

Binary file not shown.

View file

@ -22,7 +22,7 @@ public class Main extends Application {
public void mainWindow() { public void mainWindow() {
try { try {
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/MainWindowView.fxml")); FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/main/MainWindowView.fxml"));
TabPane pane = loader.load(); TabPane pane = loader.load();
Scene scene = new Scene(pane); Scene scene = new Scene(pane);

View file

@ -4,12 +4,15 @@ import de.hitec.nhplus.Main;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.control.Tab; import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane; import javafx.scene.layout.BorderPane;
import java.io.IOException; import java.io.IOException;
public class MainWindowController { public class MainWindowController {
@FXML
private TabPane mainTabPane;
@FXML @FXML
private AnchorPane patientPage; private AnchorPane patientPage;
@FXML @FXML
@ -18,14 +21,20 @@ public class MainWindowController {
private AnchorPane treatmentPage; private AnchorPane treatmentPage;
@FXML @FXML
private Tab treatmentTab; private Tab treatmentTab;
@FXML
private AnchorPane nursePage;
@FXML
private Tab nurseTab;
@FXML @FXML
public void initialize() { public void initialize() {
loadPatientPage(); loadPatientPage();
loadTreatmentsPage(); mainTabPane.getSelectionModel().select(patientTab);
patientTab.setOnSelectionChanged(event -> loadPatientPage()); patientTab.setOnSelectionChanged(event -> loadPatientPage());
treatmentTab.setOnSelectionChanged(event -> loadTreatmentsPage()); treatmentTab.setOnSelectionChanged(event -> loadTreatmentsPage());
nurseTab.setOnSelectionChanged(event -> loadNursePage());
} }
private void loadPatientPage() { private void loadPatientPage() {
@ -57,4 +66,19 @@ public class MainWindowController {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
private void loadNursePage() {
try {
BorderPane nursePane = FXMLLoader.load(
Main.class.getResource("/de/hitec/nhplus/nurse/AllNurseView.fxml")
);
nursePage.getChildren().setAll(nursePane);
AnchorPane.setTopAnchor(nursePane, 0d);
AnchorPane.setBottomAnchor(nursePane, 0d);
AnchorPane.setLeftAnchor(nursePane, 0d);
AnchorPane.setRightAnchor(nursePane, 0d);
} catch (IOException exception) {
exception.printStackTrace();
}
}
} }

View file

@ -4,6 +4,7 @@
<?import javafx.scene.control.TabPane?> <?import javafx.scene.control.TabPane?>
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.AnchorPane?>
<TabPane <TabPane
fx:id="mainTabPane"
tabClosingPolicy="UNAVAILABLE" tabClosingPolicy="UNAVAILABLE"
xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns="http://javafx.com/javafx/17.0.2-ea"
xmlns:fx="http://javafx.com/fxml/1" xmlns:fx="http://javafx.com/fxml/1"
@ -15,4 +16,7 @@
<Tab fx:id="treatmentTab" text="Behandlungen"> <Tab fx:id="treatmentTab" text="Behandlungen">
<AnchorPane fx:id="treatmentPage"/> <AnchorPane fx:id="treatmentPage"/>
</Tab> </Tab>
<Tab fx:id="nurseTab" text="Pfleger">
<AnchorPane fx:id="nursePage"/>
</Tab>
</TabPane> </TabPane>

View file

@ -4,11 +4,10 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<AnchorPane prefHeight="500.0" prefWidth="855.0" xmlns="http://javafx.com/javafx/10.0.2-internal" <BorderPane prefHeight="500.0" prefWidth="855.0" xmlns="http://javafx.com/javafx/10.0.2-internal"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.nurse.AllNurseController"> xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.nurse.AllNurseController">
<children> <children>
<TableView fx:id="tableView" editable="true" layoutX="31.0" layoutY="40.0" AnchorPane.bottomAnchor="70.0" <TableView fx:id="tableView" editable="true" layoutX="31.0" layoutY="40.0">
AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="80.0">
<columns> <columns>
<TableColumn fx:id="columnId" maxWidth="1200.0" minWidth="5.0" prefWidth="5.0" text="ID"/> <TableColumn fx:id="columnId" maxWidth="1200.0" minWidth="5.0" prefWidth="5.0" text="ID"/>
<TableColumn fx:id="columnSurname" maxWidth="7500.0" minWidth="20.0" prefWidth="100.0" text="Nachname"/> <TableColumn fx:id="columnSurname" maxWidth="7500.0" minWidth="20.0" prefWidth="100.0" text="Nachname"/>
@ -19,8 +18,7 @@
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/> <TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/>
</columnResizePolicy> </columnResizePolicy>
</TableView> </TableView>
<HBox layoutX="420.0" layoutY="450.0" spacing="10.0" AnchorPane.bottomAnchor="15.0" AnchorPane.leftAnchor="15.0" <HBox layoutX="420.0" layoutY="450.0" spacing="10.0">
AnchorPane.rightAnchor="15.0">
<children> <children>
<TextField fx:id="txfSurname" prefHeight="26.0" prefWidth="220.0" promptText="Nachname"/> <TextField fx:id="txfSurname" prefHeight="26.0" prefWidth="220.0" promptText="Nachname"/>
<TextField fx:id="txfFirstname" prefHeight="26.0" prefWidth="220.0" promptText="Vorname"/> <TextField fx:id="txfFirstname" prefHeight="26.0" prefWidth="220.0" promptText="Vorname"/>
@ -29,8 +27,7 @@
<Button fx:id="btnDelete" mnemonicParsing="false" prefWidth="90.0" text="Löschen"/> <Button fx:id="btnDelete" mnemonicParsing="false" prefWidth="90.0" text="Löschen"/>
</children> </children>
</HBox> </HBox>
<HBox alignment="TOP_CENTER" layoutX="10.0" layoutY="10.0" prefWidth="200.0" spacing="25.0" <HBox alignment="TOP_CENTER" layoutX="10.0" layoutY="10.0" prefWidth="200.0" spacing="25.0">
AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="5.0">
<children> <children>
<Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Pfleger/innen" <Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Pfleger/innen"
textAlignment="CENTER"> textAlignment="CENTER">
@ -44,4 +41,4 @@
<padding> <padding>
<Insets top="10.0"/> <Insets top="10.0"/>
</padding> </padding>
</AnchorPane> </BorderPane>