Thursday, July 21, 2016

Re: How to detect the scrollpanel is still scrolling or not in GWT?

Thanks for response. But I need consider last request only. Basically I need to skip(eaten) all the previous request. I have logic to eat the request.But Is there any way to find out scroll bar is still scrolling without release the bar.

Thank U

On Thursday, 21 July 2016 18:18:25 UTC+5:30, Gilberto wrote:
I don't know if that helps with your problem, but you could leave the events as they are today and only make new requests to the server when the previous one were executed.

Something like this:

private boolean requestingServer = false;

public void onScroll(ScrollEvent scrollEvent) {
   
if (requestingServer) return;
    requestingServer = true;
    doServerRequest(new Callback(){ //pseudo code here for a callback mechanism
        public void onResponse(Payload something){
           
requestingServer = false;
        }
    });
}

You can add a logic for a minimum delay between requests as well.

This kind of code works on GWT because it is single threaded. In pure Java you would need to create synchronized blocks to ensure that only one request is being made to the server.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment