Search code examples
javauser-interfaceprogress

Best practice to block access to application while saving data?


What is a good and friendly way to block access to a application while data entered by user is saved to server?

I currently have a client application which retrieves and saves all data used from a server. When data is retrieved/saved from/to server i display a progressbar in the statusbar of the active window and block access to the active window by painting a transparent grey rectangle over the window. This way the user knows something is going on.

But because retrieval and saving of data is fast, faster than the usual webapp, i'm wondering if i should paint a grey rectangle over the window, because it is quite distracting when the program is being used. In addition we don't usually block an entire webapp when data is submitted.

Can i just count on that the user is smart enough not to click anything while data is retrieved/saved? Or is there maybe a better way to handle such a problem?


Solution

  • It depends: If the user can corrupt the data during upload by clicking like an ape in the application you have to block the ui. In other words: Never think the user is smart enough. Never assume anything about your users regarding their knowledge about computers/your software. (At least that is what I do)

    If the requests to the server are very small then I would just set an hourglas. Then the user knows "I cannot click because the app is working". If the operation takes several seconds to complete > 1s I would show a progress bar and disable the window.

    A far better solution would be to upload the data in a background thread. This is usually a more complex task because you have to protect your domain model against threading issues or just copy the whole thing an pass it to the background thread. But this gives the user the option to continue working.