IDEMPIERE-2109:make show ProcessInfoDialog as common function
This commit is contained in:
parent
50c9fad1af
commit
9678aa617b
|
@ -3063,17 +3063,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
ProcessInfoUtil.setLogFromDB(pi);
|
||||
ProcessInfoLog m_logs[] = pi.getLogs();
|
||||
statusBar.setStatusLine(pi.getSummary(), pi.isError(),m_logs);
|
||||
if (m_logs != null) {
|
||||
ProcessInfoDialog dialog = new ProcessInfoDialog(AEnv.getDialogHeader(ctx, curWindowNo),AEnv.getDialogHeader(ctx, curWindowNo), m_logs);
|
||||
dialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
hideBusyMask();
|
||||
}
|
||||
});
|
||||
getComponent().getParent().appendChild(dialog);
|
||||
showBusyMask(dialog);
|
||||
LayoutUtils.openOverlappedWindow(this.getComponent(),dialog,"middle_center");
|
||||
|
||||
if (m_logs != null && m_logs.length > 0) {
|
||||
ProcessInfoDialog.showProcessInfo(pi, curWindowNo, getComponent(), false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,17 +16,22 @@ package org.adempiere.webui.component;
|
|||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import org.adempiere.webui.ISupportMask;
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.event.DialogEvents;
|
||||
import org.adempiere.webui.factory.ButtonFactory;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.process.ProcessInfoLog;
|
||||
import org.compiere.process.ProcessInfoUtil;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.zkoss.zhtml.Text;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.A;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Image;
|
||||
import org.zkoss.zul.Separator;
|
||||
|
@ -162,4 +167,32 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
|
|||
this.detach();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* after run a process, call this function to show result in a dialog
|
||||
* @param pi
|
||||
* @param windowNo
|
||||
* @param comp
|
||||
* @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) {
|
||||
// Get Log Info
|
||||
if (needFillLogFromDb)
|
||||
ProcessInfoUtil.setLogFromDB(pi);
|
||||
ProcessInfoLog m_logs[] = pi.getLogs();
|
||||
|
||||
if (m_logs != null && m_logs.length > 0) {
|
||||
ProcessInfoDialog dialog = new ProcessInfoDialog(AEnv.getDialogHeader(Env.getCtx(), windowNo),AEnv.getDialogHeader(Env.getCtx(), windowNo), m_logs);
|
||||
final ISupportMask supportMask = LayoutUtils.showWindowWithMask(dialog, comp, LayoutUtils.OVERLAP_PARENT);;
|
||||
dialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
supportMask.hideMask();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue