JavaFX 2.0: A Platform for Rich Enterprise Client Apps
The update to JavaFX allows developers to leverage features from the Java API.
by Manoj Debnath
May 3, 2012
Page 1 of 2
JavaFX 2.0 revamped the Java API for application development, discarding its predecessor's clumsy scripting language. This enhancement has captured the attention of developers to rethink JavaFX 2.0 as a platform for creating and deploying rich client applications. Developers can now leverage their existing Java skills without worrying about spaghetti scripting code. JavaFX 2 can run either as a standalone desktop application or in the browser. The architecture is extensible with existing Swing or the SWT API.
JavaFX 2.0 is a rich client platform designed to provide an environment that not only minimizes development time but also eases the deployment of data-driven business and enterprise client applications.
JavaFX 2.0 Architectural Overview
JavaFX 2.0 is comprised of several subcomponents, including a high-performance graphics engine named Prism. Prism is the byproduct of a Mozilla Labs experiments to bridge the gap in user experience between Web applications and desktop apps. JavaFX also includes the Glass window toolkit, a media engine and a Web engine.
The JavaFX public API provides freedom and flexibility in creating rich client applications. Since JavaFX 2 includes the capabilities of the Java platform, it can leverage the power of Java features such as annotations, multi-threading, generics, and the extended Java collection library. Most of the API and programming model have been ported directly as a lineage of its predecessor, while some APIs such as Layout and Media have been optimized and simplified in response to the feedback from previous FX users.
Scene graph is the starting point of JavaFX 2.0 application. It is responsible for rendering user interfaces and handling user input through various visual elements represented as hierarchical tree of nodes. Each item in the scene graph is called a node and has one parent and zero or more children. The javafx.scene API simplifies working with rich UIs.
The Quantum Toolkit connects Prism and Glass Windowing Toolkit together to make them available to the JavaFX layer above them in the stack and also manages the threading rules related to rendering versus events handling.
Prism is responsible for rasterization and rendering of JavaFX scenes and processes rendering jobs. It can run on both hardware and software renderers, including 3-D.
Glass Windowing Toolkit's main responsibility is to provide native operating services, such as managing the windows, timers and surfaces. It serves as the platform-dependent layer that connects the JavaFX platform to the native operating system. The Glass toolkit is also responsible for managing the event queue.
The Media Engine component has been completely redesigned for JavaFX 2.0 to increase stability, improve performance and provide consistent behavior across platforms.
JavaFX 2.0 Key Features
JavaFX APIs: Many API features are carried over from the Java language, such as use of generics, annotations, multi-threading and collections classes. Collections are defined by the javafx.collections package consisting of the following interfaces and classes:
ObservableList: It is a list that enables listeners to track changes at the time of occurrence
ListChangeListener: It is an interface that receives notifications of changes to an ObservableList
ObservableMap: It is a map that enables observers to track changes when they occur
MapChangeListener: It is an interface that receives notifications of changes to an ObservableMap
FXCollections: It is an utility class consists of static methods that are mapped copies of java.util.Collections methods
ListChangeListener.Change: It represents a change made to an ObservableList
MapChangeListener.Change: It represents a change made to an ObservableMap
The close integration between JavaFX and the Java API has enabled developers to leverage sophisticated Java IDEs, debuggers and profilers in building rich client applications.
Graphics Pipeline for Modern GPUs: It is convenient to build rich graphics with support for high-level APIs, such as blurs, shadows, 2D /3D transformation, effects, charts and reflections. The windowing toolkit gets hardware accelerated graphics pipeline support from Prism. And for unsupported graphics hardware, there is also provision for support by the Java 2D software pipeline. The animation engine is optimized to implement transitions with complete overhaul of the API to simplify usage.
Set of Rich UI Controls: There are more than 50 components for form-based UI, including charts, layout and form controls. User Interface Controls are specialized Nodes in the JavaFX Scene graph suited for reuse in many different application contexts. Cascading Style Sheet (CSS) can be used effectively to design the look and feel and layout of user interface controls. The JavaFX UI controls available through the API are built by using nodes in the scene graph. Thus the controls can use visually rich features of the JavaFX platform. As the JavaFX APIs is fully implemented in Java, it is easy to integrate the JavaFX UI controls into existing Java applications.
Render HTML content from local and remote URLs
Access document model from Java code
Manage web pop-up windows
Apply effects to the embedded browser
Powerful Properties Model: JavaFX 2.0 also introduced a new set of collections, such ObservableList, Sequence and ObservableMap, which can be used effectively in cooperation with the existing Collection classes of Java. In addition, introduced new design and implementation of bean properties and a low-level binding API for high performance lowering footprint bindings.