SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
Intro
          GWT
           RPC
          Demo




        GWT
The Google Web Toolkit

      Jeppe R. Thomsen
       jenslyn@cs.aau.dk

        Aalborg University
  Department of Computer Science


       October 6, 2009



          Jeppe    GWT - SW7       1/22
Intro   GWT
                             GWT      Motivation
                              RPC     Application Areas
                             Demo     Resources


The Presentation
     Not the usual slide style
         More text - less code
     Interrupt if you are bored, and ask me something instead
         E.g. ”You are boring, show me how to code X”




                             Jeppe    GWT - SW7                 2/22
Intro   GWT
                              GWT      Motivation
                               RPC     Application Areas
                              Demo     Resources


What is GWT - The Google Web Toolkit

  It is among other things:
      An AJAX framework
      A Widget library
      A Java-to-Javascript compiler




                              Jeppe    GWT - SW7           3/22
Intro   GWT
                              GWT      Motivation
                               RPC     Application Areas
                              Demo     Resources


Motivation for using it
      Communicate with your server through really simple RPC
          Using e.g. JSON and XML
      Optimize the JavaScript script downloads based on user
      proïŹle
          Using Deferred binding
      Reuse UI components across projects
      Use other JavaScript libraries and native JavaScript code
          Mix handwritten JavaScript in your Java code (JSNI)
      Easily support the browser’s back button and history
          adding state to the browser’s back button history
      Localize applications eïŹƒciently
      Test your code with JUnit


                              Jeppe    GWT - SW7                  4/22
Intro   GWT
                             GWT      Motivation
                              RPC     Application Areas
                             Demo     Resources


Application

  GWT is, unlike many other AJAX frameworks, aimed at both
  webpage- and webapplication- development.
      The Javascript code is compiled to minimal size
      The Javascript has any unreachable code purged at compile
      time
      Highly versatile and combinable UI widgets.
      Java source language makes it realistic to do actual
      application development in Javascript




                             Jeppe    GWT - SW7                   5/22
Intro   GWT
                            GWT      Motivation
                             RPC     Application Areas
                            Demo     Resources


Pros and Cons
     Where to use it.
         Webpages which needs to react to user actions immediately
         Anywhere you would want some dynamic content on your
         webpage
     Where Not to use it.
         Purely Static (informational) pages which does not change or
         update often.
         Anywhere it would be assumed users have disabled Javascript




                            Jeppe    GWT - SW7                          6/22
Intro   GWT
                           GWT      Motivation
                            RPC     Application Areas
                           Demo     Resources


GWT Resources

     Download GWT
     http://code.google.com/webtoolkit/
     Widgets Demo
     http://gwt.google.com/samples/KitchenSink/KitchenSink.html
     OïŹƒcial Libraries
     http://code.google.com/webtoolkit/googleapilibraries.html




                           Jeppe    GWT - SW7                     7/22
Intro   Code-, Debug-, Run Java
                             GWT      Deploy Javascript
                              RPC     Demo
                             Demo     Widgets & Panels


Develop in Java

  Use your favorite IDE
      Eclipse 3.5
      NetBeans 6.7
      IDEA 8.1
      IntelliJ 7+
  Some standard libraries are emulated, others replaced by gwt
  libraries
      java.lang
      java.lang.annotation
      java.util
      java.io
      java.sql
                             Jeppe    GWT - SW7                  8/22
Intro   Code-, Debug-, Run Java
                             GWT      Deploy Javascript
                              RPC     Demo
                             Demo     Widgets & Panels


Reference - libraries 1/3

      com.google.gwt.i18n.client.DateTimeFormat
      Replacement for the java.util.DateTime- Format class in
      normal Java. This replacement only supports a subset of the
      normal Java version.
      com.google.gwt.i18n.client.NumberFormat
      The same kind of replacement, but then for the
      java.util.NumberFormat, again providing only a subset of its
      features.
      com.google.gwt.user.client.Timer
      A simpliïŹed, browser-safe timer class that can be used to
      mimic a threaded environment, and which allows you to
      schedule tasks and actions. Its a simpliïŹed version of the
      java.util.Timer class.

                             Jeppe    GWT - SW7                      9/22
Intro      Code-, Debug-, Run Java
                                        GWT         Deploy Javascript
                                         RPC        Demo
                                        Demo        Widgets & Panels


