First time here? Check out the FAQ!
ZK 7.0.3
I have a requirement where a 'normal' java class calls Executions.createComponents, and the 'normal' class then does a blocking operation . My problem is that the 'result' of the createComponents does not appear on the screen until AFTER the blocking operation is complete or times out.
I have added problem that I the Executions.wait(_mutex); errors unless I have disable-event-thread set to false (and this is deprecated in 7.0.3) (error is This method can be called only in an event listener, not in paging loading)
Any hints appreciated.
private final Object _mutex = new Integer(0);
..
final Desktop desktop = Executions.getCurrent().getDesktop();
desktop.enableServerPush(true);
Executions.schedule(desktop,
new EventListener() {
@Override
public void onEvent(org.zkoss.zk.ui.event.Event arg0)
throws Exception {
System.out.println("start schedule..");
Executions.createComponents("simple.zul", mainPanel,
map);
System.out.println("end schedule..");
Executions.notify(_mutex);
}
}, new org.zkoss.zk.ui.event.Event("onEvent", null, null));
try {
System.out.println("Wait ..");
Executions.wait(_mutex);
System.out.println("Wait ended ..");
} catch (SuspendNotAllowedException | InterruptedException e) {
e.printStackTrace();
}
// SOME _BLOCKING _ OPERATION CODE
//
This is the way you should do it :
It's almost the same as described here, just in stead of doing only Clients.showBusy
you do also the createComponents
Asked: 2015-04-13 14:50:18 +0800
Seen: 15 times
Last updated: Apr 13 '15