This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes GWT and the fly likes How to implement these tricks in GWT? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "How to implement these tricks in GWT?" Watch "How to implement these tricks in GWT?" New topic
Author

How to implement these tricks in GWT?

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

Hi.
How to display an indicator if a link (for example) is clicked?
And how to display a message while the application is being loading (something like GMail loading message)?
Thanks for help.
Adam Tacy
author
Ranch Hand

Joined: Jun 02, 2007
Posts: 37
Hi John,

If you mean something like the "standard" Ajax spinners or GMail Loading mark and the like to indicate something is happening, then I generally build (well, resuse...) a new composite widget, something like:

public class WorkingWidgetBase extends Composite{

Widget workingWidget;
FlowPanel working = new FlowPanel();

public void start(){
working.setVisible(true);
}

public void stop(){
working.setVisible(false);
}

public WorkingWidget(Widget theWidget, boolean initiallyVisible){
working.add(theWidget);
working.setVisible(initiallyVisible);
initWidget(working);
}
}

Then I can add it to my application by adding it to the page:

WorkingWidget working = new WorkingWidget(new Label("Working"), false);
RootPanel.get("WorkingSlot").add(working);

using it along the following lines:

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

try {
working.start();
Request response = builder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
working.stop();
//Do something else
}

public void onResponseReceived(Request request, Response response) {
working.stop();
//Do something else
}
});
} catch (RequestException e) {
}
}

Hope that helps!

//Adam
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

Ok, any ideas how to create widgets like "Labels" or "Invite a friend" of GMail?
Adam Tacy
author
Ranch Hand

Joined: Jun 02, 2007
Posts: 37
Originally posted by John Todd:
Ok, any ideas how to create widgets like "Labels" or "Invite a friend" of GMail?


As a very basic view, they both look like they would fit within the new GWT RC1.4 DisclosurePanel (which would give the arrow, the title and the hidden/shown content- you would use styling to set the border and colours - and if you wanted the round corners, then that is some more CSS trickery that you can find on the web).

The contents of that DisclosurePanel would of course be different:

* "Labels" would probably be a VerticalPanel containing GWT Labels, these Labels would probably be created from data fed from a server call;
* "Invite a friend" would be a simple form.

At least that is how I would probably make my first attempt.

//Adam
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

Adam Tacy
I appreciate the effort taken to give an answer,

Please do use code tags.


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

Hey Salvin,
When I asked this question back in the 2007, no code tags were available (AFAIR)
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

WOW !!!
my bad
 
jQuery in Action, 2nd edition
 
subject: How to implement these tricks in GWT?
 
Similar Threads
Having problem with these program
how to display loading
while page is loading
please wait message using javascript
please wait message using javascript