Reference - libraries 2/3
      java.lang
          ArithmeticException ArrayIndexOutOfBoundsException ArrayStoreException AssertionError
          Boolean Byte CharSequence Character Class ClassCastException Cloneable Comparable
          Deprecated Double Enum Error Exception Float IllegalArgumentException IllegalStateException
          IndexOutOfBoundsException Integer Iterable Long Math NegativeArraySizeException
          NullPointerException Number NumberFormatException Object Override Runnable
          RuntimeException Short StackTraceElement String StringBuïŹ€er StringBuilder
          StringIndexOutOfBoundsException SuppressWarnings System Throwable
          UnsupportedOperationException Void

      java.lang.annotation
          Annotation AnnotationFormatError AnnotationTypeMismatchException Documented ElementType
          IncompleteAnnotationException Inherited Retention RetentionPolicy Target




                                        Jeppe       GWT - SW7                                           10/22
Intro      Code-, Debug-, Run Java
                                        GWT         Deploy Javascript
                                         RPC        Demo
                                        Demo        Widgets & Panels


Reference - libraries 3/3
      java.util
           AbstractCollection AbstractList AbstractMap AbstractQueue AbstractSequentialList AbstractSet
           ArrayList Arrays Collection Collections Comparator ConcurrentModiïŹcationException Date
           EmptyStackException EnumMap EnumSet Enumeration EventListener EventObject HashMap
           HashSet IdentityHashMap Iterator LinkedHashMap LinkedHashSet LinkedList List ListIterator Map
           Map.Entry MissingResourceException NoSuchElementException PriorityQueue Queue
           RandomAccess Set SortedMap SortedSet Stack TooManyListenersException TreeMap TreeSet
           Vector

      java.io
           FilterOutputStream OutputStream PrintStream Serializable

      java.sql
           Date Time Timestamp




                                         Jeppe      GWT - SW7                                              11/22
Intro   Code-, Debug-, Run Java
                                      GWT      Deploy Javascript
                                       RPC     Demo
                                      Demo     Widgets & Panels


Coding

         Modify the DOM
         JSNI - The JavaScript Native Interface
  public class JSNIExample {
    static int myStaticField;
  void instanceFoo(String s) { }
  public native void bar(JSNIExample x, String s) /*-{
      // Call instance method instanceFoo() on this
      this.@com.google.gwt.examples.JSNIExample::instanceFoo(Ljava/lang/String;)(s);
      // Call instance method instanceFoo() on x
      x.@com.google.gwt.examples.JSNIExample::instanceFoo(Ljava/lang/String;)(s);
      // Read static ïŹeld (no qualiïŹer)
      @com.google.gwt.examples.JSNIExample::myStaticField = val + ” and stuïŹ€â€;
      }-*/;
  }


                                      Jeppe    GWT - SW7                               12/22
Intro   Code-, Debug-, Run Java
                             GWT      Deploy Javascript
                              RPC     Demo
                             Demo     Widgets & Panels


Debug the Java code

  Use hosted mode while developing. Only compile to JavaScript
  when done.
      Debug Java code as you normally would
      Code runs as bytecode and served using an internal Jetty
      instance
      Most times changes are immediately visible by just refreshing
      the integrated browser instead of relaunching hosted mode
      Use GWT.log() to log user behavior and exceptions.




                             Jeppe    GWT - SW7                       13/22
Intro   Code-, Debug-, Run Java
                           GWT      Deploy Javascript
                            RPC     Demo
                           Demo     Widgets & Panels


Run the Java code

     Compile to JavaScript when done developing the application
     Java code compiled to 6(7) permutations of JavaSript to
     ensure optimal performance in most versions of major
     browsers
         IE
         Firefox
         Safari
         Opera
     Size of JavaScript code minimal.




                           Jeppe    GWT - SW7                     14/22
Intro     Code-, Debug-, Run Java
                                    GWT        Deploy Javascript
                                     RPC       Demo
                                    Demo       Widgets & Panels


Deploy the Javascript
         Specify one or more <div> elements in a .html ïŹle
               JavaScript will use them to hook bits of GWT functionality
               into the existing page
         Initial script will detect browser vendor and version
               only download relevant permutation of JavaScript

  public void onModuleLoad() {
    ïŹnal Button sendButton = new Button(”Send”);
    ïŹnal TextBox nameField = new TextBox();
    nameField.setText(”GWT User”);
      sendButton.addStyleName(”sendButton”);
      RootPanel.get(”nameFieldContainer”).add(nameField);
      RootPanel.get(”sendButtonContainer”).add(sendButton);
  }



                                     Jeppe     GWT - SW7                    15/22
