19 package org.turro.zkoss.util;
21 import org.turro.string.Strings;
22 import org.turro.command.Command;
23 import org.turro.command.Context;
24 import org.zkoss.zk.ui.Component;
25 import org.zkoss.zk.ui.event.Event;
26 import org.zkoss.zk.ui.event.EventListener;
27 import org.zkoss.zk.ui.event.Events;
28 import org.zkoss.zk.ui.util.Clients;
36 private static final String LONG_OPERATION_EVENT =
"onLongOperation";
42 public static void executeLongOperation(
final Component component,
final String busyMsg,
final Command command) {
43 if(!Strings.isBlank(busyMsg)) {
44 Clients.showBusy(busyMsg);
46 component.addEventListener(LONG_OPERATION_EVENT,
new EventListener<Event>() {
48 public void onEvent(Event event)
throws Exception {
49 Context ctx =
new Context();
51 if(!Strings.isBlank(busyMsg)) {
54 component.removeEventListener(LONG_OPERATION_EVENT,
this);
57 Events.echoEvent(LONG_OPERATION_EVENT, component,
null);
static void executeLongOperation(Component component, final Command command)
static void executeLongOperation(final Component component, final String busyMsg, final Command command)