SlideShare uma empresa Scribd logo
1 de 39
Baixar para ler offline
JFXtras
JavaFX Controls, Layouts, Services, and More


Stephen Chin          Dean Iverson
GXS                   Virginia Tech Transportation Institute
steve@widgetfx.org    deanriverson@gmail.com
tweet: @steveonjava   tweet: @deanriverson
Meet the Presenters…
              Steve                               Dean

                                     Family Man


 Family Man




                      Motorcyclist



                                                         Robotics
                                                          Coach


                                                                    2
Agenda
> JFXtras 0.7 Summary
> JavaFX 2.0 Recap

> The Future of JFXtras

> A Little Announcement…




                           3
JFXtras 0.7 Summary




     Layouts          Borders




     Shapes           Controls
                                 4
JFXtras Grid

        Row

         Row


               5
JFXtras Grid
Grid {
  effect: Reflection {}
  border: 20
  vgap: 12
  hgap: 12
  rows: bind [
    row([text, progressBar]),
    row([navigator, mediaGrid])
  ]
}
                                  6
JFXtras Borders




                  7
JFXtras Borders
Function:
override function create() {
  TitledBorder {
    id: "imageTitle"
    title: file.getName()
    content: FrameBorder {
      id: "imageFrame"
      node: ResizableImageView {
        preserveRatio: true
        smooth: true
        image: bind image
      }
    }
  }
}
                                   8
Border and Grid Example




                          9
MigLayout for JavaFX




                       10
Flexible Grid Layout


         Flow          Wrap




                              11
XMigLayout {
  constraints: "fill, wrap"
  columns: "[][]"
  rows: "[][]4mm[]push[]"
  content: [
    Label {
      text: "Email"
      layoutInfo: nodeConstraints( "ax right" )
    }
    TextBox {
      layoutInfo: nodeConstraints( "growx, pushx" )
    }
    Label {
      text: "Password"
      layoutInfo: nodeConstraints( "ax right" )
    }
    TextBox {
      layoutInfo: nodeConstraints( "growx, pushx" )
    }
    Button {
      text: "Login“, layoutInfo: nodeConstraints( "skip, right" )
    }
    Label {
      text: "This text is 'pushed' to the bottom“, layoutInfo: nodeConstraints( "span" )
}]}
                                                                                           12
Flexible Border Layout

Stage {
  title: "Mig Docking Test"
  scene: XScene {
      width: 400, height: 400
      fill: Color.LEMONCHIFFON
      content: XMigLayout {
           constraints: "fill"
           content: [
              migNode( createLabel( Color.KHAKI, "North" ), "north" ),
              migNode( createLabel( Color.GOLDENROD, "South" ), "south" ),
              migNode( createLabel( Color.GOLD, "East" ),   "east" ),
              migNode( createLabel( Color.DARKKHAKI, "West" ), "west" ),
            ]
      }
  }
}
                                                                             13
Inflexible Absolute Layout

function createLabel( color:Color, label:String ) {
   XMigLayout {
     constraints: "fill"
     content: [
        ResizableRectangle {
           fill: color
           layoutInfo: nodeConstraints( "pos 0 0 container.x2 container.y2" )
        }
        Text {
           content: label
           font: Font { size: 18 }
           layoutInfo: nodeConstraints( "center, grow" )
        }
     ]
   }
}
                                                                                14
JFXtras Shapes

    Almond     Intersection of two circles (Vesica Piscis)   centerX, centerY, width

    Arrow      Arrow shape x, y, width, height, depth, rise


    Asterisk   Asterisk with rounded corners                 centerX, centerY, width, radius, beams, roundness


    Astroid    Hypocloid with four cusps      centerX, centerY, radius

    Balloon    Rectangular shape with a tab x, y, width, height, arc, anglePosition, tabWidth,
                                            tabHeight, tabLocation, tabDisplacement


    Cross      Symmetrical cross shape        centerX, centerY, width, radius, roundness

    Donut      Regular polygon with a hole centerX, centerY, innerRadius, outerRadius, sides

    Lauburu    Four comma-shaped heads centerX, centerY, radius



                                                                                            Continued…
                                                                                                                 15
