IDEMPIERE-4864 Fix shortcut handling for combobox and ad window (#784)
Fix focus issue after closing of Process Info Dialog.
This commit is contained in:
parent
e27e11cfce
commit
c72d4609b1
|
@ -16,7 +16,9 @@ package org.adempiere.webui;
|
|||
|
||||
import org.adempiere.webui.component.Mask;
|
||||
import org.adempiere.webui.part.UIPart;
|
||||
import org.zkoss.zk.au.out.AuScript;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.util.Clients;
|
||||
|
||||
/**
|
||||
* Helper class for any component want implement {@link ISupportMask}
|
||||
|
@ -73,7 +75,14 @@ public class ShowMaskWrapper implements ISupportMask {
|
|||
if (maskObj != null || maskObj.getParent() != null){
|
||||
// in same request, not yet call to show mask
|
||||
if (!ShowMaskWrapper.hasFlagShowMask(comp)){
|
||||
Component p = maskObj.getParent();
|
||||
maskObj.detach();
|
||||
if (p == comp) {
|
||||
StringBuilder script = new StringBuilder("var w=zk.Widget.$('#");
|
||||
script.append(p.getUuid()).append("');");
|
||||
script.append("w.busy=null;");
|
||||
Clients.response(new AuScript(script.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3486,7 +3486,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
showBusyMask(dialog);
|
||||
LayoutUtils.openOverlappedWindow(getComponent(), dialog, "middle_center");
|
||||
}
|
||||
dialog.focus();
|
||||
Executions.schedule(getComponent().getDesktop(), e -> dialog.focus(), new Event("onPostShowProcessModalDialog"));
|
||||
}
|
||||
if (adTabbox.getSelectedGridTab().isQuickForm()) {
|
||||
adTabbox.getSelectedGridTab().dataRefreshAll(false, false);
|
||||
|
@ -3653,7 +3653,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
|
||||
|
||||
if (m_logs != null && m_logs.length > 0) {
|
||||
ProcessInfoDialog.showProcessInfo(pi, curWindowNo, getComponent(), false);
|
||||
ProcessInfoDialog dialog = ProcessInfoDialog.showProcessInfo(pi, curWindowNo, getComponent(), false);
|
||||
dialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, e -> focusToActivePanel());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1356,4 +1356,15 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focus() {
|
||||
super.focus();
|
||||
if (getParameterPanel() != null) {
|
||||
if (getParameterPanel().focusToFirstEditor())
|
||||
return;
|
||||
}
|
||||
if (bOK != null)
|
||||
bOK.focus();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
|
|||
* @param needFillLogFromDb if ProcessInfoUtil.setLogFromDB(pi) is called by outer function,
|
||||
* just pass false, other pass true to avoid duplicate message
|
||||
*/
|
||||
public static void showProcessInfo (ProcessInfo pi, int windowNo, final Component comp, boolean needFillLogFromDb) {
|
||||
public static ProcessInfoDialog showProcessInfo (ProcessInfo pi, int windowNo, final Component comp, boolean needFillLogFromDb) {
|
||||
ProcessInfoDialog dialog = new ProcessInfoDialog(AEnv.getDialogHeader(Env.getCtx(), windowNo),AEnv.getDialogHeader(Env.getCtx(), windowNo), pi, needFillLogFromDb);
|
||||
final ISupportMask supportMask = LayoutUtils.showWindowWithMask(dialog, comp, LayoutUtils.OVERLAP_PARENT);
|
||||
dialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||
|
@ -224,6 +224,7 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
|
|||
supportMask.hideMask();
|
||||
}
|
||||
});
|
||||
Executions.schedule(comp.getDesktop(), e -> dialog.btnOk.focus(), new Event("onPostShowProcessInfoDialog"));
|
||||
Executions.schedule(comp.getDesktop(), e -> dialog.btnOk.focus(), new Event("onPostShowProcessInfoDialog"));
|
||||
return dialog;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue