SlideShare a Scribd company logo
DataFX 
From External Data to a UI Flow 
and Back 
8
About us 
Johan Vos 
@johanvos 
. www.lodgon.com 
Hendrik Ebbers 
@hendrikEbbers 
www.guigarage.com 
. 
Jonathan Giles 
@JonathanGiles 
www.fxexperience.com
Overview
Overview 
DataSources Websocket 
Injection 
Flow
DataSources
DataSources 
Goal: 
Facilitate the interaction between a JavaFX 
Application and Enterprise Data, respecting 
the commonalities and differences between 
the Enterprise World and the Client World.
DataSources 
Data 
DataFX 
DataReader 
Converter 
DataProvider 
Observable / 
ObservableList
DataSources 
iOS Desktop Client 
REST 
Business Layer 
Server 
Persistence 
Android 
Web 
Well-known, 
Well-documented 
Non-proprietary 
protocols
Protocols 
REST 
SSE 
WebSockets 
XML 
JSON 
JDBC 
File
JFX characteristics 
Observable, ObservableList 
Leverage dynamic updates to objects and lists. 
Modifications can be propagated immediately 
to JavaFX Controls. No error-prone wiring 
needed. 
JavaFX Application Thread 
Modifactions that result in UI changes should 
only happen on the JavaFX Application Thread. 
Apart from those, nothing should happen on the 
JavaFX Application Thread
DataSources 
Read Data 
REST, SSE, WebSocket 
Convert Data 
Into Java Objects 
XMLConverter, JsonConverter 
Provide Data 
As Observable instances or ObservableList 
instances
JavaFX Integration 
Using DataSources, your data (Observable) 
and data containers (ObservableList) can 
be kept up-to-date. 
JavaFX Controls often use Observable or 
ObservableList: 
Label: Label.textProperty(); 
ListView: ListView.setItems(ObservableList);
Examples 
Project Avatar 
JS on the backend 
JS on the client 
REST, SSE, WebSockets with JSON in 
between 
Avatarfx demonstrates avatar examples in 
JavaFX client
REST 
Similarity with JAX-RS 2.0 Client API 
Simple 
Builders or get/set 
OAuth support 
GET/POST/PUT/DELETE 
Classes: 
io.datafx.io.RestSource and 
io.datafx.io.RestSourceBuilder
Demo Time
SSE 
Wikipedia: 
Server-sent events is a standard describing 
how servers can initiate data transmission 
towards clients once an initial client connection 
has been established.
SSE 
Client initiates connection 
Server sends data, DataFX creates an 
Object with Observable fields 
Every now and then, server sends updated 
data 
DataFX makes sure the Observable fields 
are updated
Demo Time
WebSockets 
Leverage client-part of JSR 356, Java 
standard for WebSocket protocol. 
Works with any service that supports the 
WebSocket protocol 
DataFX retrieves incoming messages, and 
populates an ObservableList
Demo Time
Add
Concurrency
Concurrency API 
JavaFX is a single threaded toolkit 
You should not block the platform thread 
Rest calls may take some time... 
...and could freeze the application
DataFX Executor 
Executor implementation 
supports title, message and progress for 
each service 
supports Runnable, Callable, Service & 
Task 
cancel services on the gui 
Configurable Thread Pool
Demo Time
Let‘s wait 
like SwingUtilities.invokeAndWait(...) 
void ConcurrentUtils.runAndWait(Runnable runnable) 
T ConcurrentUtils.runAndWait(Callable<T> callable) 
we will collect all 
concurrent helper 
methods here
Stream Support 
JDK 8 has Lambdas and the awesome 
Stream API 
Map and reduce your collections in 
parallel 
But how to turn into the JavaFX 
application thread?
Stream Support 
StreamFX<T> streamFX = new StreamFX<>(myStream); 
it is a wrapper 
ObservableList<T> list = ...; 
streamFX.publish(list); 
! 
! 
! 
streamFX.forEachOrdered(final 
Consumer<ObjectProperty<? super T>> action) 
this will happen in the 
application thread
Process Chain 
Like SwingWorker on steroids 
Support for an unlimited chain of 
background and application tasks 
ExceptionHandling 
Publisher support
Process Chain 
ProcessChain.create(). 
addRunnableInPlatformThread(() -> blockUI()). 
addSupplierInExecutor(() -> loadFromServer()). 
addConsumerInPlatformThread(d -> updateUI(d)). 
onException(e -> handleException(e)). 
withFinal(() -> unblockUI()). 
run();
Demo Time
Concurrency API 
DataFX core contains all basic classes 
Can be integrated in all applications 
Exception Handling 
Java8 Lambda support 
Configuration of thread pool 
Add async operations the easy way
Flow API
JavaFX Basics 
In JavaFX you should use FXML to 
define your views 
You can define a controller for the view 
Link from (FXML-) view to the controller 
<HBox fx:controller="com.guigarage.MyController"> 
<TextField fx:id="myTextfield"/> 
<Button fx:id="backButton" text="back"/> 
</HBox>
View Controller 
Some kind of inversion of control 
Define the FXML in your controller class 
Create a view by using the controller class
View Controller 
@FXMLController("Details.fxml") 
public class DetailViewController { 
@FXML 
private TextField myTextfield; 
@FXML 
private Button backButton; 
@PostConstruct 
public void init() { 
myTextfield.setText("Hello!"); 
} 
} 
define the 
FXML file 
default Java 
annotation
View Context 
Support of different contexts 
Inject context by using Annotation 
Register your model to the context 
PlugIn mechanism
Flow API 
The View Controller is good for one view 
How to link different view?
Flow API 
open View View 
View 
View 
View 
View 
search 
details 
open 
diagram 
setting *
Master Detail 
two views: master and detail 
use FXML 
switch from one view to the other one 
delete data on user action 
decoupling all this stuff!!
Master Detail 
details 
MasterView DetailsView 
back 
delete
Master Detail 
details 
delete 
MasterView DetailsView 
back 
FXML Controller FXML Controller
Master Detail 
details 
MasterView DetailsView 
Flow flow = new Flow(MasterViewController.class). 
withLink(MasterViewController.class, "details", DetailsViewController.class). 
withLink(EditViewController.class, "back", MasterViewController.class). 
direct link between the views 
action id 
back 
delete
Master Detail 
details 
MasterView DetailsView 
define a custom action … 
Flow flow = new Flow(MasterViewController.class). 
. . . 
withTaskAction(MasterViewController.class, "delete", RemoveAction.class); 
! 
! 
! 
action name 
withTaskAction(MasterViewController.class, "delete", () -> . . .); 
delete 
back 
delete 
… or a Lambda
Master Detail 
Use controller API for all views 
Define a Flow with all views 
link with by adding an action 
add custom actions to your flow 
but how can I use them?
Master Detail 
@FXMLController("Details.fxml") 
public class DetailViewController { 
! 
@FXML 
@ActionTrigger("back") 
private Button backButton; 
@PostConstruct 
public void init() { 
//... 
} 
@PreDestroy 
public void destroy() { 
//... 
} 
} 
controller API 
defined 
in FXML bind your flow 
actions by annotation 
listen to the 
flow
Master Detail 
bind it by id 
@FXMLController("Details.fxml") 
public class DetailViewController { 
! 
@FXML 
@ActionTrigger("delete") 
private Button backButton; 
@PostConstruct 
public void init() { 
//... 
} 
@ActionMethod("delete") 
public void delete() { 
//... 
} 
}
Flow API 
share your data model by using contexts 
ViewFlowContext added 
@FXMLViewFlowContext 
private ViewFlowContext context; 
You can inject contexts in your 
action classes, too 
@PostConstruct and @PreDestroy are 
covered by the view livecycle
Flow API 
Provides several action types like 
BackAction 
@BackAction 
private Button backButton; 
(Animated) Flow Container as a wrapper 
DataFX Core ExceptionHandler is used 
Flows are reusable
Demo Time
Flow API 
By using the flow API you don‘t have 
dependencies between the views 
Reuse views and actions 
Use annotations for configuration
Injection API
Injection API 
By using the flow api you can inject 
DataFX related classes 
But how can you inject any data?
Injection API 
Based on JSR 330 and JSR 299 
Developed as plugin of the flow API 
Use default annotations
Injection API 
ViewScope: Data only lives in one View 
FlowScope: Data only lives in one Flow 
ApplicationScope: Data lives in one App 
DependentScope: Data will be recreated
Demo Time
Injection API 
It’s not a complete CDI implementation! 
Qualifier, etc. are currently not supported 
No default CDI implementation is used 
Weld and OpenWebBeans core modules 
are Java EE specific
Injection API 
Inject your data in the view controller 
Define the scope of data types 
Add your own scope
DataFX Labs
Validation API 
Use of Java Bean Validation (JSR 303) 
Developed as a Flow API plugin 
Supports the JavaFX property API 
public class ValidateableDataModel { 
@NotNull 
private StringProperty name; 
}
Validation API 
@FXMLController("view.fxml") 
public class ValidationController { 
@Valid 
private ValidateableDataModel model; 
@Validator 
private ValidatorFX<ValidationController> validator; 
public void onAction() { 
validator.validateAllProperties(); 
} 
}
EJB Support 
Access remote EJBs on your client 
Developed as a Flow API plugin 
API & a experimental WildFly 
implementation
EJB Support 
@FXMLController("view.fxml") 
public class ViewController { 
! 
@RemoteEjb() 
RemoteCalculator calc; 
! 
@FXML 
@ActionTrigger("add") 
Button myButton; 
! 
@ActionMethod("add") 
public void add() { 
runInBackground(() -> sysout(calc.add(3, 3))); 
} 
! 
}
Feature Toggles 
Integrate feature toggles in the view 
Developed as a Flow API plugin 
@FXMLController("featureView.fxml") 
public class FeatureController { 
! 
@FXML 
@HideByFeature("PLAY_FEATURE") 
private Button playButton; 
! 
@FXML 
@DisabledByFeature("FEATURE2") 
private Button button2; 
! 
}
www.datafx.io
QA
Ad

