not really : https://www.zkoss.org/wiki/ZKDeveloper'sReference/UIPatterns/LongOperations/UseEchoEvents
chillworld ( 2016-05-04 15:03:49 +0800 )edit-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I use Clients.showBusy in numerous places in my application without any trouble. I am running into a strange issue with the following button callback that tries to invoke it. When I press the load button this callback is called via a javascript function in the zul. I want to showBusy while the search is invoked in the populateZoneMessageChangeHolderByDateRange method. I put the thread.sleep to make the delay long enough to test the showBusy. I have tried it both without passing in a component to showBusy and passing one in. It doesn't make a difference. I do not get the busy dialog until Clients.clearBusy is called, and then it doesn't go away. This is strange and I can't figure out what's going on since I use the same calls in numerous other places and it works fine. Any ideas? Here is the class definition and method.
public class DHzClimateZoneHistoryView extends GenericForwardComposer<Window>
{........
/**
*
* Method : onLoadButtonClicked
* @param event
*/
public void onLoadButtonClicked(Event event) throws Exception
{
try
{
Clients.showBusy("Loading...");
Thread.sleep(7000);
populateZoneMessageChangeHolderByDateRange();
Clients.clearBusy();
}
catch (Exception e)
{
Clients.clearBusy();
e.fillInStackTrace();
_logger.error(".....",e);
throw e;
}
}
You never go back to the client.
The moment you go back to the client => it's updating with show and clear at the same time. (in other words, I don't see a callback here)
Try Events.echoEvent
and do your long op in the echo event.
Or maybe an even better method is to use Robert his implementation.
Please read this small talk in order to make long ops easier.
Some more explication after comment :
Well, I do explain this with some real life example :
Let's say you have a client who want something done.
He has a contact with some company X.
Because the workload is high => company X will outsource it to company Y.
Now the Client doesn't want that work done anymore so he tells to company X to work on something else now.
But In order to stop company Y => company X should notify company Y to stop working.
Bring this back to the application.
The Client notifies the server he navigates to other page.
But did you implement that the server notifies that the thread has to stop?
It will not be automatic, so you need to implement this behavior or just let the thread finish it's work, what normally doesn't have to much impact on your application.
not really : https://www.zkoss.org/wiki/ZKDeveloper'sReference/UIPatterns/LongOperations/UseEchoEvents
chillworld ( 2016-05-04 15:03:49 +0800 )editThis method is inside the ZK event loop, shouldn't the connection to the client be there allowing the show busy to happen?
Asked: 2016-05-04 11:35:12 +0800
Seen: 37 times
Last updated: May 26 '16