2019-02-10 04:59:54 +03:00
|
|
|
package nsusbloader;
|
|
|
|
|
|
|
|
import javafx.scene.control.Alert;
|
|
|
|
import javafx.scene.control.ButtonType;
|
|
|
|
import javafx.scene.layout.Region;
|
|
|
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
|
|
|
public class ServiceWindow {
|
|
|
|
/**
|
|
|
|
* Create window with notification
|
|
|
|
* */
|
2019-02-15 05:44:39 +03:00
|
|
|
public static void getErrorNotification(String title, String body){
|
2019-02-10 04:59:54 +03:00
|
|
|
Alert alertBox = new Alert(Alert.AlertType.ERROR);
|
|
|
|
alertBox.setTitle(title);
|
|
|
|
alertBox.setHeaderText(null);
|
|
|
|
alertBox.setContentText(body);
|
|
|
|
alertBox.getDialogPane().setMinWidth(Region.USE_PREF_SIZE);
|
|
|
|
alertBox.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
|
|
|
|
alertBox.setResizable(true); // Java bug workaround for JDR11/OpenJFX. TODO: nothing. really.
|
|
|
|
alertBox.setResizable(false);
|
2019-03-19 05:06:18 +03:00
|
|
|
alertBox.getDialogPane().getStylesheets().add(AppPreferences.getInstance().getTheme());
|
2019-02-10 04:59:54 +03:00
|
|
|
alertBox.show();
|
|
|
|
}
|
2019-02-11 17:33:53 +03:00
|
|
|
/**
|
|
|
|
* Create notification window with confirm/deny
|
|
|
|
* */
|
2019-02-15 05:44:39 +03:00
|
|
|
public static boolean getConfirmationWindow(String title, String body){
|
2019-02-10 04:59:54 +03:00
|
|
|
Alert alertBox = new Alert(Alert.AlertType.CONFIRMATION);
|
|
|
|
alertBox.setTitle(title);
|
|
|
|
alertBox.setHeaderText(null);
|
|
|
|
alertBox.setContentText(body);
|
|
|
|
alertBox.getDialogPane().setMinWidth(Region.USE_PREF_SIZE);
|
|
|
|
alertBox.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
|
|
|
|
alertBox.setResizable(true); // Java bug workaround for JDR11/OpenJFX. TODO: nothing. really.
|
2019-02-18 03:06:49 +03:00
|
|
|
alertBox.getDialogPane().getStylesheets().add(AppPreferences.getInstance().getTheme());
|
2019-02-10 04:59:54 +03:00
|
|
|
Optional<ButtonType> result = alertBox.showAndWait();
|
|
|
|
|
2019-02-18 03:06:49 +03:00
|
|
|
return (result.isPresent() && result.get() == ButtonType.OK);
|
2019-02-10 04:59:54 +03:00
|
|
|
}
|
|
|
|
}
|