IDEMPIERE-801 Tab body mask doesn't block focus.

This commit is contained in:
Heng Sin Low 2013-03-27 16:21:44 +08:00
parent 7f1da9d48f
commit b253e2cdf6
7 changed files with 76 additions and 29 deletions

View File

@ -220,9 +220,9 @@ public class ValuePreference extends Window implements EventListener<Event>
this.setClosable(true); this.setClosable(true);
adwindowContent = findADWindowContent(ref); adwindowContent = findADWindowContent(ref);
if (adwindowContent != null) { if (adwindowContent != null) {
adwindowContent.showBusyMask();
ZkCssHelper.appendStyle(this, "position: absolute;"); ZkCssHelper.appendStyle(this, "position: absolute;");
adwindowContent.getComponent().getParent().appendChild(this); adwindowContent.getComponent().getParent().appendChild(this);
adwindowContent.showBusyMask(this);
LayoutUtils.openOverlappedWindow(ref, this, "after_start"); LayoutUtils.openOverlappedWindow(ref, this, "after_start");
} else { } else {
AEnv.showCenterScreen(this); AEnv.showCenterScreen(this);

View File

@ -104,6 +104,7 @@ import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.Util; import org.compiere.util.Util;
import org.compiere.util.WebDoc; import org.compiere.util.WebDoc;
import org.zkoss.zk.au.out.AuScript;
import org.zkoss.zk.ui.AbstractComponent; import org.zkoss.zk.ui.AbstractComponent;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Executions;
@ -908,8 +909,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
hideBusyMask(); hideBusyMask();
} }
}); });
showBusyMask();
getComponent().getParent().appendChild(win); getComponent().getParent().appendChild(win);
showBusyMask(win);
LayoutUtils.openOverlappedWindow(getComponent(), win, "middle_center"); LayoutUtils.openOverlappedWindow(getComponent(), win, "middle_center");
} }
@ -951,8 +952,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
focusToActivePanel(); focusToActivePanel();
} }
}); });
showBusyMask();
getComponent().getParent().appendChild(chat); getComponent().getParent().appendChild(chat);
showBusyMask(chat);
LayoutUtils.openOverlappedWindow(getComponent(), chat, "middle_center"); LayoutUtils.openOverlappedWindow(getComponent(), chat, "middle_center");
chat.showWindow(); chat.showWindow();
} }
@ -1726,8 +1727,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
}); });
} }
showBusyMask();
getComponent().getParent().appendChild(findWindow); getComponent().getParent().appendChild(findWindow);
showBusyMask(findWindow);
LayoutUtils.openEmbeddedWindow(toolbar, findWindow, "after_start"); LayoutUtils.openEmbeddedWindow(toolbar, findWindow, "after_start");
} }
@ -2191,8 +2192,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
focusToActivePanel(); focusToActivePanel();
} }
}); });
showBusyMask();
getComponent().getParent().appendChild(messagePanel); getComponent().getParent().appendChild(messagePanel);
showBusyMask(messagePanel);
LayoutUtils.openOverlappedWindow(getComponent(), messagePanel, "middle_center"); LayoutUtils.openOverlappedWindow(getComponent(), messagePanel, "middle_center");
} }
// //
@ -2224,8 +2225,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (dialog.isValid()) { if (dialog.isValid()) {
dialog.setWidth("500px"); dialog.setWidth("500px");
dialog.setBorder("normal"); dialog.setBorder("normal");
showBusyMask();
getComponent().getParent().appendChild(dialog); getComponent().getParent().appendChild(dialog);
showBusyMask(dialog);
LayoutUtils.openOverlappedWindow(getComponent(), dialog, "middle_center"); LayoutUtils.openOverlappedWindow(getComponent(), dialog, "middle_center");
dialog.focus(); dialog.focus();
} }
@ -2475,8 +2476,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
executeButtonProcess(wButton, startWOasking, table_ID, recordIdParam, isProcessMandatory); executeButtonProcess(wButton, startWOasking, table_ID, recordIdParam, isProcessMandatory);
} }
}); });
showBusyMask();
getComponent().getParent().appendChild(win); getComponent().getParent().appendChild(win);
showBusyMask(win);
LayoutUtils.openOverlappedWindow(getComponent(), win, "middle_center"); LayoutUtils.openOverlappedWindow(getComponent(), win, "middle_center");
win.focus(); win.focus();
return; return;
@ -2507,8 +2508,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
window.setMaximizable(true); window.setMaximizable(true);
window.setSizable(true); window.setSizable(true);
ZkCssHelper.appendStyle(window, "position: absolute; "); ZkCssHelper.appendStyle(window, "position: absolute; ");
showBusyMask();
getComponent().getParent().appendChild(window); getComponent().getParent().appendChild(window);
showBusyMask(window);
cf.showWindow(); cf.showWindow();
LayoutUtils.openOverlappedWindow(getComponent(), window, "middle_center"); LayoutUtils.openOverlappedWindow(getComponent(), window, "middle_center");
window.focus(); window.focus();
@ -2601,11 +2602,22 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
public void hideBusyMask() { public void hideBusyMask() {
if (mask != null && mask.getParent() != null) { if (mask != null && mask.getParent() != null) {
mask.detach(); mask.detach();
StringBuilder script = new StringBuilder("var w=zk.Widget.$('#");
script.append(getComponent().getParent().getUuid()).append("');w.busy=false;");
Clients.response(new AuScript(script.toString()));
} }
} }
public void showBusyMask() { public void showBusyMask(Window window) {
getComponent().getParent().appendChild(getMask()); getComponent().getParent().appendChild(getMask());
StringBuilder script = new StringBuilder("var w=zk.Widget.$('#");
script.append(getComponent().getParent().getUuid()).append("');");
if (window != null) {
script.append("var d=zk.Widget.$('#").append(window.getUuid()).append("');w.busy=d;");
} else {
script.append("w.busy=true;");
}
Clients.response(new AuScript(script.toString()));
} }
private void executeButtonProcess(final IProcessButton wButton, private void executeButtonProcess(final IProcessButton wButton,
@ -2677,7 +2689,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
onRefresh(true, false); onRefresh(true, false);
} }
}); });
showBusyMask(); showBusyMask(form);
LayoutUtils.openOverlappedWindow(getComponent(), form, "middle_center"); LayoutUtils.openOverlappedWindow(getComponent(), form, "middle_center");
form.focus(); form.focus();
} }
@ -2693,8 +2705,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{ {
dialog.setWidth("500px"); dialog.setWidth("500px");
dialog.setBorder("normal"); dialog.setBorder("normal");
showBusyMask();
getComponent().getParent().appendChild(dialog); getComponent().getParent().appendChild(dialog);
showBusyMask(dialog);
LayoutUtils.openOverlappedWindow(getComponent(), dialog, "middle_center"); LayoutUtils.openOverlappedWindow(getComponent(), dialog, "middle_center");
dialog.focus(); dialog.focus();
} }
@ -2843,8 +2855,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
hideBusyMask(); hideBusyMask();
} }
}); });
showBusyMask();
getComponent().getParent().appendChild(dialog); getComponent().getParent().appendChild(dialog);
showBusyMask(dialog);
LayoutUtils.openOverlappedWindow(this.getComponent(),dialog,"middle_center"); LayoutUtils.openOverlappedWindow(this.getComponent(),dialog,"middle_center");
} }

