SlideShare une entreprise Scribd logo
1  sur  53
Télécharger pour lire hors ligne
Construire une application JavaFX 8 avec 
gradle
Construire une application JavaFX 8 avec gradle 
Thierry Wasylczenko 
@twasyl 
La session trendy
3
Ce dont on va parler 
• JavaFX 8 
• gradle 
• Tooling 
• De code 
4
5 
#JavaFX 8: 
De 2 à 8
Les Properties
Les types 
8 
IntegerProperty intP = new SimpleIntegerProperty(); 
DoubleProperty doubleP = new SimpleDoubleProperty(); 
// ... 
BooleanProperty booleanP = new SimpleBooleanProperty(); 
StringProperty stringP = new SimpleStringProperty(); 
ObjectProperty<SoftShake> objectP = new SimpleObjectProperty();
Le binding 
IntegerProperty intP1 = new SimpleIntegerProperty(); 
IntegerProperty intP2 = new SimpleIntegerProperty(); 
intP1.bind(intP2); 
intP2.set(10); 
System.out.println("Et P1? " + intP1.get()); 
9
Le binding 
IntegerProperty intP1 = new SimpleIntegerProperty(); 
IntegerProperty intP2 = new SimpleIntegerProperty(); 
intP1.bindBidirectional(intP2); 
intP2.set(10); 
System.out.println("Et P1? " + intP1.get()); 
intP1.set(20); 
System.out.println("Et P2? " + intP2.get()); 
10
Les événements 
IntegerProperty intP1 = new SimpleIntegerProperty(); 
intP1.addListener((valueInt, oldInt, newInt) -> { 
System.out.println("Change"); 
}); 
intP1.set(10); 
11
POJO 2.0 
public class Conference { 
private StringProperty name = new SimpleStringProperty(); 
12 
public StringProperty nameProperty() { return this.name; } 
public String getName() { return this.name.get(); } 
public void setName(String name) { this.name.set(name); } 
} 
final Conference softShake = new Conference(); 
tf.textProperty().bindBidirectional(softShake.nameProperty());
Pas serializable
POJO 1.5 
public class Conference { 
private PropertyChangeStatus pcs = 
new PropertyChangeStatus(this); 
private String name; 
public void addPropertyChangeListener(PropertyChangeListener listener) 
this.pcs.addPropertyChangeListener(listener); 
} 
public void removePropertyChangeListener(PropertyChangeListener listener) 
this.pcs.removePropertyChangeListener(listener); 
14
POJO 1.5 
final Conference softShake = new Conference(); 
JavaBeanStringPropertyBuilder builder = new ... 
JavaBeanStringProperty nameProperty = builder.bean(softShake) 
.name("name") 
.build(); 
nameProperty.addListener((valueName, oldIName, newName) -> { 
// ... 
}); 
15
Vues
FXML 
<AnchorPane xmlns:fx="http://javafx.com/fxml" 
fx:controller="org.mycompany.Controller"> 
<stylesheets> 
<URL value="@/org/mycompany/css/Default.css" /> 
<URL value="@/org/mycompany/css/Specialized.css" /> 
</stylesheets> 
<Button fx:id="myButton" text="Button" onAction="#click" /> 
<TextField fx:id="myTextField" promptText="Enter something" /> 
</AnchorPane> 
17
Controller 
public class Controller implements Initializable { 
@FXML private Button myButton; 
@FXML private TextField myTextField; 
@FXML private void click(ActionEvent evt) { /* ... */ } 
@Override 
public void initialize(URL url, ResourceBundle resourceBundle) 
// ... 
} 
} 
18
CSS
Personnaliser les composants 
FXML 
<Button style="-fx-text-fill: white" styleClass="awesome" /> 
Java 
button.setStyle("-fx-background-color: red;"); 
button.getStyleClass().add("awesome"); 
20
Personnaliser les composants 
Feuille de style 
.button { 
-fx-text-fill: white; 
-fx-background-color: red; 
} 
.button:hover { -fx-background-color: blue; } 
.awesome { -fx-background-color: gray; } 
#myButton { -fx-text-fill: black; } 
21
PseudoState personnalisés 
PseudoClass ps = PseudoClass.getPseudoClass("awesome"); 
myButton.pseudoClassStateChanged(ps, true); 
.button:awesome { 
-fx-text-fill: orange; 
} 
#myButton:awesome { 
-fx-text-fill: green; 
} 
22
WebView
JS <> JFX 
webview.getEngine().getLoadWorker().stateProperty().addListener((observableValue, if (newState == Worker.State.SUCCEEDED) { 
JSObject window = (JSObject) webview.getEngine() 
.executeScript("window"); 
window.setMember("javaObj",this); 
} 
}); 
24
JS <> JFX 
Java 
WebEngine engine = webview.getEngine(); 
String result = engine.executeScript("return 'Hello';"); 
JavaScript 
javaObj.myWonderfulMethod("Hello"); 
25
WebSocket 
window.onload = function() { 
socket = new WebSocket("ws://mycompany.com/ws"); 
socket.onopen = function(event) { /* ... */ }; 
socket.onclose = function(event) { /* ... */ }; 
socket.onmessage = function(event) { /* ... */ }; 
}; 
26
Drag'n'drop
Drag'n'drop 
obj.setOnDragDetected(event -> { /* ... */ }); 
obj.setOnDragOver(event -> { /* ... */ }); 
obj.setOnDragEntered(event -> { /* ... */ }); 
obj.setOnDragExited(event -> { /* ... */ }); 
obj.setOnDragDropped(event -> { /* ... */ }); 
obj.setOnDragDone(event -> { /* ... */ }); 
28
Printing API
Print 
Chaque Node 
PrinterJob job = PrinterJob.createPrinterJob(); 
job.printPage(myTextField); 
Une page web 
WebView view = new WebView(); 
PrinterJob job = PrinterJob.createPrinterJob(); 
view.getEngine().print(job); 
30
3D
Objets prédéfinis 
Box b = new Box(width, height, depth); 
Cylinder c = new Cylinder(radius, height); 
Sphere s = new Sphere(radius); 
TriangleMesh tm = new TriangleMesh(); 
Les plus basiques 
32
Camera & Light 
Camera camera = new PerspectiveCamera(true); 
scene.setCamera(camera); 
PointLight point = new PointLight(Color.RED); 
AmbientLight ambient = new AmbientLight(Color.WHITE); 
scene.getRoot().getChildren().addAll(point, ambient); 
Ne pas oublier de positionner les objets 
33
34 
#gradle: 
Flexibilité
Task 
• Réponds à MON besoin 
• Dynamisme 
• Dépendances 
• Greffage au cycle de vie 
task sofshake << { 
println 'Hello Soft-Shake 2014' 
} 
tasks['sofshake'].dependsOn 'jar' 
36
Task: surcharge 
apply plugin: 'java' 
task jar(overwrite: true) << { 
// ... 
manifest { 
// ... 
} 
} 
37
Dépendances 
dependencies { 
compile (':my-project') 
runtime files('libs/a.jar', 'libs/b.jar') 
runtime "org.groovy:groovy:2.2.0@jar" 
runtime group: 'org.groovy', name: 'groovy', version: '2.2.0', ext: 
} 
38
Copy 
• Copier des fichiers facilement 
• La roue est déjà inventée 
copy { 
from file1 
from file2 
into folder 
} 
39
Gradle wrapper 
• Execution de gradle sans intallation préalable 
• Plateformes d’intégration continue friendly 
task buildGradleWrapper(type: Wrapper) { 
gradleVersion = '2.1' 
} 
40
Ouvert
Intégration de Ant 
• Variables 
• Tâches 
ant.importBuild "ant/project/file.xml" 
ant.conference = "Soft-Shake 2014" 
ant.location = "Genève" 
maTacheAnt.execute() 
44
45 
Tooling
SceneBuilder 46
ScenicView 47
TestFX 
public class DesktopTest extends GuiTest { 
public Parent getRootNode() { return new Desktop(); } 
@Test public void testMe() { 
// Given 
rightClick("#desktop").move("New").click("Text Document") 
.type("myTextfile.txt").push(ENTER); 
// When 
drag(".file").to("#trash-can"); 
// Then 
verifyThat("#desktop", contains(0, ".file")); 
48
49 
#Code
Codons ! 
• JavaFX 8 
• Properties 
• FXML 
• Styling 
• gradle 
• Dépendances 
• Build 
50
Ressources 51
Ressources 
• https://github.com/TestFX/TestFX 
• http://fxexperience.com/ 
• http://fxexperience.com/controlsfx/ 
• Source code of the demo: https://bitbucket.org/twasyl/weatherfx 
52
53

Contenu connexe

Tendances

JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 SpringKiyotaka Oku
 
The Ring programming language version 1.10 book - Part 94 of 212
The Ring programming language version 1.10 book - Part 94 of 212The Ring programming language version 1.10 book - Part 94 of 212
The Ring programming language version 1.10 book - Part 94 of 212Mahmoud Samir Fayed
 
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloading
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloadingRiga DevDays 2017 - The hitchhiker’s guide to Java class reloading
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloadingAnton Arhipov
 
Java Bytecode for Discriminating Developers - JavaZone 2011
Java Bytecode for Discriminating Developers - JavaZone 2011Java Bytecode for Discriminating Developers - JavaZone 2011
Java Bytecode for Discriminating Developers - JavaZone 2011Anton Arhipov
 
Redux for ReactJS Programmers
Redux for ReactJS ProgrammersRedux for ReactJS Programmers
Redux for ReactJS ProgrammersDavid Rodenas
 
JEEConf 2017 - The hitchhiker’s guide to Java class reloading
JEEConf 2017 - The hitchhiker’s guide to Java class reloadingJEEConf 2017 - The hitchhiker’s guide to Java class reloading
JEEConf 2017 - The hitchhiker’s guide to Java class reloadingAnton Arhipov
 
Concurrency Concepts in Java
Concurrency Concepts in JavaConcurrency Concepts in Java
Concurrency Concepts in JavaDoug Hawkins
 
Unit testing without Robolectric, Droidcon Berlin 2016
Unit testing without Robolectric, Droidcon Berlin 2016Unit testing without Robolectric, Droidcon Berlin 2016
Unit testing without Robolectric, Droidcon Berlin 2016Danny Preussler
 
Слава Бобик «NancyFx для самых маленьких»
Слава Бобик «NancyFx для самых маленьких»Слава Бобик «NancyFx для самых маленьких»
Слава Бобик «NancyFx для самых маленьких»SpbDotNet Community
 
The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189Mahmoud Samir Fayed
 
Demystifying dependency Injection: Dagger and Toothpick
Demystifying dependency Injection: Dagger and ToothpickDemystifying dependency Injection: Dagger and Toothpick
Demystifying dependency Injection: Dagger and ToothpickDanny Preussler
 
Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Amazon Cognito使って認証したい?それならSpring Security使いましょう!Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Amazon Cognito使って認証したい?それならSpring Security使いましょう!Ryosuke Uchitate
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good TestsTomek Kaczanowski
 
The Ring programming language version 1.5.2 book - Part 76 of 181
The Ring programming language version 1.5.2 book - Part 76 of 181The Ring programming language version 1.5.2 book - Part 76 of 181
The Ring programming language version 1.5.2 book - Part 76 of 181Mahmoud Samir Fayed
 
Cleanup and new optimizations in WPython 1.1
Cleanup and new optimizations in WPython 1.1Cleanup and new optimizations in WPython 1.1
Cleanup and new optimizations in WPython 1.1PyCon Italia
 
Exercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera CymbronExercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera Cymbroncymbron
 
Java Performance Puzzlers
Java Performance PuzzlersJava Performance Puzzlers
Java Performance PuzzlersDoug Hawkins
 
Csw2016 gawlik bypassing_differentdefenseschemes
Csw2016 gawlik bypassing_differentdefenseschemesCsw2016 gawlik bypassing_differentdefenseschemes
Csw2016 gawlik bypassing_differentdefenseschemesCanSecWest
 

Tendances (20)

JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 Spring
 
The Ring programming language version 1.10 book - Part 94 of 212
The Ring programming language version 1.10 book - Part 94 of 212The Ring programming language version 1.10 book - Part 94 of 212
The Ring programming language version 1.10 book - Part 94 of 212
 
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloading
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloadingRiga DevDays 2017 - The hitchhiker’s guide to Java class reloading
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloading
 
Java Bytecode for Discriminating Developers - JavaZone 2011
Java Bytecode for Discriminating Developers - JavaZone 2011Java Bytecode for Discriminating Developers - JavaZone 2011
Java Bytecode for Discriminating Developers - JavaZone 2011
 
Redux for ReactJS Programmers
Redux for ReactJS ProgrammersRedux for ReactJS Programmers
Redux for ReactJS Programmers
 
JEEConf 2017 - The hitchhiker’s guide to Java class reloading
JEEConf 2017 - The hitchhiker’s guide to Java class reloadingJEEConf 2017 - The hitchhiker’s guide to Java class reloading
JEEConf 2017 - The hitchhiker’s guide to Java class reloading
 
Concurrency Concepts in Java
Concurrency Concepts in JavaConcurrency Concepts in Java
Concurrency Concepts in Java
 
Unit testing without Robolectric, Droidcon Berlin 2016
Unit testing without Robolectric, Droidcon Berlin 2016Unit testing without Robolectric, Droidcon Berlin 2016
Unit testing without Robolectric, Droidcon Berlin 2016
 
Слава Бобик «NancyFx для самых маленьких»
Слава Бобик «NancyFx для самых маленьких»Слава Бобик «NancyFx для самых маленьких»
Слава Бобик «NancyFx для самых маленьких»
 
The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189
 
Testing with Node.js
Testing with Node.jsTesting with Node.js
Testing with Node.js
 
Demystifying dependency Injection: Dagger and Toothpick
Demystifying dependency Injection: Dagger and ToothpickDemystifying dependency Injection: Dagger and Toothpick
Demystifying dependency Injection: Dagger and Toothpick
 
droidparts
droidpartsdroidparts
droidparts
 
Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Amazon Cognito使って認証したい?それならSpring Security使いましょう!Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Amazon Cognito使って認証したい?それならSpring Security使いましょう!
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests
 
The Ring programming language version 1.5.2 book - Part 76 of 181
The Ring programming language version 1.5.2 book - Part 76 of 181The Ring programming language version 1.5.2 book - Part 76 of 181
The Ring programming language version 1.5.2 book - Part 76 of 181
 
Cleanup and new optimizations in WPython 1.1
Cleanup and new optimizations in WPython 1.1Cleanup and new optimizations in WPython 1.1
Cleanup and new optimizations in WPython 1.1
 
Exercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera CymbronExercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera Cymbron
 
Java Performance Puzzlers
Java Performance PuzzlersJava Performance Puzzlers
Java Performance Puzzlers
 
Csw2016 gawlik bypassing_differentdefenseschemes
Csw2016 gawlik bypassing_differentdefenseschemesCsw2016 gawlik bypassing_differentdefenseschemes
Csw2016 gawlik bypassing_differentdefenseschemes
 

Similaire à Construire une application JavaFX 8 avec gradle

Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsAzul Systems, Inc.
 
Dropwizard and Friends
Dropwizard and FriendsDropwizard and Friends
Dropwizard and FriendsYun Zhi Lin
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extremeyinonavraham
 
In the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleIn the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleSkills Matter
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Tsuyoshi Yamamoto
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyDavid Padbury
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesAnkit Rastogi
 
Vaadin 7 Today and Tomorrow
Vaadin 7 Today and TomorrowVaadin 7 Today and Tomorrow
Vaadin 7 Today and TomorrowJoonas Lehtinen
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript EverywherePascal Rettig
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVMSylvain Wallez
 
Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stackTomáš Kypta
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemGuardSquare
 

Similaire à Construire une application JavaFX 8 avec gradle (20)

Spring Boot
Spring BootSpring Boot
Spring Boot
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM Mechanics
 
Vaadin7
Vaadin7Vaadin7
Vaadin7
 
Dropwizard and Friends
Dropwizard and FriendsDropwizard and Friends
Dropwizard and Friends
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extreme
 
In the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleIn the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: Gradle
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
 
Griffon @ Svwjug
Griffon @ SvwjugGriffon @ Svwjug
Griffon @ Svwjug
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
 
Vaadin 7
Vaadin 7Vaadin 7
Vaadin 7
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practices
 
Vaadin 7 Today and Tomorrow
Vaadin 7 Today and TomorrowVaadin 7 Today and Tomorrow
Vaadin 7 Today and Tomorrow
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript Everywhere
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
Js tacktalk team dev js testing performance
Js tacktalk team dev js testing performanceJs tacktalk team dev js testing performance
Js tacktalk team dev js testing performance
 
Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stack
 
Serverless Java on Kubernetes
Serverless Java on KubernetesServerless Java on Kubernetes
Serverless Java on Kubernetes
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build system
 

Plus de Thierry Wasylczenko

Du développement à la livraison avec JavaFX et le JDK9
Du développement à la livraison avec JavaFX et le JDK9Du développement à la livraison avec JavaFX et le JDK9
Du développement à la livraison avec JavaFX et le JDK9Thierry Wasylczenko
 
#Polyglottisme, une autre manière de développer une application
#Polyglottisme, une autre manière de développer une application#Polyglottisme, une autre manière de développer une application
#Polyglottisme, une autre manière de développer une applicationThierry Wasylczenko
 

Plus de Thierry Wasylczenko (7)

Du développement à la livraison avec JavaFX et le JDK9
Du développement à la livraison avec JavaFX et le JDK9Du développement à la livraison avec JavaFX et le JDK9
Du développement à la livraison avec JavaFX et le JDK9
 
JavaFX et le JDK9
JavaFX et le JDK9JavaFX et le JDK9
JavaFX et le JDK9
 
#JavaFX.forReal()
#JavaFX.forReal()#JavaFX.forReal()
#JavaFX.forReal()
 
#Polyglottisme, une autre manière de développer une application
#Polyglottisme, une autre manière de développer une application#Polyglottisme, une autre manière de développer une application
#Polyglottisme, une autre manière de développer une application
 
Java goes wild, lesson 1
Java goes wild, lesson 1Java goes wild, lesson 1
Java goes wild, lesson 1
 
JavaFX, because you're worth it
JavaFX, because you're worth itJavaFX, because you're worth it
JavaFX, because you're worth it
 
Introduction to JavaFX 2
Introduction to JavaFX 2Introduction to JavaFX 2
Introduction to JavaFX 2
 

Dernier

Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfrs7054576148
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
 

Dernier (20)

(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 

Construire une application JavaFX 8 avec gradle

  • 1. Construire une application JavaFX 8 avec gradle
  • 2. Construire une application JavaFX 8 avec gradle Thierry Wasylczenko @twasyl La session trendy
  • 3. 3
  • 4. Ce dont on va parler • JavaFX 8 • gradle • Tooling • De code 4
  • 8. Les types 8 IntegerProperty intP = new SimpleIntegerProperty(); DoubleProperty doubleP = new SimpleDoubleProperty(); // ... BooleanProperty booleanP = new SimpleBooleanProperty(); StringProperty stringP = new SimpleStringProperty(); ObjectProperty<SoftShake> objectP = new SimpleObjectProperty();
  • 9. Le binding IntegerProperty intP1 = new SimpleIntegerProperty(); IntegerProperty intP2 = new SimpleIntegerProperty(); intP1.bind(intP2); intP2.set(10); System.out.println("Et P1? " + intP1.get()); 9
  • 10. Le binding IntegerProperty intP1 = new SimpleIntegerProperty(); IntegerProperty intP2 = new SimpleIntegerProperty(); intP1.bindBidirectional(intP2); intP2.set(10); System.out.println("Et P1? " + intP1.get()); intP1.set(20); System.out.println("Et P2? " + intP2.get()); 10
  • 11. Les événements IntegerProperty intP1 = new SimpleIntegerProperty(); intP1.addListener((valueInt, oldInt, newInt) -> { System.out.println("Change"); }); intP1.set(10); 11
  • 12. POJO 2.0 public class Conference { private StringProperty name = new SimpleStringProperty(); 12 public StringProperty nameProperty() { return this.name; } public String getName() { return this.name.get(); } public void setName(String name) { this.name.set(name); } } final Conference softShake = new Conference(); tf.textProperty().bindBidirectional(softShake.nameProperty());
  • 14. POJO 1.5 public class Conference { private PropertyChangeStatus pcs = new PropertyChangeStatus(this); private String name; public void addPropertyChangeListener(PropertyChangeListener listener) this.pcs.addPropertyChangeListener(listener); } public void removePropertyChangeListener(PropertyChangeListener listener) this.pcs.removePropertyChangeListener(listener); 14
  • 15. POJO 1.5 final Conference softShake = new Conference(); JavaBeanStringPropertyBuilder builder = new ... JavaBeanStringProperty nameProperty = builder.bean(softShake) .name("name") .build(); nameProperty.addListener((valueName, oldIName, newName) -> { // ... }); 15
  • 16. Vues
  • 17. FXML <AnchorPane xmlns:fx="http://javafx.com/fxml" fx:controller="org.mycompany.Controller"> <stylesheets> <URL value="@/org/mycompany/css/Default.css" /> <URL value="@/org/mycompany/css/Specialized.css" /> </stylesheets> <Button fx:id="myButton" text="Button" onAction="#click" /> <TextField fx:id="myTextField" promptText="Enter something" /> </AnchorPane> 17
  • 18. Controller public class Controller implements Initializable { @FXML private Button myButton; @FXML private TextField myTextField; @FXML private void click(ActionEvent evt) { /* ... */ } @Override public void initialize(URL url, ResourceBundle resourceBundle) // ... } } 18
  • 19. CSS
  • 20. Personnaliser les composants FXML <Button style="-fx-text-fill: white" styleClass="awesome" /> Java button.setStyle("-fx-background-color: red;"); button.getStyleClass().add("awesome"); 20
  • 21. Personnaliser les composants Feuille de style .button { -fx-text-fill: white; -fx-background-color: red; } .button:hover { -fx-background-color: blue; } .awesome { -fx-background-color: gray; } #myButton { -fx-text-fill: black; } 21
  • 22. PseudoState personnalisés PseudoClass ps = PseudoClass.getPseudoClass("awesome"); myButton.pseudoClassStateChanged(ps, true); .button:awesome { -fx-text-fill: orange; } #myButton:awesome { -fx-text-fill: green; } 22
  • 24. JS <> JFX webview.getEngine().getLoadWorker().stateProperty().addListener((observableValue, if (newState == Worker.State.SUCCEEDED) { JSObject window = (JSObject) webview.getEngine() .executeScript("window"); window.setMember("javaObj",this); } }); 24
  • 25. JS <> JFX Java WebEngine engine = webview.getEngine(); String result = engine.executeScript("return 'Hello';"); JavaScript javaObj.myWonderfulMethod("Hello"); 25
  • 26. WebSocket window.onload = function() { socket = new WebSocket("ws://mycompany.com/ws"); socket.onopen = function(event) { /* ... */ }; socket.onclose = function(event) { /* ... */ }; socket.onmessage = function(event) { /* ... */ }; }; 26
  • 28. Drag'n'drop obj.setOnDragDetected(event -> { /* ... */ }); obj.setOnDragOver(event -> { /* ... */ }); obj.setOnDragEntered(event -> { /* ... */ }); obj.setOnDragExited(event -> { /* ... */ }); obj.setOnDragDropped(event -> { /* ... */ }); obj.setOnDragDone(event -> { /* ... */ }); 28
  • 30. Print Chaque Node PrinterJob job = PrinterJob.createPrinterJob(); job.printPage(myTextField); Une page web WebView view = new WebView(); PrinterJob job = PrinterJob.createPrinterJob(); view.getEngine().print(job); 30
  • 31. 3D
  • 32. Objets prédéfinis Box b = new Box(width, height, depth); Cylinder c = new Cylinder(radius, height); Sphere s = new Sphere(radius); TriangleMesh tm = new TriangleMesh(); Les plus basiques 32
  • 33. Camera & Light Camera camera = new PerspectiveCamera(true); scene.setCamera(camera); PointLight point = new PointLight(Color.RED); AmbientLight ambient = new AmbientLight(Color.WHITE); scene.getRoot().getChildren().addAll(point, ambient); Ne pas oublier de positionner les objets 33
  • 36. Task • Réponds à MON besoin • Dynamisme • Dépendances • Greffage au cycle de vie task sofshake << { println 'Hello Soft-Shake 2014' } tasks['sofshake'].dependsOn 'jar' 36
  • 37. Task: surcharge apply plugin: 'java' task jar(overwrite: true) << { // ... manifest { // ... } } 37
  • 38. Dépendances dependencies { compile (':my-project') runtime files('libs/a.jar', 'libs/b.jar') runtime "org.groovy:groovy:2.2.0@jar" runtime group: 'org.groovy', name: 'groovy', version: '2.2.0', ext: } 38
  • 39. Copy • Copier des fichiers facilement • La roue est déjà inventée copy { from file1 from file2 into folder } 39
  • 40. Gradle wrapper • Execution de gradle sans intallation préalable • Plateformes d’intégration continue friendly task buildGradleWrapper(type: Wrapper) { gradleVersion = '2.1' } 40
  • 42.
  • 43.
  • 44. Intégration de Ant • Variables • Tâches ant.importBuild "ant/project/file.xml" ant.conference = "Soft-Shake 2014" ant.location = "Genève" maTacheAnt.execute() 44
  • 48. TestFX public class DesktopTest extends GuiTest { public Parent getRootNode() { return new Desktop(); } @Test public void testMe() { // Given rightClick("#desktop").move("New").click("Text Document") .type("myTextfile.txt").push(ENTER); // When drag(".file").to("#trash-can"); // Then verifyThat("#desktop", contains(0, ".file")); 48
  • 50. Codons ! • JavaFX 8 • Properties • FXML • Styling • gradle • Dépendances • Build 50
  • 52. Ressources • https://github.com/TestFX/TestFX • http://fxexperience.com/ • http://fxexperience.com/controlsfx/ • Source code of the demo: https://bitbucket.org/twasyl/weatherfx 52
  • 53. 53