1.1 --- a/boot-script/src/main/java/net/java/html/boot/script/Scripts.java Thu Jun 05 20:27:54 2014 +0200
1.2 +++ b/boot-script/src/main/java/net/java/html/boot/script/Scripts.java Thu Jun 05 21:01:56 2014 +0200
1.3 @@ -44,10 +44,25 @@
1.4
1.5 import java.util.concurrent.Executor;
1.6 import javax.script.ScriptEngine;
1.7 +import net.java.html.boot.BrowserBuilder;
1.8 +import net.java.html.js.JavaScriptBody;
1.9 import org.apidesign.html.boot.spi.Fn.Presenter;
1.10
1.11 /** Implementations of {@link Presenter}s that delegate
1.12 - * to Java {@link ScriptEngine scripting} API.
1.13 + * to Java {@link ScriptEngine scripting} API. Initialize your presenter
1.14 + * like this:
1.15 + *
1.16 + * <pre>
1.17 + *
1.18 + * {@link Runnable} <em>run</em> = ...; // your own init code
1.19 + * {@link Presenter Fn.Presenter} <em>p</em> = Scripts.{@link Scripts#createPresenter()};
1.20 + * BrowserBuilder.{@link BrowserBuilder#newBrowser(java.lang.Object...) newBrowser(<em>p</em>)}.
1.21 + * {@link BrowserBuilder#loadFinished(java.lang.Runnable) loadFinished(run)}.
1.22 + * {@link BrowserBuilder#showAndWait()};
1.23 + * </pre>
1.24 + *
1.25 + * and your runnable can make extensive use of {@link JavaScriptBody} directly or
1.26 + * indirectly via APIs using {@link JavaScriptBody such annotation} themselves.
1.27 *
1.28 * @author Jaroslav Tulach
1.29 */
1.30 @@ -69,8 +84,9 @@
1.31 return new ScriptPresenter(null);
1.32 }
1.33
1.34 - /** Simple implementation of {@link Presenter} that delegates
1.35 - * to Java {@link ScriptEngine scripting} API. The presenter runs headless
1.36 + /** Implementation of {@link Presenter} that delegates
1.37 + * to Java {@link ScriptEngine scripting} API and can control execution
1.38 + * thread. The presenter runs headless
1.39 * without appropriate simulation of browser APIs. Its primary usefulness
1.40 * is inside testing environments. The presenter implements {@link Executor}
1.41 * interface, and passes all runnables from {@link Executor#execute(java.lang.Runnable)}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/boot-script/src/main/java/net/java/html/boot/script/package.html Thu Jun 05 21:01:56 2014 +0200
2.3 @@ -0,0 +1,51 @@
2.4 +<!--
2.5 +
2.6 + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2.7 +
2.8 + Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
2.9 +
2.10 + Oracle and Java are registered trademarks of Oracle and/or its affiliates.
2.11 + Other names may be trademarks of their respective owners.
2.12 +
2.13 + The contents of this file are subject to the terms of either the GNU
2.14 + General Public License Version 2 only ("GPL") or the Common
2.15 + Development and Distribution License("CDDL") (collectively, the
2.16 + "License"). You may not use this file except in compliance with the
2.17 + License. You can obtain a copy of the License at
2.18 + http://www.netbeans.org/cddl-gplv2.html
2.19 + or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
2.20 + specific language governing permissions and limitations under the
2.21 + License. When distributing the software, include this License Header
2.22 + Notice in each file and include the License file at
2.23 + nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
2.24 + particular file as subject to the "Classpath" exception as provided
2.25 + by Oracle in the GPL Version 2 section of the License file that
2.26 + accompanied this code. If applicable, add the following below the
2.27 + License Header, with the fields enclosed by brackets [] replaced by
2.28 + your own identifying information:
2.29 + "Portions Copyrighted [year] [name of copyright owner]"
2.30 +
2.31 + Contributor(s):
2.32 +
2.33 + The Original Software is NetBeans. The Initial Developer of the Original
2.34 + Software is Oracle. Portions Copyright 2013-2014 Oracle. All Rights Reserved.
2.35 +
2.36 + If you wish your version of this file to be governed by only the CDDL
2.37 + or only the GPL Version 2, indicate your decision by adding
2.38 + "[Contributor] elects to include this software in this distribution
2.39 + under the [CDDL or GPL Version 2] license." If you do not indicate a
2.40 + single choice of license, a recipient has the option to distribute
2.41 + your version of this file under either the CDDL, the GPL Version 2 or
2.42 + to extend the choice of license to its licensees as provided above.
2.43 + However, if you add GPL Version 2 code and therefore, elected the GPL
2.44 + Version 2 license, then the option applies only if the new code is
2.45 + made subject to such option by the copyright holder.
2.46 +
2.47 +-->
2.48 +<body>
2.49 + <p>
2.50 + {@link net.java.html.boot.script.Scripts Factories} headless
2.51 + {@link net.java.html.boot.BrowserBuilder browser environment}
2.52 + useful for testing.
2.53 + </p>
2.54 +</body>
3.1 --- a/boot/src/main/java/net/java/html/boot/BrowserBuilder.java Thu Jun 05 20:27:54 2014 +0200
3.2 +++ b/boot/src/main/java/net/java/html/boot/BrowserBuilder.java Thu Jun 05 21:01:56 2014 +0200
3.3 @@ -72,7 +72,7 @@
3.4 * <pre>
3.5 *
3.6 * <b>public static void</b> <em>main</em>(String... args) {
3.7 - * BrowserBuilder.{@link #newBrowser}.
3.8 + * BrowserBuilder.{@link #newBrowser newBrowser()}.
3.9 * {@link #loadClass(java.lang.Class) loadClass(YourMain.class)}.
3.10 * {@link #loadPage(java.lang.String) loadPage("index.html")}.
3.11 * {@link #invoke(java.lang.String, java.lang.String[]) invoke("initialized", args)}.
4.1 --- a/pom.xml Thu Jun 05 20:27:54 2014 +0200
4.2 +++ b/pom.xml Thu Jun 05 21:01:56 2014 +0200
4.3 @@ -137,6 +137,10 @@
4.4 <packages>net.java.html.sound</packages>
4.5 </group>
4.6 <group>
4.7 + <title>Testing and Headless API</title>
4.8 + <packages>net.java.html.boot.script</packages>
4.9 + </group>
4.10 + <group>
4.11 <title>Service Provider APIs (not commonly interesting)</title>
4.12 <packages>org.apidesign.html.*</packages>
4.13 </group>