#7 Treatment structure for UI refactored
Some checks failed
Quality Check / Linting Check (push) Failing after 14s
Quality Check / Javadoc Check (push) Successful in 21s

This commit is contained in:
Dorian Nemec 2024-05-17 07:12:59 +02:00
parent 2b9734a764
commit 6fff093b0a
4 changed files with 94 additions and 14 deletions

View file

@ -33,14 +33,14 @@ public class MainWindowController {
@FXML @FXML
private Tab treatmentTab; private Tab treatmentTab;
@FXML @FXML
private TabPane treatmentTabPane;
@FXML
private Tab activeTreatmentTab; private Tab activeTreatmentTab;
@FXML @FXML
private AnchorPane lockedTreatmentPage; private AnchorPane lockedTreatmentPage;
@FXML @FXML
private Tab lockedTreatmentTab; private Tab lockedTreatmentTab;
@FXML @FXML
private TabPane treatmentPane;
@FXML
private Tab nurseTab; private Tab nurseTab;
@FXML @FXML
private TabPane nurseTabPane; private TabPane nurseTabPane;
@ -66,15 +66,21 @@ public class MainWindowController {
mainTabPane.getSelectionModel().select(patientTab); mainTabPane.getSelectionModel().select(patientTab);
patientTab.setOnSelectionChanged(event -> loadPatientPage()); patientTab.setOnSelectionChanged(event -> loadPatientPage());
treatmentTab.setOnSelectionChanged(event -> loadTreatmentsPage());
nurseTab.setOnSelectionChanged(event -> loadNursePage());
medicationTab.setOnSelectionChanged(event -> loadMedicationPage()); medicationTab.setOnSelectionChanged(event -> loadMedicationPage());
nurseTab.setOnSelectionChanged(event -> loadNursePage());
nurseTabPane.getSelectionModel().select(activeNurseTab); nurseTabPane.getSelectionModel().select(activeNurseTab);
activeNurseTab.setOnSelectionChanged(event -> loadActiveNursePage()); activeNurseTab.setOnSelectionChanged(event -> loadActiveNursePage());
lockedNurseTab.setOnSelectionChanged(event -> loadLockedNursePage()); 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. * Loads the {@link } page into its tab.
*/ */
private void loadTreatmentsPage() { private void loadTreatmentPage() {
SelectionModel<Tab> selectionModel = treatmentTabPane.getSelectionModel();
Tab selectedTab = selectionModel.getSelectedItem();
if (selectedTab == activeTreatmentTab) {
loadActiveTreatmentPage();
}
if (selectedTab == lockedTreatmentTab) {
loadLockedTreatmentPage();
}
}
private void loadActiveTreatmentPage() {
try { try {
BorderPane treatmentsPane = FXMLLoader.load( BorderPane activeTreatmentPane = FXMLLoader.load(
Objects.requireNonNull(Main.class.getResource("/de/hitec/nhplus/treatment/AllTreatmentView.fxml")) 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.setTopAnchor(treatmentsPane, 0d);
AnchorPane.setBottomAnchor(treatmentsPane, 0d); AnchorPane.setBottomAnchor(treatmentsPane, 0d);
AnchorPane.setLeftAnchor(treatmentsPane, 0d); AnchorPane.setLeftAnchor(treatmentsPane, 0d);
@ -115,7 +147,6 @@ public class MainWindowController {
/** /**
* Loads the nurse page into its tab. * Loads the nurse page into its tab.
*
*/ */
private void loadNursePage() { private void loadNursePage() {
SelectionModel<Tab> selectionModel = nurseTabPane.getSelectionModel(); SelectionModel<Tab> selectionModel = nurseTabPane.getSelectionModel();

View file

@ -17,6 +17,7 @@ import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import java.sql.SQLException; import java.sql.SQLException;
import java.time.LocalDate;
/** /**
* Controller for all locked treatments. * Controller for all locked treatments.
@ -69,8 +70,15 @@ public class LockedTreatmentController {
} }
} }
@FXML
private void unlockTreatment()
{
} }
}
/* /*
Button zum entsperren Button zum entsperren
Column fürs Datum, wann es gesperrt wird, ID(zum später löschen) Column fürs Datum, wann es gesperrt wird, ID(zum später löschen)

View file

@ -13,7 +13,7 @@
<AnchorPane fx:id="patientPage"/> <AnchorPane fx:id="patientPage"/>
</Tab> </Tab>
<Tab fx:id="treatmentTab" text="Behandlungen"> <Tab fx:id="treatmentTab" text="Behandlungen">
<TabPane fx:id="treatmentPane" tabClosingPolicy="UNAVAILABLE"> <TabPane fx:id="treatmentTabPane" tabClosingPolicy="UNAVAILABLE">
<Tab fx:id="activeTreatmentTab" text="Behandlungen"> <Tab fx:id="activeTreatmentTab" text="Behandlungen">
<AnchorPane fx:id="activeTreatmentPage"/> <AnchorPane fx:id="activeTreatmentPage"/>
</Tab> </Tab>

View file

@ -4,15 +4,56 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<BorderPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.treatment.LockedTreatmentController"> <BorderPane prefHeight="400.0"
prefWidth="600.0"
xmlns="http://javafx.com/javafx/17.0.2-ea"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="de.hitec.nhplus.treatment.LockedTreatmentController">
<padding> <padding>
<Insets bottom="8" left="8" right="8" top="8" /> <Insets bottom="8" left="8" right="8" top="8" />
</padding> </padding>
<center> <center>
<TableView fx:id="tableView" layoutX="31.0" layoutY="40"> <TableView
fx:id="tableView"
layoutX="31.0"
layoutY="40">
<columns> <columns>
<TableColumn fx:id="columnId" minWidth="40.0" prefWidth="102.0" text="ID" /> <TableColumn
fx:id="columnId"
minWidth="40.0"
prefWidth="102.0"
text="ID"
/>
</columns> </columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/>
</columnResizePolicy>
</TableView> </TableView>
</center> </center>
<bottom>
<BorderPane>
<BorderPane.margin>
<Insets top="8.0"/>
</BorderPane.margin>
<center>
<HBox spacing="8.0">
<padding>
<Insets right="8.0"/>
</padding>
</HBox>
</center>
<right>
<HBox>
<spacing>8.0</spacing>
<Button
fx:id="buttonUnlock"
mnemonicParsing="false"
onAction="#unlockTreatment"
prefWidth="90.0"
text="Entsperren"
/>
</HBox>
</right>
</BorderPane>
</bottom>
</BorderPane> </BorderPane>