Events for the same desktop are processed sequentially. It simplifies the GUI programming and component development. However, it means an event handler that spends a lot of time to execute will block any following handlers. Worse of all, the user, due to the limitation of HTTP, got no hint but the small busy dialog shown at the left-top corner on the browser.
There are basically two approaches:
- Handle everything in an event thread and have the user to wait but show more visible message to notice him
- Handle the long operation in an independent thread, such that the user can access other functions
The first approach could be done with a technique called echo events as describe in the Use Echo Events section.
The second approach can be done in several ways, such as starting a working thread to do the long operation and then using a timer to check if the data ready and show to the client. However, there is a simple approach: use an event queue to run an asynchronous listener as described in the Use Event Queues section.
In additions to above approaches, there is a special mechanism called piggyback, which could be used to piggy back UI updates without extra network traffic.
|Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.|