Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to implement these tricks in GWT?

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, any ideas how to create widgets like "Labels" or "Invite a friend" of GMail?
 
Adam Tacy
author
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 1268
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adam Tacy
I appreciate the effort taken to give an answer,

Please do use code tags.
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Salvin,
When I asked this question back in the 2007, no code tags were available (AFAIR)
 
salvin francis
Bartender
Posts: 1268
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WOW !!!
my bad
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic