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