SlideShare una empresa de Scribd logo
1 de 36
Descargar para leer sin conexión
Mixing Ajax, Swing
and Flash


         •Sibylle Peter, Matthias Huber, Canoo AG
Copyright © Canoo Engineering AG                       2




• About Canoo
        Founded 1999, Basel, Switzerland
   •
        Specialized in Rich Internet Applications
   •
        Products, Solutions, Consulting and Training




   http://www.canoo.com
Copyright © Canoo Engineering AG   3


Overview
• Integration on the client
• Why mix technologies?
• How-tos and examples for
        Ajax & Flash
   •
        Swing & Ajax
   •
        Swing & Flash
   •
Copyright © Canoo Engineering AG                                 4


Integration on the Client


                                                         Swing
      Client                       Ajax     Flash



      Server                       Server           Server
Copyright © Canoo Engineering AG                         5


Why mix technologies?
• Best-of-breed solution
• Integration of existing components
        Own components
   •
        Components which exists only in one technology
   •
• Migration of an existing internet application
• ...
Copyright © Canoo Engineering AG                               6


Mixing Ajax & Flash



                                   ExternalInterface

                      Ajax                             Flash
                                   Flex Ajax Bridge
Copyright © Canoo Engineering AG                        7


ExternalInterface



  • Flash  Ajax
      ExternalInterface.call(jsFunctionName [,param])

  • Ajax  Flash
      ExternalInterface.addCallback(ID, AS3Function)
Copyright © Canoo Engineering AG   8


ExternalInterface – Example


  • Code and demo
          Hybridstore
      •
Copyright © Canoo Engineering AG                                        9


Ajax
                                                     hybridstore.html
          flexApp = document.getElementById('flexApp');
          ...
          flexApp.setCamera(camera.checked);
          ...
          function setSelectedPhone(name, price) {
                 name.innerHTML = name;
                 price.innerHTML = price;
          }



                                   catalog.swf
Copyright © Canoo Engineering AG                                                10


Flex
                                                                 catalog.mxml
       private function setupCallbacks():void {
            if (ExternalInterface.available) {
                 ExternalInterface.addCallback(quot;setCameraquot;, setCamera);
        ...

       addEventListener(ThumbnailClickedEvent.THUMBNAIL_CLICK_EVENT,
                                  setSelectedPhoneEventHandler);
            }
       }
       ....
       private function setSelectedPhoneEventHandler(
                                 event:ThumbnailClickedEvent):void {
          var thumb:Thumbnail = event.thumbnail;
          ExternalInterface.call(quot;setSelectedPhonequot;,
                                  thumb.getName(),
                                  thumb.getPrice());
       }
Copyright © Canoo Engineering AG                             11


Flex Ajax Bridge
• Flex:
  <fab:FABridge xmlns:fab=quot;bridge.*quot; />
• JavaScript:
  <script type=quot;text/javascriptquot; src=quot;FABridge.jsquot;/>

   FABridge.flash.root().AS3Function(...)
   FABridge.flash.root().addEventListener(id, JSFunction);
Copyright © Canoo Engineering AG                                                     12


  ExternalInterface  Flex Ajax Bridge


                Interface explicitly defined   Public API of the application

          Only primitive types and arrays      User-defined AS3 types available

                        Part of Flex SDK 2     Part of LifeCycle Data Services 2.5

                     Free unlimited usage      Free usage limited on one CPU
Copyright © Canoo Engineering AG                       13


Mixing Swing & Ajax


                                   JavaScript
                         Swing                  Ajax



 • Usage of Java Browser component
         E.g. JDIC, JRex, WebRenderer
     •
Copyright © Canoo Engineering AG                       14


Mixing Swing & Ajax
• Swing  Ajax:
   IWebBrowser.executeScript(...)
• Ajax  Swing:
        No API to handle JS Events
   •
         communication via proprietary URL-protocol

        js2java://methodName?param1=value1&...
Copyright © Canoo Engineering AG   15


Swing & Ajax – Example
• Demo
        SwingGoogleMap
   •
