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