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(); } }