JFXtras Shapes (continued)
   MultiRoundRectangle       Rectangle with configurable corners     x, y, width, height, topLeftWidth/Height,
                                                                      topRightWidth/Height, bottomLeftWidth/Height,
                                                                      bottomRightWidth/Height
   Rays        Multiple rays extend from center         centerX, centerY, rays, radius, extent, rounded

   RegularPolygon            Polygon with equal sides   centerX, centerY, sides, radius


   ReuleauxTriangle          Curved triangle shape      centerX, centerY, radius

   RoundPin    Cone with rounded top      centerX, centerY, height, radius

   Star2       Multipoint star            centerX, centerY, innerRadius, outerRadius, count


   ETriangle   Equilateral triangle          x, y, width
   ITriangle   Isosceles triangle            x, y, width, height
   RTriangle   Right triangle x, y, width, height, anglePosition




                                                                                                            16
JFXtras Shapes




                 17
Sphere Challenge
                                                                          Andres Almiray’s Weblog




             http://www.jroller.com/aalmiray/entry/griffon_gfxbuilder_fxbuilder_side_by


“The following snapshot shows a couple of
spheres drawn with GfxBuilder and
FxBuilder, can you guess which one is
which?
…
This is by no means a post to bash JavaFX
rather to point out some of its deficiencies”
                            -- Andres Almiray
                    (taken completely out of context)


                                                                                               18
Sphere Challenge – JavaFX Response
>   Composition:
     RadialGradient for the Sphere

     Three additional RadialGradients for
      the light sources
     A blurred shadow underneath

>   Features:
     All Bound/Relative Coordinates

     Configurable –

           Base, Ambient, Specular, Shine Colors
           Shadow Size and Height
       Uses New JFXtras ColorUtil Library
       JavaFX Caching for High Performance
                                                    19
JFXtras Spheres Demo




                       20
JFXtras Controls
>   Simple Controls
       XHyperlink
       XEtchedButton
       XPane
>   Complex Controls
       XPicker
       XCalendarPicker
       XShelfView
       XTableView


                          21
Hyperlinks and Etched Buttons
XHyperlink {
  text: "Oracle's Homepage",
  url: "http://oracle.com/"
}

var hposSeq = [ HPos.LEFT, HPos.CENTER, HPos.RIGHT ];
HBox {
  spacing: -1
  content: for (i in [0..2]) {
     XEtchedButton {
       graphic: ImageView { image: images[i] }
       buttonGroupHPos: hposSeq[i]
     }
  }
}
                                                        22
XPane




        23
XPane

 XPane {
  title: "Default Titled XPane”
  contentNode: Label { text: "Default XPane with a Label" }
  layoutInfo: LayoutInfo { width: 200, height: 200 }
}




                                                              24
XPicker
>   Multiple Picker Types
       Side Scroll
       Drop Down
       Thumb Wheel
       Side/Thumb Nudge
>   Supports All Events
       Mouse Clicks
       Mouse Wheel
       Keyboard


                            25
XCalendarPicker
>   Configurable Locale
>   Multiple Selection Modes
       Single
       Multiple
       Range
>   Completely Skinnable




                               26
XShelfView
>   High Performance
>   Features:
       Scrollbar
       Image Title
       Reflection Effect
       Aspect Ratio
       Infinite Repeat
>   Integrates With JFXtras Data Providers
>   Automatically Updates on Model Changes

                                             27
XTableView
>   Insanely Scalable
       Up to 16 million rows
>   Extreme Performance
       Pools rendered nodes
       Caches images
       Optimized scene graph
>   Features:
       Drag-and-Drop Column Reordering
       Dynamic Updating from Model
       Automatically Populates Column Headers
                                                 28
BandMatesFX - JSONHandler in 3 Steps
              public class FreebaseResult {
                public var code: String;
    1           public var result: Result;
                public var status: String;
   POJO         public var transactionId: String;
              }

              var albumHandler:JSONHandler = JSONHandler {

    2           rootClass: "javafxpert.FreebaseResult“
                onDone: function(obj, isSequence): Void {
JSONHandler      freebaseResult = obj as FreebaseResult;
              }}

              req = HttpRequest {

    3           location: queryUrl
                onInput: function(is: java.io.InputStream) {
HttpRequest       albumHandler.parse(is);
              }}
                                                               29
