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