#17: Cleanup
All checks were successful
Quality Check / Linting Check (push) Successful in 18s
Quality Check / Linting Check (pull_request) Successful in 22s
Quality Check / Javadoc Check (push) Successful in 36s
Quality Check / Javadoc Check (pull_request) Successful in 34s

Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
This commit is contained in:
Dominik Säume 2024-05-15 09:51:57 +02:00
parent 54bdc21040
commit 082c6a7a2f
Signed by: SZUT-Dominik
GPG key ID: 67D15BB250B41E7C

View file

@ -186,32 +186,43 @@ public class AllTreatmentController {
@FXML @FXML
public void handleNewTreatment() { public void handleNewTreatment() {
try { String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem();
String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem(); Patient patient = searchInPatientList(selectedPatient);
Patient patient = searchInPatientList(selectedPatient);
String selectedNurse = this.comboBoxNurseSelection.getSelectionModel().getSelectedItem(); if(patient == null) {
Nurse nurse = searchInNurseList(selectedNurse);
newTreatmentWindow(patient, nurse);
} catch (NullPointerException exception) {
Alert alert = new Alert(Alert.AlertType.INFORMATION); Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Information"); alert.setTitle("Information");
alert.setHeaderText("Patient für die Behandlung fehlt!"); alert.setHeaderText("Patient für die Behandlung fehlt!");
alert.setContentText("Wählen Sie über die Combobox einen Patienten aus!"); alert.setContentText("Wählen Sie über die Combobox einen Patienten aus!");
alert.showAndWait(); alert.showAndWait();
return;
} }
String selectedNurse = this.comboBoxNurseSelection.getSelectionModel().getSelectedItem();
Nurse nurse = searchInNurseList(selectedNurse);
if(nurse == null) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Information");
alert.setHeaderText("Pfleger für die Behandlung fehlt!");
alert.setContentText("Wählen Sie über die Combobox einen Pfleger aus!");
alert.showAndWait();
return;
}
newTreatmentWindow(patient, nurse);
} }
@FXML @FXML
public void handleMouseClick() { public void handleMouseClick() {
tableView.setOnMouseClicked(event -> tableView.setOnMouseClicked(event ->
{ {
if (event.getClickCount() == 2 && (tableView.getSelectionModel().getSelectedItem() != null)) { if (event.getClickCount() != 2 || (tableView.getSelectionModel().getSelectedItem() == null)) {
int index = this.tableView.getSelectionModel().getSelectedIndex(); return;
Treatment treatment = this.treatments.get(index);
treatmentWindow(treatment, treatment.getNurse());
} }
int index = this.tableView.getSelectionModel().getSelectedIndex();
Treatment treatment = this.treatments.get(index);
treatmentWindow(treatment, treatment.getNurse());
}); });
} }