SlideShare a Scribd company logo
Designing a
JavaFX Mobile
application

Fabrizio Giudici
Tidalwave s.a.s.
214
AGENDA

> Putting JavaFX (Mobile) in context
> My case study
> Main features of JavaFX (Mobile)
> JavaFX Mobile through a few examples
> Current status of JavaFX Mobile
> Conclusion




                                         2
About the speaker

> Fabrizio.Giudici@tidalwave.it
> Senior Architect, Mentor, Technical Writer
> Working with Java (all the editions, plus exotic stuff) since 1996
> Working with Java ME since 1999
   –   First J2ME edition at JavaOne™ (Palm)
   –   Developed a couple of research projects with the University of Genoa
   –   Developed a couple of customer projects with my former company
   –   Consulting for customer projects
   –   Author of mobile FLOSS: windRose and blueBill Mobile
> Co-leader of JUG Milano


                                                                              3
What's wrong with JME

> Everything was so good at the old, Palm times
  – Small devices → no big expectations
   –   One reference platform
   –   One pervasive runtime
> With more devices, JME got fragmented
  – JSR as extension points (e.g. bluetooth, location)
   –   Multiple combinations
   –   Harder and harder to test
   –   windRose pain



                                                         4
Hoping in Java FX Mobile

> JavaFX announced by Sun Microsystems in 2007
  – A specific scripting language + a runtime
   –   Fight the “Ugly Java UI stereotype”
   –   Re-designed UI controls
   –   Integration with graphics designers workflow (e.g. NetBeans + Photoshop)
   –   Profiles for multiple targets (desktop / web, mobile)
> JavaFX Mobile profile
  – Can sit on top of JME (MSA: Mobile Service Architecture, a.k.a. JSR-248)
   –   Maybe no more (or reduced) fragmentation?
> Oracle commitment after the Sun buy
> A fulfilled promise?
   –   Answers at the end :-)                                                     5
My case study: blueBill Mobile

> “The field tool for birdwatchers”
  – Records geotagged observations
   –   Reference guides with multimedia
   –   Social capabilities (à la Google Friends)
> Started in 2009 with JavaFX
> Currently the most advanced version is the Android one
   –   JavaFX version being redesigned (more later)
> Demo




                                                           6
Main features of JavaFX

> The languages is both imperative and declarative
  – Imperative: for normal processing
   –   Declarative: mostly for the UI (no XML, no separate layout descriptor)
              Binding
   –   Has got closures, mixins
> Compiles to the same VM bytecode
  – Can mix with Java code (e.g. reference a Java library)
   –   On the desktop, can be mixed with Swing (in addition to its own UI widgets)
   –   On the mobile, runs its own UI widgets




                                                                                     7
Some code examples

> Example 1: Calling JME code
> Example 2: Posting contents (REST)
> Example 3: Getting resources (REST)
> Example 4: Binding (if time allows)




                                        8
Example: calling JME code

> Not much to say: it just works
package it.tidalwave.bluebillmfx;

import   javax.microedition.location.Criteria;
import   javax.microedition.location.LocationProvider;
import   javafx.animation.Timeline;
import   javafx.animation.KeyFrame;
import   it.tidalwave.geo.mapfx.model.Coordinates;

public class PositionTracker
  {
    public-read var currentPosition : Coordinates;
    def criteria = new Criteria();
    var locationProvider : LocationProvider;

    postinit {
        locationProvider = LocationProvider.getInstance(criteria);
        pollingTimeline.play();
      }


                                                                     9
Example: calling JME code

> Need to copy data in JavaFX classes if you want binding support
     function getPosition(): Void {
         def location = locationProvider.getLocation(5); // JME stuff
         def coordinates = location.getQualifiedCoordinates();

           if (coordinates != null ) {
               def lat = coordinates.getLatitude();
               def lon = coordinates.getLongitude();
               currentPosition = Coordinates { latitude: lat; longitude: lon };
             }
       }

     def pollingTimeline = Timeline {
          repeatCount: Timeline.INDEFINITE
          keyFrames:   KeyFrame { time: 10s; action: periodicTask }
       };

     function periodicTask(): Void {
         getPosition();
         // update the map position, etc...
       }
 }                                                                                10
Example: posting contents

> HttpRequest provides a skeleton
public class ObservationRDFUpload extends HttpRequest
  {
    public-init var serviceURL = "http://myHost:8084/blueBillGeoService";

      override public var method = HttpRequest.POST;

      public var content : String;

      override var output on replace {
          if (output != null) {
              output.write(content.getBytes());
              output.close();
            }
        }

      override function start(): Void {
          location = "{serviceURL}/postObservation"; // REST call
          setHeader("Content-Type", "application/rdf");
          super.start();
        }
  }                                                                         11
Example: posting contents

> HttpRequest provides a skeleton

 def upload = ObservationRDFUpload
   {
      content: // ... assemble the string with the contents
   };

 upload.start();




                                                              12
Example: reading resources

> The relevant model class
public class Taxon
  {
    public-read protected var id : String;
    public-read var urlsLoaded = false;
    var urlsLoading = false;
    var imageURLs : String[]; // [] is a list (“sequence”), not an array
    var images : DeferredImage[];

    public bound function getImage (index : Integer): DeferredImage {
        def dummy = loadImageURLs(); // assignment is a requirement for the bound function
        return images[index];
      }

    public bound function imageCount(): Integer {
        return sizeof images;
      }




                                                                                             13
Example: reading resources

> Getting a JSON resource catalog
  function loadImageURLs(): Boolean {
      if (not urlsLoading and not urlsLoaded) {
          urlsLoading = true;
          def fixedId = clean(id); // get rid of/escape “bad” chars such as :, #, etc...
          def url = "http://kenai.com/svn/bluebill-mobile~media/catalog/{fixedId}.json";

         def request : HttpRequest = HttpRequest { // mere instantiation, not subclassing!
             location: url;
             method:   HttpRequest.GET;

              onInput: function (is: InputStream) { // hey, this is not a switch() label!
                  if (request.responseCode != 200) {
                      imageURLs = "media/black_glossy_web20_icon_012.png";
                    }
                  else {
                      try {
                          def parser = PullParser { documentType: PullParser.JSON;
                                                    input: is; onEvent: parseEventCallback };
                          parser.parse();
                        }
                      catch (e: Exception) {
                          println("Exception {e} while parsing {url}");
                        }
                      finally {
                          is.close();                                                           14
                        }
                    }
                }
Example: reading resources

> Getting a JSON resource catalog
                     onException: function (e: Exception) {
                         imageURLs = "media/black_glossy_web20_icon_012.png";
                         urlsLoaded = true;
                       }

                     onDone: function() {
                         images = for (url in imageURLs) {
                             DeferredImage { url: url };
                           }

                          imageURLs = null;
                          urlsLoaded = true;
                      }
                 }

               request.start();
           }

         return urlsLoaded;
     }

  def parseEventCallback = function (event: Event): Void {
       if ((event.type == PullParser.TEXT) and (event.name == "url")) {
           insert event.text into imageURLs;
         }                                                                      15
     }
 }
Example: reading resources

> Loading an image
> JavaFX Image loads automatically when initialized
var imageCounter = 0;
public class DeferredImage
  {
    public-init var url : String;
    public-read var progress = bind image.progress;
    public-read var error = bind image.error;
    def id = imageCounter++;
    public-read var image : Image;

      public function load() { // start loading only when load() is called
          if (image == null)
            {
              image = Image {
                  url: url
                  backgroundLoading: true
                }
            }
        }                                                                    16
  }
Example: binding

> Introducing TaxonSearchController
  – Manages a list of Taxons
   –   Produces a filtered list of Taxons whose names match a substring
   –   Provides a hint for autocompletion
               Eg. you type “He”
               That matches only “Heron ***”
               Hints is “Heron “




                                                                          17
Example: binding

> Some relevant parts of Taxon
public class Taxon
  {
    public-read protected var displayName : String;
    public-read protected var scientificName : String;
    public-read protected var id : String;

      override function toString() {
          return "{displayName} ({scientificName}) ({id})"
        }
  }




                                                             18
Example: binding

> TaxonSearchController (1/3)
public class TaxonSearchController
  {
    public var taxons: Taxon[];
    public var filteredTaxons: Taxon[];
    public var selectedTaxonIndex : Integer = -1; // set from the UI

    public var selectedTaxon = bind
      if (selectedTaxonIndex < 0) then null
                                  else filteredTaxons[selectedTaxonIndex];

    // setting this property will trigger filtering
    public var filter = "" on replace {
        filteredTaxons = taxons[taxon | matches(taxon, filter)];
        updateHint();
      }

    public-read var hint = ""; // the auto-completed hint



                                                                             19
Example: binding

> TaxonSearchController (2/3)
   protected function matches (taxon : Taxon, string: String) : Boolean {
       if (string == "") {
            return true;
         }
       if (taxon.displayName.toLowerCase().startsWith(string.toLowerCase())) {
            return true;
           // more complex in the real case, as it also deals with scientific name
           // but not relevant now
         }
       return false;
     }




                                                                                     20
Example: binding

> TaxonSearchController (3/3)
     protected function updateHint(): Void {
         def hintTry = commonLeadingSubstring(filteredTaxons);
         //
         // Sometimes it can't find a better auto-completion than the current filter,
         //
         hint = if (hintTry.length() > filter.length())
                         then hintTry
                         else filter;
       }

 }




                                                                                        21
Example: binding

