Intro on GWT & Google APIs (Vikram Rangnekar, COO of Socialwok.com)
-
Upload
singapore-google-technology-user-group -
Category
Technology
-
view
1.873 -
download
3
description
Transcript of Intro on GWT & Google APIs (Vikram Rangnekar, COO of Socialwok.com)
Introduction to Google Web Toolkit
&Google APIs
What can I do with GWT
What is GWT
• Write web-interfaces in Java • Seemless and flexible development model• Cross browser compatibility: IE6/7/8, FF, Chrome, Safari• Compiled and optimized standalone Javascript files• Gain from Googles years of domain expertise• Localization support
GWT Hello World (HTML)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><script type="text/javascript" src="hw/hw.nocache.js"></script></head><body><iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe></body></html>
GWT Hello World (Java)
package com.socialwok.samples;
import com.google.gwt.user.client.ui.Label;import com.google.gwt.user.client.ui.VerticalPanel;
public class HelloWorld implements EntryPoint {
private VerticalPanel mainPanel;private Label text1;
public void onModuleLoad() { mainPanel = new VerticalPanel(); text1 = new Label("Hello World"); mainPanel.add(text1); RootPanel.get().add(mainPanel); }
GWT and Ajax
• Support for GTW-RPC, JSON and XML• GWT RPC is quite sophisticated, too. It can handle
polymorphic class hierarchies, object graph cycles, and you can even throw exceptions across the wire
• Easily support the browser's back button and history
Google AJAX API's
Searcho Can be used for image, news, web, social web and
other searches. • Visualization
o Used to graphically represent data. Google Finance and Google Analytics makes extensive use of it.
• Mapso Includes the static and dynamic maps.
• Languageo Detect and translate text and webpages.
• Many more http://code.google.com/apis/ajax/
Google Data APIs
• Calendaro Create calendars, events, fetch agendas.
• Contactso Add or retrieve contacts.
• Docso Create and mange spreadsheets, docs and
presentations. • Gmail
o Create applications to easily upload photos from devices, desktop applications, and other web services
Data API
• Authentication - OAuth and Authsubo Recommend using OAuth (Popular web standard) o Both are based on callback / request tokens
• Libraries available in popular languageso Java, PHP, .NET, Javascript and Python
• Use the Atom (XML) syndication standardo Google's atom schema is called GData
• Each type of entry (docs, calendar, etc) has its own URL to retrieve and create.
Example: Default Calendar List URL http://www.google.com/calendar/feeds/default/owncalendars/full
Javascript Data API
<head><script type="text/javascript" src="http://www.google.com/jsapi"></script></head><body> <script type="text/javascript">google.load("gdata", "1");google.setOnLoadCallback(logMeIn);
function logMeIn() { scope = "http://www.google.com/calendar/feeds/"; var token = google.accounts.user.login(scope); }
Create a Calendar Event
Using a raw atom message: <entry xmlns='http://www.w3.org/2005/Atom'
xmlns:gCal='http://schemas.google.com/gCal/2005'> <content type="html">Tennis with John April 11 3pm-3:30pm</content> <gCal:quickadd value="true"/></entry>
Using the Java Calender API Library: CalendarEventEntry myEntry = new CalendarEventEntry();
myEntry.setContent( new PlainTextConstruct("Tennis with John April 11 3pm-3:30pm"));myEntry.setQuickAdd(true);
// Send the request and receive the response:CalendarEventEntry insertedEntry = myService.insert(postUrl, myEntry);
Q & A