Intro   Code-, Debug-, Run Java
                GWT      Deploy Javascript
                 RPC     Demo
                Demo     Widgets & Panels


Demo


       Ask if you want something
         speciïŹc demonstrated.




                Jeppe    GWT - SW7                 16/22
Intro   Code-, Debug-, Run Java
                            GWT      Deploy Javascript
                             RPC     Demo
                            Demo     Widgets & Panels


Basic Widgets

  http://code.google.com/webtoolkit/doc/1.6/RefWidgetGallery.html
  http://gwt.google.com/samples/Showcase/Showcase.html




                            Jeppe    GWT - SW7                      17/22
Intro   Code-, Debug-, Run Java
                             GWT      Deploy Javascript
                              RPC     Demo
                             Demo     Widgets & Panels


Combining Widgets

  All widgets can be combined and extended
      support ease of use
      allow reusing advanced and specialized widgets which still
      compile to eïŹƒcient JavaScript
      Many advance widget libraries already exist (e.g. SmartGWT)




                             Jeppe    GWT - SW7                     18/22
Intro
                                      Motivation
                             GWT
                                      Plumbing
                              RPC
                                      Server Communication
                             Demo


RPC

      Allows a GWT client to make a call to server-side code

      Super easy development. All the proxy classes that handle
      RPC are generated automatically. All you need to do is deïŹne
      your service’s interface and its server-side implementations.

      GWT client serialization allows client JavaScript to interact
      with Java classes on the server




                             Jeppe    GWT - SW7                       19/22
Intro
                    Motivation
           GWT
                    Plumbing
            RPC
                    Server Communication
           Demo


Plumbing




           Jeppe    GWT - SW7              20/22
Intro
                                    Motivation
                           GWT
                                    Plumbing
                            RPC
                                    Server Communication
                           Demo


Server Communication

     Creating Services - Three steps

        DeïŹne the service’s synchronous and asynchronous
        interfaces
        Implement the service
        Call the service

     Exception Handling



                           Jeppe    GWT - SW7              21/22
Intro
             GWT
                      RPC example
              RPC
             Demo


Demo



       RPC Demonstration




             Jeppe    GWT - SW7     22/22

Weitere Àhnliche Inhalte

Was ist angesagt?

Intrinsic Methods in HotSpot VM
Intrinsic Methods in HotSpot VMIntrinsic Methods in HotSpot VM
Intrinsic Methods in HotSpot VMKris Mok
 
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres..."The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...Edge AI and Vision Alliance
 
Preparing your code for Java 9
Preparing your code for Java 9Preparing your code for Java 9
Preparing your code for Java 9Deepu Xavier
 
So You Want To Write Your Own Benchmark
So You Want To Write Your Own BenchmarkSo You Want To Write Your Own Benchmark
So You Want To Write Your Own BenchmarkDror Bereznitsky
 
Java Performance & Profiling
Java Performance & ProfilingJava Performance & Profiling
Java Performance & ProfilingIsuru Perera
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)DroidConTLV
 

Was ist angesagt? (8)

Intrinsic Methods in HotSpot VM
Intrinsic Methods in HotSpot VMIntrinsic Methods in HotSpot VM
Intrinsic Methods in HotSpot VM
 
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres..."The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
 
Preparing your code for Java 9
Preparing your code for Java 9Preparing your code for Java 9
Preparing your code for Java 9
 
So You Want To Write Your Own Benchmark
So You Want To Write Your Own BenchmarkSo You Want To Write Your Own Benchmark
So You Want To Write Your Own Benchmark
 
Java Performance & Profiling
Java Performance & ProfilingJava Performance & Profiling
Java Performance & Profiling
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)
 
Ratpack
RatpackRatpack
Ratpack
 
Android ndk
Android ndkAndroid ndk
Android ndk
 

Ähnlich wie Introduction to Google Web Toolkit

Google Web Toolkit (JUG Latvia)
Google Web Toolkit (JUG Latvia)Google Web Toolkit (JUG Latvia)
Google Web Toolkit (JUG Latvia)Dmitry Buzdin
 
Web polyglot programming
Web polyglot programmingWeb polyglot programming
Web polyglot programmingDmitry Buzdin
 
GWT: Our Experiences
GWT: Our ExperiencesGWT: Our Experiences
GWT: Our ExperiencesYenwen Feng
 