http://jfxtras.org/   30
JavaFX 2.0 Recap
>   The Good
       JavaFX is here to stay
       Controls will be open source
       Calling JavaFX code from different language is
        pretty cool!
>   The Bad
       We have to wait a bit… (next summer)
       Mobile is no longer on the radar
>   The Ugly
       JavaFX Script was a pretty nice language…
                                                         31
The Future of JFXtras
>   Mission:
       Provide Quality JavaFX Add-ons
>   Going Forward:
       Migrate Non-Overlapping Functionality
       Support Java APIs For All Components
       Continue to Fill the Gaps
>   Reality:
       Migration Will Be Challenging
       Release Dates Will Trail Oracle
           (until they are fully open source)

                                                 32
How about JavaFX on… Java
public class HelloStage implements Runnable {
    public void run() {
      Stage stage = new Stage();
      stage.setTitle("Hello Stage");
      stage.setWidth(600);
      stage.setHeight(450);
        Scene scene = new Scene();
        scene.setFill(Color.LIGHTGREEN);
        stage.setScene(scene);
        stage.setVisible(true);
    }
    public static void main(String[] args) {
      FX.start(new HelloStage());
    }
}
How about JavaFX on… Clojure
(defn javafxapp []
  (doto (Stage. "JavaFX Stage")
    (.setWidth 600)
    (.setHeight 450)
    (.setScene (doto (Scene.)
      (.setFill Color/LIGHTGREEN)
      (.setContent (list (doto (Rectangle.)
        (.setX 25)
        (.setY 40)
        (.setWidth 100)
        (.setHeight 50)
        (.setFill Color/RED))))))
    (.setVisible true)))
(javafxapp)

                                              34
How about JavaFX on… Groovy
FxBuilder.build {
    stage = stage(
        title: "Hello Rectangle (Groovy FxBuilder 2)",
        width: 600,
        height: 450,
        scene: scene(fill: Color.LIGHTSKYBLUE) {
            rectangle(
                x: 25, y: 40,
                width: 100, height: 50,
                fill: Color.RED
            )
        }
    )
    stage.visible = true;
}
How about JavaFX on… Scala
object HelloJavaFX extends JavaFXApplication {
  def stage = new Stage {
    title = "Hello Stage"
    width = 600
    height = 450
    scene = new Scene {
      fill = Color.LIGHTGREEN
      content = List(new Rectangle {
         x = 25
         y = 40
         width = 100
         height = 50
         fill = Color.RED
      })
    }
  }
}
                                                 36
How about JavaFX on… Visage
Stage {
  title: "Hello Stage"
  width: 600
  height: 450
  scene: Scene {
    fill: Color.LIGHTGREEN
    content: Rectangle {
      x: 25
      y: 40
      width: 100
      height: 50
      fill: Color.RED
    }
  }
}

                              37
Announcing Project Visage
>   “Visage is a domain specific language (DSL)
    designed for the express purpose of writing
    user interfaces.”

>   Visage project goals:
       Compile to JavaFX Java APIs
       Evolve the Language (Annotations, Maps, etc.)
       Support Other Toolkits

>   Come join the team!
>   For more info: http://visage-lang.org/
                                                        38
Stephen Chin          Dean Iverson
steve@widgetfx.org    deanriverson@gmail.com
tweet: @steveonjava   tweet: @deanriverson




                                               39

Mais conteúdo relacionado

Semelhante a JFXtras - JavaFX Controls, Layout, Services, and More

Introduction into JavaFX
Introduction into JavaFXIntroduction into JavaFX
Introduction into JavaFX
Eugene Bogaart
 

Semelhante a JFXtras - JavaFX Controls, Layout, Services, and More (20)

Javafx Overview 90minutes
Javafx Overview 90minutesJavafx Overview 90minutes
Javafx Overview 90minutes
 
