Exploring the Future Potential of AI-Enabled Smartphone Processors
Pro Java Fx – Developing Enterprise Applications
1. Pro JavaFX – Developing Enterprise Applications Stephen Chin Inovis, Inc.
2. About the Presenter Director SWE, Inovis, Inc. Open-Source JavaFX Hacker MBA Belotti Award UberScrumMaster XP Coach Agile Evangelist WidgetFX JFXtras FEST-JavaFX Piccolo2D Java Champion JavaOneRockstar JUG Leader Pro JavaFX Author 2 Family Man Motorcyclist
3. LearnFX and Win at Devoxx Tweet to answer: @projavafxcourse your-answer-here 3
10. XShelfView High Performance Features: Scrollbar Image Title Reflection Effect Aspect Ratio Infinite Repeat Integrates With JFXtras Data Providers Automatically Updates on Model Changes 10
11. XTreeView Hierarchical data representation Supports JFXtras Data Model Can add arbitrary nodes Vertical and horizontal scrollbars Mouse wheel navigation 11
12. 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 Fully Styleablevia CSS 12
13. SpeedReaderFX Written by Jim Weaver Read News, Twitter, and RSS in one place! Showcases use of JFXtras Layouts and Controls XMenu XTableView XPicker Contributed back to the JFXtras Samples Project 13
14. JFXtras 0.6 Release Date: 11/23/2009 14 Open Source Project (BSD License) Join and help us out at: http://jfxtras.org/
17. Basic Test Format Test { say: "A sequence should initially be empty" do: function() { varsequence:String[]; return sequence.size(); } expect: equalTo(0) }.perform(); 17
21. Parameterized Testing Test { say: "A Calculator should" var calculator = Calculator {} test: [ for (a in [0..9], b in [0..9]) { Test { say: "add {a} + {b}" do: function() {calculator.add(a, b)} expect: equalTo("{a + b}") } } ] }.perform(); 21
22. Parameterized Testing - Output test: A Calculator should add 0 + 0. test: A Calculator should add 0 + 1. test: A Calculator should add 0 + 2. test: A Calculator should add 0 + 3. test: A Calculator should add 0 + 4. test: A Calculator should add 0 + 5. test: A Calculator should add 0 + 6. test: A Calculator should add 0 + 7. test: A Calculator should add 0 + 8. test: A Calculator should add 0 + 9. test: A Calculator should add 1 + 0. ... Test Results: 100 passed, 0 failed, 0 skipped. Test run was successful! 22
23. Parameterized Testing with Assume Test { say: "A Calculator should" var calculator = Calculator {} test: [ for (aInt in [0..9], bInt in [1..9]) { var a = aInt as Number; var b = bInt as Number; [ Test { assume: that(a / b, closeTo(floor(a / b))) say: "divide {a} / {b} without a decimal" do: function() {calculator.divide(a, b)} expect: equalTo("{(a / b) as Integer}") }, Test { assume: that(a / b, isNot(closeTo(floor(a / b)))) say: "divide {a} / {b} with a decimal" do: function() {calculator.divide(a, b)} expect: equalTo("{a / b}") } ] } ] }.perform(); 23
24. Parameterized Testing with Assume - Output test: A Calculator should divide 0.0 / 1.0 without a decimal. test: A Calculator should divide 0.0 / 2.0 without a decimal. test: A Calculator should divide 0.0 / 3.0 without a decimal. test: A Calculator should divide 0.0 / 4.0 without a decimal. test: A Calculator should divide 0.0 / 5.0 without a decimal. test: A Calculator should divide 0.0 / 6.0 without a decimal. test: A Calculator should divide 0.0 / 7.0 without a decimal. test: A Calculator should divide 0.0 / 8.0 without a decimal. test: A Calculator should divide 0.0 / 9.0 without a decimal. test: A Calculator should divide 1.0 / 1.0 without a decimal. test: A Calculator should divide 1.0 / 2.0 with a decimal. test: A Calculator should divide 1.0 / 3.0 with a decimal. test: A Calculator should divide 1.0 / 4.0 with a decimal. test: A Calculator should divide 1.0 / 5.0 with a decimal. test: A Calculator should divide 1.0 / 6.0 with a decimal. test: A Calculator should divide 1.0 / 7.0 with a decimal. test: A Calculator should divide 1.0 / 8.0 with a decimal. test: A Calculator should divide 1.0 / 9.0 with a decimal. ... Test Results: 90 passed, 0 failed, 90 skipped. Test run was successful! 24
25. Run Tests in JUnitPart 1: Extend Test public class BasicTest extends Test {} public function run() { Test { say: "A sequence should initially be empty" do: function() { varsequence:String[]; return sequence.size(); } expect: equalTo(0) }.perform(); } 25
26. Run Tests in JUnitPart 2: Create Ant Target 26 Run off classes dir Exclude inner classes <junitdir="${work.dir}"fork="true"showoutput="true"> <batchtesttodir="${build.test.results.dir}"> <filesetdir="${build.classes.dir}"excludes="**/*$*.class" includes=" **/*?Test.class"/> </batchtest> <classpathrefid="test.classpath"/> <formattertype="brief"usefile="false"/> <formattertype="xml"/> </junit> Include class files ending in Test
28. REST or SOAP – Have it your way! 28 Sample Enterprise Applications Soap bars in Lille, Northern France. http://www.flickr.com/photos/gpwarlow/ / CC BY 2.0
29. Calling a REST Service REST URL: http://api.meetup.com/rsvps.json/event_id={eventId}&key={apiKey} Output: { "results": [ {"zip":"94044","lon":"-122.48999786376953","photo_url":"http:photos1.meetupstatic.comphotosmember14bamember_5333306.jpeg","response":"no","name":"Andres Almiray","comment":"Can't make it :-("} ]} 29
30. JUG Spinner - JSONHandler in 3 Steps public class Member { public varplace:Integer; public varphotoUrl:String; public varname:String; public varcomment:String; } varmemberParser:JSONHandler = JSONHandler { rootClass: "org.jfxtras.jugspinner.data.MemberSearch “ onDone: function(obj, isSequence): Void { members = (obj as MemberSearch).results; }} req = HttpRequest { location: rsvpQuery onInput: function(is: java.io.InputStream) { memberParser.parse(is); }} 30 1 POJfxO 2 JSONHandler 3 HttpRequest
31. JUG Prize Spinner Demo 31 Featured in: Enterprise Web 2.0 Fundamentals By Oswald Campesato& Kevin Nilson
34. Architecture: WidgetFX Framework Reasons for choosing WidgetFX: Supports Widgets in JavaFX and Java Commercial Friendly Open-Source Robust Security Model Cross-platform Support 34
37. Develop: Binding the Code to Graphics Add the FXZ to your project Right click and Generate UI stub Choose a filename and generate Construct a UI Node and add it to the Scene: varrallyWidgetUI:RallyWidgetUI = RallyWidgetUI{} 37
38. Develop: Calling SOAP From JavaFX Generate SOAP Stubs off WSDL: WSDL2Java -uriRally.wsdl-o src-p rallyws.api Create a new Service: rallyService= new RallyServiceServiceLocator().getRallyService(); Invoke the Service from Java or JavaFX: QueryResult result = rallyService.query(null, "Iteration", queryString, "Name", true, 0, 100); or JavaFX code: 38
40. JavaFXpert RIA Exemplar Challenge "Create an application in JavaFX that exemplifies the appearance and behavior of a next-generation enterprise RIA (rich internet application)". Grand Prize: $2,000 USD (split between a two-man graphics artist and application developer team) Deadline: 10 January, 2010 For more info: http://learnjavafx.typepad.com/ 40