More Related Content

What's hot (20)

JavaFX – 10 things I love about you
JavaFX – 10 things I love about youJavaFX – 10 things I love about you
JavaFX – 10 things I love about you
Alexander Casall
 
Java Enterprise Edition
Java Enterprise EditionJava Enterprise Edition
Java Enterprise Edition
Francesco Nolano
 
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
Stephen Chin
 
Jetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO ExtendedJetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO Extended
Toru Wonyoung Choi
 
What's New in Java 8
What's New in Java 8What's New in Java 8
What's New in Java 8
javafxpert
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
yuvalb
 
Building an app with Google's new suites
Building an app with Google's new suitesBuilding an app with Google's new suites
Building an app with Google's new suites
Toru Wonyoung Choi
 
Web注入+http漏洞等描述
Web注入+http漏洞等描述Web注入+http漏洞等描述
Web注入+http漏洞等描述
fangjiafu
 
Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)
Yevgeniy Brikman
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web Application
Yakov Fain
 
Getting started with Java 9 modules
Getting started with Java 9 modulesGetting started with Java 9 modules
Getting started with Java 9 modules
Rafael Winterhalter
 
Lecture 3: Servlets - Session Management
Lecture 3:  Servlets - Session ManagementLecture 3:  Servlets - Session Management
Lecture 3: Servlets - Session Management
Fahad Golra
 
