boot-fx/src/main/java/net/java/html/boot/fx/FXBrowsers.java
changeset 886 88d62267a0b5
parent 771 ee3614350fc8
child 889 548982033730
     1.1 --- a/boot-fx/src/main/java/net/java/html/boot/fx/FXBrowsers.java	Thu Jul 31 14:36:00 2014 +0200
     1.2 +++ b/boot-fx/src/main/java/net/java/html/boot/fx/FXBrowsers.java	Thu Dec 04 09:21:55 2014 +0100
     1.3 @@ -52,6 +52,8 @@
     1.4  import net.java.html.boot.BrowserBuilder;
     1.5  import net.java.html.js.JavaScriptBody;
     1.6  import org.netbeans.html.boot.fx.AbstractFXPresenter;
     1.7 +import org.netbeans.html.context.spi.Contexts;
     1.8 +import org.netbeans.html.context.spi.Contexts.Id;
     1.9  
    1.10  /** Utility methods to use {@link WebView} and {@link JavaScriptBody} code
    1.11   * in existing <em>JavaFX</em> applications.
    1.12 @@ -82,6 +84,16 @@
    1.13       * <p>
    1.14       * This method sets {@link WebView#getUserData()} and {@link #runInBrowser(javafx.scene.web.WebView, java.lang.Runnable)}
    1.15       * relies on the value. Please don't alter it.
    1.16 +     * <p>
    1.17 +     * Since introduction of {@link Id technology identifiers} the 
    1.18 +     * provided <code>args</code> strings are also passed to the 
    1.19 +     * {@link BrwsrCtx context} when it is being 
    1.20 +     * {@link Contexts#newBuilder(java.lang.Object...) created}
    1.21 +     * and can influence the selection
    1.22 +     * of available technologies 
    1.23 +     * (like {@link org.netbeans.html.json.spi.Technology},
    1.24 +     * {@link org.netbeans.html.json.spi.Transfer} or
    1.25 +     * {@link org.netbeans.html.json.spi.WSTransfer}).
    1.26       * 
    1.27       * @param webView the instance of Web View to tweak
    1.28       * @param url the URL of the HTML page to load into the view
    1.29 @@ -94,7 +106,10 @@
    1.30          Class<?> onPageLoad, String methodName,
    1.31          String... args
    1.32      ) {
    1.33 -        BrowserBuilder.newBrowser(new Load(webView)).
    1.34 +        Object[] context = new Object[args.length + 1];
    1.35 +        System.arraycopy(args, 0, context, 1, args.length);
    1.36 +        context[0] = new Load(webView);
    1.37 +        BrowserBuilder.newBrowser(context).
    1.38              loadPage(url.toExternalForm()).
    1.39              loadClass(onPageLoad).
    1.40              invoke(methodName, args).