#24 Fixed UI not being correctly updated
Some checks failed
Quality Check / Linting Check (push) Failing after 13s
Quality Check / Javadoc Check (push) Successful in 21s

This commit is contained in:
Dorian Nemec 2024-05-21 08:24:27 +02:00
parent 1a542a0d71
commit 48a221848a
6 changed files with 24 additions and 7 deletions

Binary file not shown.

View file

@ -49,6 +49,8 @@ public class MainWindowController {
@FXML @FXML
private Tab medicationTab; private Tab medicationTab;
@FXML @FXML
private Tab availableMedicationTab;
@FXML
private TabPane medicationTabPane; private TabPane medicationTabPane;
@FXML @FXML
private AnchorPane deprecatedMedicationPage; private AnchorPane deprecatedMedicationPage;
@ -71,7 +73,7 @@ public class MainWindowController {
activeNurseTab.setOnSelectionChanged(event -> loadActiveNursePage()); activeNurseTab.setOnSelectionChanged(event -> loadActiveNursePage());
lockedNurseTab.setOnSelectionChanged(event -> loadLockedNursePage()); lockedNurseTab.setOnSelectionChanged(event -> loadLockedNursePage());
medicationTab.setOnSelectionChanged(event -> loadMedicationPage()); availableMedicationTab.setOnSelectionChanged(event -> loadAvailableMedicationPage());
deprecatedMedicationTab.setOnSelectionChanged(event -> loadDeprecatedMedicationPage()); deprecatedMedicationTab.setOnSelectionChanged(event -> loadDeprecatedMedicationPage());
nurseTabPane.getSelectionModel().select(activeNurseTab); nurseTabPane.getSelectionModel().select(activeNurseTab);
@ -164,10 +166,22 @@ public class MainWindowController {
} }
} }
private void loadMedicationPage()
{
SelectionModel<Tab> selectionModel = medicationTabPane.getSelectionModel();
Tab selectedTab = selectionModel.getSelectedItem();
if(selectedTab == availableMedicationTab){
loadAvailableMedicationPage();
}
if(selectedTab == deprecatedMedicationTab){
loadDeprecatedMedicationPage();
}
}
/** /**
* Loads the medication page into its tab. * Loads the medication page into its tab.
*/ */
private void loadMedicationPage() { private void loadAvailableMedicationPage() {
try { try {
BorderPane medicationPane = FXMLLoader.load( BorderPane medicationPane = FXMLLoader.load(
Objects.requireNonNull(Main.class.getResource("/de/hitec/nhplus/medication/AllMedicationView.fxml")) Objects.requireNonNull(Main.class.getResource("/de/hitec/nhplus/medication/AllMedicationView.fxml"))

View file

@ -60,7 +60,7 @@ public class AllMedicationController {
*/ */
@FXML @FXML
public void initialize() { public void initialize() {
readAllAndShowInTableView(); this.readAllAndShowInTableView();
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id")); this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
this.columnName.setCellValueFactory(new PropertyValueFactory<>("name")); this.columnName.setCellValueFactory(new PropertyValueFactory<>("name"));
@ -85,6 +85,7 @@ public class AllMedicationController {
this.columnCurrentStock.setCellValueFactory(new PropertyValueFactory<>("currentStock")); this.columnCurrentStock.setCellValueFactory(new PropertyValueFactory<>("currentStock"));
this.tableView.setItems(this.medications); this.tableView.setItems(this.medications);
} }
/** /**
@ -136,7 +137,7 @@ public class AllMedicationController {
} catch (SQLException exception) { } catch (SQLException exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
readAllAndShowInTableView(); this.readAllAndShowInTableView();
} }
/** /**

View file

@ -64,6 +64,7 @@ public class DeprecatedMedicationController {
this.columnCurrentStock.setCellValueFactory(new PropertyValueFactory<>("currentStock")); this.columnCurrentStock.setCellValueFactory(new PropertyValueFactory<>("currentStock"));
this.tableView.setItems(this.medications); this.tableView.setItems(this.medications);
} }
/** /**
@ -91,7 +92,7 @@ public class DeprecatedMedicationController {
} catch (SQLException exception) { } catch (SQLException exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
readAllAndShowInTableView(); this.readAllAndShowInTableView();
} }
} }

View file

@ -75,7 +75,7 @@ public class AllTreatmentController {
*/ */
@FXML @FXML
public void initialize() { public void initialize() {
readAllAndShowInTableView();
comboBoxPatientSelection.setItems(patientSelection); comboBoxPatientSelection.setItems(patientSelection);
comboBoxPatientSelection.getSelectionModel().select("alle"); comboBoxPatientSelection.getSelectionModel().select("alle");
@ -109,6 +109,7 @@ public class AllTreatmentController {
); );
this.createComboBoxData(); this.createComboBoxData();
readAllAndShowInTableView();
} }
/** /**

View file

@ -27,7 +27,7 @@
</Tab> </Tab>
<Tab fx:id="medicationTab" text="Medikamente"> <Tab fx:id="medicationTab" text="Medikamente">
<TabPane fx:id="medicationTabPane" tabClosingPolicy="UNAVAILABLE"> <TabPane fx:id="medicationTabPane" tabClosingPolicy="UNAVAILABLE">
<Tab fx:id="allMedicationTab" text="Medikamente"> <Tab fx:id="availableMedicationTab" text="Medikamente">
<AnchorPane fx:id="medicationPage"/> <AnchorPane fx:id="medicationPage"/>
</Tab> </Tab>
<Tab fx:id="deprecatedMedicationTab" text="Veraltete Medikamente"> <Tab fx:id="deprecatedMedicationTab" text="Veraltete Medikamente">