src/main/javadoc/overview.html
author Jaroslav Tulach <jtulach@netbeans.org>
Mon, 29 Feb 2016 05:49:56 +0100
changeset 1061 584b5d87aa3f
parent 1059 c5223a12e761
child 1062 5ca4c8c435c7
permissions -rw-r--r--
Documenting the xhr4j module
     1 <!--
     2 
     3     DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     4 
     5     Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
     6 
     7     Oracle and Java are registered trademarks of Oracle and/or its affiliates.
     8     Other names may be trademarks of their respective owners.
     9 
    10     The contents of this file are subject to the terms of either the GNU
    11     General Public License Version 2 only ("GPL") or the Common
    12     Development and Distribution License("CDDL") (collectively, the
    13     "License"). You may not use this file except in compliance with the
    14     License. You can obtain a copy of the License at
    15     http://www.netbeans.org/cddl-gplv2.html
    16     or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    17     specific language governing permissions and limitations under the
    18     License.  When distributing the software, include this License Header
    19     Notice in each file and include the License file at
    20     nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    21     particular file as subject to the "Classpath" exception as provided
    22     by Oracle in the GPL Version 2 section of the License file that
    23     accompanied this code. If applicable, add the following below the
    24     License Header, with the fields enclosed by brackets [] replaced by
    25     your own identifying information:
    26     "Portions Copyrighted [year] [name of copyright owner]"
    27 
    28     Contributor(s):
    29 
    30     The Original Software is NetBeans. The Initial Developer of the Original
    31     Software is Oracle. Portions Copyright 2013-2014 Oracle. All Rights Reserved.
    32 
    33     If you wish your version of this file to be governed by only the CDDL
    34     or only the GPL Version 2, indicate your decision by adding
    35     "[Contributor] elects to include this software in this distribution
    36     under the [CDDL or GPL Version 2] license." If you do not indicate a
    37     single choice of license, a recipient has the option to distribute
    38     your version of this file under either the CDDL, the GPL Version 2 or
    39     to extend the choice of license to its licensees as provided above.
    40     However, if you add GPL Version 2 code and therefore, elected the GPL
    41     Version 2 license, then the option applies only if the new code is
    42     made subject to such option by the copyright holder.
    43 
    44 -->
    45 <!DOCTYPE html>
    46 <html>
    47     <head>
    48         <title>HTML for Java APIs</title>
    49         <meta charset="UTF-8">
    50         <meta name="viewport" content="width=device-width, initial-scale=1.0">
    51         <style type="text/css">
    52         table.field td {
    53             padding: 4px;
    54             width: 18px;
    55             height: 18px;
    56             font-size: 1.5em;
    57             border: 1px solid black;
    58         }
    59         table.field td.UNKNOWN {
    60             background-color: #D6E4E1;
    61             cursor: pointer;
    62         }
    63         table.field td.EXPLOSION {
    64             background-color: #A31E39;
    65         }
    66         table.field td.DISCOVERED {
    67             background-color: #9DB2B1;
    68         }
    69         </style>
    70     </head>
    71     <body>
    72         <p>
    73          Use Java to write application logic; Use HTML5 to render the UI;
    74          {@link net.java.html.json.Model Animate an HTML page from Java}
    75          (see <a target="_blank" href="http://dew.apidesign.org/dew/#7212206">Duke being rotated</a> by CSS);
    76          Use {@link net.java.html.json.OnReceive REST} or
    77          <a href="net/java/html/json/doc-files/websockets.html">WebSockets</a>;
    78          interact with <a href="net/java/html/js/package-summary.html">JavaScript</a>;
    79          Get the best of both worlds!
    80 
    81          The goal of these APIs is to use full featured Java runtime
    82          (like real <a target="_blank" href="http://wiki.apidesign.org/wiki/HotSpot">HotSpot VM</a>),
    83          but still rely on a very lightweight rendering technology
    84          (so it can potentially fit
    85          <a target="_blank" href="http://bck2brwsr.apidesign.org">Bck2Brwsr</a> and definitely
    86          to various types of phones). What can be more lightweight
    87          (from a browser perspective) than
    88          <a target="_blank" href="http://wiki.apidesign.org/wiki/HTML">HTML</a>!?
    89          By default we use {@link net.java.html.boot.fx JavaFX's WebView}
    90          component to display the <a target="_blank" href="http://wiki.apidesign.org/wiki/HTML">HTML</a>.
    91          We eliminate the need to manipulate the DOM directly,
    92          there is a special {@link net.java.html.json Java to Knockout.js binding}.
    93          As a result the <a target="_blank" href="http://knockoutjs.com">HTML uses Knockout.js syntax</a>,
    94          yet the application code can be written in Java.
    95         </p>
    96 
    97         <h3>Improvements in version 1.3</h3>
    98 
    99         {@link net.java.html.json.Model Model classes} can have 
   100         {@link net.java.html.json.Model#instance() per-instance private data}.
   101         {@link net.java.html.json.Model Model classes} can generate
   102         builder-like construction methods if builder
   103         {@link net.java.html.json.Model#builder() prefix} is specified.
   104         {@link net.java.html.json.Property#mutable} can be <code>false</code>
   105         to define a non-mutable (almost constant) property. That
   106         in case of <em>Knockout</em> bindings means: the property is
   107         represented by a plain value rather than an observable in the JavaScript
   108         object. The <em>JavaFX</em> presenter can be executed in headless mode -
   109         just specify <code>-Dfxpresenter.headless=true</code> when launching
   110         its virtual machine and no window will be shown. This is particularly
   111         useful for testing. Configure your <em>surefire</em> or <em>failsafe</em>
   112         plugins like: <pre>
   113 &lt;plugin&gt;
   114   &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
   115   &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
   116   &lt;version&gt;2.13&lt;/version&gt;
   117   &lt;configuration&gt;
   118       &lt;systemPropertyVariables&gt;
   119           &lt;fxpresenter.headless&gt;true&lt;/fxpresenter.headless&gt;
   120       &lt;/systemPropertyVariables&gt;
   121   &lt;/configuration&gt;
   122 &lt;/plugin&gt;
   123 </pre>
   124         OSGi headers are now <a target="_blank" href="https://netbeans.org/bugzilla/show_bug.cgi?id=256696">
   125             enterprise OSGi ready</a>.
   126         Switched to <a target="_blank" href="https://netbeans.org/bugzilla/show_bug.cgi?id=257130">minified version 3.4.0</a>
   127         of <a target="_blank" href="http://knockoutjs.com">knockout.js</a>.
   128         Better support for <a target="_blank" href="https://netbeans.org/bugzilla/show_bug.cgi?id=257348">
   129         recursive @Model definitions</a>.
   130         New module <code>org.netbeans.html:xhr4j</code> provides implementation
   131         of {@link org.netbeans.html.json.spi.Transfer} with
   132         {@link org.netbeans.html.context.spi.Contexts.Id technology identifier}
   133         <b>xhr4j</b> - this module can be used to
   134         <a target="_blank" href='https://netbeans.org/bugzilla/show_bug.cgi?id=257849'>workaround limitations
   135         of CORS</a> by handling the {@link net.java.html.json.OnReceive}
   136         connections in Java.
   137 
   138         <h3>What's Been Improved in Version 1.2.3?</h3>
   139 
   140         One can control {@link net.java.html.json.OnReceive#headers() HTTP request headers}
   141         when connecting to server using the {@link net.java.html.json.OnReceive}
   142         annotation. It is possible to have
   143         {@link net.java.html.json.ComputedProperty#write() writable computed properties}.
   144         There is an easy way to enable <a target="_blank" href="http://getfirebug.com/">Firebug</a> in
   145         the JavaFX based Web View -
   146         just run with <code>-Dfirebug.lite=true</code> as
   147         <a target="_blank" href="https://www.youtube.com/watch?v=2rxwY-QJiLo">this video</a>
   148         demonstrates.
   149         Bugfix of issues <a target="_blank" href='https://netbeans.org/bugzilla/show_bug.cgi?id=250503'>250503</a>,
   150         <a target="_blank" href='https://netbeans.org/bugzilla/show_bug.cgi?id=252987'>252987</a>.
   151 
   152         <h3>What's New in Version 1.1?</h3>
   153 
   154         <p>
   155             The content of a {@link net.java.html.BrwsrCtx context}
   156             can be selected by registering implementations under specific
   157             {@link org.netbeans.html.context.spi.Contexts.Id technology identifiers}
   158             and requesting them during
   159             {@link org.netbeans.html.context.spi.Contexts#newBuilder(java.lang.Object...) construction}
   160             of the context. <code>org.netbeans.html:ko4j</code> module's implementation
   161             offers <b>ko4j</b>, <b>xhr</b> and <b>websocket</b> identifiers
   162             for its registered services
   163             (e.g. {@link org.netbeans.html.json.spi.Technology},
   164             {@link org.netbeans.html.json.spi.Transfer} and
   165             {@link org.netbeans.html.json.spi.WSTransfer}).
   166             <code>org.netbeans.html:ko-ws-tyrus</code>
   167             module registers its
   168             {@link org.netbeans.html.json.spi.Transfer Java based JSON} and
   169             {@link org.netbeans.html.json.spi.WSTransfer WebSocket} implementations
   170             under the name <b>tyrus</b>.
   171         </p>
   172         <p>
   173             A particular DOM subtree
   174             that a <a target="_blank" href="http://knockoutjs.com">knockout.js</a> model gets
   175             applied to can be selected by using
   176             {@link net.java.html.json.Models#applyBindings(java.lang.Object,java.lang.String)
   177             Models.applyBindings(m, id)} with an id of an HTML element.
   178             There is new {@link net.java.html.json.Model#targetId()} attribute
   179             which controls behavior of the generated <code>applyBindings</code> method.
   180             If <em>specified and non-empty</em>, then the generated method
   181             will call {@link net.java.html.json.Models#applyBindings(java.lang.Object,java.lang.String)}
   182             with <code>this</code> and the provided {@link net.java.html.json.Model#targetId() target id}.
   183             If <em>specified, but left empty</em>, then the generated method
   184             calls {@link net.java.html.json.Models#applyBindings(java.lang.Object)}.
   185             <em>If unspecified</em>, the method will <b>not</b> be generated at all
   186             (a change with respect to older versions). However one can
   187             still use {@link net.java.html.json.Models#applyBindings(java.lang.Object)}
   188             or {@link net.java.html.json.Models#applyBindings(java.lang.Object,java.lang.String)}
   189             to perform the association of any model with the page element.
   190         </p>
   191         <p>
   192             Memory model when using Knockout bindings has been improved
   193             (required additions of two new methods:
   194             {@link org.netbeans.html.json.spi.PropertyBinding#weak()} and
   195             {@link org.netbeans.html.json.spi.FunctionBinding#weak()}) and
   196             now the Java {@link net.java.html.json.Model models} can garbage collect,
   197             when no longer used. Library writers that use
   198             {@link net.java.html.js.JavaScriptBody} annotation can also
   199             control garbage collection behavior of method arguments by
   200             setting {@link net.java.html.js.JavaScriptBody#keepAlive() keepAlive=false}
   201             attribute.
   202         </p>
   203 
   204         <h3>What's New in Version 1.0?</h3>
   205 
   206         <p>
   207             {@link net.java.html.json.Property#array() Array properties} are now
   208             mutable from the <a href="http://knockoutjs.com">knockout.js</a>
   209             point of view (required {@link org.netbeans.html.json.spi.Proto.Type#replaceValue one SPI change}).
   210             The page lookup mechanism can use {@link net.java.html.boot.BrowserBuilder#locale(java.util.Locale) locale}
   211             to load localized a page with appropriate suffix.
   212             All SPI were moved under the NetBeans namespace - e.g.
   213             {@link org.netbeans.html.boot.spi},
   214             {@link org.netbeans.html.context.spi},
   215             {@link org.netbeans.html.json.spi},
   216             {@link org.netbeans.html.sound.spi}, and also
   217             {@link org.netbeans.html.json.tck}. Methods annotated
   218             with {@link net.java.html.js.JavaScriptBody} annotation and
   219             without fallback Java code now throw {@link java.lang.IllegalStateException}
   220             with a message suggesting to switch to proper
   221             {@link net.java.html.BrwsrCtx#execute browser context} to
   222             prevent endless debugging when one forgets to do so.
   223         </p>
   224 
   225         <p>
   226         What's new in older versions? Click the
   227         <a href="#" onclick="return showHistoric(true)">link</a>
   228         to view even more
   229         <a href="#" onclick="return showHistoric(true)">historic changes</a> below:
   230         </p>
   231 
   232         <a name="historic.changes"></a>
   233         <div id="historic.changes">
   234             <script>
   235             function showHistoric(show) {
   236                 var e = document.getElementById("historic.changes");
   237                 if (show) {
   238                     e.style.display="block";
   239                 } else {
   240                     e.style.display="none";
   241                 }
   242                 return false;
   243             }
   244             showHistoric(false);
   245             </script>
   246 
   247         <h3>What's New in Version 0.9?</h3>
   248 
   249         <p>
   250             System can run in {@link net.java.html.boot.BrowserBuilder#classloader(java.lang.ClassLoader) Felix OSGi container} (originally only Equinox).
   251             {@link net.java.html.json.ComputedProperty Derived properties}
   252             now deeply check changes in other {@link net.java.html.json.Model model
   253             classes} they depend on and recompute their values accordingly.
   254             <a target="_blank" href="http://knockoutjs.com">Knockout.js</a> library has been updated
   255             to version 3.2.0.
   256         </p>
   257 
   258         <h3>What's New in 0.8.x Versions?</h3>
   259 
   260         <p>
   261             Setters or array properties on classes generated by {@link net.java.html.json.Model}
   262             annotation can be accessed from any thread. {@link org.netbeans.html.sound.spi.AudioEnvironment}
   263             can be registered into {@link net.java.html.BrwsrCtx}. There is
   264             a {@link net.java.html.json.Models#parse(net.java.html.BrwsrCtx, java.lang.Class, java.io.InputStream, java.util.Collection)  method}
   265             to parse a JSON array and convert it into
   266             {@link net.java.html.json.Model model classes}.
   267             Improved behavior of <code>enum</code> values in
   268             {@link net.java.html.json.Model knockout bindings}.
   269         </p>
   270 
   271         <p>
   272             Few bugfixes for better portability.
   273             New API for {@link net.java.html.boot.script.Scripts headless execution}
   274             on top of <em>Nashorn</em> - does not run <em>knockout for Java</em>
   275             fully yet
   276             (reported as <a href="https://bugs.openjdk.java.net/browse/JDK-8046013">JDK-8046013</a>),
   277             however even in current state it is quite
   278             {@link net.java.html.boot.script.Scripts useful for testing}
   279             of
   280             {@link net.java.html.js Java/JavaScript interactions}.
   281         </p>
   282 
   283         <p>
   284             {@link net.java.html.boot.fx.FXBrowsers} has been extended
   285             with new helper methods to make it easier to use HTML+Java
   286             API in existing JavaFX applications.
   287             The annotation processor is made
   288             more robust with respect to errors in callback syntax of
   289             {@link net.java.html.js.JavaScriptBody} body parameter.
   290             Javadoc of {@link net.java.html.BrwsrCtx#execute} method
   291             has been improved based on a failure of its usability study.
   292             There can be additional parameters to methods annotated by
   293             {@link net.java.html.json.OnReceive} that allows one to
   294             pass state when a JSON call is made and use it when it finishes.
   295             The mechanism of discovery of sibling HTML page has been
   296             extended to work on systems that don't support
   297             {@link java.lang.Class#getProtectionDomain}.
   298         </p>
   299 
   300         <p>
   301             The first argument of method annotated by
   302             {@link net.java.html.json.OnReceive} annotation has to
   303             be the associated {@link net.java.html.json.Model model class}.
   304         </p>
   305 
   306         <p>
   307             {@link net.java.html.json.OnReceive} annotation now accepts
   308             {@link java.util.List} of data values as second argument
   309             (previously required an array).
   310         </p>
   311 
   312 
   313         <h3>What's New in 0.7.x Versions?</h3>
   314 
   315         <p>
   316             {@link net.java.html.js.JavaScriptBody} annotation has new attribute
   317             {@link net.java.html.js.JavaScriptBody#wait4js()} which allows
   318             asynchronous execution. Libraries using
   319             {@link net.java.html.js.JavaScriptBody} are urged to use this
   320             new attribute as much as possible, as it can speed up execution
   321             in certain environments.
   322         </p>
   323 
   324         <p>
   325             Use {@link net.java.html.BrwsrCtx#execute(java.lang.Runnable)} in
   326             multi-threaded environment to execute your code on the browser thread.
   327             See example
   328             {@link net.java.html.BrwsrCtx#execute(java.lang.Runnable) using Java timer}.
   329         </p>
   330         </div>
   331 
   332         <h3>Interesting Entry Points</h3>
   333 
   334         <p>Learn how to {@link net.java.html.json.Model animate an HTML page from Java}
   335             without referencing single HTML element from the Java code.
   336         </p>
   337         <p>Use {@link net.java.html.json.OnReceive JSON} to communicate
   338             with REST based server API.
   339         </p>
   340         <p>Use <a href="net/java/html/json/doc-files/websockets.html">WebSockets</a>
   341             and JSON.
   342         </p>
   343         <p>Call JavaScript methods from Java and vice versa, via
   344             <a href="net/java/html/js/package-summary.html">JavaScriptBody</a>.
   345         </p>
   346 
   347         <h3>Getting Started</h3>
   348 
   349         There are <a href="http://wiki.apidesign.org/wiki/DukeScriptInNetBeans">many ways</a>
   350         to start developing
   351         <a href="http://html.java.net">Html for Java</a> application.
   352         However to be sure one chooses the most recent setup, it is recommended
   353         to switch to good old command line and use a
   354         <a href="http://wiki.apidesign.org/wiki/Knockout4Java">Maven archetype</a>
   355         associated with every version of this project. Make sure at least
   356         <em>JDK7</em> is your installed Java and type:
   357         <pre>
   358 $ mvn archetype:generate \
   359  -DarchetypeGroupId=org.apidesign.html \
   360  -DarchetypeArtifactId=knockout4j-archetype \
   361  -DarchetypeVersion=0.8 <em># or newer version, if available</em>
   362         </pre>
   363         Answer few questions (for example choose myfirstbrwsrpage as artifactId)
   364         and then you can:
   365         <pre>
   366 $ cd myfirstbrwsrpage
   367 $ mvn process-classes exec:java
   368         </pre>
   369         In a few seconds (or minutes if
   370         <a href="http://wiki.apidesign.org/wiki/Maven">Maven</a>
   371         decides to download the whole Internet of dependencies) you should
   372         see a sample Hello World application rendered in a
   373         <a href="http://wiki.apidesign.org/wiki/JavaFX">JavaFX</a>
   374         web view component (that of course requires your JDK to come
   375         with <a href="http://wiki.apidesign.org/wiki/JavaFX">JavaFX</a>;
   376         <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">JDK7
   377             and JDK8 from Oracle</a> contain everything that is needed).
   378         The generated application is built around one
   379         Java source (uses the {@link net.java.html.json.Model} annotation to
   380         auto-generate another <code>Data.java</code> class during compilation)
   381         and one HTML file (uses the <a href="http://knockoutjs.com">Knockout</a>
   382         syntax to <code>data-bind</code> the HTML elements to the
   383         generated <code>Data</code> model):
   384         <pre>
   385 $ ls src/main/java/**/DataModel.java
   386 $ ls src/main/webapp/pages/index.html
   387         </pre>
   388         That is all you need to get started. Play with the sources,
   389         modify them and enjoy
   390         <a href="http://html.java.net">Html for Java</a>!
   391 
   392         <h2>IDE Support</h2>
   393 
   394         <p>
   395             This API is part of <a target="_blank"
   396             href="http://netbeans.org">NetBeans.org</a> project and as such
   397             it works naturally with the <a target="_blank"
   398             href="https://netbeans.org/features/index.html">NetBeans IDE</a>.
   399             On the other hand, the API is using nothing NetBeans specific,
   400             it builds on standard Java6 APIs and as such it shall work fine
   401             in any IDE.
   402         </p>
   403 
   404         <p>
   405             A lot of work is done by
   406             <a href="http://wiki.apidesign.org/wiki/AnnotationProcessor">
   407             annotation processors</a>
   408             that generate various boiler plate code during compilation. This
   409             is a standard part of Java since JDK6, but for example Eclipse
   410             is known not to deal with processors well and developers using
   411             it need to be careful. IntelliJ users hasn't reported any issues
   412             and of course, NetBeans IDE support for
   413             <a href="http://wiki.apidesign.org/wiki/AnnotationProcessor">processors</a>
   414             is outstanding.
   415         </p>
   416 
   417         <p>
   418             When using {@link net.java.html.js.JavaScriptBody} annotation, it is
   419             useful to do a bit of post processing of classes. There is a
   420             <a href="http://wiki.apidesign.org/wiki/Maven">Maven</a>
   421             plugin for that.
   422             NetBeans IDE will invoke it when doing a build. Other IDEs may
   423             need some hint to do so.
   424             Anyway: If one does not see all (generated) sources or is getting
   425             {@link java.lang.LinkageError}s when executing the application,
   426             switch to command line and do clean build
   427             from there:
   428         </p>
   429         <pre>$ mvn clean install</pre>
   430         <p>
   431             If that succeeds, your IDE of choice will hopefully
   432             pick the generated sources up and present the result of the build
   433             properly. If not,
   434             <a href="https://netbeans.org/downloads/">download NetBeans</a>,
   435             you will be pleasantly
   436             surprised - for example with our excellent
   437             <a href="net/java/html/js/package-summary.html#debugging">Java/JavaScript
   438             debugging</a> support.
   439         </p>
   440 
   441         <a name="deploy">
   442         <h2>Deploy Your Application</h2>
   443         </a>
   444 
   445         <p>
   446         It is not goal of this documentation to list all possible ways
   447         to package and deploy applications which use this API. However it is
   448         important for new comers to see the benefits of using the
   449         <a href="http://html.java.net">HTML for Java</a> API and as such
   450         let's list at least few bundling options, known to work at the time of writing
   451         this documentation.
   452         </p>
   453 
   454         <p>
   455         First of all, this is a <em>client technology</em>. You write client applications
   456         with it which may, but need not connect to a server. You don't need
   457         Tomcat or WebLogic to deploy
   458         <a href="http://html.java.net">HTML for Java</a> applications.
   459         </p>
   460 
   461         <p>
   462             <img src='resources/javafx_logo.jpg' width="64"
   463                  height="64" align="left"/>
   464             The sample project generated by
   465             <code>org.apidesign.html knockout4j-archetype</code> is configured
   466             to use <a href="http://wiki.apidesign.org/wiki/JavaFX">JavaFX</a>
   467             as the rendering technology. This setup is primarily suitable for
   468             development - it needs no special packaging, starts quickly and
   469             allows you to use classical HotSpot VM debuggers. A final
   470             artifact from the build is also a ZIP file which you can use
   471             and distribute to your users. Good for desktop applications.
   472         </p>
   473 
   474         <p>
   475             <img src='resources/netbeans_logo.jpg' width="64"
   476                  height="64" align="right"/>
   477             <img src='resources/eclipse_logo.png' width="64"
   478                  height="64" align="right"/>
   479             All the <a href="http://html.java.net">HTML for Java</a> libraries
   480             are packaged as <a href="http://wiki.apidesign.org/wiki/OSGi">OSGi</a>
   481             bundles and as such they can easily be run in NetBeans as well as
   482             in Eclipse. As a result one can use
   483             <a href="http://wiki.apidesign.org/wiki/OSGi">OSGi</a>
   484             and have a common module system for both platforms. In addition to that
   485             one can render using
   486             HTML and have a common UI in both platforms. In such case
   487             your application would be packaged as a set of
   488             <a href="http://wiki.apidesign.org/wiki/OSGi">OSGi</a> bundles.
   489             Read
   490             <a href="http://wiki.apidesign.org/wiki/HTML">more</a>...
   491         </p>
   492 
   493         <p>
   494             <img src='resources/chrome_logo.png' width="64"
   495                  height="64" align="left"/>
   496             <img src='resources/safari_logo.png' width="64"
   497                  height="64" align="left"/>
   498             <img src='resources/ie_logo.png' width="64"
   499                  height="64" align="left"/>
   500             <img src='resources/firefox_logo.png' width="64"
   501                  height="64" align="left"/>
   502 
   503             There is more and more attempts to execute Java bytecode
   504             in a browser, without any special Java plugin installed.
   505             The <a href="http://html.java.net">HTML for Java</a> is
   506             carefully designed to produce lightweight, well performing
   507             applications even on such restricted environments. It uses
   508             no reflection calls and that allows to statically pre-compile
   509             the applications into JavaScript. One of such environments
   510             is called <a href="http://wiki.apidesign.org/wiki/Bck2Brwsr">Bck2Brwsr</a>,
   511             another <a href="http://wiki.apidesign.org/wiki/TeaVM">TeaVM</a>. Both support the
   512             {@link net.java.html.js.JavaScriptBody} annotation. Read
   513             <a href="http://wiki.apidesign.org/wiki/Bck2BrwsrViaCLI">more</a> or play
   514             a minesweeper game packaged for your browser
   515             (of course <a target="_blank"
   516                 href="http://source.apidesign.org/hg/html~demo/file/ea79b73d590a/minesweeper/src/main/java/org/apidesign/demo/minesweeper/MinesModel.java">
   517                 written</a> in Java):
   518         </p>
   519 
   520         <script type="text/html" id="field">
   521             <table class="field">
   522                 <tbody>
   523                     <!-- ko foreach: rows -->
   524                     <tr>
   525                         <!-- ko foreach: columns -->
   526                         <td data-bind="css: style, click: $parents[1].click" >
   527                             <div data-bind='html: html'></div>
   528                         </td>
   529                         <!-- /ko -->
   530                     </tr>
   531                     <!-- /ko -->
   532                 </tbody>
   533             </table>
   534         </script>
   535 
   536         <div data-bind="template: { name : 'field', if: fieldShowing }"></div>
   537 
   538         <!-- boot bck2brwsr -->
   539         <script type="text/javascript" src="resources/teavm.js"></script>
   540         <script>
   541             var vm = new VM();
   542             vm.loadClass('org.apidesign.demo.minesweeper.MainBrwsr');
   543         </script>
   544 
   545         <p>
   546             <img src='resources/ios_logo.jpg' width="64"
   547                  height="64" align="right"/>
   548             <img src='resources/android_logo.jpg' width="64"
   549                  height="64" align="right"/>
   550 
   551             Now when we have seen that the
   552             <a href="http://html.java.net">HTML for Java</a> applications
   553             can run on any modern browser, we can ask whether they can also
   554             fit into a phone!? Yes, they can and especially to phones
   555             that can execute Java code already! Just by changing your
   556             packaging you can create an APK file and deploy it to your
   557             Android phone.
   558             Read <a target="_blank" href="http://wiki.apidesign.org/wiki/DlvkBrwsr">more</a>...
   559             In case you'd like your application to reach out to second biggest
   560             group of smartphone users, don't despair: It
   561             seems the set of devices that can execute
   562             <a href="http://html.java.net">HTML for Java</a> applications
   563             has been extended to <em>iPads</em> and <em>iPhones</em>. Get the
   564             <a target="_blank" href="http://wiki.apidesign.org/wiki/IBrwsr">details here</a>
   565             and deploy everywhere!
   566         </p>
   567         <p>
   568             Convinced it makes sense to use
   569             <a href="http://html.java.net">HTML for Java</a>
   570             APIs for writing applications that are
   571             <em>written once, displayed anywhere</em>? Or do you have an
   572             environment which is not supported? In such case you can bring
   573             <a href="http://html.java.net">HTML for Java</a>
   574             to your environment yourself. Just implement your own
   575             {@link org.netbeans.html.boot.spi.Fn.Presenter}!
   576         </p>
   577 
   578         <h2>Other Resources</h2>
   579 
   580         <img src="net/java/html/json/doc-files/DukeHTML.png" width="256" height="184" alt="Duke and HTML5. Together at last!" align="right"/>
   581 
   582         The javadoc for latest and previous versions is also available
   583         online:
   584         <ul>
   585             <li>Current <a target="_blank" href="http://bits.netbeans.org/html+java/dev/">development</a> version
   586             <li>Version <a target="_blank" href="http://bits.netbeans.org/html+java/1.2.3">1.2.3</a>
   587             <li>Version <a target="_blank" href="http://bits.netbeans.org/html+java/1.1">1.1</a>
   588             <li>Version <a target="_blank" href="http://bits.netbeans.org/html+java/1.0">1.0</a>
   589             <li>Version <a target="_blank" href="http://bits.netbeans.org/html+java/0.9">0.9</a>
   590                 and historic ones (<a target="_blank" href="http://bits.netbeans.org/html+java/0.8.3">0.8.3</a>,
   591                 <a target="_blank" href="http://bits.netbeans.org/html+java/0.8.2">0.8.2</a>,
   592                 <a target="_blank" href="http://bits.netbeans.org/html+java/0.8.1">0.8.1</a>,
   593                 <a target="_blank" href="http://bits.netbeans.org/html+java/0.8">0.8</a>, and
   594                 <a target="_blank" href="http://bits.netbeans.org/html+java/0.7.5">0.7.5</a>)
   595             </li>
   596         </ul>
   597     </body>
   598 </html>