jtulach@65
|
1 |
<!--
|
jtulach@65
|
2 |
|
jaroslav@358
|
3 |
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
jtulach@65
|
4 |
|
jaroslav@365
|
5 |
Copyright 2013-2013 Oracle and/or its affiliates. All rights reserved.
|
jtulach@65
|
6 |
|
jaroslav@358
|
7 |
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
|
jaroslav@358
|
8 |
Other names may be trademarks of their respective owners.
|
jtulach@65
|
9 |
|
jaroslav@358
|
10 |
The contents of this file are subject to the terms of either the GNU
|
jaroslav@358
|
11 |
General Public License Version 2 only ("GPL") or the Common
|
jaroslav@358
|
12 |
Development and Distribution License("CDDL") (collectively, the
|
jaroslav@358
|
13 |
"License"). You may not use this file except in compliance with the
|
jaroslav@358
|
14 |
License. You can obtain a copy of the License at
|
jaroslav@358
|
15 |
http://www.netbeans.org/cddl-gplv2.html
|
jaroslav@358
|
16 |
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
|
jaroslav@358
|
17 |
specific language governing permissions and limitations under the
|
jaroslav@358
|
18 |
License. When distributing the software, include this License Header
|
jaroslav@358
|
19 |
Notice in each file and include the License file at
|
jaroslav@358
|
20 |
nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
|
jaroslav@358
|
21 |
particular file as subject to the "Classpath" exception as provided
|
jaroslav@358
|
22 |
by Oracle in the GPL Version 2 section of the License file that
|
jaroslav@358
|
23 |
accompanied this code. If applicable, add the following below the
|
jaroslav@358
|
24 |
License Header, with the fields enclosed by brackets [] replaced by
|
jaroslav@358
|
25 |
your own identifying information:
|
jaroslav@358
|
26 |
"Portions Copyrighted [year] [name of copyright owner]"
|
jaroslav@358
|
27 |
|
jaroslav@358
|
28 |
Contributor(s):
|
jaroslav@358
|
29 |
|
jaroslav@358
|
30 |
The Original Software is NetBeans. The Initial Developer of the Original
|
jaroslav@358
|
31 |
Software is Oracle. Portions Copyright 2013-2013 Oracle. All Rights Reserved.
|
jaroslav@358
|
32 |
|
jaroslav@358
|
33 |
If you wish your version of this file to be governed by only the CDDL
|
jaroslav@358
|
34 |
or only the GPL Version 2, indicate your decision by adding
|
jaroslav@358
|
35 |
"[Contributor] elects to include this software in this distribution
|
jaroslav@358
|
36 |
under the [CDDL or GPL Version 2] license." If you do not indicate a
|
jaroslav@358
|
37 |
single choice of license, a recipient has the option to distribute
|
jaroslav@358
|
38 |
your version of this file under either the CDDL, the GPL Version 2 or
|
jaroslav@358
|
39 |
to extend the choice of license to its licensees as provided above.
|
jaroslav@358
|
40 |
However, if you add GPL Version 2 code and therefore, elected the GPL
|
jaroslav@358
|
41 |
Version 2 license, then the option applies only if the new code is
|
jaroslav@358
|
42 |
made subject to such option by the copyright holder.
|
jtulach@65
|
43 |
|
jtulach@65
|
44 |
-->
|
jtulach@64
|
45 |
<body>
|
jtulach@64
|
46 |
|
jtulach@64
|
47 |
<p>
|
jtulach@64
|
48 |
This API allows you to write your application logic in Java and
|
jtulach@64
|
49 |
present it using modern HTML rendering technologies like
|
jtulach@64
|
50 |
<a href="http://knockoutjs.com">Knockout</a>
|
jtulach@64
|
51 |
<img src="doc-files/html4j.png">.
|
jtulach@64
|
52 |
</p>
|
jtulach@64
|
53 |
<p>
|
jtulach@64
|
54 |
Use <a href="Model.html">@Model</a> annotation to define one or more
|
jtulach@64
|
55 |
model classes with <a href="Property.html">properties</a>. Don't waste
|
jtulach@64
|
56 |
time writing setters or getters - they will be generated for you.
|
jtulach@64
|
57 |
Just instantiate your classes and use them!
|
jtulach@64
|
58 |
</p>
|
jtulach@64
|
59 |
<p>
|
jtulach@64
|
60 |
The class generator does not stop with getters and setters -- internally
|
jtulach@64
|
61 |
it generates bindings for various HTML technologies. Just include appropriate
|
jtulach@64
|
62 |
technology implementation on classpath of your application and your model
|
jtulach@64
|
63 |
class(es) will automatically be bound to your HTML elements (after calling
|
jtulach@64
|
64 |
<code>applyBindings()</code> on your model).
|
jtulach@64
|
65 |
</p>
|
jtulach@64
|
66 |
<p>
|
jtulach@64
|
67 |
You don't have bother with JavaScript. All your application logic is in
|
jtulach@64
|
68 |
Java. The necessary JavaScript needed for the HTML bindings remains hidden
|
jtulach@64
|
69 |
as an implementation detail of communication between the generated model
|
jtulach@64
|
70 |
class(es) and appropriate technology bridge (like artifact with id <code>ko-fx</code>
|
jtulach@64
|
71 |
and group id <code>org.apidesign.html</code>).
|
jtulach@64
|
72 |
</p>
|
jtulach@64
|
73 |
<p>
|
jtulach@64
|
74 |
The model classes can be used for JSON based server communication. Just
|
jtulach@64
|
75 |
use <a href="OnReceive.html">@OnReceive</a> annotation to define a communication
|
jtulach@64
|
76 |
point in the model class. Please note, that the model classes can easily
|
jaroslav@103
|
77 |
be used on server as well - the same code can run
|
jaroslav@103
|
78 |
in your browser as well as on your server. Just add following to your <em>pom.xml</em>
|
jaroslav@103
|
79 |
to use your classes generated by <a href="Model.html">@Model</a> annotation
|
jaroslav@103
|
80 |
as <a href="http://jersey.java.net" target="new">Jersey</a> entities:
|
jtulach@64
|
81 |
</p>
|
jaroslav@103
|
82 |
<pre>
|
jaroslav@103
|
83 |
<dependency>
|
jaroslav@103
|
84 |
<groupId>org.glassfish.jersey.media</groupId>
|
jaroslav@103
|
85 |
<artifactId>html-json</artifactId>
|
jaroslav@219
|
86 |
<version>2.1</version>
|
jaroslav@103
|
87 |
<scope>runtime</scope>
|
jaroslav@103
|
88 |
</dependency>
|
jaroslav@103
|
89 |
</pre>
|
jtulach@64
|
90 |
<p>
|
jtulach@64
|
91 |
Behavior of model classes can be enriched by using
|
jtulach@64
|
92 |
<a href="ComputedProperty.html">@ComputedProperty</a> annotation (to
|
jtulach@64
|
93 |
define <em>derived</em> properties) and by
|
jtulach@64
|
94 |
<a href="Function.html">@Function</a> annotation to define handlers
|
jtulach@64
|
95 |
to be invoked from the HTML elements.
|
jtulach@64
|
96 |
</p>
|
jaroslav@239
|
97 |
<script type="text/javascript">
|
jaroslav@239
|
98 |
var arr = document.getElementsByTagName("img");
|
jaroslav@239
|
99 |
if (arr.length === 2) {
|
jaroslav@239
|
100 |
arr[0].style.visibility = 'hidden';
|
jaroslav@239
|
101 |
arr[0].height = 0;
|
jaroslav@239
|
102 |
}
|
jaroslav@239
|
103 |
</script>
|
jtulach@64
|
104 |
</body>
|