Representation of the
HTML Geo API for Java provides annotation based way of obtaining geolocation information from a browser or any other device capable of providing it.
Interfaces for integrators of various execution environments. Not really interesting for clients.
Service provider classes to build
Service provider interfaces for those willing to
Service Provider Interfaces for those who wish to integrate own technology with the HTML for Java API.
Entry point to the test compatibility kit.
The HTML/Java API is an alternative to Swing and JavaFX for creating
applications with a graphical user interface. It's major strengths is the
intelligent combination of existing technologies.
The motivation for this project is the inability of Swing and JavaFX to keep up with the rapid development of browser based technologies, and the uncertain future of Swing and JavaFX. The logical solution is to simply use these technologies from Java instead of trying to build a whole own alternative stack. With Java/HTML we created a better and more powerful alternative, which is still small and easy to maintain.
For this Java/HTML makes use of the
Model View ViewModel (MVVM)
pattern to separate
the view from the logic of the application. This approach is different
from Swing or JavaFX, as the Java code doesn't require any references to the widgets
that are displayed in the view. The Java code instead exposes
for the View to bind to, and
functions that can be called in response to user
interactions. This keeps the
Java API small and simple to learn.
This architecture also makes it easy to port the technology to different platforms. Porting of HTML/Java is as easy as implementing
interface and successfully passing the
test compatibility kit.
Various ports of this rendering pipeline were built including support for
pure "webkit desktop rendring
and iOS WebView
developed by DukeScript project.
$ mvn archetype:generate \ -DarchetypeGroupId=com.dukescript.archetype \ -DarchetypeArtifactId=knockout4j-archetype \ -DgroupId=your.company -DartifactId=test -Dversion=1.0-SNAPSHOT -DarchetypeVersion=0.30 \ # or newer version, if availableand then you can:
$ cd test $ mvn install $ mvn -f client/pom.xml process-classes exec:exec
We tried to make our API Docs as useful as possible, so they contain lots of valuable information. So this should be your first stop when looking for information: Current development version
The DukeScript project contains a lot of information for Java/HTML developers. There's a Blog with the latest news and tips and tricks how to get the most out of these APIs and also an extensive getting started guide explaining all the concepts and walking you through code examples. For advanced users there's an in depth tutorial on the Knockout For Java API with many examples and tipps and tricks.
New modules are provided since PR #23:
render- a way to start a browser - using native GTK (on Linux and Mac OS X), AWT or CLI
browser- uses of
ProtoPresenterBuilderto start a local server and let a browser connect to it
webkit- native presenter for Linux and Mac OS X that uses WebKit via JNA
One model instance can be used in two views
GC related behavior has been improved
sanitized builder to
ScriptEngine-based execution environment
Compiles on JDK11 while using
Open JavaFX 11
Computed properties can
depend on other computed properties -
made repeatable -
@Model annotation processor bugfix
Using Android JSON
parsing library as it is Apache licensed -
It is acceptable to read properties of a model when
computing a property.
Regular subclassing of
- better garbage collector related behavior of ko4j instances thanks
to introduction of
license in the ko4j artifact - bug
Simplifying dependencies of
org.netbeans.html.json.tck - bug
Bug fix for
multiple observers on a single model object.
GC behavior specified in TCK and used in Knockout for Java implementation.
Removing dependency on Java collection classes implementations.
Models.asList(T...) factory method to
a create simple list implementation.
KnockoutTCK to avoid
undefinedare treated as null. Better behavior under multi-threaded load. Workaround for garbage collector behavior of modern JavaFX WebView implementations (JDK8 u112 and newer). JavaFX Presenter can show popup window. Development has switched to Git repository thanks to conversion by Emilian Bold. Better support for obfuscation of knockout module (bug 270013).
Model classescan have
per-instance private data.
Model classescan generate builder-like construction methods if builder
-Dfxpresenter.headless=truewhen launching its virtual machine and no window will be shown. This is particularly useful for testing. Configure your surefire or failsafe plugins like:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.13</version> <configuration> <systemPropertyVariables> <fxpresenter.headless>true</fxpresenter.headless> </systemPropertyVariables> </configuration> </plugin>OSGi headers are now enterprise OSGi ready. Switched to minified version 3.4.0 of knockout.js. Better support for recursive @Model definitions. New module
org.netbeans.html:xhr4jprovides implementation of
technology identifierxhr4j - this module can be used to workaround limitations of CORS by handling the
OnReceiveconnections in Java.
One can control
HTTP request headers
when connecting to server using the
annotation. It is possible to have
writable computed properties.
There is an easy way to enable Firebug in
the JavaFX based Web View -
just run with
Bugfix of issues 250503,
The content of a
can be selected by registering implementations under specific
and requesting them during
of the context.
org.netbeans.html:ko4j module's implementation
offers ko4j, xhr and websocket identifiers
for its registered services
module registers its
Java based JSON and
under the name tyrus.
A particular DOM subtree
that a knockout.js model gets
applied to can be selected by using
Models.applyBindings(m, id) with an id of an HTML element.
There is new
which controls behavior of the generated
If specified and non-empty, then the generated method
this and the provided
If specified, but left empty, then the generated method
If unspecified, the method will not be generated at all
(a change with respect to older versions). However one can
to perform the association of any model with the page element.
Memory model when using Knockout bindings has been improved
(required additions of two new methods:
now the Java
models can garbage collect,
when no longer used. Library writers that use
control garbage collection behavior of method arguments by
Array properties are now
mutable from the knockout.js
point of view (required
one SPI change).
The page lookup mechanism can use
to load localized a page with appropriate suffix.
All SPI were moved under the NetBeans namespace - e.g.
org.netbeans.html.sound.spi, and also
org.netbeans.html.json.tck. Methods annotated
without fallback Java code now throw
with a message suggesting to switch to proper
browser context to
prevent endless debugging when one forgets to do so.
System can run in
Felix OSGi container (originally only Equinox).
now deeply check changes in other
classes they depend on and recompute their values accordingly.
Knockout.js library has been updated
to version 3.2.0.
Setters or array properties on classes generated by
annotation can be accessed from any thread.
can be registered into
BrwsrCtx. There is
to parse a JSON array and convert it into
Improved behavior of
enum values in
Few bugfixes for better portability.
New API for
on top of Nashorn - does not run knockout for Java
(reported as JDK-8046013),
however even in current state it is quite
useful for testing
FXBrowsers has been extended
with new helper methods to make it easier to use HTML+Java
API in existing JavaFX applications.
The annotation processor is made
more robust with respect to errors in callback syntax of
has been improved based on a failure of its usability study.
There can be additional parameters to methods annotated by
OnReceive that allows one to
pass state when a JSON call is made and use it when it finishes.
The mechanism of discovery of sibling HTML page has been
extended to work on systems that don't support
asynchronous execution. Libraries using
new attribute as much as possible, as it can speed up execution
in certain environments.
Copyright © 2019 The Apache Software Foundation. All rights reserved.