Gwt simple move

I started learning GWT today and have done a lot since I have a java background. The next step is to download the JSON data from the backend server, but when I download, I want to show the progress wheel for obvious reasons.

I was expecting a widget out of the box, but it seems that it is not (correct me if I am wrong). Since I am completely new to GWT, I don’t want to add complexity with additional frameworks, but only GWT.

It seems that I will need to encode one, because for this I did not find third-party code for it. Can someone point me in the right direction? What are the steps? Should I create a single image and then rotate it into an animation or create multiple images and then replace them in a circular way? Or am I completely here?

+5
source share
3 answers

Well, as regards a simple progress step that does not show actual progress (just that the application is doing something), I would recommend a simple animated image (generating it at http://www.ajaxload.info/ ).

If the animated image / gif is not an option:

A simple solution will create multiple images and replace them in a circular way. I used this recently, basically you are making a timer that calls itself:

Timer updateAnim = new Timer() {
    @Override
    public void run() {
        currentImage = (currentImage + 1) % NO_IMAGES;
        setVisibilities();
        this.schedule(UPDATE_TICK);
    }
};

private void setVisibilities() {
    img1.setVisible(false);
    img2.setVisible(false);
    switch (currentImage) {
    case 0:
        img1.setVisible(true);
        break;
    case 1:
        img2.setVisible(true);
        break;
    }

}

setVisibilities()just sets the current image to visible and the other to invisible. I experienced this faster than switching the image url (using only one image while invoking img.setURL(String url);).

Now you just call updateAnim.schedule(UPDATE_TICK);and it will start.

, ( ) CSS ( ), , , ( , , ;). CSS.

( ), , . /CSS- .

+5

Very simple solution - use pace.js . This is a javascript script displaying progress indicators that collect events from the DOM. You can configure listening for all GWT-RCP events, as well as when the client downloads fragments. Just add the script tag to the html file where your GWT module is loaded.

This should work out of the box for GWT activity and regular ajax.

<script type="text/javascript" language="javascript"
    src="js/pace.min.js"
    data-pace-options='{"elements":{"selectors":["body","script"]},"ajax":{"trackMethods":["GET","POST"]}}'></script>
0
source

All Articles