Java 类javafx.scene.web.PromptData 实例源码

项目:willow-browser    文件:DialogFactory.java   
public Callback<PromptData, String> createPromptHandler() {
    return promptData -> {
        PromptHandler promptHandler = new PromptHandler(
                promptData.getMessage(),
                promptData.getDefaultValue(),
                event -> {
                    webView.setDisable(false);
                    removeViewOverlay();
                },
                event -> {
                    webView.setDisable(false);
                    removeViewOverlay();
                }
        );
        overlayView(promptHandler);

        // todo block until the user confirms or denies the action.
        return promptData.getDefaultValue();
    };
}
项目:netentionj-desktop    文件:DialogFactory.java   
public Callback<PromptData, String> createPromptHandler() {
    return promptData -> {
        PromptHandler promptHandler = new PromptHandler(
                promptData.getMessage(),
                promptData.getDefaultValue(),
                event -> {
                    webView.setDisable(false);
                    removeViewOverlay();
                },
                event -> {
                    webView.setDisable(false);
                    removeViewOverlay();
                }
        );
        overlayView(promptHandler);

        // todo block until the user confirms or denies the action.
        return promptData.getDefaultValue();
    };
}
项目:jace    文件:Program.java   
public void initEditor(WebView editor, File sourceFile, boolean isBlank) {
    this.editor = editor;
    targetFile = sourceFile;
    if (targetFile != null) {
        filename = targetFile.getName();
    }

    editor.getEngine().getLoadWorker().stateProperty().addListener(
            (value, old, newState) -> {
                if (newState == Worker.State.SUCCEEDED) {
                    JSObject document = (JSObject) editor.getEngine().executeScript("window");
                    document.setMember("java", this);
                    Platform.runLater(()->createEditor(isBlank));
                }
            });

    editor.getEngine().setPromptHandler((PromptData prompt) -> {
        TextInputDialog dialog = new TextInputDialog(prompt.getDefaultValue());
        dialog.setTitle("Jace IDE");
        dialog.setHeaderText("Respond and press OK, or Cancel to abort");
        dialog.setContentText(prompt.getMessage());
        return dialog.showAndWait().orElse(null);
    });

    editor.getEngine().load(getClass().getResource(CODEMIRROR_EDITOR).toExternalForm());
}
项目:lawless-legends    文件:Program.java   
public void initEditor(WebView editor, File sourceFile, boolean isBlank) {
    this.editor = editor;
    targetFile = sourceFile;
    if (targetFile != null) {
        filename = targetFile.getName();
    }

    editor.getEngine().getLoadWorker().stateProperty().addListener(
            (value, old, newState) -> {
                if (newState == Worker.State.SUCCEEDED) {
                    JSObject document = (JSObject) editor.getEngine().executeScript("window");
                    document.setMember("java", this);
                    Platform.runLater(()->createEditor(isBlank));
                }
            });

    editor.getEngine().setPromptHandler((PromptData prompt) -> {
        TextInputDialog dialog = new TextInputDialog(prompt.getDefaultValue());
        dialog.setTitle("Jace IDE");
        dialog.setHeaderText("Respond and press OK, or Cancel to abort");
        dialog.setContentText(prompt.getMessage());
        return dialog.showAndWait().orElse(null);
    });

    editor.getEngine().load(getClass().getResource(CODEMIRROR_EDITOR).toExternalForm());
}
项目:EmbeddedTomcatLauncher    文件:EmbeddedServerBrowserFrame.java   
/**
 * JavaScriptのprompt()のハンドラ
 *
 * @return
 */
private Callback<PromptData, String> createPromptHandler() {
    return new Callback<PromptData, String>() {
        @Override
        public String call(PromptData promptData) {
            final String message = promptData.getMessage();
            final String[] ret = new String[1];
            try {
                SwingUtilities.invokeAndWait(new Runnable() {
                    @Override
                    public void run() {
                        ret[0] = JOptionPane.showInputDialog(EmbeddedServerBrowserFrame.this, message);
                    }
                });
                return ret[0];

            } catch (Exception ex) {
                logger.log(Level.SEVERE, ex.toString(), ex);
            }
            return promptData.getDefaultValue();
        }
    };
}
项目:openjfx-8u-dev-tests    文件:PromptTest.java   
public String call(PromptData p) {
    defaultText = p.getDefaultValue();
    messageReceived = p.getMessage();
    promptCalled = true;
    return "response";
}
项目:ui4j    文件:WebKitPage.java   
@Override
public String call(PromptData param) {
    return handler.handle(new PromptDialogEvent(param.getMessage(), param.getDefaultValue()));
}