diff options
| author | Dominic Rogetzer <e1627756@student.tuwien.ac.at> | 2018-06-17 16:06:15 +0200 | 
|---|---|---|
| committer | Tharre <tharre3@gmail.com> | 2018-06-17 19:50:47 +0200 | 
| commit | 7db103abe2fed5c9fb3f934495aac7ace20829ea (patch) | |
| tree | a36489d54c9e88fd17f417dc4c6e921d91e2cb9c /src | |
| parent | 7e9ec24bee09c38e1968cb7a26b5c14dc0e1b1bd (diff) | |
| download | sepm-groupproject-7db103abe2fed5c9fb3f934495aac7ace20829ea.tar.gz sepm-groupproject-7db103abe2fed5c9fb3f934495aac7ace20829ea.tar.xz sepm-groupproject-7db103abe2fed5c9fb3f934495aac7ace20829ea.zip | |
Separate validation and error messages in OperationDetailsCtrl [#25963]
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/OperationDetailsController.java | 45 | 
1 files changed, 22 insertions, 23 deletions
| diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/OperationDetailsController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/OperationDetailsController.java index ab348e1..3e37a04 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/OperationDetailsController.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/OperationDetailsController.java @@ -118,21 +118,20 @@ public class OperationDetailsController {          LOG.debug("Button \"Abschließen\" clicked.");          try {              operationService.complete(operation.id(), Status.COMPLETED); -        } catch (InvalidOperationException | ServiceException e) { +        } catch (InvalidOperationException e) { +            LOG.debug("Validation error in closeOperationClicked(). ", e); +            Helper.showAlertWithOkButtonAndWait( +                    AlertType.ERROR, "Validierungsfehler", e.getMessage()); +            return; +        } catch (ServiceException e) {              LOG.error("Exception in closeOperationClicked(). ", e); -            Alert alert = new Alert(AlertType.ERROR); -            alert.setTitle("Fehler"); -            alert.setHeaderText("Fehler!"); -            alert.setContentText(e.getMessage()); -            alert.showAndWait(); +            Helper.showAlertWithOkButtonAndWait(AlertType.ERROR, "Fehler", e.getMessage());              return;          } -        Alert alert = new Alert(AlertType.CONFIRMATION); -        alert.setTitle("Erfolg"); -        alert.setHeaderText("Erfolgreich aktualisiert"); -        alert.setContentText("Der Einsatz wurde erfolgreich aktualisiert."); -        alert.showAndWait(); -        closeWindow(); +        Helper.showAlertWithOkButtonAndWait( +                AlertType.CONFIRMATION, +                "Erfolgreich aktualisiert", +                "Der Einsatz wurde erfolgreich aktualisiert.");          createOperationController.updateList();      } @@ -140,20 +139,20 @@ public class OperationDetailsController {          LOG.debug("Button \"Stornieren\" clicked.");          try {              operationService.complete(operation.id(), Status.CANCELLED); -        } catch (InvalidOperationException | ServiceException e) { +        } catch (InvalidOperationException e) { +            LOG.debug("Validation error in cancelOperationClicked(). ", e); +            Helper.showAlertWithOkButtonAndWait( +                    AlertType.ERROR, "Validierungsfehler", e.getMessage()); +            return; +        } catch (ServiceException e) {              LOG.error("Exception in cancelOperationClicked(). ", e); -            Alert alert = new Alert(AlertType.ERROR); -            alert.setTitle("Fehler"); -            alert.setHeaderText("Fehler!"); -            alert.setContentText(e.getMessage()); -            alert.showAndWait(); +            Helper.showAlertWithOkButtonAndWait(AlertType.ERROR, "Fehler", e.getMessage());              return;          } -        Alert alert = new Alert(AlertType.CONFIRMATION); -        alert.setTitle("Erfolg"); -        alert.setHeaderText("Erfolgreich aktualisiert"); -        alert.setContentText("Der Einsatz wurde erfolgreich aktualisiert."); -        alert.showAndWait(); +        Helper.showAlertWithOkButtonAndWait( +                AlertType.CONFIRMATION, +                "Erfolgreich aktualisiert", +                "Der Einsatz wurde erfolgreich aktualisiert.");          closeWindow();          createOperationController.updateList();      } | 
