SlideShare a Scribd company logo
2
Developing RIA with Java
                    Dan Vulpe
                    Software Engineer
                    Centric
                    @dvulpe
                    dvulpe@gmail.com
History

                                         Apr 2012       Aug 2012
                                        JavaFX         JavaFX
                             Oct 2011     2.1            2.2
                             JavaFX      LCD text       Canvas
                               2.0      UI elements   UI elements
 Dec 2008     Apr 2010
                             Java API   Video h264    Touch events
JavaFX 1.0   JavaFX 1.3      Windows        Mac          Linux
Scene graph design
                Scene




                Parent




       Parent   Parent   Parent




Leaf    Leaf     Leaf     Leaf    Leaf
Scene graph design
                Scene




                Parent




       Parent   Parent   Parent




Leaf    Leaf     Leaf     Leaf    Leaf
Nodes have Properties
•   parent

•   scene

•   translate (X,Y, Z)

•   scale (X,Y, Z)

•   opacity

•   ... see JavaDoc for javafx.scene.Node
Observable Properties

service.valueProperty().addListener(new ChangeListener<WorkItemUI>()
{
   @Override
   public void changed(ObservableValue<? extends WorkItemUI> value,
                                              WorkItemUI oldValue,
                                              WorkItemUI newValue) {
           itemsPane.getChildren().add(newValue);
    }
});
Binding

public void bindTo(WorkItemModel workItem) {
     title.bindBidirectional(workItem.title);
     issueType.bind(workItem.issueType);
     workItemInfo.bindBidirectional(workItem.workItemInfo);
     asignee.bindBidirectional(workItem.asignee);
     dueDate.bindBidirectional(workItem.dueDate);
     priority.bindBidirectional(workItem.priority);
 }
Hello JavaFX
Layouts
FXML
<VBox alignment="CENTER" prefHeight="250.0" prefWidth="450.0" spacing="5.0"
    xmlns:fx="http://javafx.com/fxml">
  <children>
    <Label text="Enter your credentials" textFill="WHITE"/>
    <GridPane fx:id="formContainer" hgap="10.0" vgap="10.0">
      <children>
        <Label text="Username" GridPane.columnIndex="0" GridPane.rowIndex="0"/>
        <Label text="Password" GridPane.columnIndex="0" GridPane.rowIndex="1" />
        <TextField GridPane.columnIndex="1" GridPane.rowIndex="0" />
        <TextField GridPane.columnIndex="1" GridPane.rowIndex="1" />
        <Button text="Log In" GridPane.columnIndex="1" GridPane.rowIndex="2" />
      </children>
    </GridPane>
  </children>
</VBox>
Scene Builder - Oracle
GUI Editor: Preview
CSS Styling
.root {
    -fx-font-size: 15px;
    -fx-base: #eee;
    -fx-font-family: "Trebuchet MS";
}

.workItem {
    -fx-border-radius: 5;
    -fx-background-radius: 5;
    -fx-effect: dropshadow(gaussian, #ccc, 10, 0.1, 5, 2);
    -fx-border-color: #666;
    -fx-border-weight: 1px;
    -fx-font-size: 1em;
    -fx-opacity: 0.9;
    -fx-base: #333;
}
Bindings
public class DemoController {
    @FXML
    private TextField textField;
    @FXML
    private Label label;
    @FXML
    private ListView<String> listView;
    @FXML
    private Pane rootPane;
    @FXML
    private Pane formPane;
    @FXML
    private Button aButton;

    public void setDataModel(DataModel dataModel) {
        label.textProperty().bind(dataModel.titleProperty());
        textField.textProperty().bindBidirectional(dataModel.textProperty());

        Bindings.bindContent(dataModel.aPlainList(), listView.getItems());

        aButton.disableProperty().bind(textField.textProperty().isEqualTo(""));
        formPane.prefWidthProperty().bind(rootPane.widthProperty().divide(2));
    }
}
Application Structure

  FXML
 (layout)



 FX CSS                                                 JavaFX
                           JavaFX Scene
 (styling)                                               Stage
             Rendered On                  Rendered On


  Java
Controller
Best Practices?
GUI components

External                                   Sends Actions To
            Business
Services                  Presenter                                      View
             Logic
 Client


                                 Updates                      Binds To


            Application
              State                            Model




     Core                                       UI
JavaFX approach


External           Business                       Sends Actions To
Services            Logic       Presenter                                       View
 Client



                                        Updates                      Binds To

                  Application
                    State
                                                      Model




           Core                                        UI
JavaFX approach


External           Business                                  Sends Actions To
Services            Logic                  Presenter                                       View
 Client



                                                   Updates                      Binds To

                  Application
                    State
                                                                 Model




           Core                                                   UI
                                 Async
                                Services
JavaFX approach


External           Business                                  Sends Actions To
Services            Logic                  Presenter                                       View
 Client



                                                   Updates                      Binds To

                  Application
                    State
                                                                 Model




           Core                                                   UI
                                 Async
                                Services
JavaFX approach
                                  Use
                                 Case 1


External           Business                                  Sends Actions To
Services            Logic                  Presenter                                       View
 Client



                                                   Updates                      Binds To

                  Application
                    State
                                                                 Model




           Core                                                   UI
                                 Async
                                Services
JavaFX approach
                                  Use
                                 Case 1


External           Business       Use                        Sends Actions To
Services            Logic        Case 2    Presenter                                       View
 Client



                                                   Updates                      Binds To

                  Application
                    State
                                                                 Model




           Core                                                   UI
                                 Async
                                Services
JavaFX approach
                                  Use
                                 Case 1


External           Business       Use                        Sends Actions To
Services            Logic        Case 2    Presenter                                       View
 Client

                                  Use
                                 Case 3            Updates                      Binds To

                  Application
                    State
                                                                 Model




           Core                                                   UI
                                 Async
                                Services
JavaFX approach
                                  Use
                                 Case 1


External           Business       Use                        Sends Actions To
Services            Logic        Case 2    Presenter                                       View
 Client

                                  Use
                                 Case 3            Updates                      Binds To

                  Application
                    State
                                                                 Model

                                  Use
                                 Case N

           Core                                                   UI
                                 Async
                                Services
DEMO
JavaFX App Structure

  FXML
 (layout)



 FX CSS                                                 JavaFX
                           JavaFX Scene
 (styling)                                               Stage
             Rendered On                  Rendered On


  Java
Controller
Swing Integration

  FXML
 (layout)
                                                            swing Component



 FX CSS                    JavaFX Scene                 JFXPanel
 (styling)
             Rendered On                  Rendered On


  Java
Controller
Deploy

•   applets

•   Java WebStart

•   standalone applications (natively packaged
    Windows, Mac)

•   ... using JavaFX SDK tools (ant tasks)
Why JavaFX?

•   available on the JVM (Java, JRuby, Scala, Groovy,
    Clojure)

•   portability (Mac, Linux, Windows)

•   scene-graph

•   rapid development
Resources


•   http://fxexperience.com

•   http://github.com/dvulpe/codecamp-javafx
?
Thank you!
Please fill in the feedback form!

More Related Content

PPT
Pure Ejb Within An Agile Context
PPTX
(ATS3-GS03) Accelrys Enterprise Platform Deeper Dive
PDF
Expendables E-AppStore
PDF
Beyond SPML: Access Provisioning in a Services World
PPTX
(ATS3-GS02) Accelrys Enterprise Platform in Enterprise Architectures
PDF
Java one brazil_keynote_dochez
PPTX
SharePoint 2010 as a Development Platform
PDF
Systems Resource Management with NetIQ AppManager
Pure Ejb Within An Agile Context
(ATS3-GS03) Accelrys Enterprise Platform Deeper Dive
Expendables E-AppStore
Beyond SPML: Access Provisioning in a Services World
(ATS3-GS02) Accelrys Enterprise Platform in Enterprise Architectures
Java one brazil_keynote_dochez
SharePoint 2010 as a Development Platform
Systems Resource Management with NetIQ AppManager

What's hot (20)

PDF
Spring 3 MVC CodeMash 2009
PDF
E2.0 - Next Generation Portal and Content Management
PDF
Interfacing Banner BEIS With Identity Management - Summit 2012
PDF
Introduction to Force.com
PDF
Implementing Applications with SOA and Application Integration Architecture
PDF
Connected Applications using WF and WCF
PDF
Oracle - Programatica2010
PPTX
SPEC INDIA Java Case Study
PDF
Dave Carroll Application Services Salesforce
PPTX
Applications at Scale
PPT
[S lide] java_sig-spring-framework
PDF
DevOps for Mobile - DevOpsDays, NY, 2013
PDF
New & Emerging _ Mick Andrew _ Adding mobile and web 2.0 UIs to existing appl...
ODP
Introduction to Spring Framework and Spring IoC
PPT
July 7 Demo Deck
PDF
Build Your Business Process On A Solid Foundation–Web Sphere Application Server
PDF
3 rad extensibility-srilakshmi_s_rajesh_k
 
PDF
02 Ms Online Identity Session 1
PDF
Nuno Godinho
PDF
SAP NetWeaver Cloud Platform - Virtual Bootcamp - Part 2
Spring 3 MVC CodeMash 2009
E2.0 - Next Generation Portal and Content Management
Interfacing Banner BEIS With Identity Management - Summit 2012
Introduction to Force.com
Implementing Applications with SOA and Application Integration Architecture
Connected Applications using WF and WCF
Oracle - Programatica2010
SPEC INDIA Java Case Study
Dave Carroll Application Services Salesforce
Applications at Scale
[S lide] java_sig-spring-framework
DevOps for Mobile - DevOpsDays, NY, 2013
New & Emerging _ Mick Andrew _ Adding mobile and web 2.0 UIs to existing appl...
Introduction to Spring Framework and Spring IoC
July 7 Demo Deck
Build Your Business Process On A Solid Foundation–Web Sphere Application Server
3 rad extensibility-srilakshmi_s_rajesh_k
 
02 Ms Online Identity Session 1
Nuno Godinho
SAP NetWeaver Cloud Platform - Virtual Bootcamp - Part 2
Ad

Similar to Dan Vulpe - JavaFX 2 - Developing RIA with Java (20)

PDF
Modernize your-java ee-app-server-infrastructure
PPT
Oracle ADF Overview
PDF
[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application
PDF
Summer training in j2ee
PPT
Summer training java
PDF
Summer training java
PDF
Soa Based Integration
PDF
Presenter manual J2EE (specially for summer interns)
PPTX
Push to the limit - rich and pro-active user interfaces with ADF - V2 (UKOUG,...
PDF
Introducing spring
PDF
Java EE 與 雲端運算的展望
PPTX
Jsf presentation
PDF
MongoDB for Java Devs with Spring Data - MongoPhilly 2011
PDF
Framework Engineering
PDF
N(i)2 technical architecture 2.0 (v1 1)
 
PPTX
Azure in Developer Perspective
PPTX
Configurando Private Cloud con System Center 2012
PPTX
Configuring and deploying a private cloud with system center 2012
PPTX
WebBee rapid web app development teck stack
PPTX
Introduction to ejb and struts framework
Modernize your-java ee-app-server-infrastructure
Oracle ADF Overview
[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application
Summer training in j2ee
Summer training java
Summer training java
Soa Based Integration
Presenter manual J2EE (specially for summer interns)
Push to the limit - rich and pro-active user interfaces with ADF - V2 (UKOUG,...
Introducing spring
Java EE 與 雲端運算的展望
Jsf presentation
MongoDB for Java Devs with Spring Data - MongoPhilly 2011
Framework Engineering
N(i)2 technical architecture 2.0 (v1 1)
 
Azure in Developer Perspective
Configurando Private Cloud con System Center 2012
Configuring and deploying a private cloud with system center 2012
WebBee rapid web app development teck stack
Introduction to ejb and struts framework
Ad

More from Codecamp Romania (20)

PDF
Cezar chitac the edge of experience
PPTX
Cloud powered search
PPTX
Business analysis techniques exercise your 6-pack
PPTX
Bpm company code camp - configuration or coding with pega
PPT
Andrei prisacaru takingtheunitteststothedatabase
PPTX
Agility and life
PPTX
2015 dan ardelean develop for windows 10
PDF
The bigrewrite
PDF
The case for continuous delivery
PPTX
Stefan stolniceanu spritekit, 2 d or not 2d
PPTX
Sizing epics tales from an agile kingdom
PPTX
Scale net apps in aws
PPTX
Raluca butnaru corina cilibiu the unknown universe of a product and the cer...
PPTX
Parallel & async processing using tpl dataflow
PDF
Material design screen transitions in android
PDF
Kickstart your own freelancing career
PDF
Ionut grecu the soft stuff is the hard stuff. the agile soft skills toolkit
PDF
Ecma6 in the wild
PPTX
Diana antohi me against myself or how to fail and move forward
Cezar chitac the edge of experience
Cloud powered search
Business analysis techniques exercise your 6-pack
Bpm company code camp - configuration or coding with pega
Andrei prisacaru takingtheunitteststothedatabase
Agility and life
2015 dan ardelean develop for windows 10
The bigrewrite
The case for continuous delivery
Stefan stolniceanu spritekit, 2 d or not 2d
Sizing epics tales from an agile kingdom
Scale net apps in aws
Raluca butnaru corina cilibiu the unknown universe of a product and the cer...
Parallel & async processing using tpl dataflow
Material design screen transitions in android
Kickstart your own freelancing career
Ionut grecu the soft stuff is the hard stuff. the agile soft skills toolkit
Ecma6 in the wild
Diana antohi me against myself or how to fail and move forward

Dan Vulpe - JavaFX 2 - Developing RIA with Java

  • 1. 2 Developing RIA with Java Dan Vulpe Software Engineer Centric @dvulpe dvulpe@gmail.com
  • 2. History Apr 2012 Aug 2012 JavaFX JavaFX Oct 2011 2.1 2.2 JavaFX LCD text Canvas 2.0 UI elements UI elements Dec 2008 Apr 2010 Java API Video h264 Touch events JavaFX 1.0 JavaFX 1.3 Windows Mac Linux
  • 3. Scene graph design Scene Parent Parent Parent Parent Leaf Leaf Leaf Leaf Leaf
  • 4. Scene graph design Scene Parent Parent Parent Parent Leaf Leaf Leaf Leaf Leaf
  • 5. Nodes have Properties • parent • scene • translate (X,Y, Z) • scale (X,Y, Z) • opacity • ... see JavaDoc for javafx.scene.Node
  • 6. Observable Properties service.valueProperty().addListener(new ChangeListener<WorkItemUI>() { @Override public void changed(ObservableValue<? extends WorkItemUI> value, WorkItemUI oldValue, WorkItemUI newValue) { itemsPane.getChildren().add(newValue); } });
  • 7. Binding public void bindTo(WorkItemModel workItem) { title.bindBidirectional(workItem.title); issueType.bind(workItem.issueType); workItemInfo.bindBidirectional(workItem.workItemInfo); asignee.bindBidirectional(workItem.asignee); dueDate.bindBidirectional(workItem.dueDate); priority.bindBidirectional(workItem.priority); }
  • 10. FXML <VBox alignment="CENTER" prefHeight="250.0" prefWidth="450.0" spacing="5.0" xmlns:fx="http://javafx.com/fxml"> <children> <Label text="Enter your credentials" textFill="WHITE"/> <GridPane fx:id="formContainer" hgap="10.0" vgap="10.0"> <children> <Label text="Username" GridPane.columnIndex="0" GridPane.rowIndex="0"/> <Label text="Password" GridPane.columnIndex="0" GridPane.rowIndex="1" /> <TextField GridPane.columnIndex="1" GridPane.rowIndex="0" /> <TextField GridPane.columnIndex="1" GridPane.rowIndex="1" /> <Button text="Log In" GridPane.columnIndex="1" GridPane.rowIndex="2" /> </children> </GridPane> </children> </VBox>
  • 11. Scene Builder - Oracle
  • 13. CSS Styling .root { -fx-font-size: 15px; -fx-base: #eee; -fx-font-family: "Trebuchet MS"; } .workItem { -fx-border-radius: 5; -fx-background-radius: 5; -fx-effect: dropshadow(gaussian, #ccc, 10, 0.1, 5, 2); -fx-border-color: #666; -fx-border-weight: 1px; -fx-font-size: 1em; -fx-opacity: 0.9; -fx-base: #333; }
  • 14. Bindings public class DemoController { @FXML private TextField textField; @FXML private Label label; @FXML private ListView<String> listView; @FXML private Pane rootPane; @FXML private Pane formPane; @FXML private Button aButton; public void setDataModel(DataModel dataModel) { label.textProperty().bind(dataModel.titleProperty()); textField.textProperty().bindBidirectional(dataModel.textProperty()); Bindings.bindContent(dataModel.aPlainList(), listView.getItems()); aButton.disableProperty().bind(textField.textProperty().isEqualTo("")); formPane.prefWidthProperty().bind(rootPane.widthProperty().divide(2)); } }
  • 15. Application Structure FXML (layout) FX CSS JavaFX JavaFX Scene (styling) Stage Rendered On Rendered On Java Controller
  • 17. GUI components External Sends Actions To Business Services Presenter View Logic Client Updates Binds To Application State Model Core UI
  • 18. JavaFX approach External Business Sends Actions To Services Logic Presenter View Client Updates Binds To Application State Model Core UI
  • 19. JavaFX approach External Business Sends Actions To Services Logic Presenter View Client Updates Binds To Application State Model Core UI Async Services
  • 20. JavaFX approach External Business Sends Actions To Services Logic Presenter View Client Updates Binds To Application State Model Core UI Async Services
  • 21. JavaFX approach Use Case 1 External Business Sends Actions To Services Logic Presenter View Client Updates Binds To Application State Model Core UI Async Services
  • 22. JavaFX approach Use Case 1 External Business Use Sends Actions To Services Logic Case 2 Presenter View Client Updates Binds To Application State Model Core UI Async Services
  • 23. JavaFX approach Use Case 1 External Business Use Sends Actions To Services Logic Case 2 Presenter View Client Use Case 3 Updates Binds To Application State Model Core UI Async Services
  • 24. JavaFX approach Use Case 1 External Business Use Sends Actions To Services Logic Case 2 Presenter View Client Use Case 3 Updates Binds To Application State Model Use Case N Core UI Async Services
  • 25. DEMO
  • 26. JavaFX App Structure FXML (layout) FX CSS JavaFX JavaFX Scene (styling) Stage Rendered On Rendered On Java Controller
  • 27. Swing Integration FXML (layout) swing Component FX CSS JavaFX Scene JFXPanel (styling) Rendered On Rendered On Java Controller
  • 28. Deploy • applets • Java WebStart • standalone applications (natively packaged Windows, Mac) • ... using JavaFX SDK tools (ant tasks)
  • 29. Why JavaFX? • available on the JVM (Java, JRuby, Scala, Groovy, Clojure) • portability (Mac, Linux, Windows) • scene-graph • rapid development
  • 30. Resources • http://fxexperience.com • http://github.com/dvulpe/codecamp-javafx
  • 31. ?
  • 32. Thank you! Please fill in the feedback form!