![JAR search and dependency download from the Maven repository](/logo.png)
de.carne.jfx.util.validation.ValidationAlerts Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-jfx Show documentation
Show all versions of java-jfx Show documentation
Common JavaFX code shared between my projects
The newest version!
/*
* Copyright (c) 2016-2020 Holger de Carne and contributors, All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package de.carne.jfx.util.validation;
import de.carne.jfx.scene.control.DialogHelper;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ButtonType;
/**
* Utility class for creation of validation related {@link Alert} dialogs.
*/
public final class ValidationAlerts {
private ValidationAlerts() {
// Make sure this class is not instantiated from outside
}
/**
* Creates an {@link Alert} of type {@link AlertType#ERROR} and set it up using the submitted
* {@link ValidationException}.
*
* @param e The {@link ValidationException} providing the alert details.
* @return The created alert.
*/
public static Alert error(ValidationException e) {
Alert alert = new Alert(AlertType.ERROR, e.getLocalizedMessage(), ButtonType.OK);
alert.setHeaderText(ValidationAlertsI18N.strMessageValidationError());
DialogHelper.setExceptionContent(alert, e.getCause());
return alert;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy