SlideShare une entreprise Scribd logo
1  sur  28
Télécharger pour lire hors ligne
Effective JavaFX
Architecture with


                  Presented by
               Srikanth Shenoy
                  ObjectSource
         (Covers FxObjects 0.1)
Introduction
   Who am I?
       A hands-on architect
       Experienced and very knowledgeable in Java and
        Java EE
       Authored a book on Struts
       Several articles on Java EE for leading journals
       Director of Enterprise Java Practice at
        ObjectSource
       Creator of FxObjects framework
Introduction
   What is FxObjects? (Currently 0.1)
       An open source JavaFX application development
        framework (Apache License)
   Why FxObjects?
       Enterprise JavaFX architect/developer starts from
        scratch, reinventing the wheel, wasting time and
        repeating mistakes
       Enterprise JavaFX applications need a strategic
        and functional framework (not a point solution).
       FxObjects is that strategic functional framework !
   Learn FxObjects in 25 slides !
30K ft. Overview
Introduction
   FxObjects is the end to end application
    development framework in the UI tier.
   Designed to simplify large JavaFX application
    development
   Makes your application elegant by using
    proven patterns, principles and practices
   If you use FxObjects as defined in the user
    guide, your application becomes inherently
    test friendly
Introduction
   FxObjects is Dependency Injection (DI)
    friendly from the grounds-up.
   Tested with Spring 2.5
   Dependency Injection + FxObjects makes a
    very powerful and agile programming model
   FxObjects makes TDD possible with JavaFX
    by using Model-View-Presenter (MVP)
   FxObjects is NOT a UI component library
    (and never intends to be).
Model-View-Presenter
(Passive View)


   Note the sequence of events in MVP passive
    View
   Actual UI is lean, mean and clean 
   Presenter does the heavy lifting on the UI
    side. But Presenter is not really a UI !!
   Hence Presenter can be easily tested and
    asserted
MVP with FxObjects
   NodePresenter is the FxObjects class.
   MyNodePresenter and MyNode are app
    classes & hold reference to each other
   When a event occurs, the MyNode simply
    calls doOnSearchButtonClick()
Presenter Code
   doSearchButtonClick method
       Validates UI (for mandatory fields)
       Calls the service asynchronously using FxObjects
        Command classes
       That’s it!
   You will see FxObjects Commands next
       For aiding the async service calls
       Update the UI when async calls return data
       Show error message when service call fails
Challenges in Service
Invocation
   Async calls are fire and forget
   They should execute off the Event Dispatch
    Thread (EDT)
   All UI updates should then again occur ON
    the EDT.
   Can be confusing and errror-prone
   Swing provided SwingWorker
   JavaFX provides a async framework
       Slightly complex, but FXObjects simplifies this
JavaFX Async Framework
Challenges in Service
Invocation (contd.)
   HttpRequest (core JavaFX class) has some
    solution (async call is off-EDT & callbacks are
    on-EDT), but it is the foundation for a full
    solution
   FxObjects HttpCommands provide the
    missing pieces to make this simple
   How to easily go to another page v/s stay on
    same page after service invocation?
       FxObjects solves this, as we shall see soon
        (controller chain)
Command objects
   Command objects are configured first and
    then executed [with execute(..) method]
var cmd =   DefaultAsyncCommand      {
     runInBackground: function(modelObj:Object):Object {
         //call service here
     }
     onSuccess:   function(resultObj:Object):Void {
         //update ui widgets here OR navigate to another UI
     }
     onError: function(e:Exception):Void {
         //show the error
     }
}
Automating XML to JavaFX
   No Xml tag handling code necessary
   Use XmlResponseBuilder
   Called ResponseBuilder since it was initially
    built to construct JavaFX objects from XML
    content (returned by REST services)
   Can handle XML of any type and of any
    depth
       Scales well for all kinds of xml
       Best suited for small JavaFX apps though
   Larger apps can use JAXBResponseBuilder
Automating JavaFX to XML
   No code necessary
   Use XmlRequestBuilder
   Called RequestBuilder since it was initially
    built to construct XML from JavaFX objects to
    be sent as request body to REST services
   Can handle JavaFX objects of any type and
    of any depth
       Scales well for JavaFX objects of any kind
       Best suited for small JavaFX apps
   Larger apps can use JAXBRequestBuilder
HttpCommands and Builders
   Just like DefaultAsyncCommand
   No runInBackground necessary. [Http
    GET/POST themselves run in background !!]
   Url & query parameters are configurable with
    { } syntax
       e.g. http://server/app/search?zipCode={zipCode}
       The params in {} can be passed in a Map
       Otherwise reflection is used to query the object
   Need RequestBuilder and ResponseBuilder
       XML***Builder or JAXB***Builder
GetHttpCommand
var respBuilder = new MyJAXBResponseBuilder();
respBuilder.setSchema(…);
var cmd = GetHttpCommand {
    urlTemplate: “http://.../Search?output=xml&zip={zipCode}&..
    responseBuilder: respBuilder
    onSuccess: function(resultData:Object) {
      var result = resultData as ResultSet;
      //update UI components here OR navigate to another UI
    }
    onError: function(e:Exception) {
    ..
    }
}
..
function doSearchButtonClick() {
  var paramMap = new HashMap();
  paramMap.put(“zipCode”, node.zipCodeTxtBox.text);
  cmd.execute(paramMap);
}
Custom JAXB Response
Builder
public class CafeSearchResponseBuilder extends
   JAXBResponseBuilder<ResultSet> {
  @Override
  public ResultSet buildResponse(String serverResponse) {
    ResultSet rs =
               buildResponseObjectFromXml(serverResponse);
    return rs;
  }

    @Override
    public ResultSet buildResponse(InputStream inputStream) {
      ResultSet rs = buildResponseObjectFromXml(inputStream);
      return rs;
    }
}
BodyHttpCommand
   Use for PUT and POST
   Almost same as GetHttpCommand
   Additionally needs RequestBuilder
       To convert the presentation model object into
        format expected by server (Generaly XML)
   Optionally a content pre-processor
       To massage the output from the requestbuilder
        and before sending to server
Navigation challenges
   How to go to another page v/s stay on same
    page after service invocation succeeds?
   Default JavaFX model involves binding to a
    new scenegraph
       Couples the lower level UI to top level stage.
   No idioms for organizing the application into
    modules
   Who decides what is the default node to
    display?
   Solution: FxObjects ControllerChain
Controller Chain
Navigation with FxObjects
Controller Chain
   Each Application can hold many Presenters
   Each Application can have many Modules
   Each Module can hold many Presenters
   Application has a Application Controller
   Each Module has a Module Controller.
       Module Controller has a Id
   Each NodePresenter owns the Node
       Node Presenter has a Id
Navigation with FxObjects
Controller Chain (contd.)
public MyNodePresenter extends NodePresenter
  var cmd = DefaultAsyncCommand {
    runInBackground:function(modelObj:Object):Object {
      //call service here
    }
    onSuccess: function(resultObj:Object):Void {
      //update ui here OR go to another page
      this.changeNodePresenter(“someNodePresenterId”);
    }
    onError: function(e:Exception):Void {
      //show the error
    }
  }
changeNodePresenter(..) is defined in NodePresenter class (the parent)
FxObjects and Dependency
Injection
   FxObjects is built with Dependency Injection
    in mind.
       DI is optional, but recommended
   What can be wired
       ApplicationController, ModuleController
       NodePresenter (but not Nodes)
       Commands, Services (Service Proxies)
   Nodes should be maintained by Presenters.
       This lets presenters choose appropriate node
        handling strategy (cache, dispose after use etc.)
Bootstrapping FxObjects
var ctx = new ClassPathXmlApplicationContext(“/your-spring.xml");
var appController =
        ctx.getBean("appController") as ApplicationController;

Stage {
  title: "FxObjects Example“
  scene: Scene {
    width: 600
    height: 400
    content: bind [
        appController.currentNodePresenter.getNode()
    ]
  }
}
   Node presenter configured as default is shown at the beginning
   Every navigation call sets another NodePresenter as the “Current”
    NodePresenter and that gets bound to the scenegraph
What’s coming in 0.2?
   Lifecycle
   Event
   Event Bus
   Security
   JSON to JavaFX round-tripping
   Suggestions welcome (Please post in the
    discussion forums)
   Timeframe: September 2010
FxObjects Summary
   Enterprise JavaFX applications are inherently
    complex.
       Architecting such apps is art and science
       FxObjects can help
   The more complex the application, the more
    value you get from FxObjects
   End to end programming model for the UI
   Does not force any programming model for
    the server
Links
   Project site – https://fxobjects/dev.java.net
   Not a single person open source project
       FxObjects is developed and supported by
        ObjectSource (http://www.objectsource.com)
   Download, use, extend, redistribute, OEM
   Discussion Forums on project site
       We will answer your questions
   Participation welcome
       Post ideas, questions, concerns, comments
       Contribute code

Contenu connexe

Tendances

Understanding Framework Architecture using Eclipse
Understanding Framework Architecture using EclipseUnderstanding Framework Architecture using Eclipse
Understanding Framework Architecture using Eclipseanshunjain
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Ran Mizrahi
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiRan Mizrahi
 
JavaFX8 TestFX - CDI
JavaFX8   TestFX - CDIJavaFX8   TestFX - CDI
JavaFX8 TestFX - CDISven Ruppert
 
Java interview-questions-and-answers
Java interview-questions-and-answersJava interview-questions-and-answers
Java interview-questions-and-answersbestonlinetrainers
 
Java script Examples by Som
Java script Examples by Som  Java script Examples by Som
Java script Examples by Som Som Prakash Rai
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to JavaSMIJava
 
Zend Studio Tips and Tricks
Zend Studio Tips and TricksZend Studio Tips and Tricks
Zend Studio Tips and TricksRoy Ganor
 
Commit University - Exploring Angular 2
Commit University - Exploring Angular 2Commit University - Exploring Angular 2
Commit University - Exploring Angular 2Commit University
 
Java 9 New Features
Java 9 New FeaturesJava 9 New Features
Java 9 New FeaturesAli BAKAN
 
01 introduction to struts2
01 introduction to struts201 introduction to struts2
01 introduction to struts2Smita B Kumar
 
Advanced JavaScript - Internship Presentation - Week6
Advanced JavaScript - Internship Presentation - Week6Advanced JavaScript - Internship Presentation - Week6
Advanced JavaScript - Internship Presentation - Week6Devang Garach
 
Session 45 - Spring - Part 3 - AOP
Session 45 - Spring - Part 3 - AOPSession 45 - Spring - Part 3 - AOP
Session 45 - Spring - Part 3 - AOPPawanMM
 

Tendances (19)

Understanding Framework Architecture using Eclipse
Understanding Framework Architecture using EclipseUnderstanding Framework Architecture using Eclipse
Understanding Framework Architecture using Eclipse
 
Struts2
Struts2Struts2
Struts2
 
OmniFaces validators
OmniFaces validatorsOmniFaces validators
OmniFaces validators
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)
 
EJB Part-1
EJB Part-1EJB Part-1
EJB Part-1
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
 
JavaFX8 TestFX - CDI
JavaFX8   TestFX - CDIJavaFX8   TestFX - CDI
JavaFX8 TestFX - CDI
 
Signal Framework
Signal FrameworkSignal Framework
Signal Framework
 
Java interview-questions-and-answers
Java interview-questions-and-answersJava interview-questions-and-answers
Java interview-questions-and-answers
 
Java script Examples by Som
Java script Examples by Som  Java script Examples by Som
Java script Examples by Som
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to Java
 
Zend Studio Tips and Tricks
Zend Studio Tips and TricksZend Studio Tips and Tricks
Zend Studio Tips and Tricks
 
Commit University - Exploring Angular 2
Commit University - Exploring Angular 2Commit University - Exploring Angular 2
Commit University - Exploring Angular 2
 
Java 9 New Features
Java 9 New FeaturesJava 9 New Features
Java 9 New Features
 
Java Tutorial
Java TutorialJava Tutorial
Java Tutorial
 
Core java introduction
Core java introduction Core java introduction
Core java introduction
 
01 introduction to struts2
01 introduction to struts201 introduction to struts2
01 introduction to struts2
 
Advanced JavaScript - Internship Presentation - Week6
Advanced JavaScript - Internship Presentation - Week6Advanced JavaScript - Internship Presentation - Week6
Advanced JavaScript - Internship Presentation - Week6
 
Session 45 - Spring - Part 3 - AOP
Session 45 - Spring - Part 3 - AOPSession 45 - Spring - Part 3 - AOP
Session 45 - Spring - Part 3 - AOP
 

En vedette

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
 
Introduction into JavaFX
Introduction into JavaFXIntroduction into JavaFX
Introduction into JavaFXEugene Bogaart
 
Getting your Grails on
Getting your Grails onGetting your Grails on
Getting your Grails onTom Henricksen
 
Message Driven Architecture in Grails
Message Driven Architecture in GrailsMessage Driven Architecture in Grails
Message Driven Architecture in GrailsDaniel Woods
 
OpenJFX on Android and Devices
OpenJFX on Android and DevicesOpenJFX on Android and Devices
OpenJFX on Android and DevicesStephen Chin
 
Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7Bruno Borges
 
Visual Design with Data
Visual Design with DataVisual Design with Data
Visual Design with DataSeth Familian
 

En vedette (13)

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)
 
Introduction into JavaFX
Introduction into JavaFXIntroduction into JavaFX
Introduction into JavaFX
 
Neo4J and Grails
Neo4J and GrailsNeo4J and Grails
Neo4J and Grails
 
Getting your Grails on
Getting your Grails onGetting your Grails on
Getting your Grails on
 
JavaFx
JavaFxJavaFx
JavaFx
 
Play framework
Play frameworkPlay framework
Play framework
 
JavaFX Uni Parthenope
JavaFX Uni ParthenopeJavaFX Uni Parthenope
JavaFX Uni Parthenope
 
Message Driven Architecture in Grails
Message Driven Architecture in GrailsMessage Driven Architecture in Grails
Message Driven Architecture in Grails
 
JavaFX in Action Part I
JavaFX in Action Part IJavaFX in Action Part I
JavaFX in Action Part I
 
OpenJFX on Android and Devices
OpenJFX on Android and DevicesOpenJFX on Android and Devices
OpenJFX on Android and Devices
 
Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Visual Design with Data
Visual Design with DataVisual Design with Data
Visual Design with Data
 

Similaire à Effective JavaFX architecture with FxObjects

Module design pattern i.e. express js
Module design pattern i.e. express jsModule design pattern i.e. express js
Module design pattern i.e. express jsAhmed Assaf
 
React Native for multi-platform mobile applications
React Native for multi-platform mobile applicationsReact Native for multi-platform mobile applications
React Native for multi-platform mobile applicationsMatteo Manchi
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]GDSC UofT Mississauga
 
Clojure Fundamentals Course For Beginners
Clojure Fundamentals Course For Beginners Clojure Fundamentals Course For Beginners
Clojure Fundamentals Course For Beginners Paddy Lock
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Previewvaluebound
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day trainingTroy Miles
 
OpenDaylight and YANG
OpenDaylight and YANGOpenDaylight and YANG
OpenDaylight and YANGCoreStack
 
Introduction to jsf2
Introduction to jsf2Introduction to jsf2
Introduction to jsf2Rajiv Gupta
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsJeff Durta
 
React Basic and Advance || React Basic
React Basic and Advance   || React BasicReact Basic and Advance   || React Basic
React Basic and Advance || React Basicrafaqathussainc077
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryjanet736113
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 

Similaire à Effective JavaFX architecture with FxObjects (20)

Module design pattern i.e. express js
Module design pattern i.e. express jsModule design pattern i.e. express js
Module design pattern i.e. express js
 
React Native for multi-platform mobile applications
React Native for multi-platform mobile applicationsReact Native for multi-platform mobile applications
React Native for multi-platform mobile applications
 
DataFX - JavaOne 2013
DataFX - JavaOne 2013DataFX - JavaOne 2013
DataFX - JavaOne 2013
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
 
Clojure Fundamentals Course For Beginners
Clojure Fundamentals Course For Beginners Clojure Fundamentals Course For Beginners
Clojure Fundamentals Course For Beginners
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day training
 
react-slides.pptx
react-slides.pptxreact-slides.pptx
react-slides.pptx
 
OpenDaylight and YANG
OpenDaylight and YANGOpenDaylight and YANG
OpenDaylight and YANG
 
node.js.pptx
node.js.pptxnode.js.pptx
node.js.pptx
 
Introduction to jsf2
Introduction to jsf2Introduction to jsf2
Introduction to jsf2
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
 
React native
React nativeReact native
React native
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
 
React Basic and Advance || React Basic
React Basic and Advance   || React BasicReact Basic and Advance   || React Basic
React Basic and Advance || React Basic
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
react-slides.pdf
react-slides.pdfreact-slides.pdf
react-slides.pdf
 