Gwt Presentation1
Gwt Presentation1Gwt Presentation1
Gwt Presentation1rajakumar.tu
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13Fred Sauer
 
Google Web Toolkit Introduction - eXo Platform SEA
Google Web Toolkit Introduction - eXo Platform SEAGoogle Web Toolkit Introduction - eXo Platform SEA
Google Web Toolkit Introduction - eXo Platform SEAnerazz08
 
Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2JooinK
 
New Features of Java7 SE
New Features of Java7 SENew Features of Java7 SE
New Features of Java7 SEdogangoko
 
Gwt session
Gwt sessionGwt session
Gwt sessionAhmed Akl
 
Gwt session
Gwt sessionGwt session
Gwt sessionMans Jug
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And BeyondVMware Tanzu
 
GQuery a jQuery clone for Gwt, RivieraDev 2011
GQuery a jQuery clone for Gwt, RivieraDev 2011GQuery a jQuery clone for Gwt, RivieraDev 2011
GQuery a jQuery clone for Gwt, RivieraDev 2011Manuel Carrasco Moñino
 
G W T(2)
G W T(2)G W T(2)
G W T(2)tomcoh
 

Ähnlich wie Introduction to Google Web Toolkit (20)

Google Web Toolkit (JUG Latvia)
Google Web Toolkit (JUG Latvia)Google Web Toolkit (JUG Latvia)
Google Web Toolkit (JUG Latvia)
 
Web polyglot programming
Web polyglot programmingWeb polyglot programming
Web polyglot programming
 
GWT: Our Experiences
GWT: Our ExperiencesGWT: Our Experiences
GWT: Our Experiences
 
Gwt Presentation1
Gwt Presentation1Gwt Presentation1
Gwt Presentation1
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
 
Google Web Toolkit Introduction - eXo Platform SEA
Google Web Toolkit Introduction - eXo Platform SEAGoogle Web Toolkit Introduction - eXo Platform SEA
Google Web Toolkit Introduction - eXo Platform SEA
 
Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2
 
Gwt
GwtGwt
Gwt
 
New Features of Java7 SE
New Features of Java7 SENew Features of Java7 SE
New Features of Java7 SE
 
Gwt session
Gwt sessionGwt session
Gwt session
 
Gwt session
Gwt sessionGwt session
Gwt session
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And Beyond
 
GWT- Google Web Toolkit
GWT- Google Web ToolkitGWT- Google Web Toolkit
GWT- Google Web Toolkit
 
GQuery a jQuery clone for Gwt, RivieraDev 2011
GQuery a jQuery clone for Gwt, RivieraDev 2011GQuery a jQuery clone for Gwt, RivieraDev 2011
GQuery a jQuery clone for Gwt, RivieraDev 2011
 
GWT-Basics
GWT-BasicsGWT-Basics
GWT-Basics
 
GWT-Basics
GWT-BasicsGWT-Basics
GWT-Basics
 
The Java alternative to Javascript
The Java alternative to JavascriptThe Java alternative to Javascript
The Java alternative to Javascript
 
Mlocjs buzdin
Mlocjs buzdinMlocjs buzdin
Mlocjs buzdin
 
Apache James/Hupa & GWT
Apache James/Hupa & GWTApache James/Hupa & GWT
Apache James/Hupa & GWT
 
G W T(2)
G W T(2)G W T(2)
G W T(2)
 

KĂŒrzlich hochgeladen

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
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
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Mcleodganj Call Girls đŸ„° 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls đŸ„° 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls đŸ„° 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls đŸ„° 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 

