FXBrwsr
From APIDesign
(→Demo) |
(→Debugging) |
||
Line 9: | Line 9: | ||
== Debugging == | == Debugging == | ||
- | By merging advanced [[HTML]] technology (like [[Knockout.js]]) and [[Java]] one gets all the goodies of [[Java]] language, together with using more and more popular and powerful [[HTML]] presentation technologies | + | By merging advanced [[HTML]] technology (like [[Knockout.js]]) and [[Java]] one gets all the goodies of [[Java]] language, together with using more and more popular and powerful [[HTML]] presentation technologies - one gets [[Knockout4Java]]! The [[Java]] model is fully separated from the view (e.g. [[HTML]]), can be unit tested and also (as the code runs in [[HotSpot]] [[VM]] it can be fully debugged). Just follow the [[Twitter]] client instructions: |
* clone the http://source.apidesign.org/hg/html~demo/ [[Hg]] repository | * clone the http://source.apidesign.org/hg/html~demo/ [[Hg]] repository | ||
* open its ''twitter'' project in [[NetBeans]] IDE 7.3 | * open its ''twitter'' project in [[NetBeans]] IDE 7.3 |
Current revision
FXBrwsr is a subproject of Bck2Brwsr. Its goal is to use full featured Java runtime (e.g. real HotSpot VM), but still rely on a very lightweight rendering technology (so it can still fit Bck2Brwsr). What can be more lightweight (from a browser perspective) than HTML!?
FXBrwsr uses JavaFX's WebView component to display HTML. However to eliminate the need to manipulate the DOM directly, there is a special Java to Knockout.js binding. As a result the HTML uses Knockout.js syntax, yet the application code can be written in Java.
Install
In case you are running NetBeans 7.4, install HTML/Java Project support. Then you can create new project using project wizard: HTML5/HTML with Java Application Logic.
Debugging
By merging advanced HTML technology (like Knockout.js) and Java one gets all the goodies of Java language, together with using more and more popular and powerful HTML presentation technologies - one gets Knockout4Java! The Java model is fully separated from the view (e.g. HTML), can be unit tested and also (as the code runs in HotSpot VM it can be fully debugged). Just follow the Twitter client instructions:
- clone the http://source.apidesign.org/hg/html~demo/ Hg repository
- open its twitter project in NetBeans IDE 7.3
- open TwitterClient class and place breakpoint somewhere
- select Debug Project
You'll get all the goodies of Java. Moreover (as Twitter client page also mentions) you can still get your application Bck2Brwsr by selecting different Maven profile: bck2brwsr (see the combo in NetBeans 7.3 toolbar).
Demo
Demo showing the basics of Knockout4Java. These days you can use NetBeans 7.4, install HTML/Java Project Support plugin and create new project (HTML5/HTML with Java Applicatio Logic) using the project wizard.
The server side of the Twitter example no longer works as Twitter changed its protocol in May 2013. This is what you get when using services in the cloud! In addition to the video you can also use NetBeans HTML Easel support to inspect the DOM tree.