Copyright © Canoo Engineering AG                           16


Swing & Ajax – Example I

                                                map.html
        SwingGoogleMap

                  JDIC WebBrowser

                        Native Browser Engine
Copyright © Canoo Engineering AG                                          17


Swing & Ajax – Example II



         Zoom In
                                                             Google Map

      ActionListener


                                                     map.zoomIn
                                   JDIC WebBrowser
          executeScript                              map.getZoom
Copyright © Canoo Engineering AG                                               18


Swing & Ajax – Example III


           NavBar
                                                            Google Map
                setLocation
                                                                   mouseMove

   JS2JavaEventHandler                                     EventListener


                                   JDIC WebBrowser
          JS2JavaEvent                               document.location
Copyright © Canoo Engineering AG                          19


Mixing Swing & Flash – jFlash


                                    Java API
                          Swing                   Flash
                                   External API



• Integration with Java Flash player
        e.g. jFlash
   •
Copyright © Canoo Engineering AG                                              20


jFlash
• Uses Flash plugin of IE
• Java  Flash
        Calls ActiveXControl.CallFunction using an API of jFlash similar to
   •
        the reflection API
• Flash  Java
        ExternalInterface.call(...) calls as events
   •
Copyright © Canoo Engineering AG                   21


External API
• XML – Format of the External API

   <invoke name=quot;functionNamequot; returntype=quot;xmlquot;>
    <arguments>
       ... (individual argument values)
      </arguments>
   </invoke>
Copyright © Canoo Engineering AG   22


Swing & Flash – Example
• Demo
        JFlashHybridStore
   •
Copyright © Canoo Engineering AG                       23


Swing & Flash – Example I

                                           store.swf
         JFlashHybridStore

                   JFlash

                         IE Flash Plugin
Copyright © Canoo Engineering AG                                   24


Swing & Flash – Example II


            Camera
                                                       Store

        ActionListener


                                            ActiveX.CallFunction
                                   JFlash
          callExternalAPI                      <invoke …
Copyright © Canoo Engineering AG                                      25


Swing & Flash – Example III

          NavBar                                      Store
               setSelectedPhone

                                              ThumbnailClickedEvent
  JS2JavaEventHandler

               JS2JavaEvent

   JFlashEventHandler                              EventHandler


               JFlashEvent
                                   JFlash
               <invoke…                     ExternalInterface.call
Copyright © Canoo Engineering AG                                             26


Mixing Swing & Flash – JDIC



                     JavaScript
                                                 ExternalInterface

      Swing                                                          Flash
                                    JavaScript
                                                    FABridge
                      URL loading
Copyright © Canoo Engineering AG   27


Swing & Flash – Example
• Demo
        JDICHybridStore
   •
Copyright © Canoo Engineering AG                       28


Swing & Flash – Example I

                                          store.html
         JDICHybridStore

                   JDIC WebBrowser

                         Native Browser
Copyright © Canoo Engineering AG                                        29


Swing & Flash – Example II


            Camera
                                                                Store

         ActionListener



                                   JDIC WebBrowser

        executeScript                        store.html
                                                          <invoke …
        flexApp.setCamera..
Copyright © Canoo Engineering AG                                          30


Swing & Flash – Example III

       NavBar                                           Store

                                                           ClickedEvent
            setSelectedPhone
                                                     EventHandler
JS2JavaEventHandler                               ExternalInterface.call

                                                      store.html


                               JDIC WebBrowser
        JS2JavaEvent                             document.location
Copyright © Canoo Engineering AG                                                 31


                             JDIC  JFlash


                   All platforms supported      Internet Explorer Flash plugin

                               Open source      Commercial

                                   JavaScript   ActiveXControl

                      java.awt.Component        java.awt.Component
Copyright © Canoo Engineering AG       32


Summary
• Ajax and Flash
        Good integration support
   •
        Ongoing development (Apollo)
   •
Copyright © Canoo Engineering AG                                         33


Summary
• Integration of Ajax/Flex in Swing
        Mostly low level communication
   •
        One technology (Java browser component) available to integrate
   •
        Ajax and Flash
        Ajax: Communication using JavaScript-injection
   •
        Flash: Communication using callbacks / Flex Ajax Bridge
   •
Copyright © Canoo Engineering AG                   34


Summary
• Effort
        Implementation
   •
        Deployment
   •
• Maintainance
        Loose coupling
   •
        All communication code in one technology
   •

• Mixing technologies as an alternative
Copyright © Canoo Engineering AG             35




  • Demos and source code on our RIA Blog:
      • http://www.canoo.com/blog/



   • Questions?
Copyright © Canoo Engineering AG                                              36


Links
• Adobe
        Flex 2: http://www.adobe.com/products/flex/
   •
        HybridStore: http://www.adobe.com/devnet/flex/samples/hybrid_store/
   •
• JDIC
        https://jdic.dev.java.net
   •
• JFlash
        http://sesma.com/software/products/jflash/
   •
• Sun (Mixing heavyweight & lightweight components)
        http://java.sun.com/products/jfc/tsc/articles/mixing/
   •
• WebRenderer
        http://www.webrenderer.com/
   •

Más contenido relacionado

Similar a Ajax Swing Flash Jazoon07

Web applications support on AGL
Web applications support on AGLWeb applications support on AGL
Web applications support on AGLIgalia
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureSimon Willison
 
BlackBerry10 apps with Adobe AIR & Apache Flex - BlackBerry JAM Europe
BlackBerry10 apps with Adobe AIR & Apache Flex - BlackBerry JAM EuropeBlackBerry10 apps with Adobe AIR & Apache Flex - BlackBerry JAM Europe
BlackBerry10 apps with Adobe AIR & Apache Flex - BlackBerry JAM EuropeMariano Carrizo
 
GermaniumWeb training for CXA2010
GermaniumWeb training for CXA2010GermaniumWeb training for CXA2010
GermaniumWeb training for CXA2010ianloh13
 
CommunityOneEast 09 - Dynamic Languages: the next big thing for the JVM or an...
CommunityOneEast 09 - Dynamic Languages: the next big thing for the JVM or an...CommunityOneEast 09 - Dynamic Languages: the next big thing for the JVM or an...
CommunityOneEast 09 - Dynamic Languages: the next big thing for the JVM or an...Chris Richardson
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extremeyinonavraham
 
Ajax Push ICEfaces Ted Goddard
Ajax Push ICEfaces Ted GoddardAjax Push ICEfaces Ted Goddard
Ajax Push ICEfaces Ted Goddardrajivmordani
 
Phone gap 12 things you should know
Phone gap 12 things you should knowPhone gap 12 things you should know
Phone gap 12 things you should knowISOCHK
 
Moving from AS3 to Flex - advantages, hazards, traps
Moving from AS3 to Flex - advantages, hazards, trapsMoving from AS3 to Flex - advantages, hazards, traps
Moving from AS3 to Flex - advantages, hazards, trapsFlorian Weil
 
Connection lost... F%CK!
Connection lost... F%CK! Connection lost... F%CK!
Connection lost... F%CK! Creuna
 
MAYA HTT NX ST CAD-CAE Workflows
MAYA HTT NX ST CAD-CAE WorkflowsMAYA HTT NX ST CAD-CAE Workflows
MAYA HTT NX ST CAD-CAE WorkflowsDora Smith
 
Maya HTT NX CAD Assoc Fluid Domains
Maya HTT NX CAD Assoc Fluid DomainsMaya HTT NX CAD Assoc Fluid Domains
Maya HTT NX CAD Assoc Fluid DomainsDora Smith
 
JavaME Deploy and Test - JMDF 2005
JavaME Deploy and Test - JMDF 2005JavaME Deploy and Test - JMDF 2005
JavaME Deploy and Test - JMDF 2005Edoardo Schepis
 
Flex For Java Architects Ledroff Breizh Jug V Blog Cc
Flex For Java Architects Ledroff Breizh Jug V Blog CcFlex For Java Architects Ledroff Breizh Jug V Blog Cc
Flex For Java Architects Ledroff Breizh Jug V Blog CcFrançois Le Droff
 
Declarative Import with Magento 2 Import Framework (M2IF)
Declarative Import with Magento 2 Import Framework (M2IF)Declarative Import with Magento 2 Import Framework (M2IF)
Declarative Import with Magento 2 Import Framework (M2IF)Tim Wagner
 

Similar a Ajax Swing Flash Jazoon07 (20)

GlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium ParisGlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium Paris
 
Web applications support on AGL
Web applications support on AGLWeb applications support on AGL
Web applications support on AGL
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
 
Os Ramani
Os RamaniOs Ramani
Os Ramani
 
BlackBerry10 apps with Adobe AIR & Apache Flex - BlackBerry JAM Europe
BlackBerry10 apps with Adobe AIR & Apache Flex - BlackBerry JAM EuropeBlackBerry10 apps with Adobe AIR & Apache Flex - BlackBerry JAM Europe
BlackBerry10 apps with Adobe AIR & Apache Flex - BlackBerry JAM Europe
 
GermaniumWeb training for CXA2010
GermaniumWeb training for CXA2010GermaniumWeb training for CXA2010
GermaniumWeb training for CXA2010
 
Ilog Ria2
Ilog Ria2Ilog Ria2
Ilog Ria2
 
CommunityOneEast 09 - Dynamic Languages: the next big thing for the JVM or an...
CommunityOneEast 09 - Dynamic Languages: the next big thing for the JVM or an...CommunityOneEast 09 - Dynamic Languages: the next big thing for the JVM or an...
CommunityOneEast 09 - Dynamic Languages: the next big thing for the JVM or an...
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extreme
 
Ajax Push ICEfaces Ted Goddard
Ajax Push ICEfaces Ted GoddardAjax Push ICEfaces Ted Goddard
Ajax Push ICEfaces Ted Goddard
 
Android Development Workshop V2
Android Development Workshop   V2Android Development Workshop   V2
Android Development Workshop V2
 
Phone gap 12 things you should know
Phone gap 12 things you should knowPhone gap 12 things you should know
Phone gap 12 things you should know
 
Gain more freedom when migrating from Camunda 7 to 8.pdf
Gain more freedom when migrating from Camunda 7 to 8.pdfGain more freedom when migrating from Camunda 7 to 8.pdf
Gain more freedom when migrating from Camunda 7 to 8.pdf
 
Moving from AS3 to Flex - advantages, hazards, traps
Moving from AS3 to Flex - advantages, hazards, trapsMoving from AS3 to Flex - advantages, hazards, traps
Moving from AS3 to Flex - advantages, hazards, traps
 
Connection lost... F%CK!
Connection lost... F%CK! Connection lost... F%CK!
Connection lost... F%CK!
 
MAYA HTT NX ST CAD-CAE Workflows
MAYA HTT NX ST CAD-CAE WorkflowsMAYA HTT NX ST CAD-CAE Workflows
MAYA HTT NX ST CAD-CAE Workflows
 
Maya HTT NX CAD Assoc Fluid Domains
Maya HTT NX CAD Assoc Fluid DomainsMaya HTT NX CAD Assoc Fluid Domains
Maya HTT NX CAD Assoc Fluid Domains
 
JavaME Deploy and Test - JMDF 2005
JavaME Deploy and Test - JMDF 2005JavaME Deploy and Test - JMDF 2005
JavaME Deploy and Test - JMDF 2005
 
Flex For Java Architects Ledroff Breizh Jug V Blog Cc
Flex For Java Architects Ledroff Breizh Jug V Blog CcFlex For Java Architects Ledroff Breizh Jug V Blog Cc
Flex For Java Architects Ledroff Breizh Jug V Blog Cc
 
Declarative Import with Magento 2 Import Framework (M2IF)
Declarative Import with Magento 2 Import Framework (M2IF)Declarative Import with Magento 2 Import Framework (M2IF)
Declarative Import with Magento 2 Import Framework (M2IF)
 

Último

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Ajax Swing Flash Jazoon07

  • 1. Mixing Ajax, Swing and Flash •Sibylle Peter, Matthias Huber, Canoo AG
  • 2. Copyright © Canoo Engineering AG 2 • About Canoo Founded 1999, Basel, Switzerland • Specialized in Rich Internet Applications • Products, Solutions, Consulting and Training http://www.canoo.com
  • 3. Copyright © Canoo Engineering AG 3 Overview • Integration on the client • Why mix technologies? • How-tos and examples for Ajax & Flash • Swing & Ajax • Swing & Flash •
  • 4. Copyright © Canoo Engineering AG 4 Integration on the Client Swing Client Ajax Flash Server Server Server
  • 5. Copyright © Canoo Engineering AG 5 Why mix technologies? • Best-of-breed solution • Integration of existing components Own components • Components which exists only in one technology • • Migration of an existing internet application • ...
  • 6. Copyright © Canoo Engineering AG 6 Mixing Ajax & Flash ExternalInterface Ajax Flash Flex Ajax Bridge
  • 7. Copyright © Canoo Engineering AG 7 ExternalInterface • Flash  Ajax ExternalInterface.call(jsFunctionName [,param]) • Ajax  Flash ExternalInterface.addCallback(ID, AS3Function)
  • 8. Copyright © Canoo Engineering AG 8 ExternalInterface – Example • Code and demo Hybridstore •
  • 9. Copyright © Canoo Engineering AG 9 Ajax hybridstore.html flexApp = document.getElementById('flexApp'); ... flexApp.setCamera(camera.checked); ... function setSelectedPhone(name, price) { name.innerHTML = name; price.innerHTML = price; } catalog.swf
  • 10. Copyright © Canoo Engineering AG 10 Flex catalog.mxml private function setupCallbacks():void { if (ExternalInterface.available) { ExternalInterface.addCallback(quot;setCameraquot;, setCamera); ... addEventListener(ThumbnailClickedEvent.THUMBNAIL_CLICK_EVENT, setSelectedPhoneEventHandler); } } .... private function setSelectedPhoneEventHandler( event:ThumbnailClickedEvent):void { var thumb:Thumbnail = event.thumbnail; ExternalInterface.call(quot;setSelectedPhonequot;, thumb.getName(), thumb.getPrice()); }
  • 11. Copyright © Canoo Engineering AG 11 Flex Ajax Bridge • Flex: <fab:FABridge xmlns:fab=quot;bridge.*quot; /> • JavaScript: <script type=quot;text/javascriptquot; src=quot;FABridge.jsquot;/> FABridge.flash.root().AS3Function(...) FABridge.flash.root().addEventListener(id, JSFunction);
  • 12. Copyright © Canoo Engineering AG 12 ExternalInterface  Flex Ajax Bridge Interface explicitly defined Public API of the application Only primitive types and arrays User-defined AS3 types available Part of Flex SDK 2 Part of LifeCycle Data Services 2.5 Free unlimited usage Free usage limited on one CPU
  • 13. Copyright © Canoo Engineering AG 13 Mixing Swing & Ajax JavaScript Swing Ajax • Usage of Java Browser component E.g. JDIC, JRex, WebRenderer •
  • 14. Copyright © Canoo Engineering AG 14 Mixing Swing & Ajax • Swing  Ajax: IWebBrowser.executeScript(...) • Ajax  Swing: No API to handle JS Events •  communication via proprietary URL-protocol js2java://methodName?param1=value1&...
  • 15. Copyright © Canoo Engineering AG 15 Swing & Ajax – Example • Demo SwingGoogleMap •
  • 16. Copyright © Canoo Engineering AG 16 Swing & Ajax – Example I map.html SwingGoogleMap JDIC WebBrowser Native Browser Engine
  • 17. Copyright © Canoo Engineering AG 17 Swing & Ajax – Example II Zoom In Google Map ActionListener map.zoomIn JDIC WebBrowser executeScript map.getZoom
  • 18. Copyright © Canoo Engineering AG 18 Swing & Ajax – Example III NavBar Google Map setLocation mouseMove JS2JavaEventHandler EventListener JDIC WebBrowser JS2JavaEvent document.location
  • 19. Copyright © Canoo Engineering AG 19 Mixing Swing & Flash – jFlash Java API Swing Flash External API • Integration with Java Flash player e.g. jFlash •
  • 20. Copyright © Canoo Engineering AG 20 jFlash • Uses Flash plugin of IE • Java  Flash Calls ActiveXControl.CallFunction using an API of jFlash similar to • the reflection API • Flash  Java ExternalInterface.call(...) calls as events •
  • 21. Copyright © Canoo Engineering AG 21 External API • XML – Format of the External API <invoke name=quot;functionNamequot; returntype=quot;xmlquot;> <arguments> ... (individual argument values) </arguments> </invoke>
  • 22. Copyright © Canoo Engineering AG 22 Swing & Flash – Example • Demo JFlashHybridStore •
  • 23. Copyright © Canoo Engineering AG 23 Swing & Flash – Example I store.swf JFlashHybridStore JFlash IE Flash Plugin
  • 24. Copyright © Canoo Engineering AG 24 Swing & Flash – Example II Camera Store ActionListener ActiveX.CallFunction JFlash callExternalAPI <invoke …
  • 25. Copyright © Canoo Engineering AG 25 Swing & Flash – Example III NavBar Store setSelectedPhone ThumbnailClickedEvent JS2JavaEventHandler JS2JavaEvent JFlashEventHandler EventHandler JFlashEvent JFlash <invoke… ExternalInterface.call
  • 26. Copyright © Canoo Engineering AG 26 Mixing Swing & Flash – JDIC JavaScript ExternalInterface Swing Flash JavaScript FABridge URL loading
  • 27. Copyright © Canoo Engineering AG 27 Swing & Flash – Example • Demo JDICHybridStore •
  • 28. Copyright © Canoo Engineering AG 28 Swing & Flash – Example I store.html JDICHybridStore JDIC WebBrowser Native Browser
  • 29. Copyright © Canoo Engineering AG 29 Swing & Flash – Example II Camera Store ActionListener JDIC WebBrowser executeScript store.html <invoke … flexApp.setCamera..
  • 30. Copyright © Canoo Engineering AG 30 Swing & Flash – Example III NavBar Store ClickedEvent setSelectedPhone EventHandler JS2JavaEventHandler ExternalInterface.call store.html JDIC WebBrowser JS2JavaEvent document.location
  • 31. Copyright © Canoo Engineering AG 31 JDIC  JFlash All platforms supported Internet Explorer Flash plugin Open source Commercial JavaScript ActiveXControl java.awt.Component java.awt.Component
  • 32. Copyright © Canoo Engineering AG 32 Summary • Ajax and Flash Good integration support • Ongoing development (Apollo) •
  • 33. Copyright © Canoo Engineering AG 33 Summary • Integration of Ajax/Flex in Swing Mostly low level communication • One technology (Java browser component) available to integrate • Ajax and Flash Ajax: Communication using JavaScript-injection • Flash: Communication using callbacks / Flex Ajax Bridge •
  • 34. Copyright © Canoo Engineering AG 34 Summary • Effort Implementation • Deployment • • Maintainance Loose coupling • All communication code in one technology • • Mixing technologies as an alternative
  • 35. Copyright © Canoo Engineering AG 35 • Demos and source code on our RIA Blog: • http://www.canoo.com/blog/ • Questions?
  • 36. Copyright © Canoo Engineering AG 36 Links • Adobe Flex 2: http://www.adobe.com/products/flex/ • HybridStore: http://www.adobe.com/devnet/flex/samples/hybrid_store/ • • JDIC https://jdic.dev.java.net • • JFlash http://sesma.com/software/products/jflash/ • • Sun (Mixing heavyweight & lightweight components) http://java.sun.com/products/jfc/tsc/articles/mixing/ • • WebRenderer http://www.webrenderer.com/ •