Top Banner
How to start using Google Web Toolkit (GWT) Alline Watkins & June Clarke
16

How to start with Google Web Toolkit

Dec 01, 2014

Download

Education

Alline Oliveira

GWT Presentation @ SOCAL CODE CAMP
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: How to start with Google Web Toolkit

How to start using Google Web Toolkit (GWT)

Alline Watkins & June Clarke

Page 2: How to start with Google Web Toolkit

http://code.google.com/intl/en/webtoolkit/overview.html

By GWT Web Page:

Google Web Toolkit (GWT) is a development toolkit for building and optimizing complex browser-based applications. Its goal is to enable productive development of high-performance web applications without the developer having to be an expert in browser quirks, XMLHttpRequest, and JavaScript. GWT is used by many products at Google, including Google Wave and the new version of AdWords. It's open source, completely free, and used by thousands of developers around the world.

Page 3: How to start with Google Web Toolkit

Installation: Google Plug-in for Eclipse http://code.google.com/intl/en/eclipse/index.html

Page 4: How to start with Google Web Toolkit

Create New GWT Project

Page 5: How to start with Google Web Toolkit

Our Application Example - Tic Tac Toe Game

Page 6: How to start with Google Web Toolkit

GWT Widgets Showcase http://gwt.google.com/samples/Showcase/Showcase.html

Vertical/Horizontal Panel

Grid

Label

HTML Panel

Mouse Events

Asynchronous Calls

RPC's

Page 7: How to start with Google Web Toolkit

GWT Browser Plug-in

Page 8: How to start with Google Web Toolkit

GWT Browser Plug-in & Debug Mode

Page 9: How to start with Google Web Toolkit

The MVP Architecture

Page 10: How to start with Google Web Toolkit

Event Handler

Anchor anchorTest = new Anchor("Test");anchorTest.addClickHandler(new ClickHandler() {

@Overridepublic void onClick(ClickEvent event) {

// TODO Auto-generated method stub

}});

Page 11: How to start with Google Web Toolkit

AJAX web application model

Page 12: How to start with Google Web Toolkit

Java components of the GWT RPC Mechanism

http://code.google.com/webtoolkit/doc/latest/tutorial/RPC.html

Page 13: How to start with Google Web Toolkit

Asynchronous Calls

GreetingServiceAsync myService = GWT.create(GreetingService.class);

myService.myMethod( methodParameters , new AsyncCallback<String>() {

@Overridepublic void onSuccess(String result) {

// TODO Auto-generated method stub

}

@Overridepublic void onFailure(Throwable caught) {

// TODO Auto-generated method stub

}

});

Page 14: How to start with Google Web Toolkit

Calling Web Services

RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);

try {Request request = builder.sendRequest(null, new RequestCallback() {

public void onError(Request request, Throwable exception) {//displayError("Couldn't retrieve JSON");

}

public void onResponseReceived(Request request,Response response) {

if (200 == response.getStatusCode()) {// response.getText();

} else {// response.getStatusText();

}}

});

} catch (RequestException e) {//displayError("Couldn't retrieve JSON");

}

Page 15: How to start with Google Web Toolkit

The Final Application Example