Search in sources :

Example 1 with ButtonData

use of javafx.scene.control.ButtonBar.ButtonData in project certmgr by hdecarne.

the class PasswordDialog method queryPasswordHelper.

@Nullable
private char[] queryPasswordHelper(Supplier<PasswordResult> query, boolean requery) {
    PasswordResult passwordResult;
    if (this.cancelAll) {
        passwordResult = PasswordResult.CANCEL;
    } else if (!requery && this.rememberedPassword != null) {
        passwordResult = new PasswordResult(ButtonType.YES, this.rememberedPassword, true);
    } else {
        passwordResult = PlatformHelper.runLater(query);
    }
    ButtonData dialogResultData = passwordResult.dialogResult().getButtonData();
    if (dialogResultData == ButtonData.YES) {
        this.cancelAll = false;
        this.rememberedPassword = (passwordResult.rememberPassword() ? passwordResult.password() : null);
    } else if (dialogResultData == ButtonData.NO) {
        this.cancelAll = false;
        this.rememberedPassword = null;
    } else {
        this.cancelAll = true;
        this.rememberedPassword = null;
    }
    return passwordResult.password();
}
Also used : ButtonData(javafx.scene.control.ButtonBar.ButtonData) Nullable(de.carne.check.Nullable)

Aggregations

Nullable (de.carne.check.Nullable)1 ButtonData (javafx.scene.control.ButtonBar.ButtonData)1