how to start with google web toolkit

Post on 01-Dec-2014

967 Views

Category:

Education

5 Downloads

Preview:

Click to see full reader

DESCRIPTION

GWT Presentation @ SOCAL CODE CAMP

TRANSCRIPT

How to start using Google Web Toolkit (GWT)

Alline Watkins & June Clarke

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.

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

Create New GWT Project

Our Application Example - Tic Tac Toe Game

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

Vertical/Horizontal Panel

Grid

Label

HTML Panel

Mouse Events

Asynchronous Calls

RPC's

GWT Browser Plug-in

GWT Browser Plug-in & Debug Mode

The MVP Architecture

Event Handler

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

@Overridepublic void onClick(ClickEvent event) {

// TODO Auto-generated method stub

}});

AJAX web application model

Java components of the GWT RPC Mechanism

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

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

}

});

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");

}

The Final Application Example

alline.oliveira@gmail.com

joonspoon@joonspoon.com

top related