SlideShare uma empresa Scribd logo
1 de 45
Embedding Web UI Components
    EclipseCon 2011



           Boris Bokowski




                              © 2010 IBM Corporation
Motivation
                          http://vimeo.com/21166223




     2
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Your Cross-Platform Choices




     3
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
suggestion: bring these closer together




     4
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Web and Desktop User Interfaces

      Web and desktop are similar
        – Both have basic widgets like push buttons, entry fields
        – Tab folders, menus (menu bars, drop down, pop up)
        – Many more examples 


      Web and desktop are different
        – Web content scrolls, banner on every page
        – Web has built-in navigation model
        – Desktop content is packed (banner a “waste of space”)
        – Many more examples 


      Observation
        – Can’t just cram desktop UI into web browser (or vice versa)
                  ‱ Want “appropriate” web experience
                  ‱ Want “appropriate” desktop experience
     5
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Idea: Share components, not applications

      Run web components on the desktop
        – Use the SWT Browser control
                  ‱ Backed by IE, Mozilla, or Safari
                  ‱ Improved API for Javaℱ-JavaScript interop in 3.5
            – Use web technology (AJAX, Flash, Silverlight, 
)
            – Provide first class interoperability with Eclipse



       Implement single source components that work on
       the web, Eclipse (and elsewhere
)




     6
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
SWT Browser widget




     7
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
What you get

              new Browser(parent, SWT.NONE)




              new Browser(parent, SWT.MOZILLA)




              new Browser(parent, SWT.WEBKIT) @since 3.7




     8
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Setup

          Browser b = ...;
          b.setURL("http://www.foo.com");
          "Begins loading a URL. The loading of its content
          occurs asynchronously."


          Alternative: b.setText("<html>
</html>");


          New in 3.6:
          b.setURL(String url, String postData,
          String[] headers);

     9
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Exercise 1
                          Create plug-in project
                          Add SWT dependency
                          main, mainloop
                          Create browser
                          shell.setSize(600, 400)
     10
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Example: Google Maps




     11
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Google Maps API

       (from http://code.google.com/apis/maps/documentation/introduction.html,
          Apache 2.0, see http://code.google.com/apis/ajaxsearch/faq/#license)


       <script type="text/javascript"
         src="http://maps.google.com/maps?file=api&amp;v=2"></script>

       <script type="text/javascript">

       function init() {

           if (GBrowserIsCompatible()) {

               var map = new GMap2(document.getElementById("map_canvas"));

               map.setCenter(new GLatLng(37.4419, -122.1419), 13);

               map.setUIToDefault();

           }

       }

       </script>

       <body onload="init()"> <div id="map_canvas"></div> </body>
     12
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Exercise 2
                          Copy "Hello World" code from
                          http://code.google.com/apis/maps/documentation/introduction.html

                          Preferences: Java > Editor > Typing
                          "Escape text when pasting into string"
                          Use browser.setText("
")

     13
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Java to JavaScript

        public Object browser.evaluate(String
         script)


        The supported mappings are:
             – JavaScript null or undefined -> null
             – JavaScript number -> java.lang.Double
             – JavaScript string -> java.lang.String
             – JavaScript boolean -> java.lang.Boolean
             – JavaScript array whose elements are all of supported
               types -> java.lang.Object[]



     14
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Exercise 3
                          Add buttons "Zoom In", "Zoom Out"
                          window.map instead of var map
                          browser.evaluate(
                                  "window.map.zoomIn();");


     15
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
JavaScript to Java

          Install function at JavaScript window level:
          new BrowserFunction(browser, "hello") {
                   public Object function(Object[] args)
          {
                          // ...
                   }
          };
          Call BrowserFunction from JavaScript:
                   alert(window.hello("42", 42));
          Same rules for mapping from JavaScript to Java apply

     16
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Exercise 4
                          new Text(shell, SWT.BORDER |
                                           SWT.READ_ONLY);
                          use static field for Text

                                     Maps > Event > Event Arguments

     17
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Exercise 4'
                          Work some more on JavaScript side
                          Get address from Google

                          http://code.google.com/apis/ajax/playground
                                Maps > Service > Geocoding Reverse


     18
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Advanced Topics




     19
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Initialization

          browser.addProgressListener(new ProgressListener() {
                      public void completed(ProgressEvent event) {
                                     // execute JavaScript code here
                      }
                      public void changed(ProgressEvent event) {
                                     // or here
                      }
          });




     20
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Other useful API

        Cookies
             – Browser.getCookie
             – Browser.setCookie
             – Browser.clearSessions
        Simple authentication
             – Browser.addAuthenticationListener
        Intercepting link clicks
             – Browser.addLocationListener
             – Browser.addOpenWindowListener
        Safe close (vetoable)
             – Browser.close

     21
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Some limitations

          Trying 0

          Trying 1

          Trying 2

          Trying 3

          Trying 4
                          e.g. recursive calls between JavaScript and Java
          Trying 5

          Trying 6

          Trying 7

          Trying 8

          Trying 9

          Trying 10

          Trying 11

          Trying 12

          Trying 13

          Trying 14




     22
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Debugging

        Sorry, no JavaScript debugger
        Use Firebug / Firefox (or other browser debugger)
        May be able to use Firebug Light in SWT Browser


        Make small steps
        Test on all browsers
        Log to a useful place (Java side?)
        Last resort: insert print statements or alerts



     23
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Case Studies




     24
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Case Study: Jazz Work Item Editor




     25
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Jazz Work Item Editor: Integration Examples


         Passing login information into the widget to achieve
          single sign-on
         Editor lifecycle and save actions
         Confirmations, warnings, and errors in standard dialog
          (as opposed to JavaScript alerts)
         Drag and drop from web UI to view
         Adopt workbench preferences (e.g. colors)




     26
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Jazz Work Item Editor : Lessons learned


         80% integration with 20% effort possible
            – Editor lifecycle (dirty bit, File > Save, title in tab)
            – Intercept links to not leave the page
            – Authentication (single sign on)
            – Use standard dialogs


         Service injection idea useful even web only
            – Addresses consistency issues across web UI


         Gaps remain between web and desktop version
           – No shared model and change propagation
                      ‱ Item changes not updated to web UI


         Footprint an issue: ~ 3MB per browser instance
     27
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
PDE site.xml editor (e4 0.9)




     28
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
OpenSocial Gadgets




     29
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Eclipse Application Services (“Twenty Things”)

       Editor lifecycle                                              Long-running operations
       Receiving input                                               Progress reporting
       Producing selection                                           Error handling
       Standard dialogs                                              Navigation model
       Persisting UI state                                           Resource management
       Logging                                                       Status line
       Interface to help system                                      Drag and drop
       Menu contributions                                            Undo/Redo
       Authentication                                                Accessing preferences
       Authorization



     30
     32             IBM Confidential                                                           © 2009 IBM Corporation
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Exercise 5 (at home?)
                          Pick an “Eclipse Application Service”
                          Implement an Eclipse View or Editor based
                          on a Web UI, connecting to Eclipse using
                          one of the “20 things”



     10
     31
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Web gadgets could use “20 things” too




     32
     33             IBM Confidential                                 © 2009 IBM Corporation
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Other approaches




     33
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Alternative Approach: RAP

      RAP is a community driven Eclipse open source
       project
      RCP app running on a server
      Widgets virtualized to the web browser
             – Think XWindows for SWT
             – SWT widget is replaced by a facade, forwarded to web
               control




     34
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
The Promise

       Single sourcing
          – Write once, run both desktop and/or web
          – Quickly re-deploy existing desktop oriented app to the web


       Continue to write in Java
         – Keep your existing code base
         – Continue to use same libraries
         – Same tools (JDT)
         – Leverage skill set




     35
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
The Problems

       Desktop and web metaphors differ
         – Toolbars, page metaphor, navigation, wizards, pop ups
         – Easy to achieve ‘unnatural’ web UIs


       Difficult to leverage native web advantages
          – Model is server based with extremely thin client


       Some Eclipse platform APIs are desktop centric
         – Make assumptions about locality of data, responsiveness




     36
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
SWT Browser Edition

        Program to existing SWT API
             – Perhaps subset
        Cross-compile to “native” web
             – e.g. GWT compiler for JavaScript as target
             – custom cross-compilation to ActionScript
        Using a “port” of SWT to web UI technology
             – Dojo (incomplete, experimental)
             – Flex (working, usable)




     37
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
The Promise

       Single sourcing
          – Write once, run both desktop and/or web
          – Reuse existing desktop oriented component in web application


       Continue to write in Java
         – Keep your existing code base
         – Continue to use same libraries
         – Same tools (JDT)
         – Leverage skill set




     38
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
The Problems

       Story does not address client/server split
          – No existing UI components that could be reused
          – "Big ball of mud" problem


       Footprint issues
          – SWT itself is of substantial size already
          – Desktop code ususally has lots of dependencies because it can


       Exceptions (where SWT BE makes sense):
         – StyledText widget
         – Reuse of draw2d / GEF graphical editors interesting



     39
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
In Closing





     40
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Be Aware of Trade-offs

       Web look and feel potentially different
       Form-based UIs a good candidate, since already
        different looking
       Simple widgets have native L&F
             – buttons, text fields, combos
       More advanced widgets don’t
             – tables, trees




     41
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Conclusion

       No silver bullet for reuse of desktop code on web


       There is opportunity for reuse of web UI code
          – In embedded browser
                    ‱ write once HTML, CSS, JavaScript code
                    ‱ with some trade offs
             – Using Eclipse Application Services
                    ‱ for consistency, proper integration


       OpenSocial Gadgets
         – Existing spec, existing gadgets
         – Opens up Eclipse

     42
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Recommendations
            1. Existing Desktop Apps
                  ‱ You are likely using the Eclipse application framework
                    already
                  ‱ Moving to e4 application services may make sense
                    (simplification)

            2. Existing Desktop, Transition to Web
                  ‱ No compelling solution for reusing desktop code in web
                    context
                  ‱ Port components to web
                      Easy wins: form-based UIs


            3. Targeting the Web
                  ‱ Modify to use services
                  ‱ Results in better consistency
     43           ‱ Option to embed in desktop environment
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Comments?
                                                          Questions?




     44             IBM Confidential                                   © 2009 IBM Corporation
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
Legal Notice

        Copyright © IBM Corp., 2007-2010. All rights reserved. This presentation and the source code in
         it are made available under the EPL, v1.0 unless otherwise marked.
        Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United
         States, other countries, or both.
        Eclipse and the Eclipse logo are trademarks of Eclipse Foundation, Inc.
        IBM and the IBM logo are trademarks or registered trademarks of IBM Corporation, in the United
         States, other countries or both.
        Rational and the Rational logo are trademarks or registered trademarks of International Business
         Machines Corporation in the United States, other countries or both.
        Other company, product, or service names may be trademarks or service marks of others.
        THE INFORMATION DISCUSSED IN THIS PRESENTATION IS PROVIDED FOR
         INFORMATIONAL PURPOSES ONLY. WHILE EFFORTS WERE MADE TO VERIFY THE
         COMPLETENESS AND ACCURACY OF THE INFORMATION, IT IS PROVIDED "AS IS"
         WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, AND IBM SHALL NOT BE
         RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE
         RELATED TO, SUCH INFORMATION. ANY INFORMATION CONCERNING IBM'S PRODUCT
         PLANS OR STRATEGY IS SUBJECT TO CHANGE BY IBM WITHOUT NOTICE




     45
© 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked

Mais conteĂșdo relacionado

Mais procurados

OOPs Concepts - Android Programming
OOPs Concepts - Android ProgrammingOOPs Concepts - Android Programming
OOPs Concepts - Android ProgrammingPurvik Rana
 
Fundamentos de PadrÔes de Projeto de Software
Fundamentos de PadrÔes de Projeto de SoftwareFundamentos de PadrÔes de Projeto de Software
Fundamentos de PadrÔes de Projeto de SoftwareÁlvaro Farias Pinheiro
 
Robot Framework - principais caracterĂ­sticas
Robot Framework - principais caracterĂ­sticasRobot Framework - principais caracterĂ­sticas
Robot Framework - principais caracterĂ­sticasalinebiath
 
Data driven testing
Data driven testingData driven testing
Data driven testingĐăng Minh
 
Designing Optimized Symbols for InduSoft Web Studio Projects
Designing Optimized Symbols for InduSoft Web Studio ProjectsDesigning Optimized Symbols for InduSoft Web Studio Projects
Designing Optimized Symbols for InduSoft Web Studio ProjectsAVEVA
 
Automação de Testes com Robot Framework - GUTS-SC
Automação de Testes com Robot Framework - GUTS-SCAutomação de Testes com Robot Framework - GUTS-SC
Automação de Testes com Robot Framework - GUTS-SCMayara Fernandes
 
Apresentação-Resumo sobre o Java Swing.
Apresentação-Resumo sobre o Java Swing.Apresentação-Resumo sobre o Java Swing.
Apresentação-Resumo sobre o Java Swing.Gabriel Jesus
 
Gestão de defeitos e testes com Jira
Gestão de defeitos e testes com JiraGestão de defeitos e testes com Jira
Gestão de defeitos e testes com JiraQualister
 
Introdução ao Java Swing (Interface)
Introdução ao Java Swing (Interface)Introdução ao Java Swing (Interface)
Introdução ao Java Swing (Interface)Sérgio Souza Costa
 
Hybrid Automation Framework Development introduction
Hybrid Automation Framework Development introductionHybrid Automation Framework Development introduction
Hybrid Automation Framework Development introductionGanuka Yashantha
 
Introduction to jmeter
Introduction to jmeterIntroduction to jmeter
Introduction to jmetertest test
 
Postgresql + Python = Power!
Postgresql + Python = Power!Postgresql + Python = Power!
Postgresql + Python = Power!Juliano Atanazio
 
Katalon Studio - Best automation solution for software testing team
Katalon Studio - Best automation solution for software testing teamKatalon Studio - Best automation solution for software testing team
Katalon Studio - Best automation solution for software testing teamKatalon Studio
 
API Automation Testing Using RestAssured+Cucumber
API Automation Testing Using RestAssured+CucumberAPI Automation Testing Using RestAssured+Cucumber
API Automation Testing Using RestAssured+CucumberKnoldus Inc.
 

Mais procurados (20)

OOPs Concepts - Android Programming
OOPs Concepts - Android ProgrammingOOPs Concepts - Android Programming
OOPs Concepts - Android Programming
 
Fundamentos de PadrÔes de Projeto de Software
Fundamentos de PadrÔes de Projeto de SoftwareFundamentos de PadrÔes de Projeto de Software
Fundamentos de PadrÔes de Projeto de Software
 
Robot Framework - principais caracterĂ­sticas
Robot Framework - principais caracterĂ­sticasRobot Framework - principais caracterĂ­sticas
Robot Framework - principais caracterĂ­sticas
 
Data driven testing
Data driven testingData driven testing
Data driven testing
 
Designing Optimized Symbols for InduSoft Web Studio Projects
Designing Optimized Symbols for InduSoft Web Studio ProjectsDesigning Optimized Symbols for InduSoft Web Studio Projects
Designing Optimized Symbols for InduSoft Web Studio Projects
 
Linux - DNS
Linux - DNSLinux - DNS
Linux - DNS
 
Automação de Testes com Robot Framework - GUTS-SC
Automação de Testes com Robot Framework - GUTS-SCAutomação de Testes com Robot Framework - GUTS-SC
Automação de Testes com Robot Framework - GUTS-SC
 
Apresentação-Resumo sobre o Java Swing.
Apresentação-Resumo sobre o Java Swing.Apresentação-Resumo sobre o Java Swing.
Apresentação-Resumo sobre o Java Swing.
 
POO - Aula 1
POO - Aula 1POO - Aula 1
POO - Aula 1
 
Gestão de defeitos e testes com Jira
Gestão de defeitos e testes com JiraGestão de defeitos e testes com Jira
Gestão de defeitos e testes com Jira
 
Junit
JunitJunit
Junit
 
Selenium IDE LOCATORS
Selenium IDE LOCATORSSelenium IDE LOCATORS
Selenium IDE LOCATORS
 
Java www
Java wwwJava www
Java www
 
Introdução ao Java Swing (Interface)
Introdução ao Java Swing (Interface)Introdução ao Java Swing (Interface)
Introdução ao Java Swing (Interface)
 
Hybrid Automation Framework Development introduction
Hybrid Automation Framework Development introductionHybrid Automation Framework Development introduction
Hybrid Automation Framework Development introduction
 
Introduction to jmeter
Introduction to jmeterIntroduction to jmeter
Introduction to jmeter
 
Postgresql + Python = Power!
Postgresql + Python = Power!Postgresql + Python = Power!
Postgresql + Python = Power!
 
Katalon Studio - Best automation solution for software testing team
Katalon Studio - Best automation solution for software testing teamKatalon Studio - Best automation solution for software testing team
Katalon Studio - Best automation solution for software testing team
 
API Automation Testing Using RestAssured+Cucumber
API Automation Testing Using RestAssured+CucumberAPI Automation Testing Using RestAssured+Cucumber
API Automation Testing Using RestAssured+Cucumber
 
Introdução ao JavaFX
Introdução ao JavaFXIntrodução ao JavaFX
Introdução ao JavaFX
 

Semelhante a Embedding Web UI Components in Eclipse with SWT Browser

Apache Felix Web Console
Apache Felix Web ConsoleApache Felix Web Console
Apache Felix Web ConsoleFelix Meschberger
 
Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Mikkel Flindt Heisterberg
 
Cross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual StudioCross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual Studiobryan costanich
 
Deploying applications to Cloud with Google App Engine
Deploying applications to Cloud with Google App EngineDeploying applications to Cloud with Google App Engine
Deploying applications to Cloud with Google App EngineAlexander Zamkovyi
 
Flutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - textFlutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - textToma Velev
 
Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaChristian Heilmann
 
We4IT lcty 2013 - infra-man - whats new in ibm domino application development
We4IT lcty 2013 - infra-man - whats new in ibm domino application developmentWe4IT lcty 2013 - infra-man - whats new in ibm domino application development
We4IT lcty 2013 - infra-man - whats new in ibm domino application developmentWe4IT Group
 
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache CordovaHazem Saleh
 
Adobe AIR Mobile development for Android and PlayBook
Adobe AIR Mobile development for Android and PlayBookAdobe AIR Mobile development for Android and PlayBook
Adobe AIR Mobile development for Android and PlayBookMihai Corlan
 
Cordova + Ionic + MobileFirst
Cordova + Ionic + MobileFirstCordova + Ionic + MobileFirst
Cordova + Ionic + MobileFirstRaymond Camden
 
Apache Cordova In Action
Apache Cordova In ActionApache Cordova In Action
Apache Cordova In ActionHazem Saleh
 
Part 3 web development
Part 3 web developmentPart 3 web development
Part 3 web developmenttechbed
 
Lotusphere 2011 Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...
Lotusphere 2011  Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...Lotusphere 2011  Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...
Lotusphere 2011 Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...Ryan Baxter
 
Java Programming (M&M)
Java Programming (M&M)Java Programming (M&M)
Java Programming (M&M)mafffffe19
 
Free EJB Tutorial | VirtualNuggets
Free EJB Tutorial | VirtualNuggetsFree EJB Tutorial | VirtualNuggets
Free EJB Tutorial | VirtualNuggetsVirtual Nuggets
 
Introduction to Cordova
Introduction to CordovaIntroduction to Cordova
Introduction to CordovaRaymond Camden
 
(Christian heilman) firefox
(Christian heilman) firefox(Christian heilman) firefox
(Christian heilman) firefoxNAVER D2
 
Plug yourself in and your app will never be the same (2 hr editon)
Plug yourself in and your app will never be the same (2 hr editon)Plug yourself in and your app will never be the same (2 hr editon)
Plug yourself in and your app will never be the same (2 hr editon)Mikkel Flindt Heisterberg
 

Semelhante a Embedding Web UI Components in Eclipse with SWT Browser (20)

Apache Felix Web Console
Apache Felix Web ConsoleApache Felix Web Console
Apache Felix Web Console
 
Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)
 
Appium solution
Appium solutionAppium solution
Appium solution
 
Cross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual StudioCross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual Studio
 
Deploying applications to Cloud with Google App Engine
Deploying applications to Cloud with Google App EngineDeploying applications to Cloud with Google App Engine
Deploying applications to Cloud with Google App Engine
 
Flutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - textFlutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - text
 
Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World Romania
 
We4IT lcty 2013 - infra-man - whats new in ibm domino application development
We4IT lcty 2013 - infra-man - whats new in ibm domino application developmentWe4IT lcty 2013 - infra-man - whats new in ibm domino application development
We4IT lcty 2013 - infra-man - whats new in ibm domino application development
 
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
 
Adobe AIR Mobile development for Android and PlayBook
Adobe AIR Mobile development for Android and PlayBookAdobe AIR Mobile development for Android and PlayBook
Adobe AIR Mobile development for Android and PlayBook
 
Cordova + Ionic + MobileFirst
Cordova + Ionic + MobileFirstCordova + Ionic + MobileFirst
Cordova + Ionic + MobileFirst
 
Apache Cordova In Action
Apache Cordova In ActionApache Cordova In Action
Apache Cordova In Action
 
Part 3 web development
Part 3 web developmentPart 3 web development
Part 3 web development
 
Lotusphere 2011 Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...
Lotusphere 2011  Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...Lotusphere 2011  Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...
Lotusphere 2011 Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...
 
Java Programming (M&M)
Java Programming (M&M)Java Programming (M&M)
Java Programming (M&M)
 
Free EJB Tutorial | VirtualNuggets
Free EJB Tutorial | VirtualNuggetsFree EJB Tutorial | VirtualNuggets
Free EJB Tutorial | VirtualNuggets
 
Codename one
Codename oneCodename one
Codename one
 
Introduction to Cordova
Introduction to CordovaIntroduction to Cordova
Introduction to Cordova
 
(Christian heilman) firefox
(Christian heilman) firefox(Christian heilman) firefox
(Christian heilman) firefox
 
Plug yourself in and your app will never be the same (2 hr editon)
Plug yourself in and your app will never be the same (2 hr editon)Plug yourself in and your app will never be the same (2 hr editon)
Plug yourself in and your app will never be the same (2 hr editon)
 

Último

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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel AraĂșjo
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 

Último (20)

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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 

Embedding Web UI Components in Eclipse with SWT Browser

  • 1. Embedding Web UI Components EclipseCon 2011 Boris Bokowski © 2010 IBM Corporation
  • 2. Motivation http://vimeo.com/21166223 2 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 3. Your Cross-Platform Choices 3 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 4. suggestion: bring these closer together 4 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 5. Web and Desktop User Interfaces Web and desktop are similar – Both have basic widgets like push buttons, entry fields – Tab folders, menus (menu bars, drop down, pop up) – Many more examples 
 Web and desktop are different – Web content scrolls, banner on every page – Web has built-in navigation model – Desktop content is packed (banner a “waste of space”) – Many more examples 
 Observation – Can’t just cram desktop UI into web browser (or vice versa) ‱ Want “appropriate” web experience ‱ Want “appropriate” desktop experience 5 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 6. Idea: Share components, not applications Run web components on the desktop – Use the SWT Browser control ‱ Backed by IE, Mozilla, or Safari ‱ Improved API for Javaℱ-JavaScript interop in 3.5 – Use web technology (AJAX, Flash, Silverlight, 
) – Provide first class interoperability with Eclipse  Implement single source components that work on the web, Eclipse (and elsewhere
) 6 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 7. SWT Browser widget 7 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 8. What you get new Browser(parent, SWT.NONE) new Browser(parent, SWT.MOZILLA) new Browser(parent, SWT.WEBKIT) @since 3.7 8 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 9. Setup Browser b = ...; b.setURL("http://www.foo.com"); "Begins loading a URL. The loading of its content occurs asynchronously." Alternative: b.setText("<html>
</html>"); New in 3.6: b.setURL(String url, String postData, String[] headers); 9 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 10. Exercise 1 Create plug-in project Add SWT dependency main, mainloop Create browser shell.setSize(600, 400) 10 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 11. Example: Google Maps 11 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 12. Google Maps API (from http://code.google.com/apis/maps/documentation/introduction.html, Apache 2.0, see http://code.google.com/apis/ajaxsearch/faq/#license) <script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2"></script> <script type="text/javascript"> function init() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(37.4419, -122.1419), 13); map.setUIToDefault(); } } </script> <body onload="init()"> <div id="map_canvas"></div> </body> 12 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 13. Exercise 2 Copy "Hello World" code from http://code.google.com/apis/maps/documentation/introduction.html Preferences: Java > Editor > Typing "Escape text when pasting into string" Use browser.setText("
") 13 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 14. Java to JavaScript  public Object browser.evaluate(String script)  The supported mappings are: – JavaScript null or undefined -> null – JavaScript number -> java.lang.Double – JavaScript string -> java.lang.String – JavaScript boolean -> java.lang.Boolean – JavaScript array whose elements are all of supported types -> java.lang.Object[] 14 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 15. Exercise 3 Add buttons "Zoom In", "Zoom Out" window.map instead of var map browser.evaluate( "window.map.zoomIn();"); 15 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 16. JavaScript to Java Install function at JavaScript window level: new BrowserFunction(browser, "hello") { public Object function(Object[] args) { // ... } }; Call BrowserFunction from JavaScript: alert(window.hello("42", 42)); Same rules for mapping from JavaScript to Java apply 16 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 17. Exercise 4 new Text(shell, SWT.BORDER | SWT.READ_ONLY); use static field for Text Maps > Event > Event Arguments 17 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 18. Exercise 4' Work some more on JavaScript side Get address from Google
 http://code.google.com/apis/ajax/playground Maps > Service > Geocoding Reverse 18 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 19. Advanced Topics 19 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 20. Initialization browser.addProgressListener(new ProgressListener() { public void completed(ProgressEvent event) { // execute JavaScript code here } public void changed(ProgressEvent event) { // or here } }); 20 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 21. Other useful API  Cookies – Browser.getCookie – Browser.setCookie – Browser.clearSessions  Simple authentication – Browser.addAuthenticationListener  Intercepting link clicks – Browser.addLocationListener – Browser.addOpenWindowListener  Safe close (vetoable) – Browser.close 21 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 22. Some limitations  Trying 0  Trying 1  Trying 2  Trying 3  Trying 4 e.g. recursive calls between JavaScript and Java  Trying 5  Trying 6  Trying 7  Trying 8  Trying 9  Trying 10  Trying 11  Trying 12  Trying 13  Trying 14 22 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 23. Debugging  Sorry, no JavaScript debugger  Use Firebug / Firefox (or other browser debugger)  May be able to use Firebug Light in SWT Browser  Make small steps  Test on all browsers  Log to a useful place (Java side?)  Last resort: insert print statements or alerts 23 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 24. Case Studies 24 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 25. Case Study: Jazz Work Item Editor 25 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 26. Jazz Work Item Editor: Integration Examples Passing login information into the widget to achieve single sign-on Editor lifecycle and save actions Confirmations, warnings, and errors in standard dialog (as opposed to JavaScript alerts) Drag and drop from web UI to view Adopt workbench preferences (e.g. colors) 26 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 27. Jazz Work Item Editor : Lessons learned 80% integration with 20% effort possible – Editor lifecycle (dirty bit, File > Save, title in tab) – Intercept links to not leave the page – Authentication (single sign on) – Use standard dialogs Service injection idea useful even web only – Addresses consistency issues across web UI Gaps remain between web and desktop version – No shared model and change propagation ‱ Item changes not updated to web UI Footprint an issue: ~ 3MB per browser instance 27 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 28. PDE site.xml editor (e4 0.9) 28 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 29. OpenSocial Gadgets 29 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 30. Eclipse Application Services (“Twenty Things”)  Editor lifecycle  Long-running operations  Receiving input  Progress reporting  Producing selection  Error handling  Standard dialogs  Navigation model  Persisting UI state  Resource management  Logging  Status line  Interface to help system  Drag and drop  Menu contributions  Undo/Redo  Authentication  Accessing preferences  Authorization 30 32 IBM Confidential © 2009 IBM Corporation © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 31. Exercise 5 (at home?) Pick an “Eclipse Application Service” Implement an Eclipse View or Editor based on a Web UI, connecting to Eclipse using one of the “20 things” 10 31 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 32. Web gadgets could use “20 things” too 32 33 IBM Confidential © 2009 IBM Corporation © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 33. Other approaches 33 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 34. Alternative Approach: RAP RAP is a community driven Eclipse open source project RCP app running on a server Widgets virtualized to the web browser – Think XWindows for SWT – SWT widget is replaced by a facade, forwarded to web control 34 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 35. The Promise  Single sourcing – Write once, run both desktop and/or web – Quickly re-deploy existing desktop oriented app to the web  Continue to write in Java – Keep your existing code base – Continue to use same libraries – Same tools (JDT) – Leverage skill set 35 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 36. The Problems  Desktop and web metaphors differ – Toolbars, page metaphor, navigation, wizards, pop ups – Easy to achieve ‘unnatural’ web UIs  Difficult to leverage native web advantages – Model is server based with extremely thin client  Some Eclipse platform APIs are desktop centric – Make assumptions about locality of data, responsiveness 36 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 37. SWT Browser Edition  Program to existing SWT API – Perhaps subset  Cross-compile to “native” web – e.g. GWT compiler for JavaScript as target – custom cross-compilation to ActionScript  Using a “port” of SWT to web UI technology – Dojo (incomplete, experimental) – Flex (working, usable) 37 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 38. The Promise  Single sourcing – Write once, run both desktop and/or web – Reuse existing desktop oriented component in web application  Continue to write in Java – Keep your existing code base – Continue to use same libraries – Same tools (JDT) – Leverage skill set 38 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 39. The Problems  Story does not address client/server split – No existing UI components that could be reused – "Big ball of mud" problem  Footprint issues – SWT itself is of substantial size already – Desktop code ususally has lots of dependencies because it can  Exceptions (where SWT BE makes sense): – StyledText widget – Reuse of draw2d / GEF graphical editors interesting 39 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 40. In Closing
 40 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 41. Be Aware of Trade-offs  Web look and feel potentially different  Form-based UIs a good candidate, since already different looking  Simple widgets have native L&F – buttons, text fields, combos  More advanced widgets don’t – tables, trees 41 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 42. Conclusion  No silver bullet for reuse of desktop code on web  There is opportunity for reuse of web UI code – In embedded browser ‱ write once HTML, CSS, JavaScript code ‱ with some trade offs – Using Eclipse Application Services ‱ for consistency, proper integration  OpenSocial Gadgets – Existing spec, existing gadgets – Opens up Eclipse 42 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 43. Recommendations 1. Existing Desktop Apps ‱ You are likely using the Eclipse application framework already ‱ Moving to e4 application services may make sense (simplification) 2. Existing Desktop, Transition to Web ‱ No compelling solution for reusing desktop code in web context ‱ Port components to web Easy wins: form-based UIs 3. Targeting the Web ‱ Modify to use services ‱ Results in better consistency 43 ‱ Option to embed in desktop environment © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 44. Comments? Questions? 44 IBM Confidential © 2009 IBM Corporation © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked
  • 45. Legal Notice  Copyright © IBM Corp., 2007-2010. All rights reserved. This presentation and the source code in it are made available under the EPL, v1.0 unless otherwise marked.  Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.  Eclipse and the Eclipse logo are trademarks of Eclipse Foundation, Inc.  IBM and the IBM logo are trademarks or registered trademarks of IBM Corporation, in the United States, other countries or both.  Rational and the Rational logo are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries or both.  Other company, product, or service names may be trademarks or service marks of others.  THE INFORMATION DISCUSSED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION, IT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, AND IBM SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, SUCH INFORMATION. ANY INFORMATION CONCERNING IBM'S PRODUCT PLANS OR STRATEGY IS SUBJECT TO CHANGE BY IBM WITHOUT NOTICE 45 © 2011 IBM Corp., licensed under EPL, v1.0 unless otherwise marked

Notas do Editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. KM 07/28: Do we have other &amp;#x201C;easy wins&amp;#x201D;?\n
  44. \n
  45. \n