KĂŒrzlich hochgeladen (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
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
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Mcleodganj Call Girls đŸ„° 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls đŸ„° 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls đŸ„° 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls đŸ„° 8617370543 Service Offer VIP Hot Model
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Introduction to Google Web Toolkit

  • 1. Intro GWT RPC Demo GWT The Google Web Toolkit Jeppe R. Thomsen jenslyn@cs.aau.dk Aalborg University Department of Computer Science October 6, 2009 Jeppe GWT - SW7 1/22
  • 2. Intro GWT GWT Motivation RPC Application Areas Demo Resources The Presentation Not the usual slide style More text - less code Interrupt if you are bored, and ask me something instead E.g. ”You are boring, show me how to code X” Jeppe GWT - SW7 2/22
  • 3. Intro GWT GWT Motivation RPC Application Areas Demo Resources What is GWT - The Google Web Toolkit It is among other things: An AJAX framework A Widget library A Java-to-Javascript compiler Jeppe GWT - SW7 3/22
  • 4. Intro GWT GWT Motivation RPC Application Areas Demo Resources Motivation for using it Communicate with your server through really simple RPC Using e.g. JSON and XML Optimize the JavaScript script downloads based on user proïŹle Using Deferred binding Reuse UI components across projects Use other JavaScript libraries and native JavaScript code Mix handwritten JavaScript in your Java code (JSNI) Easily support the browser’s back button and history adding state to the browser’s back button history Localize applications eïŹƒciently Test your code with JUnit Jeppe GWT - SW7 4/22
  • 5. Intro GWT GWT Motivation RPC Application Areas Demo Resources Application GWT is, unlike many other AJAX frameworks, aimed at both webpage- and webapplication- development. The Javascript code is compiled to minimal size The Javascript has any unreachable code purged at compile time Highly versatile and combinable UI widgets. Java source language makes it realistic to do actual application development in Javascript Jeppe GWT - SW7 5/22
  • 6. Intro GWT GWT Motivation RPC Application Areas Demo Resources Pros and Cons Where to use it. Webpages which needs to react to user actions immediately Anywhere you would want some dynamic content on your webpage Where Not to use it. Purely Static (informational) pages which does not change or update often. Anywhere it would be assumed users have disabled Javascript Jeppe GWT - SW7 6/22
  • 7. Intro GWT GWT Motivation RPC Application Areas Demo Resources GWT Resources Download GWT http://code.google.com/webtoolkit/ Widgets Demo http://gwt.google.com/samples/KitchenSink/KitchenSink.html OïŹƒcial Libraries http://code.google.com/webtoolkit/googleapilibraries.html Jeppe GWT - SW7 7/22
  • 8. Intro Code-, Debug-, Run Java GWT Deploy Javascript RPC Demo Demo Widgets & Panels Develop in Java Use your favorite IDE Eclipse 3.5 NetBeans 6.7 IDEA 8.1 IntelliJ 7+ Some standard libraries are emulated, others replaced by gwt libraries java.lang java.lang.annotation java.util java.io java.sql Jeppe GWT - SW7 8/22
  • 9. Intro Code-, Debug-, Run Java GWT Deploy Javascript RPC Demo Demo Widgets & Panels Reference - libraries 1/3 com.google.gwt.i18n.client.DateTimeFormat Replacement for the java.util.DateTime- Format class in normal Java. This replacement only supports a subset of the normal Java version. com.google.gwt.i18n.client.NumberFormat The same kind of replacement, but then for the java.util.NumberFormat, again providing only a subset of its features. com.google.gwt.user.client.Timer A simpliïŹed, browser-safe timer class that can be used to mimic a threaded environment, and which allows you to schedule tasks and actions. Its a simpliïŹed version of the java.util.Timer class. Jeppe GWT - SW7 9/22
  • 10. Intro Code-, Debug-, Run Java GWT Deploy Javascript RPC Demo Demo Widgets & Panels Reference - libraries 2/3 java.lang ArithmeticException ArrayIndexOutOfBoundsException ArrayStoreException AssertionError Boolean Byte CharSequence Character Class ClassCastException Cloneable Comparable Deprecated Double Enum Error Exception Float IllegalArgumentException IllegalStateException IndexOutOfBoundsException Integer Iterable Long Math NegativeArraySizeException NullPointerException Number NumberFormatException Object Override Runnable RuntimeException Short StackTraceElement String StringBuïŹ€er StringBuilder StringIndexOutOfBoundsException SuppressWarnings System Throwable UnsupportedOperationException Void java.lang.annotation Annotation AnnotationFormatError AnnotationTypeMismatchException Documented ElementType IncompleteAnnotationException Inherited Retention RetentionPolicy Target Jeppe GWT - SW7 10/22
  • 11. Intro Code-, Debug-, Run Java GWT Deploy Javascript RPC Demo Demo Widgets & Panels Reference - libraries 3/3 java.util AbstractCollection AbstractList AbstractMap AbstractQueue AbstractSequentialList AbstractSet ArrayList Arrays Collection Collections Comparator ConcurrentModiïŹcationException Date EmptyStackException EnumMap EnumSet Enumeration EventListener EventObject HashMap HashSet IdentityHashMap Iterator LinkedHashMap LinkedHashSet LinkedList List ListIterator Map Map.Entry MissingResourceException NoSuchElementException PriorityQueue Queue RandomAccess Set SortedMap SortedSet Stack TooManyListenersException TreeMap TreeSet Vector java.io FilterOutputStream OutputStream PrintStream Serializable java.sql Date Time Timestamp Jeppe GWT - SW7 11/22
  • 12. Intro Code-, Debug-, Run Java GWT Deploy Javascript RPC Demo Demo Widgets & Panels Coding Modify the DOM JSNI - The JavaScript Native Interface public class JSNIExample { static int myStaticField; void instanceFoo(String s) { } public native void bar(JSNIExample x, String s) /*-{ // Call instance method instanceFoo() on this this.@com.google.gwt.examples.JSNIExample::instanceFoo(Ljava/lang/String;)(s); // Call instance method instanceFoo() on x x.@com.google.gwt.examples.JSNIExample::instanceFoo(Ljava/lang/String;)(s); // Read static ïŹeld (no qualiïŹer) @com.google.gwt.examples.JSNIExample::myStaticField = val + ” and stuïŹ€â€; }-*/; } Jeppe GWT - SW7 12/22
  • 13. Intro Code-, Debug-, Run Java GWT Deploy Javascript RPC Demo Demo Widgets & Panels Debug the Java code Use hosted mode while developing. Only compile to JavaScript when done. Debug Java code as you normally would Code runs as bytecode and served using an internal Jetty instance Most times changes are immediately visible by just refreshing the integrated browser instead of relaunching hosted mode Use GWT.log() to log user behavior and exceptions. Jeppe GWT - SW7 13/22
  • 14. Intro Code-, Debug-, Run Java GWT Deploy Javascript RPC Demo Demo Widgets & Panels Run the Java code Compile to JavaScript when done developing the application Java code compiled to 6(7) permutations of JavaSript to ensure optimal performance in most versions of major browsers IE Firefox Safari Opera Size of JavaScript code minimal. Jeppe GWT - SW7 14/22
  • 15. Intro Code-, Debug-, Run Java GWT Deploy Javascript RPC Demo Demo Widgets & Panels Deploy the Javascript Specify one or more <div> elements in a .html ïŹle JavaScript will use them to hook bits of GWT functionality into the existing page Initial script will detect browser vendor and version only download relevant permutation of JavaScript public void onModuleLoad() { ïŹnal Button sendButton = new Button(”Send”); ïŹnal TextBox nameField = new TextBox(); nameField.setText(”GWT User”); sendButton.addStyleName(”sendButton”); RootPanel.get(”nameFieldContainer”).add(nameField); RootPanel.get(”sendButtonContainer”).add(sendButton); } Jeppe GWT - SW7 15/22
  • 16. Intro Code-, Debug-, Run Java GWT Deploy Javascript RPC Demo Demo Widgets & Panels Demo Ask if you want something speciïŹc demonstrated. Jeppe GWT - SW7 16/22
  • 17. Intro Code-, Debug-, Run Java GWT Deploy Javascript RPC Demo Demo Widgets & Panels Basic Widgets http://code.google.com/webtoolkit/doc/1.6/RefWidgetGallery.html http://gwt.google.com/samples/Showcase/Showcase.html Jeppe GWT - SW7 17/22
  • 18. Intro Code-, Debug-, Run Java GWT Deploy Javascript RPC Demo Demo Widgets & Panels Combining Widgets All widgets can be combined and extended support ease of use allow reusing advanced and specialized widgets which still compile to eïŹƒcient JavaScript Many advance widget libraries already exist (e.g. SmartGWT) Jeppe GWT - SW7 18/22
  • 19. Intro Motivation GWT Plumbing RPC Server Communication Demo RPC Allows a GWT client to make a call to server-side code Super easy development. All the proxy classes that handle RPC are generated automatically. All you need to do is deïŹne your service’s interface and its server-side implementations. GWT client serialization allows client JavaScript to interact with Java classes on the server Jeppe GWT - SW7 19/22
  • 20. Intro Motivation GWT Plumbing RPC Server Communication Demo Plumbing Jeppe GWT - SW7 20/22
  • 21. Intro Motivation GWT Plumbing RPC Server Communication Demo Server Communication Creating Services - Three steps DeïŹne the service’s synchronous and asynchronous interfaces Implement the service Call the service Exception Handling Jeppe GWT - SW7 21/22
  • 22. Intro GWT RPC example RPC Demo Demo RPC Demonstration Jeppe GWT - SW7 22/22