Javafx Overview 90minutes
Javafx Overview 90minutesJavafx Overview 90minutes
Javafx Overview 90minutes
 
Javafx Overview 90minutes
Javafx Overview 90minutesJavafx Overview 90minutes
Javafx Overview 90minutes
 
Building Data Rich Interfaces with JavaFX
Building Data Rich Interfaces with JavaFXBuilding Data Rich Interfaces with JavaFX
Building Data Rich Interfaces with JavaFX
 
Extjsslides 091216224157-phpapp02
Extjsslides 091216224157-phpapp02Extjsslides 091216224157-phpapp02
Extjsslides 091216224157-phpapp02
 
W-JAX 09 - Lift
W-JAX 09 - LiftW-JAX 09 - Lift
W-JAX 09 - Lift
 
C# v8 new features - raimundas banevicius
C# v8 new features - raimundas baneviciusC# v8 new features - raimundas banevicius
C# v8 new features - raimundas banevicius
 
Data-Oriented Programming with Clojure and Jackdaw (Charles Reese, Funding Ci...
Data-Oriented Programming with Clojure and Jackdaw (Charles Reese, Funding Ci...Data-Oriented Programming with Clojure and Jackdaw (Charles Reese, Funding Ci...
Data-Oriented Programming with Clojure and Jackdaw (Charles Reese, Funding Ci...
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
Graph computation
Graph computationGraph computation
Graph computation
 
Large-scale graph processing with Apache Flink @GraphDevroom FOSDEM'15
Large-scale graph processing with Apache Flink @GraphDevroom FOSDEM'15Large-scale graph processing with Apache Flink @GraphDevroom FOSDEM'15
Large-scale graph processing with Apache Flink @GraphDevroom FOSDEM'15
 
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
 
Groovy's Builder
Groovy's BuilderGroovy's Builder
Groovy's Builder
 
SVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generationSVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generation
 
Java Fx Overview Tech Tour
Java Fx Overview Tech TourJava Fx Overview Tech Tour
Java Fx Overview Tech Tour
 
Introduction into JavaFX
Introduction into JavaFXIntroduction into JavaFX
Introduction into JavaFX
 
Scala clojure techday_2011
Scala clojure techday_2011Scala clojure techday_2011
Scala clojure techday_2011
 
React JS and Redux
React JS and ReduxReact JS and Redux
React JS and Redux
 
SVGo workshop
SVGo workshopSVGo workshop
SVGo workshop
 
JCD 2012 JavaFX 2
JCD 2012 JavaFX 2JCD 2012 JavaFX 2
JCD 2012 JavaFX 2
 

Mais de Stephen Chin

Mais de Stephen Chin (20)

DevOps Tools for Java Developers v2
DevOps Tools for Java Developers v2DevOps Tools for Java Developers v2
DevOps Tools for Java Developers v2
 
10 Ways Everyone Can Support the Java Community
10 Ways Everyone Can Support the Java Community10 Ways Everyone Can Support the Java Community
10 Ways Everyone Can Support the Java Community
 
Java Clients and JavaFX: The Definitive Guide
Java Clients and JavaFX: The Definitive GuideJava Clients and JavaFX: The Definitive Guide
Java Clients and JavaFX: The Definitive Guide
 
DevOps Tools for Java Developers
DevOps Tools for Java DevelopersDevOps Tools for Java Developers
DevOps Tools for Java Developers
 
Java Clients and JavaFX - Presented to LJC
Java Clients and JavaFX - Presented to LJCJava Clients and JavaFX - Presented to LJC
Java Clients and JavaFX - Presented to LJC
 
RetroPi Handheld Raspberry Pi Gaming Console
RetroPi Handheld Raspberry Pi Gaming ConsoleRetroPi Handheld Raspberry Pi Gaming Console
RetroPi Handheld Raspberry Pi Gaming Console
 
JavaFX on Mobile (by Johan Vos)
JavaFX on Mobile (by Johan Vos)JavaFX on Mobile (by Johan Vos)
JavaFX on Mobile (by Johan Vos)
 
Confessions of a Former Agile Methodologist (JFrog Edition)
Confessions of a Former Agile Methodologist (JFrog Edition)Confessions of a Former Agile Methodologist (JFrog Edition)
Confessions of a Former Agile Methodologist (JFrog Edition)
 
Devoxx4Kids Lego Workshop
Devoxx4Kids Lego WorkshopDevoxx4Kids Lego Workshop
Devoxx4Kids Lego Workshop
 
Raspberry Pi with Java (JJUG)
Raspberry Pi with Java (JJUG)Raspberry Pi with Java (JJUG)
Raspberry Pi with Java (JJUG)
 
Confessions of a Former Agile Methodologist
Confessions of a Former Agile MethodologistConfessions of a Former Agile Methodologist
Confessions of a Former Agile Methodologist
 
Internet of Things Magic Show
Internet of Things Magic ShowInternet of Things Magic Show
Internet of Things Magic Show
 
Zombie Time - JSR 310 for the Undead
Zombie Time - JSR 310 for the UndeadZombie Time - JSR 310 for the Undead
Zombie Time - JSR 310 for the Undead
 
JCrete Embedded Java Workshop
JCrete Embedded Java WorkshopJCrete Embedded Java Workshop
JCrete Embedded Java Workshop
 
Oracle IoT Kids Workshop
Oracle IoT Kids WorkshopOracle IoT Kids Workshop
Oracle IoT Kids Workshop
 
OpenJFX on Android and Devices
OpenJFX on Android and DevicesOpenJFX on Android and Devices
OpenJFX on Android and Devices
 
Java on Raspberry Pi Lab
Java on Raspberry Pi LabJava on Raspberry Pi Lab
Java on Raspberry Pi Lab
 
Java 8 for Tablets, Pis, and Legos
Java 8 for Tablets, Pis, and LegosJava 8 for Tablets, Pis, and Legos
Java 8 for Tablets, Pis, and Legos
 
DukeScript
DukeScriptDukeScript
DukeScript
 
Devoxx4Kids NAO Workshop
Devoxx4Kids NAO WorkshopDevoxx4Kids NAO Workshop
Devoxx4Kids NAO Workshop
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

JFXtras - JavaFX Controls, Layout, Services, and More

  • 1. JFXtras JavaFX Controls, Layouts, Services, and More Stephen Chin Dean Iverson GXS Virginia Tech Transportation Institute steve@widgetfx.org deanriverson@gmail.com tweet: @steveonjava tweet: @deanriverson
  • 2. Meet the Presenters… Steve Dean Family Man Family Man Motorcyclist Robotics Coach 2
  • 3. Agenda > JFXtras 0.7 Summary > JavaFX 2.0 Recap > The Future of JFXtras > A Little Announcement… 3
  • 4. JFXtras 0.7 Summary Layouts Borders Shapes Controls 4
  • 5. JFXtras Grid Row Row 5
  • 6. JFXtras Grid Grid { effect: Reflection {} border: 20 vgap: 12 hgap: 12 rows: bind [ row([text, progressBar]), row([navigator, mediaGrid]) ] } 6
  • 8. JFXtras Borders Function: override function create() { TitledBorder { id: "imageTitle" title: file.getName() content: FrameBorder { id: "imageFrame" node: ResizableImageView { preserveRatio: true smooth: true image: bind image } } } } 8
  • 9. Border and Grid Example 9
  • 11. Flexible Grid Layout Flow Wrap 11
  • 12. XMigLayout { constraints: "fill, wrap" columns: "[][]" rows: "[][]4mm[]push[]" content: [ Label { text: "Email" layoutInfo: nodeConstraints( "ax right" ) } TextBox { layoutInfo: nodeConstraints( "growx, pushx" ) } Label { text: "Password" layoutInfo: nodeConstraints( "ax right" ) } TextBox { layoutInfo: nodeConstraints( "growx, pushx" ) } Button { text: "Login“, layoutInfo: nodeConstraints( "skip, right" ) } Label { text: "This text is 'pushed' to the bottom“, layoutInfo: nodeConstraints( "span" ) }]} 12
  • 13. Flexible Border Layout Stage { title: "Mig Docking Test" scene: XScene { width: 400, height: 400 fill: Color.LEMONCHIFFON content: XMigLayout { constraints: "fill" content: [ migNode( createLabel( Color.KHAKI, "North" ), "north" ), migNode( createLabel( Color.GOLDENROD, "South" ), "south" ), migNode( createLabel( Color.GOLD, "East" ), "east" ), migNode( createLabel( Color.DARKKHAKI, "West" ), "west" ), ] } } } 13
  • 14. Inflexible Absolute Layout function createLabel( color:Color, label:String ) { XMigLayout { constraints: "fill" content: [ ResizableRectangle { fill: color layoutInfo: nodeConstraints( "pos 0 0 container.x2 container.y2" ) } Text { content: label font: Font { size: 18 } layoutInfo: nodeConstraints( "center, grow" ) } ] } } 14
  • 15. JFXtras Shapes Almond Intersection of two circles (Vesica Piscis) centerX, centerY, width Arrow Arrow shape x, y, width, height, depth, rise Asterisk Asterisk with rounded corners centerX, centerY, width, radius, beams, roundness Astroid Hypocloid with four cusps centerX, centerY, radius Balloon Rectangular shape with a tab x, y, width, height, arc, anglePosition, tabWidth, tabHeight, tabLocation, tabDisplacement Cross Symmetrical cross shape centerX, centerY, width, radius, roundness Donut Regular polygon with a hole centerX, centerY, innerRadius, outerRadius, sides Lauburu Four comma-shaped heads centerX, centerY, radius Continued… 15
  • 16. JFXtras Shapes (continued) MultiRoundRectangle Rectangle with configurable corners x, y, width, height, topLeftWidth/Height, topRightWidth/Height, bottomLeftWidth/Height, bottomRightWidth/Height Rays Multiple rays extend from center centerX, centerY, rays, radius, extent, rounded RegularPolygon Polygon with equal sides centerX, centerY, sides, radius ReuleauxTriangle Curved triangle shape centerX, centerY, radius RoundPin Cone with rounded top centerX, centerY, height, radius Star2 Multipoint star centerX, centerY, innerRadius, outerRadius, count ETriangle Equilateral triangle x, y, width ITriangle Isosceles triangle x, y, width, height RTriangle Right triangle x, y, width, height, anglePosition 16
  • 18. Sphere Challenge Andres Almiray’s Weblog http://www.jroller.com/aalmiray/entry/griffon_gfxbuilder_fxbuilder_side_by “The following snapshot shows a couple of spheres drawn with GfxBuilder and FxBuilder, can you guess which one is which? … This is by no means a post to bash JavaFX rather to point out some of its deficiencies” -- Andres Almiray (taken completely out of context) 18
  • 19. Sphere Challenge – JavaFX Response > Composition:  RadialGradient for the Sphere  Three additional RadialGradients for the light sources  A blurred shadow underneath > Features:  All Bound/Relative Coordinates  Configurable –  Base, Ambient, Specular, Shine Colors  Shadow Size and Height  Uses New JFXtras ColorUtil Library  JavaFX Caching for High Performance 19
  • 21. JFXtras Controls > Simple Controls  XHyperlink  XEtchedButton  XPane > Complex Controls  XPicker  XCalendarPicker  XShelfView  XTableView 21
  • 22. Hyperlinks and Etched Buttons XHyperlink { text: "Oracle's Homepage", url: "http://oracle.com/" } var hposSeq = [ HPos.LEFT, HPos.CENTER, HPos.RIGHT ]; HBox { spacing: -1 content: for (i in [0..2]) { XEtchedButton { graphic: ImageView { image: images[i] } buttonGroupHPos: hposSeq[i] } } } 22
  • 23. XPane 23
  • 24. XPane XPane { title: "Default Titled XPane” contentNode: Label { text: "Default XPane with a Label" } layoutInfo: LayoutInfo { width: 200, height: 200 } } 24
  • 25. XPicker > Multiple Picker Types  Side Scroll  Drop Down  Thumb Wheel  Side/Thumb Nudge > Supports All Events  Mouse Clicks  Mouse Wheel  Keyboard 25
  • 26. XCalendarPicker > Configurable Locale > Multiple Selection Modes  Single  Multiple  Range > Completely Skinnable 26
  • 27. XShelfView > High Performance > Features:  Scrollbar  Image Title  Reflection Effect  Aspect Ratio  Infinite Repeat > Integrates With JFXtras Data Providers > Automatically Updates on Model Changes 27
  • 28. XTableView > Insanely Scalable  Up to 16 million rows > Extreme Performance  Pools rendered nodes  Caches images  Optimized scene graph > Features:  Drag-and-Drop Column Reordering  Dynamic Updating from Model  Automatically Populates Column Headers 28
  • 29. BandMatesFX - JSONHandler in 3 Steps public class FreebaseResult { public var code: String; 1 public var result: Result; public var status: String; POJO public var transactionId: String; } var albumHandler:JSONHandler = JSONHandler { 2 rootClass: "javafxpert.FreebaseResult“ onDone: function(obj, isSequence): Void { JSONHandler freebaseResult = obj as FreebaseResult; }} req = HttpRequest { 3 location: queryUrl onInput: function(is: java.io.InputStream) { HttpRequest albumHandler.parse(is); }} 29
  • 31. JavaFX 2.0 Recap > The Good  JavaFX is here to stay  Controls will be open source  Calling JavaFX code from different language is pretty cool! > The Bad  We have to wait a bit… (next summer)  Mobile is no longer on the radar > The Ugly  JavaFX Script was a pretty nice language… 31
  • 32. The Future of JFXtras > Mission:  Provide Quality JavaFX Add-ons > Going Forward:  Migrate Non-Overlapping Functionality  Support Java APIs For All Components  Continue to Fill the Gaps > Reality:  Migration Will Be Challenging  Release Dates Will Trail Oracle  (until they are fully open source) 32
  • 33. How about JavaFX on… Java public class HelloStage implements Runnable { public void run() { Stage stage = new Stage(); stage.setTitle("Hello Stage"); stage.setWidth(600); stage.setHeight(450); Scene scene = new Scene(); scene.setFill(Color.LIGHTGREEN); stage.setScene(scene); stage.setVisible(true); } public static void main(String[] args) { FX.start(new HelloStage()); } }
  • 34. How about JavaFX on… Clojure (defn javafxapp [] (doto (Stage. "JavaFX Stage") (.setWidth 600) (.setHeight 450) (.setScene (doto (Scene.) (.setFill Color/LIGHTGREEN) (.setContent (list (doto (Rectangle.) (.setX 25) (.setY 40) (.setWidth 100) (.setHeight 50) (.setFill Color/RED)))))) (.setVisible true))) (javafxapp) 34
  • 35. How about JavaFX on… Groovy FxBuilder.build { stage = stage( title: "Hello Rectangle (Groovy FxBuilder 2)", width: 600, height: 450, scene: scene(fill: Color.LIGHTSKYBLUE) { rectangle( x: 25, y: 40, width: 100, height: 50, fill: Color.RED ) } ) stage.visible = true; }
  • 36. How about JavaFX on… Scala object HelloJavaFX extends JavaFXApplication { def stage = new Stage { title = "Hello Stage" width = 600 height = 450 scene = new Scene { fill = Color.LIGHTGREEN content = List(new Rectangle { x = 25 y = 40 width = 100 height = 50 fill = Color.RED }) } } } 36
  • 37. How about JavaFX on… Visage Stage { title: "Hello Stage" width: 600 height: 450 scene: Scene { fill: Color.LIGHTGREEN content: Rectangle { x: 25 y: 40 width: 100 height: 50 fill: Color.RED } } } 37
  • 38. Announcing Project Visage > “Visage is a domain specific language (DSL) designed for the express purpose of writing user interfaces.” > Visage project goals:  Compile to JavaFX Java APIs  Evolve the Language (Annotations, Maps, etc.)  Support Other Toolkits > Come join the team! > For more info: http://visage-lang.org/ 38
  • 39. Stephen Chin Dean Iverson steve@widgetfx.org deanriverson@gmail.com tweet: @steveonjava tweet: @deanriverson 39