/* * Decompiled with CFR 0.152. * * Could not load the following classes: * javafx.scene.Group * javafx.scene.Node * javafx.scene.control.Alert * javafx.scene.control.Alert$AlertType * javafx.scene.control.ButtonType * javafx.scene.control.CheckBox * javafx.scene.control.DialogPane */ package gearth.misc; import java.util.HashSet; import java.util.Set; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; import javafx.scene.control.CheckBox; import javafx.scene.control.DialogPane; public class ConfirmationDialog { private static Set ignoreDialogs = new HashSet(); public static Alert createAlertWithOptOut(Alert.AlertType type, final String dialogKey, String title, String headerText, String message, final String optOutMessage, ButtonType ... buttonTypes) { Alert alert = new Alert(type); alert.getDialogPane().applyCss(); Node graphic = alert.getDialogPane().getGraphic(); alert.setDialogPane(new DialogPane(){ protected Node createDetailsButton() { CheckBox optOut = new CheckBox(); optOut.setText(optOutMessage); optOut.setOnAction(event -> { if (optOut.isSelected()) { ignoreDialogs.add(dialogKey); } }); return optOut; } }); alert.getDialogPane().getButtonTypes().addAll((Object[])buttonTypes); alert.getDialogPane().setContentText(message); alert.getDialogPane().setExpandableContent((Node)new Group()); alert.getDialogPane().setExpanded(true); alert.getDialogPane().setGraphic(graphic); alert.setTitle(title); alert.setHeaderText(headerText); return alert; } public static boolean showDialog(String dialogKey) { return !ignoreDialogs.contains(dialogKey); } }