#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
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<Tab> 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,7 +147,6 @@ public class MainWindowController {
/**
* Loads the nurse page into its tab.
*
*/
private void loadNursePage() {
SelectionModel<Tab> selectionModel = nurseTabPane.getSelectionModel();

View file

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

View file

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

View file

@ -4,15 +4,56 @@
<?import javafx.scene.control.*?>
<?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>
<Insets bottom="8" left="8" right="8" top="8" />
</padding>
<center>
<TableView fx:id="tableView" layoutX="31.0" layoutY="40">
<TableView
fx:id="tableView"
layoutX="31.0"
layoutY="40">
<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>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/>
</columnResizePolicy>
</TableView>
</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>