use of javafx.scene.web.WebView in project azure-tools-for-java by Microsoft.
the class JobViewPanel method init.
private void init(final JFXPanel panel) {
String url = rootPath + "/com.microsoft.hdinsight/hdinsight/job/html/index.html";
url = url.replace("\\", "/");
final String queryString = "?projectid=" + id + "&engintype=javafx";
final String weburl = "file:///" + url + queryString;
Platform.setImplicitExit(false);
Platform.runLater(() -> {
webView = new WebView();
webEngine = webView.getEngine();
webEngine.setJavaScriptEnabled(true);
webEngine.getLoadWorker().stateProperty().addListener((ObservableValue<? extends Worker.State> ov, Worker.State oldState, Worker.State newState) -> {
if (newState == Worker.State.SUCCEEDED) {
JSObject win = (JSObject) webEngine.executeScript("window");
win.setMember("JobUtils", jobUtil);
}
});
panel.setScene(new Scene(webView));
if (!alreadyLoad) {
webEngine.load(weburl);
alreadyLoad = true;
}
});
}
use of javafx.scene.web.WebView in project Retrospector by NonlinearFruit.
the class Cheatsheet method start.
@Override
public void start(Stage primaryStage) {
WebView web = new WebView();
// web.getEngine().load(getClass().getResource("web/materialtable.css").toExternalForm());
String webContent = new PumpkinEater("Search Cheatsheet", new String[] { "Symbol", "Name", "Example", "Explanation" }, new String[] { ":", "and", "lord:rings", "contains 'lord' and 'rings'" }, new String[] { "|", "or", "Marvel|DC", "contains 'marvel' or 'dc'" }, new String[] { "!", "not", "!rebecca black", "contains no 'rebecca black'" }, new String[] { "`", "cmd", "[See Below]", "[See Below]" }, new String[] { "`T", "title", "`T~civil war", "title contains 'civil war'" }, new String[] { "`C", "creator", "`C=BBC", "creator equals 'bbc'" }, new String[] { "`S", "season", "`S=1", "season equals '1'" }, new String[] { "`E", "episode", "`E~13", "episode contains '13'" }, new String[] { "`A", "category", "`A~Book", "category contains 'book'" }, new String[] { "Example", "-->", "batman|superman:`A=Movie:!vs", "contains 'batman' or 'superman',<br>category equals 'movie' and<br>contains no 'vs'" }, new String[] { "Example", "-->", "sherlock:doyle:baskervilles", "contains 'sherlock',<br>contains 'doyle' and<br>contains 'baskervilles'" }).getHtml();
web.getEngine().loadContent(webContent);
StackPane root = new StackPane(web);
Scene scene = new Scene(root, 800, 600);
primaryStage.setTitle("Search Cheatsheet");
primaryStage.setScene(scene);
primaryStage.show();
}
use of javafx.scene.web.WebView in project jabref by JabRef.
the class MathSciNetPaneView method getPane.
StackPane getPane() {
StackPane root = new StackPane();
ProgressIndicator progress = new ProgressIndicator();
progress.setMaxSize(100, 100);
WebView browser = new WebView();
// Quick hack to disable navigating
browser.addEventFilter(javafx.scene.input.MouseEvent.ANY, javafx.scene.input.MouseEvent::consume);
browser.setContextMenuEnabled(false);
root.getChildren().addAll(browser, progress);
mathSciNetId.getExternalURI().ifPresent(url -> browser.getEngine().load(url.toASCIIString()));
// Hide progress indicator if finished (over 70% loaded)
browser.getEngine().getLoadWorker().progressProperty().addListener((observable, oldValue, newValue) -> {
if (newValue.doubleValue() >= 0.7) {
progress.setVisible(false);
}
});
return root;
}
use of javafx.scene.web.WebView in project L42 by ElvisResearchGroup.
the class Frame method initWeb.
private Void initWeb(CountDownLatch latch, JFXPanel jfxPanel, String html) {
Group root = new Group();
Scene scene = new Scene(root);
WebView browser = new WebView();
this.webEngine = browser.getEngine();
this.webEngine.getLoadWorker().stateProperty().addListener((ov, oldState, newState) -> {
if (newState == Worker.State.SUCCEEDED) {
latch.countDown();
}
});
this.webEngine.loadContent(html);
this.webEngine.setOnAlert(event -> {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Information Dialog");
alert.setHeaderText(null);
alert.setContentText(event.getData());
alert.showAndWait();
});
root.getChildren().add(browser);
jfxPanel.setScene(scene);
return null;
}
use of javafx.scene.web.WebView in project Gargoyle by callakrsos.
the class MimeViewerExam method start.
@Override
public void start(Stage primaryStage) throws Exception {
WebView center = new WebView();
WebEngine engine = center.getEngine();
URL resource = MimeViewerExam.class.getResource("Sample.html");
// String externalForm = resource.toExternalForm();
String readToString = FileUtil.readToString(resource.openStream());
System.out.println("##########################################");
System.out.println("mime string");
System.out.println(readToString);
System.out.println("##########################################");
final MessageBuilder builder = new DefaultMessageBuilder();
final Message message = builder.parseMessage(resource.openStream());
Body body = ((Entity) message).getBody();
StringBuilder sb = new StringBuilder();
extracted(sb, body);
Document parse = Jsoup.parse(sb.toString());
Elements select = parse.select("img");
select.forEach(e -> {
String attr = e.attr("src");
if (attr.startsWith("cid:")) {
String cid = attr.replace("cid:", "");
String string = meta.get(cid);
e.attr("src", "data:image/jpg;base64,".concat(string));
}
});
System.out.println("##########################################");
System.out.println("html string");
System.out.println(sb.toString());
System.out.println("##########################################");
System.out.println(parse.toString());
engine.loadContent(sb.toString(), "text/html");
primaryStage.setScene(new Scene(new BorderPane(center)));
primaryStage.show();
}
Aggregations