Java fx smart code econ
Java fx smart code econJava fx smart code econ
Java fx smart code econ
Tom Schindl
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
Dzmitry Naskou
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods pptJava servlet life cycle - methods ppt
Java servlet life cycle - methods ppt
kamal kotecha
 
Spring Core
Spring CoreSpring Core
Spring Core
Pushan Bhattacharya
 
Using the Tooling API to Generate Apex SOAP Web Service Clients
Using the Tooling API to Generate Apex SOAP Web Service ClientsUsing the Tooling API to Generate Apex SOAP Web Service Clients
Using the Tooling API to Generate Apex SOAP Web Service Clients
Daniel Ballinger
 
Jdbc example program with access and MySql
Jdbc example program with access and MySqlJdbc example program with access and MySql
Jdbc example program with access and MySql
kamal kotecha
 
Spring framework in depth
Spring framework in depthSpring framework in depth
Spring framework in depth
Vinay Kumar
 
struts
strutsstruts
struts
Arjun Shanka
 
JavaFX – 10 things I love about you
JavaFX – 10 things I love about youJavaFX – 10 things I love about you
JavaFX – 10 things I love about you
Alexander Casall
 
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
JavaFX 2 and Scala - Like Milk and Cookies (33rd Degrees)
Stephen Chin
 
Jetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO ExtendedJetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO Extended
Toru Wonyoung Choi
 
What's New in Java 8
What's New in Java 8What's New in Java 8
What's New in Java 8
javafxpert
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
yuvalb
 
Building an app with Google's new suites
Building an app with Google's new suitesBuilding an app with Google's new suites
Building an app with Google's new suites
Toru Wonyoung Choi
 
Web注入+http漏洞等描述
Web注入+http漏洞等描述Web注入+http漏洞等描述
Web注入+http漏洞等描述
fangjiafu
 
Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)
Yevgeniy Brikman
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web Application
Yakov Fain
 
Getting started with Java 9 modules
Getting started with Java 9 modulesGetting started with Java 9 modules
Getting started with Java 9 modules
Rafael Winterhalter
 
Lecture 3: Servlets - Session Management
Lecture 3:  Servlets - Session ManagementLecture 3:  Servlets - Session Management
Lecture 3: Servlets - Session Management
Fahad Golra
 
Java fx smart code econ
Java fx smart code econJava fx smart code econ
Java fx smart code econ
Tom Schindl
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
Dzmitry Naskou
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods pptJava servlet life cycle - methods ppt
Java servlet life cycle - methods ppt
kamal kotecha
 
Using the Tooling API to Generate Apex SOAP Web Service Clients
Using the Tooling API to Generate Apex SOAP Web Service ClientsUsing the Tooling API to Generate Apex SOAP Web Service Clients
Using the Tooling API to Generate Apex SOAP Web Service Clients
Daniel Ballinger
 
Jdbc example program with access and MySql
Jdbc example program with access and MySqlJdbc example program with access and MySql
Jdbc example program with access and MySql
kamal kotecha
 
Spring framework in depth
Spring framework in depthSpring framework in depth
Spring framework in depth
Vinay Kumar
 

Viewers also liked (14)

Check style 기초가이드
Check style 기초가이드Check style 기초가이드
Check style 기초가이드
rupert kim
 
JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016
Hendrik Ebbers
 
BUILDING MODERN WEB UIS WITH WEB COMPONENTS @ Devoxx
BUILDING MODERN WEB UIS WITH WEB COMPONENTS @ DevoxxBUILDING MODERN WEB UIS WITH WEB COMPONENTS @ Devoxx
BUILDING MODERN WEB UIS WITH WEB COMPONENTS @ Devoxx
Hendrik Ebbers
 
Delivering unicorns
Delivering unicornsDelivering unicorns
Delivering unicorns
Katarzyna Mrowca
 
JavaFX - Straight from the trenches
JavaFX - Straight from the trenchesJavaFX - Straight from the trenches
JavaFX - Straight from the trenches
Anderson Braz
 
UI test automation techniques by an example of JavaFX UI
UI test automation techniques by an example of JavaFX UIUI test automation techniques by an example of JavaFX UI
UI test automation techniques by an example of JavaFX UI
yaevents
 
Java Fx - Return of client Java
Java Fx - Return of client JavaJava Fx - Return of client Java
Java Fx - Return of client Java
Shuji Watanabe
 
From Swing to JavaFX
From Swing to JavaFXFrom Swing to JavaFX
From Swing to JavaFX
Yuichi Sakuraba
 
JavaFX Your Way: Building JavaFX Applications with Alternative Languages
JavaFX Your Way: Building JavaFX Applications with Alternative LanguagesJavaFX Your Way: Building JavaFX Applications with Alternative Languages
JavaFX Your Way: Building JavaFX Applications with Alternative Languages
Stephen Chin
 
JavaFX Overview
JavaFX OverviewJavaFX Overview
JavaFX Overview
José Maria Silveira Neto
 
JavaFX in Action Part I
JavaFX in Action Part IJavaFX in Action Part I
JavaFX in Action Part I
Mohammad Hossein Rimaz
 
JavaFX Layout Secrets with Amy Fowler
JavaFX Layout Secrets with Amy FowlerJavaFX Layout Secrets with Amy Fowler
JavaFX Layout Secrets with Amy Fowler
Stephen Chin
 
JavaFX Presentation
JavaFX PresentationJavaFX Presentation
JavaFX Presentation
Mochamad Taufik Mulyadi
 
애자일의 모든것
애자일의 모든것애자일의 모든것
애자일의 모든것
KH Park (박경훈)
 
Check style 기초가이드
Check style 기초가이드Check style 기초가이드
Check style 기초가이드
rupert kim
 
JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016
Hendrik Ebbers
 
BUILDING MODERN WEB UIS WITH WEB COMPONENTS @ Devoxx
BUILDING MODERN WEB UIS WITH WEB COMPONENTS @ DevoxxBUILDING MODERN WEB UIS WITH WEB COMPONENTS @ Devoxx
BUILDING MODERN WEB UIS WITH WEB COMPONENTS @ Devoxx
Hendrik Ebbers
 
JavaFX - Straight from the trenches
JavaFX - Straight from the trenchesJavaFX - Straight from the trenches
JavaFX - Straight from the trenches
Anderson Braz
 
UI test automation techniques by an example of JavaFX UI
UI test automation techniques by an example of JavaFX UIUI test automation techniques by an example of JavaFX UI
UI test automation techniques by an example of JavaFX UI
yaevents
 
Java Fx - Return of client Java
Java Fx - Return of client JavaJava Fx - Return of client Java
Java Fx - Return of client Java
Shuji Watanabe
 
JavaFX Your Way: Building JavaFX Applications with Alternative Languages
JavaFX Your Way: Building JavaFX Applications with Alternative LanguagesJavaFX Your Way: Building JavaFX Applications with Alternative Languages
JavaFX Your Way: Building JavaFX Applications with Alternative Languages
Stephen Chin
 
JavaFX Layout Secrets with Amy Fowler
JavaFX Layout Secrets with Amy FowlerJavaFX Layout Secrets with Amy Fowler
JavaFX Layout Secrets with Amy Fowler
Stephen Chin
 
Ad

Similar to DataFX 8 (JavaOne 2014) (20)

Effective JavaFX architecture with FxObjects
Effective JavaFX architecture with FxObjectsEffective JavaFX architecture with FxObjects
Effective JavaFX architecture with FxObjects
Srikanth Shenoy
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
Phuc Le Cong
 
SpringBootCompleteBootcamp.pptx
SpringBootCompleteBootcamp.pptxSpringBootCompleteBootcamp.pptx
SpringBootCompleteBootcamp.pptx
SUFYAN SATTAR
 
Jdbc
JdbcJdbc
Jdbc
BindhuBhargaviTalasi
 
Introduction to jsf2
Introduction to jsf2Introduction to jsf2
Introduction to jsf2
Rajiv Gupta
 
Liferay (DXP) 7 Tech Meetup for Developers
Liferay (DXP) 7 Tech Meetup for DevelopersLiferay (DXP) 7 Tech Meetup for Developers
Liferay (DXP) 7 Tech Meetup for Developers
Azilen Technologies Pvt. Ltd.
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008
Jonas Follesø
 
D22 portlet development with open source frameworks
D22 portlet development with open source frameworksD22 portlet development with open source frameworks
D22 portlet development with open source frameworks
Sunil Patil
 
D22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksD22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source Frameworks
Sunil Patil
 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892
Tuna Tore
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
Tuna Tore
 
Asp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentAsp.Net Ajax Component Development
Asp.Net Ajax Component Development
Chui-Wen Chiu
 
MVC
MVCMVC
MVC
akshin
 
MVC3 Development with visual studio 2010
MVC3 Development with visual studio 2010MVC3 Development with visual studio 2010
MVC3 Development with visual studio 2010
AbhishekLuv Kumar
 
JEE5 New Features
JEE5 New FeaturesJEE5 New Features
JEE5 New Features
Haitham Raik
 
Spring 3: What's New
Spring 3: What's NewSpring 3: What's New
Spring 3: What's New
Ted Pennings
 
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
dioduong345
 
Jsf presentation
Jsf presentationJsf presentation
Jsf presentation
Ashish Gupta
 
struts unit best pdf for struts java.pptx
struts unit best pdf for struts java.pptxstruts unit best pdf for struts java.pptx
struts unit best pdf for struts java.pptx
ozakamal8
 
struts unit best pdf for struts java.pptx
struts unit best pdf for struts java.pptxstruts unit best pdf for struts java.pptx
struts unit best pdf for struts java.pptx
ozakamal8
 
Effective JavaFX architecture with FxObjects
Effective JavaFX architecture with FxObjectsEffective JavaFX architecture with FxObjects
Effective JavaFX architecture with FxObjects
Srikanth Shenoy
 
SpringBootCompleteBootcamp.pptx
SpringBootCompleteBootcamp.pptxSpringBootCompleteBootcamp.pptx
SpringBootCompleteBootcamp.pptx
SUFYAN SATTAR
 
Introduction to jsf2
Introduction to jsf2Introduction to jsf2
Introduction to jsf2
Rajiv Gupta
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008
Jonas Follesø
 
D22 portlet development with open source frameworks
D22 portlet development with open source frameworksD22 portlet development with open source frameworks
D22 portlet development with open source frameworks
Sunil Patil
 
D22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksD22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source Frameworks
Sunil Patil
 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892
Tuna Tore
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
Tuna Tore
 
Asp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentAsp.Net Ajax Component Development
Asp.Net Ajax Component Development
Chui-Wen Chiu
 
MVC3 Development with visual studio 2010
MVC3 Development with visual studio 2010MVC3 Development with visual studio 2010
MVC3 Development with visual studio 2010
AbhishekLuv Kumar
 
Spring 3: What's New
Spring 3: What's NewSpring 3: What's New
Spring 3: What's New
Ted Pennings
 
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
dioduong345
 
struts unit best pdf for struts java.pptx
struts unit best pdf for struts java.pptxstruts unit best pdf for struts java.pptx
struts unit best pdf for struts java.pptx
ozakamal8
 
struts unit best pdf for struts java.pptx
struts unit best pdf for struts java.pptxstruts unit best pdf for struts java.pptx
struts unit best pdf for struts java.pptx
ozakamal8
 
Ad

More from Hendrik Ebbers (19)

Java Desktop 2019
Java Desktop 2019Java Desktop 2019
Java Desktop 2019
Hendrik Ebbers
 
Java APIs- The missing manual (concurrency)
Java APIs- The missing manual (concurrency)Java APIs- The missing manual (concurrency)
Java APIs- The missing manual (concurrency)
Hendrik Ebbers
 
Beauty & the Beast - Java VS TypeScript
Beauty & the Beast - Java VS TypeScriptBeauty & the Beast - Java VS TypeScript
Beauty & the Beast - Java VS TypeScript
Hendrik Ebbers
 
Java 11 OMG
Java 11 OMGJava 11 OMG
Java 11 OMG
Hendrik Ebbers
 
Java APIs - the missing manual
Java APIs - the missing manualJava APIs - the missing manual
Java APIs - the missing manual
Hendrik Ebbers
 
Multidevice Controls: A Different Approach to UX
Multidevice Controls: A Different Approach to UXMultidevice Controls: A Different Approach to UX
Multidevice Controls: A Different Approach to UX
Hendrik Ebbers
 
Java WebStart Is Dead: What Should We Do Now?
Java WebStart Is Dead: What Should We Do Now?Java WebStart Is Dead: What Should We Do Now?
Java WebStart Is Dead: What Should We Do Now?
Hendrik Ebbers
 
Java ap is you should know
Java ap is you should knowJava ap is you should know
Java ap is you should know
Hendrik Ebbers
 
Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)
Hendrik Ebbers
 
webcomponents (Jfokus 2015)
webcomponents (Jfokus 2015)webcomponents (Jfokus 2015)
webcomponents (Jfokus 2015)
Hendrik Ebbers
 
Feature driven development
Feature driven developmentFeature driven development
Feature driven development
Hendrik Ebbers
 
Extreme Gui Makeover
Extreme Gui MakeoverExtreme Gui Makeover
Extreme Gui Makeover
Hendrik Ebbers
 
JavaFX Enterprise
JavaFX EnterpriseJavaFX Enterprise
JavaFX Enterprise
Hendrik Ebbers
 
Bonjour for Java
Bonjour for JavaBonjour for Java
Bonjour for Java
Hendrik Ebbers
 
Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013
Hendrik Ebbers
 
Devoxx UK 2013: Sandboxing with the Vagrant-Binding API
Devoxx UK 2013: Sandboxing with the Vagrant-Binding APIDevoxx UK 2013: Sandboxing with the Vagrant-Binding API
Devoxx UK 2013: Sandboxing with the Vagrant-Binding API
Hendrik Ebbers
 
Vagrant-Binding JUG Dortmund
Vagrant-Binding JUG DortmundVagrant-Binding JUG Dortmund
Vagrant-Binding JUG Dortmund
Hendrik Ebbers
 
Lightweight and reproducible environments with vagrant and Puppet
Lightweight and reproducible environments with vagrant and PuppetLightweight and reproducible environments with vagrant and Puppet
Lightweight and reproducible environments with vagrant and Puppet
Hendrik Ebbers
 
Jgrid
JgridJgrid
Jgrid
Hendrik Ebbers
 
Java APIs- The missing manual (concurrency)
Java APIs- The missing manual (concurrency)Java APIs- The missing manual (concurrency)
Java APIs- The missing manual (concurrency)
Hendrik Ebbers
 
Beauty & the Beast - Java VS TypeScript
Beauty & the Beast - Java VS TypeScriptBeauty & the Beast - Java VS TypeScript
Beauty & the Beast - Java VS TypeScript
Hendrik Ebbers
 
Java APIs - the missing manual
Java APIs - the missing manualJava APIs - the missing manual
Java APIs - the missing manual
Hendrik Ebbers
 
Multidevice Controls: A Different Approach to UX
Multidevice Controls: A Different Approach to UXMultidevice Controls: A Different Approach to UX
Multidevice Controls: A Different Approach to UX
Hendrik Ebbers
 
Java WebStart Is Dead: What Should We Do Now?
Java WebStart Is Dead: What Should We Do Now?Java WebStart Is Dead: What Should We Do Now?
Java WebStart Is Dead: What Should We Do Now?
Hendrik Ebbers
 
Java ap is you should know
Java ap is you should knowJava ap is you should know
Java ap is you should know
Hendrik Ebbers
 
Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)
Hendrik Ebbers
 
webcomponents (Jfokus 2015)
webcomponents (Jfokus 2015)webcomponents (Jfokus 2015)
webcomponents (Jfokus 2015)
Hendrik Ebbers
 
Feature driven development
Feature driven developmentFeature driven development
Feature driven development
Hendrik Ebbers
 
Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013
Hendrik Ebbers
 
Devoxx UK 2013: Sandboxing with the Vagrant-Binding API
Devoxx UK 2013: Sandboxing with the Vagrant-Binding APIDevoxx UK 2013: Sandboxing with the Vagrant-Binding API
Devoxx UK 2013: Sandboxing with the Vagrant-Binding API
Hendrik Ebbers
 
Vagrant-Binding JUG Dortmund
Vagrant-Binding JUG DortmundVagrant-Binding JUG Dortmund
Vagrant-Binding JUG Dortmund
Hendrik Ebbers
 
Lightweight and reproducible environments with vagrant and Puppet
Lightweight and reproducible environments with vagrant and PuppetLightweight and reproducible environments with vagrant and Puppet
Lightweight and reproducible environments with vagrant and Puppet
Hendrik Ebbers
 

Recently uploaded (20)

Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 

DataFX 8 (JavaOne 2014)

  • 1. DataFX From External Data to a UI Flow and Back 8
  • 2. About us Johan Vos @johanvos . www.lodgon.com Hendrik Ebbers @hendrikEbbers www.guigarage.com . Jonathan Giles @JonathanGiles www.fxexperience.com
  • 6. DataSources Goal: Facilitate the interaction between a JavaFX Application and Enterprise Data, respecting the commonalities and differences between the Enterprise World and the Client World.
  • 7. DataSources Data DataFX DataReader Converter DataProvider Observable / ObservableList
  • 8. DataSources iOS Desktop Client REST Business Layer Server Persistence Android Web Well-known, Well-documented Non-proprietary protocols
  • 9. Protocols REST SSE WebSockets XML JSON JDBC File
  • 10. JFX characteristics Observable, ObservableList Leverage dynamic updates to objects and lists. Modifications can be propagated immediately to JavaFX Controls. No error-prone wiring needed. JavaFX Application Thread Modifactions that result in UI changes should only happen on the JavaFX Application Thread. Apart from those, nothing should happen on the JavaFX Application Thread
  • 11. DataSources Read Data REST, SSE, WebSocket Convert Data Into Java Objects XMLConverter, JsonConverter Provide Data As Observable instances or ObservableList instances
  • 12. JavaFX Integration Using DataSources, your data (Observable) and data containers (ObservableList) can be kept up-to-date. JavaFX Controls often use Observable or ObservableList: Label: Label.textProperty(); ListView: ListView.setItems(ObservableList);
  • 13. Examples Project Avatar JS on the backend JS on the client REST, SSE, WebSockets with JSON in between Avatarfx demonstrates avatar examples in JavaFX client
  • 14. REST Similarity with JAX-RS 2.0 Client API Simple Builders or get/set OAuth support GET/POST/PUT/DELETE Classes: io.datafx.io.RestSource and io.datafx.io.RestSourceBuilder
  • 16. SSE Wikipedia: Server-sent events is a standard describing how servers can initiate data transmission towards clients once an initial client connection has been established.
  • 17. SSE Client initiates connection Server sends data, DataFX creates an Object with Observable fields Every now and then, server sends updated data DataFX makes sure the Observable fields are updated
  • 19. WebSockets Leverage client-part of JSR 356, Java standard for WebSocket protocol. Works with any service that supports the WebSocket protocol DataFX retrieves incoming messages, and populates an ObservableList
  • 21. Add
  • 23. Concurrency API JavaFX is a single threaded toolkit You should not block the platform thread Rest calls may take some time... ...and could freeze the application
  • 24. DataFX Executor Executor implementation supports title, message and progress for each service supports Runnable, Callable, Service & Task cancel services on the gui Configurable Thread Pool
  • 26. Let‘s wait like SwingUtilities.invokeAndWait(...) void ConcurrentUtils.runAndWait(Runnable runnable) T ConcurrentUtils.runAndWait(Callable<T> callable) we will collect all concurrent helper methods here
  • 27. Stream Support JDK 8 has Lambdas and the awesome Stream API Map and reduce your collections in parallel But how to turn into the JavaFX application thread?
  • 28. Stream Support StreamFX<T> streamFX = new StreamFX<>(myStream); it is a wrapper ObservableList<T> list = ...; streamFX.publish(list); ! ! ! streamFX.forEachOrdered(final Consumer<ObjectProperty<? super T>> action) this will happen in the application thread
  • 29. Process Chain Like SwingWorker on steroids Support for an unlimited chain of background and application tasks ExceptionHandling Publisher support
  • 30. Process Chain ProcessChain.create(). addRunnableInPlatformThread(() -> blockUI()). addSupplierInExecutor(() -> loadFromServer()). addConsumerInPlatformThread(d -> updateUI(d)). onException(e -> handleException(e)). withFinal(() -> unblockUI()). run();
  • 32. Concurrency API DataFX core contains all basic classes Can be integrated in all applications Exception Handling Java8 Lambda support Configuration of thread pool Add async operations the easy way
  • 34. JavaFX Basics In JavaFX you should use FXML to define your views You can define a controller for the view Link from (FXML-) view to the controller <HBox fx:controller="com.guigarage.MyController"> <TextField fx:id="myTextfield"/> <Button fx:id="backButton" text="back"/> </HBox>
  • 35. View Controller Some kind of inversion of control Define the FXML in your controller class Create a view by using the controller class
  • 36. View Controller @FXMLController("Details.fxml") public class DetailViewController { @FXML private TextField myTextfield; @FXML private Button backButton; @PostConstruct public void init() { myTextfield.setText("Hello!"); } } define the FXML file default Java annotation
  • 37. View Context Support of different contexts Inject context by using Annotation Register your model to the context PlugIn mechanism
  • 38. Flow API The View Controller is good for one view How to link different view?
  • 39. Flow API open View View View View View View search details open diagram setting *
  • 40. Master Detail two views: master and detail use FXML switch from one view to the other one delete data on user action decoupling all this stuff!!
  • 41. Master Detail details MasterView DetailsView back delete
  • 42. Master Detail details delete MasterView DetailsView back FXML Controller FXML Controller
  • 43. Master Detail details MasterView DetailsView Flow flow = new Flow(MasterViewController.class). withLink(MasterViewController.class, "details", DetailsViewController.class). withLink(EditViewController.class, "back", MasterViewController.class). direct link between the views action id back delete
  • 44. Master Detail details MasterView DetailsView define a custom action … Flow flow = new Flow(MasterViewController.class). . . . withTaskAction(MasterViewController.class, "delete", RemoveAction.class); ! ! ! action name withTaskAction(MasterViewController.class, "delete", () -> . . .); delete back delete … or a Lambda
  • 45. Master Detail Use controller API for all views Define a Flow with all views link with by adding an action add custom actions to your flow but how can I use them?
  • 46. Master Detail @FXMLController("Details.fxml") public class DetailViewController { ! @FXML @ActionTrigger("back") private Button backButton; @PostConstruct public void init() { //... } @PreDestroy public void destroy() { //... } } controller API defined in FXML bind your flow actions by annotation listen to the flow
  • 47. Master Detail bind it by id @FXMLController("Details.fxml") public class DetailViewController { ! @FXML @ActionTrigger("delete") private Button backButton; @PostConstruct public void init() { //... } @ActionMethod("delete") public void delete() { //... } }
  • 48. Flow API share your data model by using contexts ViewFlowContext added @FXMLViewFlowContext private ViewFlowContext context; You can inject contexts in your action classes, too @PostConstruct and @PreDestroy are covered by the view livecycle
  • 49. Flow API Provides several action types like BackAction @BackAction private Button backButton; (Animated) Flow Container as a wrapper DataFX Core ExceptionHandler is used Flows are reusable
  • 51. Flow API By using the flow API you don‘t have dependencies between the views Reuse views and actions Use annotations for configuration
  • 53. Injection API By using the flow api you can inject DataFX related classes But how can you inject any data?
  • 54. Injection API Based on JSR 330 and JSR 299 Developed as plugin of the flow API Use default annotations
  • 55. Injection API ViewScope: Data only lives in one View FlowScope: Data only lives in one Flow ApplicationScope: Data lives in one App DependentScope: Data will be recreated
  • 57. Injection API It’s not a complete CDI implementation! Qualifier, etc. are currently not supported No default CDI implementation is used Weld and OpenWebBeans core modules are Java EE specific
  • 58. Injection API Inject your data in the view controller Define the scope of data types Add your own scope
  • 60. Validation API Use of Java Bean Validation (JSR 303) Developed as a Flow API plugin Supports the JavaFX property API public class ValidateableDataModel { @NotNull private StringProperty name; }
  • 61. Validation API @FXMLController("view.fxml") public class ValidationController { @Valid private ValidateableDataModel model; @Validator private ValidatorFX<ValidationController> validator; public void onAction() { validator.validateAllProperties(); } }
  • 62. EJB Support Access remote EJBs on your client Developed as a Flow API plugin API & a experimental WildFly implementation
  • 63. EJB Support @FXMLController("view.fxml") public class ViewController { ! @RemoteEjb() RemoteCalculator calc; ! @FXML @ActionTrigger("add") Button myButton; ! @ActionMethod("add") public void add() { runInBackground(() -> sysout(calc.add(3, 3))); } ! }
  • 64. Feature Toggles Integrate feature toggles in the view Developed as a Flow API plugin @FXMLController("featureView.fxml") public class FeatureController { ! @FXML @HideByFeature("PLAY_FEATURE") private Button playButton; ! @FXML @DisabledByFeature("FEATURE2") private Button button2; ! }
  • 66. QA