JavaFX Die neue UI- Technologie im JDK 8 Wolfgang Weigend Sen. Leitender Systemberater Java Technologie und Architektur 1 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle s products remains at the sole discretion of Oracle. 2 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Agenda Aktueller Status von JavaFX JavaFX-Aufbau und Architekturkonzept Vorteile von JavaFX bei der Entwicklung von JavaFX Anwendungen komplett in der Java Programmiersprache und mit Java Entwicklungswerkzeugen JavaFX Scene Builder Open Source Projekt OpenJFX Kundenbeispiele Zusammenfassung 3 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Existierende JavaFX Produkt Releases JavaFX 8 ist Bestandteil vom JDK 8 General Availability for Windows, Linux, Mac OS Java SE Development Kit 8 Update 6 for ARM Starting with JDK 8u33, JavaFX Embedded is removed from the ARM bundle and is not supported http://www.oracle.com/technetwork/java/javase/jdk-8u33-arm-relnotes-2406696.html http://mail.openjdk.java.net/pipermail/openjfx-dev/2015-january/016570.html Development Tools NetBeans 8.0.2 JavaFX Scene Builder 2.0 e(fx)clipse major release cycle alignment with eclipse roadmap minor release cycle with JavaFX roadmap 4 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
JavaFX and JDK for ARM Kevin Rushforth StartingwithJDK8u33,JavaFXhasbeenremovedfrombothOracleJDKforARMandOracleJavaSEEmbedded. This is a resource trade off within Oracle. Included in that difficult trade off decision was the ongoing investment needed to properly support FX in a world where so much the hardware is not standardized -- it really is difficult to have enough hardware and testing resources committed to support FX on ARM. It is important to understand that when we say support, we are not talking about just "running" on a device like the Raspberry PI -- but providing support for paying customers that are almost certainly going to be using hardware that is customized for their embedded product. ThisdoesnotmeanthatFXisgoingawayonotherplatforms,andhopefullydoesnotmeanwewillbedisappearingfromARMcompletely. The core JavaFX team will continue working on the ARM port as resources permit, hopefully with involvement of members of the OpenJFX community. We have continued to demonstrate this commitment with the moving all of the JavaFX sources to OpenJFX, and maintaining an up to date OpenJFX Wiki which includes detailed articles on building for ARM. WewillcontinuetodowhatwecantomakeiteasiertobuildandoverlayOpenJFXontopoftheARMJDKs. WehopetoarrangeforaexternalbuildofOpenJFXforARMsothatmorepeoplewillbeabletoeasilyobtainacurrentbuild. Most of the FX source code is shared across all ports, and we will continue to do regular internal builds of linux-armv6hf to ensure that it runs.wewillcontinuetomaintainthe*monocleglassplatforminanycase,asweuseitforsomeofourdesktopunittests. We have received a lot of help from the community -- particularly for ios and Android. Now we hope we can work together to keep Linux ARM viable and interesting. 5 Copyright 2015 Oracle and/or its affiliates. All rights reserved. *Monocle is now the default implementation of Glass on embedded platforms.
JavaFX Linux on ARM Port created by MicroDoc MicroDoc creates Linux on ARM Port for JavaFX on their own Source code and testing included As well for higher versions of Java, i.e. Java SE 9 MicroDoc leds own projects MicroDoc Linux on ARM Port created and shipped OpenJFX 8 source with Multi-Touch JavaFX build for manufacturing customer in Austria Debian Linux MicroDoc has started to create and deploy embedded runtimes in 1999 MicroDoc worked with customers from a large variety of industries including Automotive, Telematics, Telecommunication, GSM Network Infrastructure, Building Automation, Smart Home, Smart Grid / Smart Metering, Mobile Computing, Airline Traffic Management, Security Systems, Laser Technology, Education 6 Copyright 2015 Oracle and/or its affiliates. All rights reserved. Source: https://www.microdoc.com/
JavaFX Runtime Architektur JavaFX Architektur Komponenten Glass Windowing Toolkit: Provides native operating services, such as managing the windows, timers, and surfaces Prism: Graphics pipeline that can run on hardware and software renderers UI Toolkit: Ties Prism and Glass together and makes them available to the JavaFX APIs 7 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
JavaFX Architektur Internal API Course-grained porting layer FX APIs isolated from implementation details Allows porting to completely different systems 8 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
JavaFX Architektur Quantum Toolkit ties Prism and Glass Windowing Toolkit together and makes them available to the JavaFX layer above in the stack Quantum Toolkit manages the threading rules related to rendering versus events handling 9 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
JavaFX Architektur Graphics API Use hardware where possible Fast paths using shaders for ellipses, rectangles, etc. Reduce context switches Looking towards possible state sorting optimizations in the future Fallback to software rendering when necessary Bad drivers are the main reason for doing so 10 Copyright 2015 Oracle and/or its affiliates. All rights reserved. Converts the scene graph into rendering calls Abstracts D3D, OpenGL, Java2D behind a Graphics object Handles dirty regions, clipping, and other optimizations Font support Rasterization
JavaFX Architektur Windowing API Windows Mac Linux Headless (not done) Provides basic OS services Drawing surface Input events Event queue 11 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
JavaFX Scenegraph Scenegraph Instead of remove/add: group.getchildren().remove(node); group.getchildren().add(0, node); node.tofront() node.toback() Scenegraph node.tofront() node.toback() 12 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Displaying HTML in JavaFX public class WebViewDemo extends Application { public static void main(string[] args) { launch(args); } @Override public void start(stage stage) { WebView webview = new WebView(); webview.getengine().load("http://java.oracle.com"); Scene scene = new Scene(webView); stage.setscene(scene); stage.settitle("web View Demo"); stage.show(); } } 13 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
JavaFX mit JFXPanel Komponente in Swing Anwendungen einbinden public class Test { Class JFXPanel java.lang.object Scene scene = createscene(); java.awt.component fxpanel.setscene(scene); java.awt.container } javax.swing.jcomponent javafx.embed.swing.jfxpanel private static void initandshowgui() { // This method is invoked on Swing thread JFrame frame = new JFrame("FX"); final JFXPanel fxpanel = new JFXPanel(); frame.add(fxpanel); frame.setvisible(true); Platform.runLater(new Runnable() { private static void initfx(jfxpanel fxpanel) { // This method is invoked on JavaFX thread public static void main(string[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { initfx(fxpanel); } @Override public void run() { initandshowgui(); } }); }); } } } 14 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
[SwingNode, JFXPanel] Focus issue when mixing JavaFX and Swing multiple times - Runtime RT-39196 public class EmbeddedTestWithFX extends JFrame { Details: Bug in JDK 8u20 and JDK8u40EA on Windows 8 If Swing is embed into JavaFX which is embedded into Swing, the focus of controls have issues TextArea is shown, but It doesn't get the focus by clicking on it (It's the same for other controls, like jbuttons). If a FocusListener on the JTextArea is registered, you see that it becomes the focus after a click, but it loses the focus instantly. The example starts to work with: -Djavafx.embed.singleThread=true public EmbeddedTestWithFX() { setsize(new Dimension(300, 300)); JTextArea textarea = new JTextArea(); textarea.setsize(new Dimension(150, 150)); JPanel container = new JPanel(); container.setlayout(null); container.add(textarea); JFXPanel jfxpanel = new JFXPanel(); Platform.runLater(() -> { SwingNode swing = new SwingNode(); StackPane stack = new StackPane(swing); Scene scene = new Scene(stack); swing.setcontent(container); SwingUtilities.invokeLater(() -> jfxpanel.setscene(scene)); }); Clicked the TextArea, it holds the focus and text could be entered. } setcontentpane(jfxpanel); 15 Copyright 2015 Oracle and/or its affiliates. All rights reserved. } public static void main(string[] args) { new EmbeddedTestWithFX().setVisible(true); }
WebView und Swing Interoperabilität WebView Component Swing and SWT Interop. Browser Plug-In Embed Web content in JavaFX applications HTML rendering based on Webkit Hardware accelerated rendering using PRISM DOM access and manipulation Embed JavaFX content into existing Swing applications Extend existing Swing applications with new JavaFX features such as WebView and highperformance graphics Applies to SWT* applications as well Faster loading of JavaFX Web applications based on Prism Pre-loader for improved user experience with JavaFX Web applications 16 Copyright 2015 Oracle and/or its affiliates. All rights reserved. * Feature introduced since JavaFX 2.1
Swing to JavaFX Migration Swing UI Controls analysieren Soll Swing-Behavior in JavaFX Migration mit eingebaut werden? Exakt gleiche Darstellung auf Pixel-Ebene? Layout Manager Teilweise automatisch überführen Manuelle Tätigkeit Geschäftslogik/Code entflechten Wie stark ist die Verzahnung von Code & UI? Fachlicher Freeze während der Migration, mit dem Ziel einer möglichst kurzen Code-Freeze-Phase 17 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Design Objectives JavaFX Moving Client Forward Oracle s next generation Java client solution Built on Java in Java Modular architecture Migration path for Java client UI technologies Advanced tooling Delivering on the cross-platform promise 18 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Java APIs und FXML Java APIs für JavaFX FXML End-to-end Java development Java language features - generics, annotations, multi-threading Fluent API for UI construction Alternative JVM supported languages (e.g. Groovy, Scala) with JavaFX Leverage sophisticated Java IDEs, debuggers and profilers Java APIs preserve convenient JavaFX Script features (e.g., bind) Scriptable, XML-based markup language for defining UI Convenient alternative to developing UI programmatically in Java Easy to learn and intuitive for developers familiar with web technologies or other markup based UI technologies Powerful scripting feature allows embedding scripts within FXML. Any JVM scripting language can be used, including JavaScript, Groovy, and Scala 19 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Graphics und Media New Graphics Pipeline Media New hardware accelerated graphics pipeline (Prism) New windowing toolkit (Glass) for Prism Java2D Software Pipeline under Prism High-level support for making rich graphics simple Shadows, Blurs, Reflections, Effects, 2D transforms 3D Transforms today; Full 3D objects in future Stable media framework based on GStreamer H.264*, VP6; MP3, AAC* playback of Web multimedia content Low latency audio Alpha Channel support for full transparency to solid Pixel Performance improvements Full screen video 20 Copyright 2015 Oracle and/or its affiliates. All rights reserved. * Feature introduced since JavaFX 2.1
New JavaFX Features in JDK 8 New Modern Theme: Modena JavaFX 3D Rich Text TreeTableView DatePicker Public API for CSS structure WebView Enhancements Embedded Support 21 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Modena Modern Theme - New in JavaFX 8 22 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Rich Text - New in JavaFX 8 Use Cases text editor, code editor mixed style Labels, buttons, cells, headings, descriptions, large textual content, etc. Details TextFlow, a new layout container Text is just a node so you can add effects, event handlers, and animations You can also use CSS, FXML 23 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
TreeTableView - New in JavaFX 8 Goal: reuse as many API, or API concepts, as possible from the TreeView and TableView controls API 24 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
DatePicker - New in JavaFX 8 25 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Public API for CSS structure - New in JavaFX 8 CSS styling is one of the key features for JavaFX CSS has been implemented exclusively in private API (com.sun.javafx.css package) Tools (e.g. Scene Builder) require a CSS public API Developers will be able to define custom CSS styles 26 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Hello World in JavaFX Programming in Java public class JavaFXExample extends Application { @Override public void start(stage stage){ Scene scene = new Scene( LabelBuilder.create().text("Hello World!") }.layoutx(25).build()); stage.settitle("welcome to JavaFX!"); stage.setscene(scene); stage.show(); } public static void main(string[] args) { launch(args); } 27 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Hello World in JavaFX Programming in FXML und Java FXML <BorderPane> <center> <Label text= %helloworld"/> </center> </BorderPane> Java public class FXMLExample extends Application { @Override public void start(stage stage) throws Exception { stage.settitle("fxml Example"); Parent root = FXMLLoader.load(getClass().getResource ( example.fxml"), ResourceBundle.getBundle( r.fxml_example")); stage.setscene(new Scene(root)); stage.show(); } public static void main(string[] args) { launch(args); } } 28 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Java Entwicklungswerkzeuge Source editor with improved syntactic highlighting, code completion, refactoring etc. Full debugger and profiler support Project wizard for easy creation of JavaFX applications Other Java IDE s Source editor with syntactic highlighting, code completion, refactoring etc. Full debugger and Profiler support 29 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Die Community beteiligt sich The third party developer community has shown interest in JavaFX. Here are a few projects: e(fx)clipse: plugins for Eclipse and for OSGi DataFX: data source and cell factories for JavaFX UI controls ScalaFX, GroovyFX: Scala and Groovy bindings for JavaFX JFX Flow, efx, JRebirth: application development frameworks FXForms2: automatic form generation JFXtras: UI controls and extensions for JavaFX XDEV IDE and XDEV Application Framework XAPI 30 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Gluon Ignite library Dependency Injection Frameworks in JavaFX applications With the Gluon Ignite library, developers can use popular dependency injection frameworks in their JavaFX applications, including inside their FXML controllers Gluon Ignite creates a common abstraction over several popular dependency injection frameworks: currently Guice, Spring, and Dagger, and plan to add more as the demand becomes obvious With full support of JSR-330 Gluon Ignite makes using dependency injection in JavaFX applications trivial Example of creating an application using the Guice framework and Gluon Ignite: Source: http://gluonhq.com/ open-source/ignite/ 31 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Funktionale Systemtests für JavaFX Automatisiertes Testen für JavaFX UI Controls QF-Test Firma Quality First Software Professionelles GUI-Testen für Java & Web www.qfs.de Functional Testing UI Controls Scenegraph 32 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
QF-Test und JavaFX 8 JavaFX ist eine pure Java-Anbindung analog Swing Erfahrungsschatz erlaubt schnelle Erweiterung auf JavaFX Technischer Durchstich bereits erfolgreich vollzogen Offizielle Unterstützung für Java 8 QF-Test Version 4.0.7 freigegeben Java Swing Eclipse/SWT 33 Copyright 2015 Oracle and/or its affiliates. All rights reserved. Web
QF-Test & JavaFX 8 GUI Testautomatisierung 34 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
JavaFX Scene Builder 2.0 http://www.oracle.com/technetwork/java/javase/downloads/sb2download-2177776.html 35 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
JavaFX Scene Builder UI layout tool for JavaFX FXML visual editor Can be used standalone or with all major Java IDEs Tighter integration with NetBeans IDE Preview mode CSS support Supported on Windows and Mac OS X 36 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Gluon supports Scene Builder Scene Builder only as source code within the OpenJFX project Gluon provides Scene Builder builds Actively work on improvements to Scene Builder, in a public repo, to further drive the functionality of Scene Builder forward These builds will be the Oracle bits, with additional improvements based on community involvement and our desires to better support third party projects such as ControlsFX, FXyz, DataFX, others Downloads: Note: Scene Builder is open source and licensed under the BSD license 37 Copyright 2015 Oracle and/or its affiliates. All rights reserved. Source: http://gluonhq.com/open-source/scene-builder/
JavaFX und Open Source http://openjdk.java.net/projects/openjfx OpenJFX UI Controls Scenegraph JemmyFX 38 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
JavaFX via Open Source im JDK 8 Open Source OpenJFX Project under OpenJDK First phase to focus on UI Controls Übergang Common license with Java SE JavaFX included in Java SE with JDK 8 JavaFX for Java SE Embedded (ARM), see Oracle notes earlier Standardisierung Oracle committed to JavaFX standardization JSR to be submitted through JCP and JSR expected for JDK 9 39 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Open Source und Standardisierung JavaFX source code being contributed as part of OpenJFX http://openjdk.java.net/projects/openjfx/ Source code being contributed in phases Open sourced as of March 2013 UI Controls Scene Graph JemmyFX Functional Tests Oracle is committed to standardize JavaFX through JCP One or more JSRs will be submitted Expected to be become part of the Java SE specification 40 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Die künftige Ausrichtung von JavaFX Oracle s Next Generation Java Client Solution Tighter Integration with Java SE Migration Path for Java Client UI Technologies Optimized Web Services Support Advanced Tooling Support for Modern Device Interactions Delivering on the Cross Platform Promise 41 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
JavaFX goes Open Source ios- und Android-Implementierungen ios- und Android-Implementierungen sind Open Source Lizensierung mit eigenem Applikations-Co-Bundle 42 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Alternative usage of RoboVM Develop iphone and ipad Apps in Java with RoboVM Java to Native The RoboVM ahead-of-time compiler translates Java bytecode into native ARM or x86 code Apps run directly on the CPU, no interpreter or virtual machine involved Objective-C Bridge RoboVM includes a Java to Objective-C bridge Bridged Objective-C objects can be used just like any other Java object Much of UI-Kit is already bridged and more frameworks will follow http://blog.robovm.org/2013/05/javafx-openjfx-on-ios-using-robovm.html 43 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
JavaFXPorts: JavaFX on Mobile and Tablets Package your JavaFX Application for deployment on ios and Android JavaFX on client, desktop, laptop and embedded systems JavaFX on mobile and tablets Why is a port needed? - Isn't Java Write Once Run Anywhere? OpenJDK http://javafxports.org/page/home 44 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
JavaFX Kundenbeispiele 45 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
JavaFX Anwendungen Celer is a trading management platform for every asset class, the true multi asset modular trading platform. Built by traders for traders. The Celer Trading module is built on top of the Celer framework and combines an execution and order management system in one, giving all the control needed in one easy to use platform. Quick order entry and combination depth deal tickets are just some of the features that the platform can offer customer trading. Software Development Kit (SDK) The Celer Framework SDK allows to build the next feature to keep customer business ahead of the competition and to adapt to customer needs in the future. 46 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Volkswagen Group Research - Reactive Modeling of Automotive User Interfaces with JavaFX UI series development at Volkswagen Group UI prototyping at Volkswagen Group Research The UI framework Tappas Reactive UI modeling Implementation of reactive models with JavaFX JavaFX on automotive target hardware 47 Copyright 2015 Oracle and/or its affiliates. All rights reserved. Source: Volkswagen Group Research at JavaOne 2014
UI series development at Volkswagen Group User interfaces for automotive infotainment systems are developed for various models, brands and markets at Volkswagen Group A high number of variants and skins are required The development is based on state chart models Java 1.4 code is generated Rendering is hardware accelerated using OpenGL ES 48 Copyright 2015 Oracle and/or its affiliates. All rights reserved. Source: Volkswagen Group Research at JavaOne 2014
UI prototyping at Volkswagen Group Research UI prototypes require fast and flexible development JavaFX is our technology of choice, replacing Flash Source: Volkswagen Group Research at JavaOne 2014 49 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
JavaFX - UI prototyping at Volkswagen Group Research - Tappas UI framework UI prototypes require fast and flexible development JavaFX is our technology of choice, replacing Flash Tappas UI framework Highly modular and flexible with OSGi Different JavaFX center console applications for different hardware and operating concepts Single screen, split screen or dual screen applications Hardware keys, direct touch or indirect touch operation Various JavaFX apps as OSGi bundles, running within the different center console applications Tuner, media, telephone, contacts, climate, navigation with a 3D map written in JavaFX, etc. Reactive modeling of screen changes Quelle: Volkswagen AG, Jens Ehrke & Simon Gerlach, JavaOne 2014, 1. Oktober 2014 Reactive Modeling of Automotive User Interfaces with JavaFX 50 Copyright 2015 Oracle and/or its affiliates. All rights reserved. Source: Volkswagen Group Research at JavaOne 2014
Zusammenfassung JavaFX is the strategic Java UI technology for rich client applications Unified development of Java and Web applications Browser Plug-in, Web Start, Native Executables Hardware Accelerated Graphics (DirectX, OpenGL) JavaFX with HTML-DOM JavaFX with WebView for HTML5 features Improved JavaScript Engine JavaFX as applet integrated to run in a web page IDE support for Eclipse e(fx)clipse, IntelliJ, IDEA, NetBeans, etc. Wanted JavaFX for mobile operating systems ios & Android - desirable Developer community could make use of the JavaFX Open Source process Get hands-on porting for ios and Android 51 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Ressourcen Downloads: http://otn.oracle.com/javafx OpenJFX: http://openjdk.java.net/projects/openjfx/ Oracle Premier Support http://www.oracle.com/us/support/software/premier/ Blogs http://blogs.oracle.com/javafx http://fxexperience.com OTN Forum: https://forums.oracle.com/forums/forum.jspa?forumid=1385 Twitter: @javafx4you 52 Copyright 2015 Oracle and/or its affiliates. All rights reserved.
Danke! Wolfgang.Weigend@oracle.com Twitter: wolflook 53 Copyright 2015 Oracle and/or its affiliates. All rights reserved.