S
S
sonriente2011-11-30 19:04:00
Java
sonriente, 2011-11-30 19:04:00

GWT vs GIF animation

I'm trying to make a loader for a GWT application using a regular GIF that shows/hides at the right time. I do this: Then I remove / show using the function: Everything works fine, only the animation is shown _only_ once. Those. if I hide the loader and then restart it, there will be no animation, but a static image will be shown. Sadness:( Google does not give anything good. How to solve the problem? Perhaps someone tried to attach some kind of spin.js to gwt? (I also tried this, but in this case the animation is not shown at all).

AbsolutePanel loader = new AbsolutePanel();
Image loaderImage = new Image("images/loader.gif");

public Constructor() {
loaderImage.setStyleName("loader-image");
loader.add(loaderImage);
loader.setStyleName("loader");
RootPanel.get().add(loader);
}



public void showHideLoader(String mode) {

if (mode.equals("hide")) {
loader.setVisible(false);
} else {
loader.setVisible(true);
}
}


Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill Mamaev, 2011-11-30
@r00tGER

In my opinion, GWT has nothing to do with it, it works fine for me in the same way:
http://bash-rdr.appspot.com/ - when changing quotes, a spinner appears.
Maybe it's in your gif, is it exactly looped?
Try opening it in the browser directly - does the animation stop?

V
vimvim, 2011-12-01
@vimvim

If I understand correctly, you need to make an indicator that will spin until the GWT application is loaded and initialized? In this case, it is better to do it differently:
- Place the indicator on the host page as a static image, so that it is displayed as soon as the page is loaded into the browser.
- At the moment when the GWT application is initialized and ready to display something, you need to use the DOM function to find the indicator on the host page and hide it.
The benefit here is that the indicator will be shown and spinning almost immediately as soon as the page loads. If done in the way you described, the indicator will only appear when the GWT application is loaded, and this can take a significant amount of time for a large application.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question