Change mouse cursor while loading

Hi dears, I need to change the mouse cursor to progress style while the view is processing some data. Is there any listener that I can use to control it?

Hi, I don’t know of any built in feature but you could try adding a style name to, for example, your layout with addStyleName("myStyle") and use the
CSS cursor property
in your application’s theme to change the cursor for that layout.

Hi Adam, thanks for your answer.

But in fact, what I need to know is when the app/view is loading and while it is I want to change the system cursor to the “wait” style. I am not sure how can I intercept the start and end of any HTTP Vaadin invocation. In Angular it is possible to create an HTTP Interceptor to control this kind of thing and I believe that it is possible with Vaadin too.

The client to server requests are handled around RpcProxy and ServerRpcQueue classes and the message itself is sent by the MessageSender class. I can’t find a hook quickly that could be used to intercept these calls.

There is, however, the built in loading indicator that is triggered on each client requests (RPC calls) except for the ones that are annotated with @NoLoadingIndicator. The delay to show the indicator can be customised by UI.getLoadingIndicatorConfiguration().setFirstDelay() and the other set*Delay() methods.

Hi Adam, sorry but I didn’t understood what can I do… maybe because I am a neebie in Vaadin :\ How can I interact with this three entities?

Alright, so what I mean is that I didn’t find an easy way to intercept server calls.

You can, however change the delay of the built in indicator that could be used to indicate ongoing calls. It isn’t changing the mouse pointer, but can still be a useful indication of an ongoing process to the user.

To change the delay between starting a server call and showing the indicator, call UI.getCurrent().getLoadingIndicatorConfiguration().setFirstDelay(). If you change this to a small value, the users will know that there is some ongoing process shortly after the the server call has started.

Thanks Adam, I am not sure if my client is going to accept this option, but I will try!

I don’t think you have to do these things that the other members have shared I would suggest you to check Hello Cursor for this.
Related Resource: