-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi everybody.
I have some more lengthy processing in certain parts of the system. To do so would "lock" the screen and not allow users to interfere in the process.
When the button is pressed, the screen appears only "processing ..." (ZK default behavior), my message does not appear.
I tried to implement EventInterceptor, doing a combination of methods beforeProcessEvent and afterProcessEvent, but when an error / exception occurs, the afterProcessEvent method is not called and the screen still "locked".
Is there any other alternative to solve this kind of question?
What's wrong with this code?
<window height="100%" width="100%"> <button label="btn1"> <attribute name="onClick"> <![CDATA[ Clients.evalJavaScript("zUtl.progressbox('myProgressbox', 'lock my window', true);"); // some long operation String t = ""; for (int x = 0; x < 25000; x++) { t += x; } // after long operation... unlock Clients.evalJavaScript("zUtl.destroyProgressbox('myProgressbox');"); ]]> </attribute> </button> </window> EventInterceptor implementation @Override public Event beforeProcessEvent(final Event event) { Clients.evalJavaScript("zUtl.progressbox('myProgressbox', 'Aguarde, processamento em execução...', true);"); return event; } @Override public void afterProcessEvent(final Event event) { Clients.evalJavaScript("zUtl.destroyProgressbox('myProgressbox');"); }
Thanks
You could just use Clients.showBusy with Events.echoEvent, like this:
<window id="w" width="200px" title="Test echoEvent" border="normal"> <attribute name="onLater"><![CDATA[ String t = ""; for (int x = 0; x < 25000; x++) { t += x; } Clients.clearBusy(); ]]></attribute> <button label="Echo Event"> <attribute name="onClick"> Clients.showBusy("My custom message..."); Events.echoEvent("onLater", w, null); </attribute> </button> </window>
Asked: 2011-10-10 10:45:00 +0800
Seen: 196 times
Last updated: Oct 10 '11