-
Bug
-
Resolution: Invalid
-
Normal
-
None
-
5.0.9
-
Tomcat 6.0.35, Java jdk1.6.0_25, Windows XP.
Here is the case.
Suppose you have a long operation to do when you click on a menuitem, so you have an event listener on the item.
Knowing that you may want to present user a showBusy mask. So you have a situation like (pseudoCode):
private void registerMyHandlers() {
menuItem.addEventListener(Events.onClick, new EventListener()
);
menuItem.addEventListener(Events.onClick, longOperationListener);
}
Going in debug I saw that Clients.showBusy() is executed before longOperationListener but the final result is that
the mask is presented to user when longOperationListener is accomplished.
Going deep in zk source I saw that the code doesn't execute anything but addAuResponse(AuResponse resposne);
that, reporting the Javadoc, is
"Adds an asynchronous response (
{@link AuResponse}) which will be sent to client at the end of the execution.
It is the same as <code>addAuResponse(response.getOverrideKey(), resposne)"
So I'm supposing that the execution flow is in a sort of box (I think it might is the event queue manager/ event dispatcher) in which the Clients.showbusy is executed when the box code is complete, say (pseudoCode)
while (queue.hasEvents()) { // a monitored access to a variable makes is awakable if is queue is empty
Events[] clickEvents = queue.getEvents(Events.OnClick);
for (Event e in clickEvents) {
Component target = e.getTarget();
Iterator<EventListener> it = target.getListenerIterator(Events.OnClick);
while (it.hasNext())
}
}
What I'm thinking is that the Clients.showBusy, since it runs at the end of current execution, is executed when the while starts over.
I'm thinking that this behaviour is defective by design.
Am I wrong is any point?