18 package org.turro.elephant.zkoss;
21 import org.turro.command.Command;
22 import org.turro.command.Context;
23 import org.zkoss.zk.ui.Component;
24 import org.zkoss.zk.ui.Executions;
25 import org.zkoss.zk.ui.UiException;
26 import org.zkoss.zk.ui.event.Event;
27 import org.zkoss.zk.ui.event.EventListener;
28 import org.zkoss.zk.ui.event.Events;
29 import org.zkoss.zul.Window;
38 public static int doModal(String file)
throws InterruptedException {
39 return doModal(file,
null, (Map)
null);
43 public static int doModal(String file, Map arg)
throws InterruptedException {
44 return doModal(file,
null, arg);
48 public static int doModal(String file, Component parent, Map arg)
throws InterruptedException {
54 if(win.getDesktop().getWebApp().getConfiguration().isEventThreadEnabled()) {
57 }
catch (Throwable ex) {
59 if (ex instanceof InterruptedException)
60 throw (InterruptedException)ex;
61 throw UiException.Aide.wrap(ex);
64 return win.getResult();
68 public static void doModal(Window win)
throws InterruptedException {
69 if(win.getDesktop().getWebApp().getConfiguration().isEventThreadEnabled()) {
72 }
catch (Throwable ex) {
74 if (ex instanceof InterruptedException)
75 throw (InterruptedException)ex;
76 throw UiException.Aide.wrap(ex);
81 public static void doModal(String file, Command command) {
82 doModal(file,
null,
null, command);
85 public static void doModal(String file, Map arg, Command command)
throws InterruptedException {
86 doModal(file,
null, arg, command);
89 public static void doModal(String file, Component parent, Map arg, Command command) {
93 public static void doModal(
final Window win,
final Command command) {
94 win.addEventListener(Events.ON_CLOSE,
new EventListener<Event>() {
96 public void onEvent(Event event) throws Exception {
98 Context ctx = new Context();
100 command.execute(ctx);
102 win.removeEventListener(Events.ON_CLOSE, this);
110 return (
ModalWindow) Executions.createComponents(file,
null,
null);
114 return (
ModalWindow) Executions.createComponents(file,
null, arg);
118 return (
ModalWindow) Executions.createComponents(file, parent, arg);
static ModalWindow getModal(String file, Component parent, Map arg)
static int doModal(ModalWindow win)
static ModalWindow getModal(String file, Map arg)
static int doModal(String file, Component parent, Map arg)
static void doModal(String file, Map arg, Command command)
static void doModal(Window win)
static void doModal(String file, Command command)
static void doModal(final Window win, final Command command)
static int doModal(String file)
static int doModal(String file, Map arg)
static void doModal(String file, Component parent, Map arg, Command command)
static ModalWindow getModal(String file)