diff options
author | Dominic Rogetzer <e1627756@student.tuwien.ac.at> | 2018-06-17 16:49:46 +0200 |
---|---|---|
committer | Tharre <tharre3@gmail.com> | 2018-06-17 19:50:47 +0200 |
commit | 90152495c6f708aa4a324fc29473a0871fdfa777 (patch) | |
tree | 3f325c2766ac53960e9b91ae359d0ff814afd5cd /src | |
parent | e845001685a0e0b77ec1bc2c16818cce30de8861 (diff) | |
download | sepm-groupproject-90152495c6f708aa4a324fc29473a0871fdfa777.tar.gz sepm-groupproject-90152495c6f708aa4a324fc29473a0871fdfa777.tar.xz sepm-groupproject-90152495c6f708aa4a324fc29473a0871fdfa777.zip |
Use specific helper methods for alerts in CreateOperationCtrl [#25963]
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/CreateOperationController.java | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/CreateOperationController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/CreateOperationController.java index fe1b1d8..c3eb32b 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/CreateOperationController.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/CreateOperationController.java @@ -1,5 +1,9 @@ package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.controller; +import static at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.controller.Helper.showServiceExceptionAlertAndWait; +import static at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.controller.Helper.showSuccessAlertAndWait; +import static at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.controller.Helper.showValidationErrorAlertAndWait; + import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Operation; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Operation.Status; import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Registration; @@ -19,7 +23,6 @@ import java.util.List; import java.util.Set; import javafx.collections.FXCollections; import javafx.fxml.FXML; -import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Button; import javafx.scene.control.ContextMenu; import javafx.scene.control.Label; @@ -152,11 +155,11 @@ public class CreateOperationController { } } catch (ServiceException | IOException e) { LOG.error("Exception in updateList(). ", e); - Helper.showAlertWithOkButtonAndWait(AlertType.ERROR, "Fehler", e.getMessage()); + showServiceExceptionAlertAndWait( + "Beim Erstellen des Ranking ist ein Fehler aufgetreten."); } catch (InvalidOperationException e) { LOG.debug("Validation error in updateList(). ", e); - Helper.showAlertWithOkButtonAndWait( - AlertType.ERROR, "Validierungsfehler", e.getMessage()); + showValidationErrorAlertAndWait(e.getMessage()); } try { lvActiveOperations.setItems( @@ -164,9 +167,7 @@ public class CreateOperationController { operationService.list(EnumSet.of(Status.ACTIVE)))); } catch (ServiceException e) { LOG.error("ServiceException in updateList(). ", e); - Helper.showAlertWithOkButtonAndWait( - AlertType.ERROR, - "Fehler", + showServiceExceptionAlertAndWait( "Beim Holen der aktiven Einsätze ist ein Fehler aufgetreten"); } } @@ -196,12 +197,11 @@ public class CreateOperationController { LOG.debug( "Validation error in createContextMenu(). (mi.setOnAction) ", e); - Helper.showAlertWithOkButtonAndWait( - AlertType.ERROR, "Validierungsfehler", e.getMessage()); + showValidationErrorAlertAndWait(e.getMessage()); } catch (ServiceException e) { LOG.error("Exception in createContextMenu(). (mi.setOnAction) ", e); - Helper.showAlertWithOkButtonAndWait( - AlertType.ERROR, "Fehler", e.getMessage()); + showServiceExceptionAlertAndWait( + "Beim Aktualisieren der Fahrzeuge ist ein Fehler aufgetreten."); } }); @@ -242,12 +242,11 @@ public class CreateOperationController { LOG.debug( "Validation error in createContextMenu(). (abmelden.setOnAction) ", e); - Helper.showAlertWithOkButtonAndWait( - AlertType.ERROR, "Validierungsfehler", e.getMessage()); + showValidationErrorAlertAndWait(e.getMessage()); } catch (ServiceException e) { LOG.error("Exception in createContextMenu(). (abmelden.setOnAction) ", e); - Helper.showAlertWithOkButtonAndWait( - AlertType.ERROR, "Fehler", e.getMessage()); + showServiceExceptionAlertAndWait( + "Beim Aktualisieren der Fahrzeuge ist ein Fehler aufgetreten."); } }); @@ -274,18 +273,15 @@ public class CreateOperationController { operationService.add(operation); } catch (ServiceException e) { LOG.error("Exception in createOperationClicked(). ", e); - Helper.showAlertWithOkButtonAndWait(AlertType.ERROR, "Fehler", e.getMessage()); + showServiceExceptionAlertAndWait( + "Beim Erstellen des Einsatzes ist ein Fehler aufgetreten."); return; } catch (InvalidOperationException e) { LOG.debug("Validation error in createOperationClicked(). ", e); - Helper.showAlertWithOkButtonAndWait( - AlertType.ERROR, "Validierungsfehler", e.getMessage()); + showValidationErrorAlertAndWait(e.getMessage()); return; } - Helper.showAlertWithOkButtonAndWait( - AlertType.CONFIRMATION, - "Erfolgreich gespeichert", - "Der Einsatz wurde erfolgreich gespeichert."); + showSuccessAlertAndWait("Der Einsatz wurde erfolgreich gespeichert."); updateList(); lblChosenVehicles.setText("keine ausgewählt"); txtAddress.setText(""); |