#24 Fixed UI not being correctly updated
This commit is contained in:
parent
1a542a0d71
commit
48a221848a
6 changed files with 24 additions and 7 deletions
Binary file not shown.
|
@ -49,6 +49,8 @@ public class MainWindowController {
|
|||
@FXML
|
||||
private Tab medicationTab;
|
||||
@FXML
|
||||
private Tab availableMedicationTab;
|
||||
@FXML
|
||||
private TabPane medicationTabPane;
|
||||
@FXML
|
||||
private AnchorPane deprecatedMedicationPage;
|
||||
|
@ -71,7 +73,7 @@ public class MainWindowController {
|
|||
|
||||
activeNurseTab.setOnSelectionChanged(event -> loadActiveNursePage());
|
||||
lockedNurseTab.setOnSelectionChanged(event -> loadLockedNursePage());
|
||||
medicationTab.setOnSelectionChanged(event -> loadMedicationPage());
|
||||
availableMedicationTab.setOnSelectionChanged(event -> loadAvailableMedicationPage());
|
||||
deprecatedMedicationTab.setOnSelectionChanged(event -> loadDeprecatedMedicationPage());
|
||||
|
||||
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.
|
||||
*/
|
||||
private void loadMedicationPage() {
|
||||
private void loadAvailableMedicationPage() {
|
||||
try {
|
||||
BorderPane medicationPane = FXMLLoader.load(
|
||||
Objects.requireNonNull(Main.class.getResource("/de/hitec/nhplus/medication/AllMedicationView.fxml"))
|
||||
|
|
|
@ -60,7 +60,7 @@ public class AllMedicationController {
|
|||
*/
|
||||
@FXML
|
||||
public void initialize() {
|
||||
readAllAndShowInTableView();
|
||||
this.readAllAndShowInTableView();
|
||||
|
||||
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
|
||||
this.columnName.setCellValueFactory(new PropertyValueFactory<>("name"));
|
||||
|
@ -85,6 +85,7 @@ public class AllMedicationController {
|
|||
this.columnCurrentStock.setCellValueFactory(new PropertyValueFactory<>("currentStock"));
|
||||
|
||||
this.tableView.setItems(this.medications);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,7 +137,7 @@ public class AllMedicationController {
|
|||
} catch (SQLException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
readAllAndShowInTableView();
|
||||
this.readAllAndShowInTableView();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -64,6 +64,7 @@ public class DeprecatedMedicationController {
|
|||
this.columnCurrentStock.setCellValueFactory(new PropertyValueFactory<>("currentStock"));
|
||||
|
||||
this.tableView.setItems(this.medications);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,7 +92,7 @@ public class DeprecatedMedicationController {
|
|||
} catch (SQLException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
readAllAndShowInTableView();
|
||||
this.readAllAndShowInTableView();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class AllTreatmentController {
|
|||
*/
|
||||
@FXML
|
||||
public void initialize() {
|
||||
readAllAndShowInTableView();
|
||||
|
||||
comboBoxPatientSelection.setItems(patientSelection);
|
||||
comboBoxPatientSelection.getSelectionModel().select("alle");
|
||||
|
||||
|
@ -109,6 +109,7 @@ public class AllTreatmentController {
|
|||
);
|
||||
|
||||
this.createComboBoxData();
|
||||
readAllAndShowInTableView();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</Tab>
|
||||
<Tab fx:id="medicationTab" text="Medikamente">
|
||||
<TabPane fx:id="medicationTabPane" tabClosingPolicy="UNAVAILABLE">
|
||||
<Tab fx:id="allMedicationTab" text="Medikamente">
|
||||
<Tab fx:id="availableMedicationTab" text="Medikamente">
|
||||
<AnchorPane fx:id="medicationPage"/>
|
||||
</Tab>
|
||||
<Tab fx:id="deprecatedMedicationTab" text="Veraltete Medikamente">
|
||||
|
|
Loading…
Reference in a new issue