IE doesnt show my progress bar when the data loads in to my Grid

34 views
Skip to first unread message

Suren

unread,
Apr 8, 2009, 1:22:48 AM4/8/09
to Google Web Toolkit
Hi All,

I am loading 100x100 values into the cells of a Grid from the DB. Its
taking some time to show the Grid in IE.

So thought of showing a progress bar during that time instead of
showing blank page to the user.

So I am trying to display a progressbar.gif image during the data
load.

But the problem here is that, still the progressbar is not shown. Its
showing hourglass mouse cursor in the IE and showing nothing and looks
like the loading page.

what I am doing wrong here? do I need to have a seperate thread to
show the image??

Or instead of this approach, I expect if anything else is better way
of doing it from the group.

Kindly advise

Thanks
Suren

alex.d

unread,
Apr 8, 2009, 4:10:13 AM4/8/09
to Google Web Toolkit
You can't "start antother thread" from javascript. And though it's a
singlethreaded environment your animation isn't "moving" probably
because browser is busy with filling the data. You can show some
static text "Loading..." and then load your data.

vaibhav

unread,
Apr 8, 2009, 9:01:50 AM4/8/09
to Google Web Toolkit
Hi,
If you are using the GIF image using the image object you can not show the GIF image as the GIF image is divided in the frames. You need to set the image to a widget (recommended label) using the css.
 
If you are setting the progress bar image on any widgets like label or panel through css then you need to set the size of the widgets. Typically the width and height in pixel. Do not forget to set the size in pixel.
 
If you have set the pixel size too then after showing the image you need to relax the GUI using the timer. Like
 
Show();
 
Timer timer = new Timer(){
 
Public void run(){
   
    Do next task
}
 
};
 
timer.schedule(1000);
 
Show is the way to show the image in popup. Here you can use your own way to show GIF image and in timer run add your next logic to load the grid. Schedule it to 1000 ms and the work is done.
 
Regards
Vaibhav Saxena
 
 
-------Original Message-------
FREE Animations for your email - by IncrediMail! Click Here!

Thomas Broyer

unread,
Apr 8, 2009, 12:04:34 PM4/8/09
to Google Web Toolkit
IncrementalCommand is your new friend! ;-)

In a few words: split your data loading algorithm and load "segments"
at a time.

Suren

unread,
Apr 9, 2009, 1:10:11 AM4/9/09
to Google Web Toolkit
Hi Vaibhav,

Thanks to your idea.

I implemented the same. But again the label now is not shown properly.
After few seconds again the page is busy with loading data. And the
entire page is goes off with blank with giving impression that
hanging.. and once the data is loaded I am getiting the Grid visible.

Still I cant prevent the impact of grid data loading while showing the
label.

Here is how I am dealing with it..
[code]
package com.ibsplc.idaho.thinclient.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.ui.*;


public class Thinclient implements EntryPoint{

/**
* This is the entry point method.
*/

Grid flexTable = new Grid(101,87);

final Label img = new Label();

public void onModuleLoad() {

flexTable.setVisible(false);
img.setStyleName("ProgressImage");
RootPanel.get().add(img);

final DBFetchAsync dbFetch = (DBFetchAsync) GWT.create
(DBFetch.class);

ServiceDefTarget endpoint = (ServiceDefTarget) dbFetch;
endpoint.setServiceEntryPoint(GWT.getModuleBaseURL() +
"DBFetch"); // for GWT eclipse launch

AsyncCallback asyncCallback = new AsyncCallback(){
public void onSuccess(Object result) {
try {

//here comes the code for Loading the data into the Grid.......

//after data load is completed
RootPanel.get().remove(img); //removing the Label which has the
Progressbar image
flexTable.setVisible(true); //showin the Grid
RootPanel.get().add(flexTable); //Adding to the Root panel

} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}

public void onFailure(Throwable caught) {
Window.alert("Failed to get quote " + caught.getMessage());
};
};

flexTable.addStyleName("FlexTable");
try {
dbFetch.setGridDataInfo(asyncCallback);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
}

[/code]

Kindly advise whether its correct way of doing it. And how I can
achieve my requirement?

Thanks
Suren
>  faint_grain.jpg
> 1KViewDownload
>
>  imstp_animation_monkey_en_020908.gif
> 55KViewDownload- Hide quoted text -
>
> - Show quoted text -

Suren

unread,
Apr 9, 2009, 1:42:56 AM4/9/09
to Google Web Toolkit
Hi Thomas,

Thanks for the reply. I am a stranger to IncrementalCommand. Anyway
let me check what is all about.

Thanks.
Suren
> at a time.- Hide quoted text -

alex.d

unread,
Apr 9, 2009, 4:43:03 AM4/9/09
to Google Web Toolkit
Try to fetch data in a defferedCommand:

DeferredCommand.addCommand(new Command(){
public void execute() {
dbFetch.setGridDataInfo(asyncCallback);
}
});

Suren

unread,
Apr 9, 2009, 5:18:36 AM4/9/09
to Google Web Toolkit
Hi Alex,

I have tried as you mentioned. Label is initially shown and the gif
image started giving me kind of progress bar impression. But it
stopped in the half way and hangs there until my grid is shown

Any help?

Thanks
Suren
> > > - Show quoted text -- Hide quoted text -

alex.d

unread,
Apr 9, 2009, 6:05:44 AM4/9/09
to Google Web Toolkit
That's because browser is to busy with populating the grid, that it
doesn't have time to animate you gif. I don't think you can really
solve this. You can put some empty loops into setGridDataInfo(for
example after each 10 rows or smth.) to get browser time to update
your gif - but imho it's just isn't worth it. A static label is
enough. If google use it(google maps) then it's probably not that bad.

Suren

unread,
Apr 9, 2009, 6:45:35 AM4/9/09
to Google Web Toolkit
Hi Alex,

Yes it seems to me that this is not possible to show my gif properly.
I can do like what you suggest, but already I am having some
performance issue, if I include empty loops, that will cause me
heavily. So I am planning to show a static text in a Label. I have to
try that. But before doing that, one doubt in my mind..is that..

Do the same thing will happen to the Label too? like it will show
blank kind of a page when the gid is loaded.

Anyway let me try and confirm

Thanks everyone for help
Reply all
Reply to author
Forward
0 new messages