1.1 --- a/boot-fx/src/main/java/net/java/html/boot/fx/FXBrowsers.java Tue Jul 22 06:30:19 2014 +0200
1.2 +++ b/boot-fx/src/main/java/net/java/html/boot/fx/FXBrowsers.java Thu Jul 31 14:36:00 2014 +0200
1.3 @@ -121,9 +121,34 @@
1.4 public static void load(
1.5 WebView webView, final URL url, Runnable onPageLoad
1.6 ) {
1.7 + load(webView, url, onPageLoad, null);
1.8 + }
1.9 +
1.10 + /** Enables the Java/JavaScript bridge (that supports {@link JavaScriptBody} and co.)
1.11 + * in the provided <code>webView</code>. This method returns
1.12 + * immediately. Once the support is active, it calls back specified
1.13 + * method in <code>onPageLoad</code>'s run method.
1.14 + * This is more convenient way to initialize the webview,
1.15 + * but it requires one to make sure
1.16 + * all {@link JavaScriptBody} methods has been post-processed during
1.17 + * compilation and there will be no need to instantiate new classloader.
1.18 + * <p>
1.19 + * This method sets {@link WebView#getUserData()} and {@link #runInBrowser(javafx.scene.web.WebView, java.lang.Runnable)}
1.20 + * relies on the value. Please don't alter it.
1.21 + *
1.22 + * @param webView the instance of Web View to tweak
1.23 + * @param url the URL of the HTML page to load into the view
1.24 + * @param onPageLoad callback to call when the page is ready
1.25 + * @param loader the loader to use when constructing initial {@link BrwsrCtx} or <code>null</code>
1.26 + * @since 0.9
1.27 + */
1.28 + public static void load(
1.29 + WebView webView, final URL url, Runnable onPageLoad, ClassLoader loader
1.30 + ) {
1.31 BrowserBuilder.newBrowser(new Load(webView)).
1.32 loadPage(url.toExternalForm()).
1.33 loadFinished(onPageLoad).
1.34 + classloader(loader).
1.35 showAndWait();
1.36 }
1.37