IDEMPIERE-3630 Process Dialog should wait for Info Popup.

This commit is contained in:
Heng Sin Low 2018-01-26 18:14:37 +08:00
parent 4d7f35616e
commit 2f71950292
3 changed files with 59 additions and 6 deletions

View File

@ -94,7 +94,9 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
*/ */
private static final long serialVersionUID = -6728929130788829223L; private static final long serialVersionUID = -6728929130788829223L;
public static final String ON_INITIAL_FOCUS_EVENT = "onInitialFocus"; public static final String ON_INITIAL_FOCUS_EVENT = "onInitialFocus";
private static final String ON_OK_ECHO = "onOkEcho";
/** Logger */ /** Logger */
private static CLogger log = CLogger.getCLogger(ProcessDialog.class); private static CLogger log = CLogger.getCLogger(ProcessDialog.class);
@ -138,6 +140,7 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
querySaved(); querySaved();
addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this); addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this);
addEventListener(ON_INITIAL_FOCUS_EVENT, this); addEventListener(ON_INITIAL_FOCUS_EVENT, this);
addEventListener(ON_OK_ECHO, this);
} }
catch(Exception ex) catch(Exception ex)
{ {
@ -188,10 +191,9 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
} else if (bOK.equals(component)) { } else if (bOK.equals(component)) {
super.onEvent(event); super.onEvent(event);
if (isParameterPage) onOk();
startProcess(); } else if (event.getName().equals(ON_OK_ECHO)) {
else onOk();
restart();
}else if (bCancel.equals(component)){ }else if (bCancel.equals(component)){
super.onEvent(event); super.onEvent(event);
cancelProcess(); cancelProcess();
@ -228,6 +230,20 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
} }
} }
private void onOk() {
if (isParameterPage)
{
if (getParameterPanel().isWaitingForDialog())
{
Events.echoEvent(ON_OK_ECHO, this, null);
return;
}
startProcess();
}
else
restart();
}
private void onCtrlKeyEvent(KeyEvent keyEvent) { private void onCtrlKeyEvent(KeyEvent keyEvent) {
if (keyEvent.isAltKey() && keyEvent.getKeyCode() == 0x58) { // Alt-X if (keyEvent.isAltKey() && keyEvent.getKeyCode() == 0x58) { // Alt-X
if (m_WindowNo > 0) { if (m_WindowNo > 0) {

View File

@ -30,6 +30,7 @@ import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.HtmlBasedComponent; import org.zkoss.zk.ui.HtmlBasedComponent;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
/** /**
* *
@ -48,6 +49,9 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
* *
*/ */
private static final long serialVersionUID = -6227339628038418701L; private static final long serialVersionUID = -6227339628038418701L;
private static final String ON_OK_ECHO = "onOkEcho";
/** Logger */ /** Logger */
private static CLogger log = CLogger.getCLogger(ProcessModalDialog.class); private static CLogger log = CLogger.getCLogger(ProcessModalDialog.class);
// //
@ -112,6 +116,7 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
{ {
log.log(Level.SEVERE, "", ex); log.log(Level.SEVERE, "", ex);
} }
addEventListener(ON_OK_ECHO, this);
} }
public ProcessModalDialog (int WindowNo, int AD_Process_ID, int tableId, int recordId, boolean autoStart) public ProcessModalDialog (int WindowNo, int AD_Process_ID, int tableId, int recordId, boolean autoStart)
@ -199,13 +204,24 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
Component component = event.getTarget(); Component component = event.getTarget();
if (component.equals(bOK)) { if (component.equals(bOK)) {
super.onEvent(event); super.onEvent(event);
startProcess(); onOk();
} else if (event.getName().equals(ON_OK_ECHO)) {
onOk();
} else if (component.equals(bCancel)) { } else if (component.equals(bCancel)) {
super.onEvent(event); super.onEvent(event);
cancelProcess(); cancelProcess();
}else { }else {
super.onEvent(event); super.onEvent(event);
} }
}
private void onOk() {
if (getParameterPanel().isWaitingForDialog())
{
Events.echoEvent(ON_OK_ECHO, this, null);
return;
}
startProcess();
} }
protected void onClientInfo() { protected void onClientInfo() {

View File

@ -37,6 +37,7 @@ import org.adempiere.webui.component.Urlbox;
import org.adempiere.webui.editor.IZoomableEditor; import org.adempiere.webui.editor.IZoomableEditor;
import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WEditorPopupMenu; import org.adempiere.webui.editor.WEditorPopupMenu;
import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.editor.WebEditorFactory; import org.adempiere.webui.editor.WebEditorFactory;
import org.adempiere.webui.event.ContextMenuListener; import org.adempiere.webui.event.ContextMenuListener;
import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeEvent;
@ -932,6 +933,26 @@ public class ProcessParameterPanel extends Panel implements
return null; return null;
} }
/**
* @return true if editor is showing dialog awaiting user action
*/
public boolean isWaitingForDialog() {
for (int i = 0; i < m_mFields.size(); i++) {
// Get Values
WEditor editor = (WEditor) m_wEditors.get(i);
WEditor editor2 = (WEditor) m_wEditors2.get(i);
if (editor != null && editor instanceof WSearchEditor) {
if (((WSearchEditor)editor).isShowingDialog())
return true;
} else if (editor2 != null && editor2 instanceof WSearchEditor) {
if (((WSearchEditor)editor2).isShowingDialog())
return true;
}
}
return false;
}
static class ZoomListener implements EventListener<Event> { static class ZoomListener implements EventListener<Event> {
private IZoomableEditor searchEditor; private IZoomableEditor searchEditor;