View File

@ -163,8 +163,8 @@ public class WBinaryEditor extends WEditor
adwindow = ADWindow.findADWindow(getComponent()); adwindow = ADWindow.findADWindow(getComponent());
if (adwindow != null) { if (adwindow != null) {
ADWindowContent content = adwindow.getADWindowContent(); ADWindowContent content = adwindow.getADWindowContent();
content.showBusyMask();
content.getComponent().getParent().appendChild(dialog); content.getComponent().getParent().appendChild(dialog);
content.showBusyMask(dialog);
LayoutUtils.openOverlappedWindow(content.getComponent().getParent(), dialog, "middle_center"); LayoutUtils.openOverlappedWindow(content.getComponent().getParent(), dialog, "middle_center");
} else { } else {
AEnv.showWindow(dialog); AEnv.showWindow(dialog);

View File

@ -248,7 +248,7 @@ public class WStringEditor extends WEditor implements ContextMenuListener
if (adwindowContent != null) if (adwindowContent != null)
{ {
adwindowContent.getComponent().getParent().appendChild(dialog); adwindowContent.getComponent().getParent().appendChild(dialog);
adwindowContent.showBusyMask(); adwindowContent.showBusyMask(dialog);
LayoutUtils.openOverlappedWindow(adwindowContent.getComponent().getParent(), dialog, "middle_center"); LayoutUtils.openOverlappedWindow(adwindowContent.getComponent().getParent(), dialog, "middle_center");
} }
else else

View File

@ -134,8 +134,8 @@ public class ExportAction implements EventListener<Event>
confirmPanel.addActionListener(this); confirmPanel.addActionListener(this);
} }
panel.showBusyMask();
panel.getComponent().getParent().appendChild(winExportFile); panel.getComponent().getParent().appendChild(winExportFile);
panel.showBusyMask(winExportFile);
LayoutUtils.openOverlappedWindow(panel.getComponent(), winExportFile, "middle_center"); LayoutUtils.openOverlappedWindow(panel.getComponent(), winExportFile, "middle_center");
winExportFile.addEventListener(DialogEvents.ON_WINDOW_CLOSE, this); winExportFile.addEventListener(DialogEvents.ON_WINDOW_CLOSE, this);
} }

View File

@ -196,8 +196,8 @@ public class FileImportAction implements EventListener<Event>
confirmPanel.addActionListener(this); confirmPanel.addActionListener(this);
} }
panel.showBusyMask();
panel.getComponent().getParent().appendChild(winImportFile); panel.getComponent().getParent().appendChild(winImportFile);
panel.showBusyMask(winImportFile);
LayoutUtils.openOverlappedWindow(panel.getComponent(), winImportFile, "middle_center"); LayoutUtils.openOverlappedWindow(panel.getComponent(), winImportFile, "middle_center");
winImportFile.addEventListener(DialogEvents.ON_WINDOW_CLOSE, this); winImportFile.addEventListener(DialogEvents.ON_WINDOW_CLOSE, this);
} }

View File

@ -3,3 +3,38 @@ function _idempiere_popup_window(refid, windowid, position) {
var window = zk(windowid); var window = zk(windowid);
window.position(ref.$n(), position); window.position(ref.$n(), position);
} }
zk.override(zk.Widget.prototype, "canActivate",
function () {
var b = this.$canActivate.apply(this, arguments);
if (b) {
if (zk.currentModal) {
return true;
}
var wgt = this;
while (wgt) {
if (wgt.busy) {
if (wgt.busy.className == 'zul.wnd.Window') {
if (zUtl.isAncestor(wgt.busy, this)) {
return true;
} else {
wgt.busy.focus(0);
return false;
}
} else {
jq.focusOut();
}
return false;
}
if (wgt.className == 'zul.wnd.Window') {
if (wgt.getMode() == 'overlapped') {
return true;
}
}
wgt = wgt.parent;
}
return true;
} else {
return false;
}
});