blob: f120eb619d2eca2093829fac90f0cc5fb7b096cd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package at.ac.tuwien.sepm.assignment.groupphase.missioncontrol.controller;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ButtonType;
public class Helper {
static final String ALERT_TITLE_VALIDATION_ERROR = "Validierungsfehler";
static final String ALERT_TITLE_SERVICE_EXCEPTION = "Fehler";
static final String ALERT_TITLE_SUCCESS = "Erfolg";
private Helper() {} // SonarLint insisted to create a private constructor to hide the public one
static void showValidationErrorAlertAndWait(String message) {
showAlertWithOkButtonAndWait(AlertType.ERROR, ALERT_TITLE_VALIDATION_ERROR, message);
}
static void showServiceExceptionAlertAndWait(String message) {
showAlertWithOkButtonAndWait(AlertType.ERROR, ALERT_TITLE_SERVICE_EXCEPTION, message);
}
static void showSuccessAlertAndWait(String message) {
showAlertWithOkButtonAndWait(AlertType.INFORMATION, ALERT_TITLE_SUCCESS, message);
}
static void showAlertWithOkButtonAndWait(
AlertType alertType, String headerText, String contentText) {
Alert alert = new Alert(alertType, contentText, ButtonType.OK);
alert.setTitle(headerText);
alert.setHeaderText(headerText);
alert.showAndWait();
}
}
|