react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react library
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Lezione 03 Introduzione a react
Lezione 03   Introduzione a reactLezione 03   Introduzione a react
Lezione 03 Introduzione a react
 

Dernier

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 

Dernier (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 

Effective JavaFX architecture with FxObjects

  • 1. Effective JavaFX Architecture with Presented by Srikanth Shenoy ObjectSource (Covers FxObjects 0.1)
  • 2. Introduction  Who am I?  A hands-on architect  Experienced and very knowledgeable in Java and Java EE  Authored a book on Struts  Several articles on Java EE for leading journals  Director of Enterprise Java Practice at ObjectSource  Creator of FxObjects framework
  • 3. Introduction  What is FxObjects? (Currently 0.1)  An open source JavaFX application development framework (Apache License)  Why FxObjects?  Enterprise JavaFX architect/developer starts from scratch, reinventing the wheel, wasting time and repeating mistakes  Enterprise JavaFX applications need a strategic and functional framework (not a point solution).  FxObjects is that strategic functional framework !  Learn FxObjects in 25 slides !
  • 5. Introduction  FxObjects is the end to end application development framework in the UI tier.  Designed to simplify large JavaFX application development  Makes your application elegant by using proven patterns, principles and practices  If you use FxObjects as defined in the user guide, your application becomes inherently test friendly
  • 6. Introduction  FxObjects is Dependency Injection (DI) friendly from the grounds-up.  Tested with Spring 2.5  Dependency Injection + FxObjects makes a very powerful and agile programming model  FxObjects makes TDD possible with JavaFX by using Model-View-Presenter (MVP)  FxObjects is NOT a UI component library (and never intends to be).
  • 7. Model-View-Presenter (Passive View)  Note the sequence of events in MVP passive View  Actual UI is lean, mean and clean   Presenter does the heavy lifting on the UI side. But Presenter is not really a UI !!  Hence Presenter can be easily tested and asserted
  • 8. MVP with FxObjects  NodePresenter is the FxObjects class.  MyNodePresenter and MyNode are app classes & hold reference to each other  When a event occurs, the MyNode simply calls doOnSearchButtonClick()
  • 9. Presenter Code  doSearchButtonClick method  Validates UI (for mandatory fields)  Calls the service asynchronously using FxObjects Command classes  That’s it!  You will see FxObjects Commands next  For aiding the async service calls  Update the UI when async calls return data  Show error message when service call fails
  • 10. Challenges in Service Invocation  Async calls are fire and forget  They should execute off the Event Dispatch Thread (EDT)  All UI updates should then again occur ON the EDT.  Can be confusing and errror-prone  Swing provided SwingWorker  JavaFX provides a async framework  Slightly complex, but FXObjects simplifies this
  • 12. Challenges in Service Invocation (contd.)  HttpRequest (core JavaFX class) has some solution (async call is off-EDT & callbacks are on-EDT), but it is the foundation for a full solution  FxObjects HttpCommands provide the missing pieces to make this simple  How to easily go to another page v/s stay on same page after service invocation?  FxObjects solves this, as we shall see soon (controller chain)
  • 13. Command objects  Command objects are configured first and then executed [with execute(..) method] var cmd = DefaultAsyncCommand { runInBackground: function(modelObj:Object):Object { //call service here } onSuccess: function(resultObj:Object):Void { //update ui widgets here OR navigate to another UI } onError: function(e:Exception):Void { //show the error } }
  • 14. Automating XML to JavaFX  No Xml tag handling code necessary  Use XmlResponseBuilder  Called ResponseBuilder since it was initially built to construct JavaFX objects from XML content (returned by REST services)  Can handle XML of any type and of any depth  Scales well for all kinds of xml  Best suited for small JavaFX apps though  Larger apps can use JAXBResponseBuilder
  • 15. Automating JavaFX to XML  No code necessary  Use XmlRequestBuilder  Called RequestBuilder since it was initially built to construct XML from JavaFX objects to be sent as request body to REST services  Can handle JavaFX objects of any type and of any depth  Scales well for JavaFX objects of any kind  Best suited for small JavaFX apps  Larger apps can use JAXBRequestBuilder
  • 16. HttpCommands and Builders  Just like DefaultAsyncCommand  No runInBackground necessary. [Http GET/POST themselves run in background !!]  Url & query parameters are configurable with { } syntax  e.g. http://server/app/search?zipCode={zipCode}  The params in {} can be passed in a Map  Otherwise reflection is used to query the object  Need RequestBuilder and ResponseBuilder  XML***Builder or JAXB***Builder
  • 17. GetHttpCommand var respBuilder = new MyJAXBResponseBuilder(); respBuilder.setSchema(…); var cmd = GetHttpCommand { urlTemplate: “http://.../Search?output=xml&zip={zipCode}&.. responseBuilder: respBuilder onSuccess: function(resultData:Object) { var result = resultData as ResultSet; //update UI components here OR navigate to another UI } onError: function(e:Exception) { .. } } .. function doSearchButtonClick() { var paramMap = new HashMap(); paramMap.put(“zipCode”, node.zipCodeTxtBox.text); cmd.execute(paramMap); }
  • 18. Custom JAXB Response Builder public class CafeSearchResponseBuilder extends JAXBResponseBuilder<ResultSet> { @Override public ResultSet buildResponse(String serverResponse) { ResultSet rs = buildResponseObjectFromXml(serverResponse); return rs; } @Override public ResultSet buildResponse(InputStream inputStream) { ResultSet rs = buildResponseObjectFromXml(inputStream); return rs; } }
  • 19. BodyHttpCommand  Use for PUT and POST  Almost same as GetHttpCommand  Additionally needs RequestBuilder  To convert the presentation model object into format expected by server (Generaly XML)  Optionally a content pre-processor  To massage the output from the requestbuilder and before sending to server
  • 20. Navigation challenges  How to go to another page v/s stay on same page after service invocation succeeds?  Default JavaFX model involves binding to a new scenegraph  Couples the lower level UI to top level stage.  No idioms for organizing the application into modules  Who decides what is the default node to display?  Solution: FxObjects ControllerChain
  • 22. Navigation with FxObjects Controller Chain  Each Application can hold many Presenters  Each Application can have many Modules  Each Module can hold many Presenters  Application has a Application Controller  Each Module has a Module Controller.  Module Controller has a Id  Each NodePresenter owns the Node  Node Presenter has a Id
  • 23. Navigation with FxObjects Controller Chain (contd.) public MyNodePresenter extends NodePresenter var cmd = DefaultAsyncCommand { runInBackground:function(modelObj:Object):Object { //call service here } onSuccess: function(resultObj:Object):Void { //update ui here OR go to another page this.changeNodePresenter(“someNodePresenterId”); } onError: function(e:Exception):Void { //show the error } } changeNodePresenter(..) is defined in NodePresenter class (the parent)
  • 24. FxObjects and Dependency Injection  FxObjects is built with Dependency Injection in mind.  DI is optional, but recommended  What can be wired  ApplicationController, ModuleController  NodePresenter (but not Nodes)  Commands, Services (Service Proxies)  Nodes should be maintained by Presenters.  This lets presenters choose appropriate node handling strategy (cache, dispose after use etc.)
  • 25. Bootstrapping FxObjects var ctx = new ClassPathXmlApplicationContext(“/your-spring.xml"); var appController = ctx.getBean("appController") as ApplicationController; Stage { title: "FxObjects Example“ scene: Scene { width: 600 height: 400 content: bind [ appController.currentNodePresenter.getNode() ] } }  Node presenter configured as default is shown at the beginning  Every navigation call sets another NodePresenter as the “Current” NodePresenter and that gets bound to the scenegraph
  • 26. What’s coming in 0.2?  Lifecycle  Event  Event Bus  Security  JSON to JavaFX round-tripping  Suggestions welcome (Please post in the discussion forums)  Timeframe: September 2010
  • 27. FxObjects Summary  Enterprise JavaFX applications are inherently complex.  Architecting such apps is art and science  FxObjects can help  The more complex the application, the more value you get from FxObjects  End to end programming model for the UI  Does not force any programming model for the server
  • 28. Links  Project site – https://fxobjects/dev.java.net  Not a single person open source project  FxObjects is developed and supported by ObjectSource (http://www.objectsource.com)  Download, use, extend, redistribute, OEM  Discussion Forums on project site  We will answer your questions  Participation welcome  Post ideas, questions, concerns, comments  Contribute code