> TaxonSearchScreen
public class TaxonSearchScreen extends Container // e.g. a UI panel
  {
    // warning: there are some simplifications, but the concepts are here
    public-read def controller = TaxonSearchController {
         selectedTaxonIndex: bind list.selectedIndex;
      }
    def list = ListBox { // the list widget in the UI
         items: bind controller.filteredTaxons
      };

   def hint = bind controller.hint on replace {
       if (hint != "") {
           filter = hint;
         }
     }
   var resetSelectionWhenFilterChanges = bind controller.selectedTaxon on replace {
       if (controller.selectedTaxon != null) {
           list.selectedIndex = 0;
         }
     }
   TextBox { // a text input box in the UI
       text: bind controller.filter with inverse
     }
   Text { // a label rendering a text in the UI
       content: bind "{sizeof controller.filteredTaxons} specie(s)"                   22
     }
JavaFX mobile in 2009

> Development tools available (emulator, etc...)
> First capable phones at J1: LG Incite, HTC Touch Diamond
> Announced a “JavaFX Mobile player”
  – Would run JavaFX on MSA (JSR 248) JME phones
> Looked very promising
  – That's why blueBill Mobile started with it




                                                             23
Status updates in 2010

> Barcelona Mobile World Congress 2010
  – “Feature phones” (Qualcomm and the Brew Mobile Platform OS)
   –   Sony-Ericsson in “upcoming phones”
> Recent phone status update (JavaFX forums, March 16, 2010)
  – LG Incite, HTC Touch Diamond... still!
   –   “Unofficially” runs on any Windows Mobile 6.x device (e.g. HTC HD2)
> JavaFX 1.3 released on May 14, 2010
  – Shares many improvements with the desktop/web profile
   –   Mobile emulator runs on Mac OS X
> JavaFX Mobile Player MIA (I mean, it's Windows Mobile only)
> No further manufacturer endorsements?
                                                                             24
My view of Java-related mobile solutions

> We're in the climax of the “next generation mobile” war
  – iPhone/iPad, Android leading on the growth rates
   –   Adobe Flash at stake, but if it survives will be relevant
> Is there still room for JavaFX Mobile? JME?
> JavaFX Mobile
   –   Still excites me, technically
   –   The Oracle-Sun deal might have slowed down deals – but...
   –   … timing out this Summer
   –Hoping in a specific Android port/adaptation (using the Android UI/runtime)
               Hearing a few people talking about that
               Would bring-in e.g. the integration with graphic designer workflow
> JME still relevant for the “glorious old guard” (Nokia, etc..., BlackBerry)
  – “Oldies but goodies”                                                         25
My research for the Summer

> Two/threefold strategy
  – Android (it delivers, short time-to-market)
   –   JME (catch the “old glorious guard”)
   –   JavaFX (if industry endorsements / Android support will show up)
> Study whether it is possible to reuse code
  – Not thinking of “catch-all” frameworks
   –   Reusing only the models, writing ad-hoc UIs (no “GCD syndrome”)
   –   Maven for re-using artifacts
   –   Byte-code manipulation (e.g. RetroWeaver) for fitting JME Java 1.3?
   –   Follow my blog and my space at Dzone.com
> The “new” blueBill Mobile for JavaFX code is not yet available
  – Under heavy refactoring, catching up with the Android version            26
Questions?

> Thanks for your attention
  – http://javafx.com
   –   http://bluebill.tidalwave.it/mobile
   –   http://windrose.tidalwave.it




                                             27
Fabrizio Giudici   www.tidalwave.it
Tidalwave s.a.s.   fabrizio.giudici@
                   tidalwave.it

More Related Content

What's hot

J query1
J query1J query1
J query1
Manav Prasad
 
CSharp Advanced L05-Attributes+Reflection
CSharp Advanced L05-Attributes+ReflectionCSharp Advanced L05-Attributes+Reflection
CSharp Advanced L05-Attributes+Reflection
Mohammad Shaker
 
Web2py tutorial to create db driven application.
Web2py tutorial to create db driven application.Web2py tutorial to create db driven application.
Web2py tutorial to create db driven application.fRui Apps
 
Class-based views with Django
Class-based views with DjangoClass-based views with Django
Class-based views with Django
Simon Willison
 
A Gentle Introduction To Object Oriented Php
A Gentle Introduction To Object Oriented PhpA Gentle Introduction To Object Oriented Php
A Gentle Introduction To Object Oriented PhpMichael Girouard
 
Synapseindia object oriented programming in php
Synapseindia object oriented programming in phpSynapseindia object oriented programming in php
Synapseindia object oriented programming in php
Synapseindiappsdevelopment
 
java script
java scriptjava script
java script
monikadeshmane
 
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby DeveloperVenturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Jon Kruger
 
Java for beginners
Java for beginnersJava for beginners
Java for beginners
Saeid Zebardast
 
ZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMJonathan Wage
 
Java script
Java scriptJava script
Java script
Adrian Caetano
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
Jonathan Wage
 
Doctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document MapperDoctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document Mapper
Jonathan Wage
 
Xtext Eclipse Con
Xtext Eclipse ConXtext Eclipse Con
Xtext Eclipse Con
Sven Efftinge
 
Jackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSVJackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSV
Tatu Saloranta
 

What's hot (18)

J query1
J query1J query1
J query1
 
CSharp Advanced L05-Attributes+Reflection
CSharp Advanced L05-Attributes+ReflectionCSharp Advanced L05-Attributes+Reflection
CSharp Advanced L05-Attributes+Reflection
 
Web2py tutorial to create db driven application.
Web2py tutorial to create db driven application.Web2py tutorial to create db driven application.
Web2py tutorial to create db driven application.
 
Class-based views with Django
Class-based views with DjangoClass-based views with Django
Class-based views with Django
 
A Gentle Introduction To Object Oriented Php
A Gentle Introduction To Object Oriented PhpA Gentle Introduction To Object Oriented Php
A Gentle Introduction To Object Oriented Php
 
Dartprogramming
DartprogrammingDartprogramming
Dartprogramming
 
Synapseindia object oriented programming in php
Synapseindia object oriented programming in phpSynapseindia object oriented programming in php
Synapseindia object oriented programming in php
 
java script
java scriptjava script
java script
 
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby DeveloperVenturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
 
Java for beginners
Java for beginnersJava for beginners
Java for beginners
 
jQuery-1-Ajax
jQuery-1-AjaxjQuery-1-Ajax
jQuery-1-Ajax
 
ZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODM
 
Java script
Java scriptJava script
Java script
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
Doctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document MapperDoctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document Mapper
 
Xtext Eclipse Con
Xtext Eclipse ConXtext Eclipse Con
Xtext Eclipse Con
 
Jackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSVJackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSV
 
KAAccessControl
KAAccessControlKAAccessControl
KAAccessControl
 

Viewers also liked

JavaFX and HTML5 - Like Curds and Rice
JavaFX and HTML5 - Like Curds and RiceJavaFX and HTML5 - Like Curds and Rice
JavaFX and HTML5 - Like Curds and Rice
Stephen Chin
 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5
Stephen Chin
 
Building RIA Applications with JavaFX
Building RIA Applications with JavaFXBuilding RIA Applications with JavaFX
Building RIA Applications with JavaFX
Max Katz
 
JavaFX Advanced
JavaFX AdvancedJavaFX Advanced
JavaFX Advanced
Paul Bakker
 
JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014
Ryan Cuprak
 
JavaFX on Mobile (by Johan Vos)
JavaFX on Mobile (by Johan Vos)JavaFX on Mobile (by Johan Vos)
JavaFX on Mobile (by Johan Vos)
Stephen Chin
 
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
 

Viewers also liked (7)

JavaFX and HTML5 - Like Curds and Rice
JavaFX and HTML5 - Like Curds and RiceJavaFX and HTML5 - Like Curds and Rice
JavaFX and HTML5 - Like Curds and Rice
 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5
 
Building RIA Applications with JavaFX
Building RIA Applications with JavaFXBuilding RIA Applications with JavaFX
Building RIA Applications with JavaFX
 
JavaFX Advanced
JavaFX AdvancedJavaFX Advanced
JavaFX Advanced
 
JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014
 
JavaFX on Mobile (by Johan Vos)
JavaFX on Mobile (by Johan Vos)JavaFX on Mobile (by Johan Vos)
JavaFX on Mobile (by Johan Vos)
 
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)
 

Similar to Designing a JavaFX Mobile application

How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js frameworkBen Lin
 
ES6 metaprogramming unleashed
ES6 metaprogramming unleashedES6 metaprogramming unleashed
ES6 metaprogramming unleashed
Javier Arias Losada
 
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngineGoogle Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Roman Kirillov
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
Lazy Loading Because I'm Lazy
Lazy Loading Because I'm LazyLazy Loading Because I'm Lazy
Lazy Loading Because I'm Lazy
Johnathan Leppert
 
GradleFX
GradleFXGradleFX
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011Nick Sieger
 
Scala based Lift Framework
Scala based Lift FrameworkScala based Lift Framework
Scala based Lift Frameworkvhazrati
 
Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web Framework
IndicThreads
 
Overview Of Lift Framework
Overview Of Lift FrameworkOverview Of Lift Framework
Overview Of Lift Framework
Xebia IT Architects
 
async/await in Swift
async/await in Swiftasync/await in Swift
async/await in Swift
Peter Friese
 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGems
Sadayuki Furuhashi
 
Asynchronous Interfaces
Asynchronous InterfacesAsynchronous Interfaces
Asynchronous Interfaces
maccman
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScript
Andrew Dupont
 
BlackBerry DevCon 2011 - PhoneGap and WebWorks
BlackBerry DevCon 2011 - PhoneGap and WebWorksBlackBerry DevCon 2011 - PhoneGap and WebWorks
BlackBerry DevCon 2011 - PhoneGap and WebWorksmwbrooks
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5arajivmordani
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications
Juliana Lucena
 
OSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi ecosystems compared on Apache Karaf - Christian SchneiderOSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi ecosystems compared on Apache Karaf - Christian Schneider
mfrancis
 
Multilingualism makes better programmers
Multilingualism makes better programmersMultilingualism makes better programmers
Multilingualism makes better programmers
Alexander Varwijk
 
The Beauty of Java Script
The Beauty of Java ScriptThe Beauty of Java Script
The Beauty of Java Script
Michael Girouard
 

Similar to Designing a JavaFX Mobile application (20)

How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js framework
 
ES6 metaprogramming unleashed
ES6 metaprogramming unleashedES6 metaprogramming unleashed
ES6 metaprogramming unleashed
 
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngineGoogle Cloud Endpoints: Building Third-Party APIs on Google AppEngine
Google Cloud Endpoints: Building Third-Party APIs on Google AppEngine
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Lazy Loading Because I'm Lazy
Lazy Loading Because I'm LazyLazy Loading Because I'm Lazy
Lazy Loading Because I'm Lazy
 
GradleFX
GradleFXGradleFX
GradleFX
 
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
 
Scala based Lift Framework
Scala based Lift FrameworkScala based Lift Framework
Scala based Lift Framework
 
Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web Framework
 
Overview Of Lift Framework
Overview Of Lift FrameworkOverview Of Lift Framework
Overview Of Lift Framework
 
async/await in Swift
async/await in Swiftasync/await in Swift
async/await in Swift
 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGems
 
Asynchronous Interfaces
Asynchronous InterfacesAsynchronous Interfaces
Asynchronous Interfaces
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScript
 
BlackBerry DevCon 2011 - PhoneGap and WebWorks
BlackBerry DevCon 2011 - PhoneGap and WebWorksBlackBerry DevCon 2011 - PhoneGap and WebWorks
BlackBerry DevCon 2011 - PhoneGap and WebWorks
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5a
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications
 
OSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi ecosystems compared on Apache Karaf - Christian SchneiderOSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi ecosystems compared on Apache Karaf - Christian Schneider
 
Multilingualism makes better programmers
Multilingualism makes better programmersMultilingualism makes better programmers
Multilingualism makes better programmers
 
The Beauty of Java Script
The Beauty of Java ScriptThe Beauty of Java Script
The Beauty of Java Script
 

More from Fabrizio Giudici

Building Android apps with Maven
Building Android apps with MavenBuilding Android apps with Maven
Building Android apps with Maven
Fabrizio Giudici
 
DCI - Data, Context and Interaction @ Jug Lugano May 2011
DCI - Data, Context and Interaction @ Jug Lugano May 2011 DCI - Data, Context and Interaction @ Jug Lugano May 2011
DCI - Data, Context and Interaction @ Jug Lugano May 2011
Fabrizio Giudici
 
DCI - Data, Context and Interaction @ Jug Genova April 2011
DCI - Data, Context and Interaction @ Jug Genova April 2011DCI - Data, Context and Interaction @ Jug Genova April 2011
DCI - Data, Context and Interaction @ Jug Genova April 2011
Fabrizio Giudici
 
NOSQL also means RDF stores: an Android case study
NOSQL also means RDF stores: an Android case studyNOSQL also means RDF stores: an Android case study
NOSQL also means RDF stores: an Android case studyFabrizio Giudici
 
Tools for an effective software factory
Tools for an effective software factoryTools for an effective software factory
Tools for an effective software factoryFabrizio Giudici
 
Parallel Computing Scenarios and the new challenges for the Software Architect
Parallel Computing Scenarios  and the new challenges for the Software ArchitectParallel Computing Scenarios  and the new challenges for the Software Architect
Parallel Computing Scenarios and the new challenges for the Software ArchitectFabrizio Giudici
 
blueMarine a desktop app for the open source photographic workflow
blueMarine  a desktop app for the open source photographic workflowblueMarine  a desktop app for the open source photographic workflow
blueMarine a desktop app for the open source photographic workflowFabrizio Giudici
 
blueMarine photographic workflow with Java
blueMarine photographic workflow with JavablueMarine photographic workflow with Java
blueMarine photographic workflow with JavaFabrizio Giudici
 
blueMarine Sailing with NetBeans Platform
blueMarine Sailing with NetBeans PlatformblueMarine Sailing with NetBeans Platform
blueMarine Sailing with NetBeans PlatformFabrizio Giudici
 
NASA World Wind for Java API Overview
NASA World Wind for Java  API OverviewNASA World Wind for Java  API Overview
NASA World Wind for Java API OverviewFabrizio Giudici
 
Web Development with Apache Struts 2
Web Development with  Apache Struts 2Web Development with  Apache Struts 2
Web Development with Apache Struts 2Fabrizio Giudici
 
blueMarine Or Why You Should Really Ship Swing Applications
blueMarine  Or Why You Should Really Ship Swing  Applications blueMarine  Or Why You Should Really Ship Swing  Applications
blueMarine Or Why You Should Really Ship Swing Applications Fabrizio Giudici
 
Android java fx-jme@jug-lugano
Android java fx-jme@jug-luganoAndroid java fx-jme@jug-lugano
Android java fx-jme@jug-lugano
Fabrizio Giudici
 

More from Fabrizio Giudici (16)

Building Android apps with Maven
Building Android apps with MavenBuilding Android apps with Maven
Building Android apps with Maven
 
DCI - Data, Context and Interaction @ Jug Lugano May 2011
DCI - Data, Context and Interaction @ Jug Lugano May 2011 DCI - Data, Context and Interaction @ Jug Lugano May 2011
DCI - Data, Context and Interaction @ Jug Lugano May 2011
 
DCI - Data, Context and Interaction @ Jug Genova April 2011
DCI - Data, Context and Interaction @ Jug Genova April 2011DCI - Data, Context and Interaction @ Jug Genova April 2011
DCI - Data, Context and Interaction @ Jug Genova April 2011
 
NOSQL also means RDF stores: an Android case study
NOSQL also means RDF stores: an Android case studyNOSQL also means RDF stores: an Android case study
NOSQL also means RDF stores: an Android case study
 
Netbeans+platform+maven
Netbeans+platform+mavenNetbeans+platform+maven
Netbeans+platform+maven
 
Tools for an effective software factory
Tools for an effective software factoryTools for an effective software factory
Tools for an effective software factory
 
Parallel Computing Scenarios and the new challenges for the Software Architect
Parallel Computing Scenarios  and the new challenges for the Software ArchitectParallel Computing Scenarios  and the new challenges for the Software Architect
Parallel Computing Scenarios and the new challenges for the Software Architect
 
blueMarine a desktop app for the open source photographic workflow
blueMarine  a desktop app for the open source photographic workflowblueMarine  a desktop app for the open source photographic workflow
blueMarine a desktop app for the open source photographic workflow
 
blueMarine photographic workflow with Java
blueMarine photographic workflow with JavablueMarine photographic workflow with Java
blueMarine photographic workflow with Java
 
blueMarine Sailing with NetBeans Platform
blueMarine Sailing with NetBeans PlatformblueMarine Sailing with NetBeans Platform
blueMarine Sailing with NetBeans Platform
 
NASA World Wind for Java API Overview
NASA World Wind for Java  API OverviewNASA World Wind for Java  API Overview
NASA World Wind for Java API Overview
 
The VRC Project
The VRC ProjectThe VRC Project
The VRC Project
 
Web Development with Apache Struts 2
Web Development with  Apache Struts 2Web Development with  Apache Struts 2
Web Development with Apache Struts 2
 
blueMarine Or Why You Should Really Ship Swing Applications
blueMarine  Or Why You Should Really Ship Swing  Applications blueMarine  Or Why You Should Really Ship Swing  Applications
blueMarine Or Why You Should Really Ship Swing Applications
 
Android java fx-jme@jug-lugano
Android java fx-jme@jug-luganoAndroid java fx-jme@jug-lugano
Android java fx-jme@jug-lugano
 
Mercurial
MercurialMercurial
Mercurial
 

Recently uploaded

Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 

Recently uploaded (20)

Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 

Designing a JavaFX Mobile application

  • 1. Designing a JavaFX Mobile application Fabrizio Giudici Tidalwave s.a.s. 214
  • 2. AGENDA > Putting JavaFX (Mobile) in context > My case study > Main features of JavaFX (Mobile) > JavaFX Mobile through a few examples > Current status of JavaFX Mobile > Conclusion 2
  • 3. About the speaker > Fabrizio.Giudici@tidalwave.it > Senior Architect, Mentor, Technical Writer > Working with Java (all the editions, plus exotic stuff) since 1996 > Working with Java ME since 1999 – First J2ME edition at JavaOne™ (Palm) – Developed a couple of research projects with the University of Genoa – Developed a couple of customer projects with my former company – Consulting for customer projects – Author of mobile FLOSS: windRose and blueBill Mobile > Co-leader of JUG Milano 3
  • 4. What's wrong with JME > Everything was so good at the old, Palm times – Small devices → no big expectations – One reference platform – One pervasive runtime > With more devices, JME got fragmented – JSR as extension points (e.g. bluetooth, location) – Multiple combinations – Harder and harder to test – windRose pain 4
  • 5. Hoping in Java FX Mobile > JavaFX announced by Sun Microsystems in 2007 – A specific scripting language + a runtime – Fight the “Ugly Java UI stereotype” – Re-designed UI controls – Integration with graphics designers workflow (e.g. NetBeans + Photoshop) – Profiles for multiple targets (desktop / web, mobile) > JavaFX Mobile profile – Can sit on top of JME (MSA: Mobile Service Architecture, a.k.a. JSR-248) – Maybe no more (or reduced) fragmentation? > Oracle commitment after the Sun buy > A fulfilled promise? – Answers at the end :-) 5
  • 6. My case study: blueBill Mobile > “The field tool for birdwatchers” – Records geotagged observations – Reference guides with multimedia – Social capabilities (à la Google Friends) > Started in 2009 with JavaFX > Currently the most advanced version is the Android one – JavaFX version being redesigned (more later) > Demo 6
  • 7. Main features of JavaFX > The languages is both imperative and declarative – Imperative: for normal processing – Declarative: mostly for the UI (no XML, no separate layout descriptor)  Binding – Has got closures, mixins > Compiles to the same VM bytecode – Can mix with Java code (e.g. reference a Java library) – On the desktop, can be mixed with Swing (in addition to its own UI widgets) – On the mobile, runs its own UI widgets 7
  • 8. Some code examples > Example 1: Calling JME code > Example 2: Posting contents (REST) > Example 3: Getting resources (REST) > Example 4: Binding (if time allows) 8
  • 9. Example: calling JME code > Not much to say: it just works package it.tidalwave.bluebillmfx; import javax.microedition.location.Criteria; import javax.microedition.location.LocationProvider; import javafx.animation.Timeline; import javafx.animation.KeyFrame; import it.tidalwave.geo.mapfx.model.Coordinates; public class PositionTracker { public-read var currentPosition : Coordinates; def criteria = new Criteria(); var locationProvider : LocationProvider; postinit { locationProvider = LocationProvider.getInstance(criteria); pollingTimeline.play(); } 9
  • 10. Example: calling JME code > Need to copy data in JavaFX classes if you want binding support function getPosition(): Void { def location = locationProvider.getLocation(5); // JME stuff def coordinates = location.getQualifiedCoordinates(); if (coordinates != null ) { def lat = coordinates.getLatitude(); def lon = coordinates.getLongitude(); currentPosition = Coordinates { latitude: lat; longitude: lon }; } } def pollingTimeline = Timeline { repeatCount: Timeline.INDEFINITE keyFrames: KeyFrame { time: 10s; action: periodicTask } }; function periodicTask(): Void { getPosition(); // update the map position, etc... } } 10
  • 11. Example: posting contents > HttpRequest provides a skeleton public class ObservationRDFUpload extends HttpRequest { public-init var serviceURL = "http://myHost:8084/blueBillGeoService"; override public var method = HttpRequest.POST; public var content : String; override var output on replace { if (output != null) { output.write(content.getBytes()); output.close(); } } override function start(): Void { location = "{serviceURL}/postObservation"; // REST call setHeader("Content-Type", "application/rdf"); super.start(); } } 11
  • 12. Example: posting contents > HttpRequest provides a skeleton def upload = ObservationRDFUpload { content: // ... assemble the string with the contents }; upload.start(); 12
  • 13. Example: reading resources > The relevant model class public class Taxon { public-read protected var id : String; public-read var urlsLoaded = false; var urlsLoading = false; var imageURLs : String[]; // [] is a list (“sequence”), not an array var images : DeferredImage[]; public bound function getImage (index : Integer): DeferredImage { def dummy = loadImageURLs(); // assignment is a requirement for the bound function return images[index]; } public bound function imageCount(): Integer { return sizeof images; } 13
  • 14. Example: reading resources > Getting a JSON resource catalog function loadImageURLs(): Boolean { if (not urlsLoading and not urlsLoaded) { urlsLoading = true; def fixedId = clean(id); // get rid of/escape “bad” chars such as :, #, etc... def url = "http://kenai.com/svn/bluebill-mobile~media/catalog/{fixedId}.json"; def request : HttpRequest = HttpRequest { // mere instantiation, not subclassing! location: url; method: HttpRequest.GET; onInput: function (is: InputStream) { // hey, this is not a switch() label! if (request.responseCode != 200) { imageURLs = "media/black_glossy_web20_icon_012.png"; } else { try { def parser = PullParser { documentType: PullParser.JSON; input: is; onEvent: parseEventCallback }; parser.parse(); } catch (e: Exception) { println("Exception {e} while parsing {url}"); } finally { is.close(); 14 } } }
  • 15. Example: reading resources > Getting a JSON resource catalog onException: function (e: Exception) { imageURLs = "media/black_glossy_web20_icon_012.png"; urlsLoaded = true; } onDone: function() { images = for (url in imageURLs) { DeferredImage { url: url }; } imageURLs = null; urlsLoaded = true; } } request.start(); } return urlsLoaded; } def parseEventCallback = function (event: Event): Void { if ((event.type == PullParser.TEXT) and (event.name == "url")) { insert event.text into imageURLs; } 15 } }
  • 16. Example: reading resources > Loading an image > JavaFX Image loads automatically when initialized var imageCounter = 0; public class DeferredImage { public-init var url : String; public-read var progress = bind image.progress; public-read var error = bind image.error; def id = imageCounter++; public-read var image : Image; public function load() { // start loading only when load() is called if (image == null) { image = Image { url: url backgroundLoading: true } } } 16 }
  • 17. Example: binding > Introducing TaxonSearchController – Manages a list of Taxons – Produces a filtered list of Taxons whose names match a substring – Provides a hint for autocompletion  Eg. you type “He”  That matches only “Heron ***”  Hints is “Heron “ 17
  • 18. Example: binding > Some relevant parts of Taxon public class Taxon { public-read protected var displayName : String; public-read protected var scientificName : String; public-read protected var id : String; override function toString() { return "{displayName} ({scientificName}) ({id})" } } 18
  • 19. Example: binding > TaxonSearchController (1/3) public class TaxonSearchController { public var taxons: Taxon[]; public var filteredTaxons: Taxon[]; public var selectedTaxonIndex : Integer = -1; // set from the UI public var selectedTaxon = bind if (selectedTaxonIndex < 0) then null else filteredTaxons[selectedTaxonIndex]; // setting this property will trigger filtering public var filter = "" on replace { filteredTaxons = taxons[taxon | matches(taxon, filter)]; updateHint(); } public-read var hint = ""; // the auto-completed hint 19
  • 20. Example: binding > TaxonSearchController (2/3) protected function matches (taxon : Taxon, string: String) : Boolean { if (string == "") { return true; } if (taxon.displayName.toLowerCase().startsWith(string.toLowerCase())) { return true; // more complex in the real case, as it also deals with scientific name // but not relevant now } return false; } 20
  • 21. Example: binding > TaxonSearchController (3/3) protected function updateHint(): Void { def hintTry = commonLeadingSubstring(filteredTaxons); // // Sometimes it can't find a better auto-completion than the current filter, // hint = if (hintTry.length() > filter.length()) then hintTry else filter; } } 21
  • 22. Example: binding > TaxonSearchScreen public class TaxonSearchScreen extends Container // e.g. a UI panel { // warning: there are some simplifications, but the concepts are here public-read def controller = TaxonSearchController { selectedTaxonIndex: bind list.selectedIndex; } def list = ListBox { // the list widget in the UI items: bind controller.filteredTaxons }; def hint = bind controller.hint on replace { if (hint != "") { filter = hint; } } var resetSelectionWhenFilterChanges = bind controller.selectedTaxon on replace { if (controller.selectedTaxon != null) { list.selectedIndex = 0; } } TextBox { // a text input box in the UI text: bind controller.filter with inverse } Text { // a label rendering a text in the UI content: bind "{sizeof controller.filteredTaxons} specie(s)" 22 }
  • 23. JavaFX mobile in 2009 > Development tools available (emulator, etc...) > First capable phones at J1: LG Incite, HTC Touch Diamond > Announced a “JavaFX Mobile player” – Would run JavaFX on MSA (JSR 248) JME phones > Looked very promising – That's why blueBill Mobile started with it 23
  • 24. Status updates in 2010 > Barcelona Mobile World Congress 2010 – “Feature phones” (Qualcomm and the Brew Mobile Platform OS) – Sony-Ericsson in “upcoming phones” > Recent phone status update (JavaFX forums, March 16, 2010) – LG Incite, HTC Touch Diamond... still! – “Unofficially” runs on any Windows Mobile 6.x device (e.g. HTC HD2) > JavaFX 1.3 released on May 14, 2010 – Shares many improvements with the desktop/web profile – Mobile emulator runs on Mac OS X > JavaFX Mobile Player MIA (I mean, it's Windows Mobile only) > No further manufacturer endorsements? 24
  • 25. My view of Java-related mobile solutions > We're in the climax of the “next generation mobile” war – iPhone/iPad, Android leading on the growth rates – Adobe Flash at stake, but if it survives will be relevant > Is there still room for JavaFX Mobile? JME? > JavaFX Mobile – Still excites me, technically – The Oracle-Sun deal might have slowed down deals – but... – … timing out this Summer –Hoping in a specific Android port/adaptation (using the Android UI/runtime)  Hearing a few people talking about that  Would bring-in e.g. the integration with graphic designer workflow > JME still relevant for the “glorious old guard” (Nokia, etc..., BlackBerry) – “Oldies but goodies” 25
  • 26. My research for the Summer > Two/threefold strategy – Android (it delivers, short time-to-market) – JME (catch the “old glorious guard”) – JavaFX (if industry endorsements / Android support will show up) > Study whether it is possible to reuse code – Not thinking of “catch-all” frameworks – Reusing only the models, writing ad-hoc UIs (no “GCD syndrome”) – Maven for re-using artifacts – Byte-code manipulation (e.g. RetroWeaver) for fitting JME Java 1.3? – Follow my blog and my space at Dzone.com > The “new” blueBill Mobile for JavaFX code is not yet available – Under heavy refactoring, catching up with the Android version 26
  • 27. Questions? > Thanks for your attention – http://javafx.com – http://bluebill.tidalwave.it/mobile – http://windrose.tidalwave.it 27
  • 28. Fabrizio Giudici www.tidalwave.it Tidalwave s.a.s. fabrizio.giudici@ tidalwave.it