3 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5 Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
7 Oracle and Java are registered trademarks of Oracle and/or its affiliates.
8 Other names may be trademarks of their respective owners.
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]"
30 The Original Software is NetBeans. The Initial Developer of the Original
31 Software is Oracle. Portions Copyright 2013-2014 Oracle. All Rights Reserved.
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.
48 This API allows you to write your application logic in Java and
49 present it using modern HTML rendering technologies like
50 <a href="http://knockoutjs.com">Knockout</a>
52 a server via <a href="OnReceive.html">REST</a> or
53 <a href="doc-files/websockets.html">WebSocket</a>s.
55 <img src="doc-files/html4j.png">
57 Use <a href="Model.html">@Model</a> annotation to define one or more
58 model classes with <a href="Property.html">properties</a>. Don't waste
59 time writing setters or getters - they will be generated for you.
60 Just instantiate your classes and use them!
63 The class generator does not stop with getters and setters -- internally
64 it generates bindings for various HTML technologies. Just include appropriate
65 technology implementation on classpath of your application and your model
66 class(es) will automatically be bound to your HTML elements (after calling
67 <code>applyBindings()</code> on your model).
70 You don't have bother with JavaScript. All your application logic is in
71 Java. The necessary JavaScript needed for the HTML bindings remains hidden
72 as an implementation detail of communication between the generated model
73 class(es) and appropriate technology bridge. For example
74 the <code>ko4j</code> module:
78 <groupId>org.netbeans.html</groupId>
79 <artifactId>ko4j</artifactId>
80 <scope>runtime</scope>
85 The model classes can be used for JSON based server communication. Just
86 use <a href="OnReceive.html">@OnReceive</a> annotation to define a communication
87 point in the model class. Please note, that the model classes can easily
88 be used on server as well - the same code can run
89 in your browser as well as on your server. Just add following to your <em>pom.xml</em>
90 to use your classes generated by <a href="Model.html">@Model</a> annotation
91 as <a href="http://jersey.java.net" target="new">Jersey</a> entities:
95 <groupId>org.glassfish.jersey.media</groupId>
96 <artifactId>html-json</artifactId>
97 <version>2.6</version> <-- or 2.6-SNAPSHOT until it gets released -->
98 <scope>runtime</scope>
102 Behavior of model classes can be enriched by using
103 <a href="ComputedProperty.html">@ComputedProperty</a> annotation (to
104 define <em>derived</em> properties) and by
105 <a href="Function.html">@Function</a> annotation to define handlers
106 to be invoked from the HTML elements.