I use resty gwt for all server communication. I would like some indicator that would show the operation is in progress.
I consider 2 aproaches:
- progressbar, which will show in progress percentage;
- animation, that will be showed while operation is in progress, but without any percantage.
I've assumed that I need to add custom filter with callback.
I would like to fire events like: RestyGwtComunicationStart and RestyGwtComunicationEnd, or callback to fire onComunicationStarted and
onComunicationEnded. I would like to have this declared in one place, RestyGWT Dispatcher configuration. Also if there was an error I would like to fetch the error.
But I don't know where to start. There is no word about it in documentations.
Can I ask You for help? How can I do this?
Unfortunately I did not get adequate answer, So I developed my own solution.
At first I've added Resty configuration
RestyGwtConfigto my Module configurationthen I've set Custom distpatcher for all my comunication requests of resty gwt.
Then I've added custom filter (
ProgressIndicatorFilter) to handle communication's start and end callbacks:in filter class method overriden
filterI've added an event trigger (eventBus.fireEvent(new IndicatorEvent("Rest-Gwt Comunication started"));) and registered callback, here is whole code:Registering a callback couldn't be done straight forward, like
new ProgressIndicatorDispatcherCallback()cause I use dependency injection. So I've created a factory to assist injection as follow:
Here and here You can find more Assisted Injection info.
Here is the callback code: