Pro JavaFX – Developing Enterprise Applications<br />Stephen Chin<br />Inovis, Inc.<br />
About the Presenter<br />Director SWE, Inovis, Inc.<br />Open-Source JavaFX Hacker<br />MBA<br />Belotti Award<br />UberSc...
LearnFX and Win at Devoxx<br />Tweet to answer:<br />@projavafxcourse your-answer-here<br />3<br />
Enterprise JavaFX Agenda<br />JFXtras Layouts and Controls<br />Automated JavaFX Testing<br />Sample Enterprise Applicatio...
5<br />JFXtras Layouts and Controls<br />HttpRequest {<br />  location: http://steveonjava.com/<br />onResponseMessage: fu...
JFXtras 0.6 Controls<br />XCalendarPicker<br />XMenu<br />XMultiLineTextBox<br />XPane<br />XPasswordPane<br />XPicker<br ...
XPicker<br />Multiple Picker Types<br />Side Scroll<br />Drop Down<br />Thumb Wheel<br />Side/Thumb Nudge<br />Supports Al...
XCalendarPicker<br />Configurable Locale<br />Multiple Selection Modes<br />Single<br />Multiple<br />Range<br />Completel...
JFXtras Data Providers<br />9<br />
XShelfView<br />High Performance<br />Features:<br />Scrollbar<br />Image Title<br />Reflection Effect<br />Aspect Ratio<b...
XTreeView<br />Hierarchical data representation<br />Supports JFXtras Data Model<br />Can add arbitrary nodes<br />Vertica...
XTableView<br />Insanely Scalable<br />Up to 16 million rows<br />Extreme Performance<br />Pools rendered nodes<br />Cache...
SpeedReaderFX<br />Written by Jim Weaver<br />Read News, Twitter, and RSS in one place!<br />Showcases use of JFXtras Layo...
JFXtras 0.6         Release Date: 11/23/2009<br />14<br />Open Source Project (BSD License)<br />Join and help us out at:<...
15<br />Testing With FEST-JavaFX<br />HttpRequest {<br />  location: http://steveonjava.com/<br />onResponseMessage: funct...
16<br />Mike Cohn’s Testing Pyramid<br />Robot<br />(coming soon)<br />BDD<br />Fluent<br />Assertions<br />
Basic Test Format<br />Test {<br />say: &quot;A sequence should initially be empty&quot;<br />do: function() {<br />varseq...
Fluent Assertions<br />lessThanOrCloseTo<br />greaterThanOrCloseTo<br />lessThanOrEqualTo<br />greaterThanorEqualTo<br />t...
Fluent Assertion Examples<br />isNot(null)<br />isNot(closeTo(floor(i*1.5)))<br />lessThanOrEqualTo(2.0)<br />greaterThanO...
Testing Quiz: Which test will fail?<br />20<br />varseq = [1, 3, 5, 7, 9];<br />Test {<br />    say: &quot;ranges&quot;<br...
Parameterized Testing<br />Test {<br />    say: &quot;A Calculator should&quot;<br />var calculator = Calculator {}<br /> ...
Parameterized Testing - Output<br />test: A Calculator should add 0 + 0.<br />test: A Calculator should add 0 + 1.<br />te...
Parameterized Testing with Assume<br />Test {<br />    say: &quot;A Calculator should&quot;<br />var calculator = Calculat...
Parameterized Testing with Assume - Output<br />test: A Calculator should divide 0.0 / 1.0 without a decimal.<br />test: A...
Run Tests in JUnitPart 1: Extend Test<br />public class BasicTest extends Test {}<br />public function run() {<br />    Te...
Run Tests in JUnitPart 2: Create Ant Target<br />26<br />Run off classes dir<br />Exclude inner classes<br />&lt;junitdir=...
Run Tests in JUnitPart 3: Execute Ant Script<br />27<br />
REST or SOAP – Have it your way!<br />28<br />Sample Enterprise Applications<br />Soap bars in Lille, Northern France. <br...
Calling a REST Service<br />REST URL:<br />http://api.meetup.com/rsvps.json/event_id={eventId}&key={apiKey}<br />Output:<b...
JUG Spinner - JSONHandler in 3 Steps<br />public class Member {<br />    public varplace:Integer;<br />    public varphoto...
JUG Prize Spinner Demo<br />31<br />Featured in:<br />Enterprise Web 2.0 Fundamentals<br />By Oswald Campesato& Kevin Nils...
32<br />Enterprise Widget Tutorial<br />
Use Case: Tracking Agile Development<br />33<br />
Architecture: WidgetFX Framework<br />Reasons for choosing WidgetFX:<br />Supports Widgets in JavaFX and Java<br />Commerc...
Design: Using the Production Suite 1<br />35<br />
Design: Using the Production Suite 2<br />36<br />
Develop: Binding the Code to Graphics<br />Add the FXZ to your project<br />Right click and Generate UI stub<br />Choose a...
Develop: Calling SOAP From JavaFX<br />Generate SOAP Stubs off WSDL:<br />WSDL2Java -uriRally.wsdl-o src-p rallyws.api<br ...
RallyWidget Demo<br />39<br />
JavaFXpert RIA Exemplar Challenge<br />&quot;Create an application in JavaFX that exemplifies the appearance and behavior ...
LearnFX and Win at Devoxx<br />41<br />
42<br />Thank You<br />Stephen Chin<br />http://steveonjava.com/<br />Tweet: steveonjava<br />
Upcoming SlideShare
Loading in...5
×

Pro Java Fx – Developing Enterprise Applications

4,945

Published on

Pro JavaFX - Developing Enterprise Applications talk given at Devoxx 2009 in Antwerp, Belgium.

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
4,945
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
43
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Pro Java Fx – Developing Enterprise Applications

  1. 1. Pro JavaFX – Developing Enterprise Applications<br />Stephen Chin<br />Inovis, Inc.<br />
  2. 2. About the Presenter<br />Director SWE, Inovis, Inc.<br />Open-Source JavaFX Hacker<br />MBA<br />Belotti Award<br />UberScrumMaster<br />XP Coach<br />Agile Evangelist<br />WidgetFX<br />JFXtras<br />FEST-JavaFX<br />Piccolo2D<br />Java Champion<br />JavaOneRockstar<br />JUG Leader<br />Pro JavaFX Author<br />2<br />Family Man<br />Motorcyclist<br />
  3. 3. LearnFX and Win at Devoxx<br />Tweet to answer:<br />@projavafxcourse your-answer-here<br />3<br />
  4. 4. Enterprise JavaFX Agenda<br />JFXtras Layouts and Controls<br />Automated JavaFX Testing<br />Sample Enterprise Applications<br />4<br />HttpRequest {<br /> location: http://steveonjava.com/<br />onResponseMessage: function(m) {<br />println(m); FX.exit()<br />}}.start();<br />@projavafxcourse answer<br />4<br />
  5. 5. 5<br />JFXtras Layouts and Controls<br />HttpRequest {<br /> location: http://steveonjava.com/<br />onResponseMessage: function(m) {<br />println(m); FX.exit()<br />}}.start();<br />@projavafxcourse answer<br />
  6. 6. JFXtras 0.6 Controls<br />XCalendarPicker<br />XMenu<br />XMultiLineTextBox<br />XPane<br />XPasswordPane<br />XPicker<br />XScrollView<br />XShelfView<br />XSpinnerWheel<br />XTableView<br />XTreeView<br />6<br />
  7. 7. XPicker<br />Multiple Picker Types<br />Side Scroll<br />Drop Down<br />Thumb Wheel<br />Side/Thumb Nudge<br />Supports All Events<br />Mouse Clicks<br />Mouse Wheel<br />Keyboard<br />7<br />
  8. 8. XCalendarPicker<br />Configurable Locale<br />Multiple Selection Modes<br />Single<br />Multiple<br />Range<br />Completely Skinnable<br />8<br />
  9. 9. JFXtras Data Providers<br />9<br />
  10. 10. XShelfView<br />High Performance<br />Features:<br />Scrollbar<br />Image Title<br />Reflection Effect<br />Aspect Ratio<br />Infinite Repeat<br />Integrates With JFXtras Data Providers<br />Automatically Updates on Model Changes<br />10<br />
  11. 11. XTreeView<br />Hierarchical data representation<br />Supports JFXtras Data Model<br />Can add arbitrary nodes<br />Vertical and horizontal scrollbars<br />Mouse wheel navigation<br />11<br />
  12. 12. XTableView<br />Insanely Scalable<br />Up to 16 million rows<br />Extreme Performance<br />Pools rendered nodes<br />Caches images<br />Optimized scene graph<br />Features:<br />Drag-and-Drop Column Reordering<br />Dynamic Updating from Model<br />Automatically Populates Column Headers<br />Fully Styleablevia CSS<br />12<br />
  13. 13. SpeedReaderFX<br />Written by Jim Weaver<br />Read News, Twitter, and RSS in one place!<br />Showcases use of JFXtras Layouts and Controls<br />XMenu<br />XTableView<br />XPicker<br />Contributed back to the JFXtras Samples Project<br />13<br />
  14. 14. JFXtras 0.6 Release Date: 11/23/2009<br />14<br />Open Source Project (BSD License)<br />Join and help us out at:<br />http://jfxtras.org/<br />
  15. 15. 15<br />Testing With FEST-JavaFX<br />HttpRequest {<br /> location: http://steveonjava.com/<br />onResponseMessage: function(m) {<br />println(m); FX.exit()<br />}}.start();<br />@projavafxcourse answer<br />
  16. 16. 16<br />Mike Cohn’s Testing Pyramid<br />Robot<br />(coming soon)<br />BDD<br />Fluent<br />Assertions<br />
  17. 17. Basic Test Format<br />Test {<br />say: &quot;A sequence should initially be empty&quot;<br />do: function() {<br />varsequence:String[];<br /> return sequence.size();<br /> }<br />expect: equalTo(0)<br />}.perform();<br />17<br />
  18. 18. Fluent Assertions<br />lessThanOrCloseTo<br />greaterThanOrCloseTo<br />lessThanOrEqualTo<br />greaterThanorEqualTo<br />typeIs<br />instanceOf<br />anything<br />is<br />isNot<br />equalTo<br />closeTo<br />greaterThan<br />18<br />Make sure to include this static import:<br /><ul><li>import org.jfxtras.test.Expect.*;</li></ul>And then chain any of these assertions:<br />
  19. 19. Fluent Assertion Examples<br />isNot(null)<br />isNot(closeTo(floor(i*1.5)))<br />lessThanOrEqualTo(2.0)<br />greaterThanOrCloseTo(123.10, 0.0100000)<br />isNot(lessThanOrCloseTo(2.1435, 0.00011))<br />typeIs(&quot;org.jfxtras.test.UserXException&quot;)<br />instanceOf(UserXException{}.getJFXClass())<br />19<br />
  20. 20. Testing Quiz: Which test will fail?<br />20<br />varseq = [1, 3, 5, 7, 9];<br />Test {<br /> say: &quot;ranges&quot;<br /> do: function() {<br />seq[0..2]<br /> }<br /> expect: equalTo([1, 3, 5])<br />}<br />Test {<br /> say: &quot;exclusive ends&quot;<br /> do: function() {<br />seq[0..&lt;2]<br /> }<br /> expect: equalTo([1, 3])<br />}<br />Test {<br /> say: &quot;open ends&quot;<br /> do: function() {<br />seq[2..]<br /> }<br /> expect: equalTo([5])<br />}<br />Test {<br /> say: &quot;open exclusive ends&quot;<br /> do: function() {<br />seq[2..&lt;]<br /> }<br /> expect: equalTo([5, 7])<br />}<br />1<br />2<br />3<br />4<br />
  21. 21. Parameterized Testing<br />Test {<br /> say: &quot;A Calculator should&quot;<br />var calculator = Calculator {}<br /> test: [<br /> for (a in [0..9], b in [0..9]) {<br /> Test {<br /> say: &quot;add {a} + {b}&quot;<br /> do: function() {calculator.add(a, b)}<br /> expect: equalTo(&quot;{a + b}&quot;)<br /> }<br /> } <br /> ]<br />}.perform();<br />21<br />
  22. 22. Parameterized Testing - Output<br />test: A Calculator should add 0 + 0.<br />test: A Calculator should add 0 + 1.<br />test: A Calculator should add 0 + 2.<br />test: A Calculator should add 0 + 3.<br />test: A Calculator should add 0 + 4.<br />test: A Calculator should add 0 + 5.<br />test: A Calculator should add 0 + 6.<br />test: A Calculator should add 0 + 7.<br />test: A Calculator should add 0 + 8.<br />test: A Calculator should add 0 + 9.<br />test: A Calculator should add 1 + 0.<br />...<br />Test Results: 100 passed, 0 failed, 0 skipped.<br />Test run was successful!<br />22<br />
  23. 23. Parameterized Testing with Assume<br />Test {<br /> say: &quot;A Calculator should&quot;<br />var calculator = Calculator {}<br /> test: [<br /> for (aInt in [0..9], bInt in [1..9]) {<br />var a = aInt as Number;<br />var b = bInt as Number;<br /> [<br /> Test {<br />assume: that(a / b, closeTo(floor(a / b)))<br /> say: &quot;divide {a} / {b} without a decimal&quot;<br /> do: function() {calculator.divide(a, b)}<br /> expect: equalTo(&quot;{(a / b) as Integer}&quot;)<br /> },<br /> Test {<br />assume: that(a / b, isNot(closeTo(floor(a / b))))<br /> say: &quot;divide {a} / {b} with a decimal&quot;<br /> do: function() {calculator.divide(a, b)}<br /> expect: equalTo(&quot;{a / b}&quot;)<br /> }<br /> ]<br /> }<br /> ]<br />}.perform();<br />23<br />
  24. 24. Parameterized Testing with Assume - Output<br />test: A Calculator should divide 0.0 / 1.0 without a decimal.<br />test: A Calculator should divide 0.0 / 2.0 without a decimal.<br />test: A Calculator should divide 0.0 / 3.0 without a decimal.<br />test: A Calculator should divide 0.0 / 4.0 without a decimal.<br />test: A Calculator should divide 0.0 / 5.0 without a decimal.<br />test: A Calculator should divide 0.0 / 6.0 without a decimal.<br />test: A Calculator should divide 0.0 / 7.0 without a decimal.<br />test: A Calculator should divide 0.0 / 8.0 without a decimal.<br />test: A Calculator should divide 0.0 / 9.0 without a decimal.<br />test: A Calculator should divide 1.0 / 1.0 without a decimal.<br />test: A Calculator should divide 1.0 / 2.0 with a decimal.<br />test: A Calculator should divide 1.0 / 3.0 with a decimal.<br />test: A Calculator should divide 1.0 / 4.0 with a decimal.<br />test: A Calculator should divide 1.0 / 5.0 with a decimal.<br />test: A Calculator should divide 1.0 / 6.0 with a decimal.<br />test: A Calculator should divide 1.0 / 7.0 with a decimal.<br />test: A Calculator should divide 1.0 / 8.0 with a decimal.<br />test: A Calculator should divide 1.0 / 9.0 with a decimal.<br />...<br />Test Results: 90 passed, 0 failed, 90 skipped.<br />Test run was successful!<br />24<br />
  25. 25. Run Tests in JUnitPart 1: Extend Test<br />public class BasicTest extends Test {}<br />public function run() {<br /> Test {<br /> say: &quot;A sequence should initially be empty&quot;<br /> do: function() {<br />varsequence:String[];<br /> return sequence.size();<br /> }<br /> expect: equalTo(0)<br /> }.perform();<br />}<br />25<br />
  26. 26. Run Tests in JUnitPart 2: Create Ant Target<br />26<br />Run off classes dir<br />Exclude inner classes<br />&lt;junitdir=&quot;${work.dir}&quot;fork=&quot;true&quot;showoutput=&quot;true&quot;&gt;<br />&lt;batchtesttodir=&quot;${build.test.results.dir}&quot;&gt;<br /> &lt;filesetdir=&quot;${build.classes.dir}&quot;excludes=&quot;**/*$*.class&quot;<br />includes=&quot; **/*?Test.class&quot;/&gt;<br />&lt;/batchtest&gt;<br />&lt;classpathrefid=&quot;test.classpath&quot;/&gt;<br />&lt;formattertype=&quot;brief&quot;usefile=&quot;false&quot;/&gt;<br />&lt;formattertype=&quot;xml&quot;/&gt;<br />&lt;/junit&gt;<br />Include class files ending in Test<br />
  27. 27. Run Tests in JUnitPart 3: Execute Ant Script<br />27<br />
  28. 28. REST or SOAP – Have it your way!<br />28<br />Sample Enterprise Applications<br />Soap bars in Lille, Northern France. <br />http://www.flickr.com/photos/gpwarlow/ / CC BY 2.0<br />
  29. 29. Calling a REST Service<br />REST URL:<br />http://api.meetup.com/rsvps.json/event_id={eventId}&key={apiKey}<br />Output:<br />{ &quot;results&quot;: [<br /> {&quot;zip&quot;:&quot;94044&quot;,&quot;lon&quot;:&quot;-122.48999786376953&quot;,&quot;photo_url&quot;:&quot;http://photos1.meetupstatic.com/photos/member/1/4/b/a/member_5333306.jpeg&quot;,&quot;response&quot;:&quot;no&quot;,&quot;name&quot;:&quot;Andres Almiray&quot;,&quot;comment&quot;:&quot;Can&apos;t make it :-(&quot;}<br />]}<br />29<br />
  30. 30. JUG Spinner - JSONHandler in 3 Steps<br />public class Member {<br /> public varplace:Integer;<br /> public varphotoUrl:String;<br /> public varname:String;<br /> public varcomment:String;<br />}<br />varmemberParser:JSONHandler = JSONHandler {<br />  rootClass: &quot;org.jfxtras.jugspinner.data.MemberSearch “<br />  onDone: function(obj, isSequence): Void {<br />    members = (obj as MemberSearch).results;<br />}}<br />req = HttpRequest {<br /> location: rsvpQuery<br />onInput: function(is: java.io.InputStream) {<br />memberParser.parse(is);<br />}}<br />30<br />1<br />POJfxO<br />2<br />JSONHandler<br />3<br />HttpRequest<br />
  31. 31. JUG Prize Spinner Demo<br />31<br />Featured in:<br />Enterprise Web 2.0 Fundamentals<br />By Oswald Campesato& Kevin Nilson<br />
  32. 32. 32<br />Enterprise Widget Tutorial<br />
  33. 33. Use Case: Tracking Agile Development<br />33<br />
  34. 34. Architecture: WidgetFX Framework<br />Reasons for choosing WidgetFX:<br />Supports Widgets in JavaFX and Java<br />Commercial Friendly Open-Source<br />Robust Security Model<br />Cross-platform Support<br />34<br />
  35. 35. Design: Using the Production Suite 1<br />35<br />
  36. 36. Design: Using the Production Suite 2<br />36<br />
  37. 37. Develop: Binding the Code to Graphics<br />Add the FXZ to your project<br />Right click and Generate UI stub<br />Choose a filename and generate<br />Construct a UI Node and add it to the Scene:<br />varrallyWidgetUI:RallyWidgetUI = RallyWidgetUI{}<br />37<br />
  38. 38. Develop: Calling SOAP From JavaFX<br />Generate SOAP Stubs off WSDL:<br />WSDL2Java -uriRally.wsdl-o src-p rallyws.api<br />Create a new Service:<br />rallyService= new RallyServiceServiceLocator().getRallyService();<br />Invoke the Service from Java or JavaFX:<br />QueryResult result = rallyService.query(null, &quot;Iteration&quot;, queryString, &quot;Name&quot;, true, 0, 100); or JavaFX code:<br />38<br />
  39. 39. RallyWidget Demo<br />39<br />
  40. 40. JavaFXpert RIA Exemplar Challenge<br />&quot;Create an application in JavaFX that exemplifies the appearance and behavior of a next-generation enterprise RIA (rich internet application)&quot;.<br />Grand Prize: $2,000 USD<br />(split between a two-man graphics artist and application developer team)<br />Deadline: 10 January, 2010<br />For more info: http://learnjavafx.typepad.com/<br />40<br />
  41. 41. LearnFX and Win at Devoxx<br />41<br />
  42. 42. 42<br />Thank You<br />Stephen Chin<br />http://steveonjava.com/<br />Tweet: steveonjava<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×