We like GWT! …we think you will too. Stuart Ervine & Franck Rasolo Please plug in your laptops and...

Post on 05-Jan-2016

213 views 0 download

Transcript of We like GWT! …we think you will too. Stuart Ervine & Franck Rasolo Please plug in your laptops and...

Welike

GWT!

…we think you will too.

Stuart Ervine & Franck Rasolo

Please

plug in

your

laptops

and pair

up.

Welike

GWT!

Introduction • In this workshop we'll be building a short

application

• Please figure out how to boot your laptop from either the CD or USB

• If you can't boot from either, please pair up with someone who can

Welike

GWT!

What is GWT? • Java toolkit for building rich web applications

• You can write all the code in Java, so no JSPs, templating languages or action classes

• It compiles into Javascript, uses asynchronous requests

• It is more akin to Swing

Welike

GWT!

What we're not going to cover here: • No GWTTestCase• No Google API integration• No 3rd party GWT library integration• No optimization

(though feel free to talk to us about this after)• No JSNI• Little, if any, CSS• No clever ruby / python back end integration• No discussion on client architecture• Little, if any, comparison with or discussion

about other (Java) web frameworks

Welike

GWT!

The Client• MegaBank are losing lots of cash and can't

be bailed out any further - they can't sell stocks fast enough, you see the dealers didn't get their bonus and can't be bothered answering the phone any more. In fact, they're often seen down the pub...

• They've asked you to develop a front end to a trading platform to allow them to sell stocks online, cutting out the dealer.

Welike

GWT!

The Stories• Display account details• Display current holdings• Refresh prices manually• Display the profit as a percentage

of the current price• If profit is negative, show it in red,

otherwise green• Auto ticking refresh (example of a timer)• Add advice (as per existing stories)• Add sell button

Welike

GWT!Here's

how it all

hangs

together.

Welike

GWT!

Boot up your machines• Boot from the USB drive (BOOT mount)

or CD provided

• Open the APPS mounted drive and run ./start.sh

• IntelliJ should open and you can run the sample application by clicking the Run button (green triangle)

Welike

GWT!

What's been done so far• Display account details• Display current holdings• Refresh prices manually• Display the profit as a percentage of the

current price• If profit is negative, show it in red, otherwise

green• Auto ticking refresh (example of a timer)• Add advice (as per existing stories)• Add sell button

Welike

GWT!

What's left to do• Refresh prices manually

• Display the profit as a percentage of the current price

• If profit is negative, show it in red, otherwise green

• Auto ticking refresh (example of a timer)

• Add advice (as per existing stories)

• Add sell button

Welike

GWT!

Common widgetsButtonButton button = new Button();button.addClickListener(new ClickListener() {    public void onClick(Widget sender) {        // do something    }});

FlowPanel (outputs an HTML DIV tag)FlowPanel panel = new FlowPanel();panel.add(new Label("hello"));panel.add(new Label("goodbye"));

Welike

GWT!

TimersHow to use a timer:

Timer timer = new Timer() {    public void run() {        // do something    } };

timer.scheduleRepeating(1000);

Welike

GWT!

Any outstanding questions?

Round up

What did

you think?

Does anyone want to show & tell?

Welike

GWT!

• The code and slides are available at : http://code.google.com/p/welikegwt-presentation

• Read more about GWT at : http://code.google.com/webtoolkit

• Please contact us at the following :xxx@xxx.com

Thank you!