IDEMPIERE-2532:issue relate show dialog when run process
show message success event hasn't any m_logs show message error same success (use ProcessInfoDialog not use FDialog)
This commit is contained in:
parent
220d14a3d1
commit
b827cbf292
|
@ -53,13 +53,38 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
|
||||||
private Button btnOk = ButtonFactory.createNamedButton(ConfirmPanel.A_OK);
|
private Button btnOk = ButtonFactory.createNamedButton(ConfirmPanel.A_OK);
|
||||||
private Image img = new Image();
|
private Image img = new Image();
|
||||||
public static final String INFORMATION = "~./zul/img/msgbox/info-btn.png";
|
public static final String INFORMATION = "~./zul/img/msgbox/info-btn.png";
|
||||||
|
public static final String ERROR = "~./zul/img/msgbox/info-btn.png";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Should use {@link #ProcessInfoDialog(String, String, ProcessInfo)} for flexible show message
|
||||||
|
* @param title
|
||||||
|
* @param header
|
||||||
|
* @param m_logs
|
||||||
|
*/
|
||||||
public ProcessInfoDialog(String title, String header,
|
public ProcessInfoDialog(String title, String header,
|
||||||
ProcessInfoLog[] m_logs) {
|
ProcessInfoLog[] m_logs) {
|
||||||
init(title, header, m_logs);
|
init(title, header, null, m_logs);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init(String title, String header, ProcessInfoLog[] m_logs) {
|
/**
|
||||||
|
* show result after run a process
|
||||||
|
* @param title
|
||||||
|
* @param header
|
||||||
|
* @param pi
|
||||||
|
*/
|
||||||
|
public ProcessInfoDialog(String title, String header, ProcessInfo pi, boolean needFillLogFromDb) {
|
||||||
|
if (needFillLogFromDb)
|
||||||
|
ProcessInfoUtil.setLogFromDB(pi);
|
||||||
|
init(pi.getTitle(), null, pi, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param title
|
||||||
|
* @param header
|
||||||
|
* @param m_logs
|
||||||
|
*/
|
||||||
|
private void init(String title, String header, ProcessInfo pi, ProcessInfoLog[] m_logs) {
|
||||||
this.setTitle(title);
|
this.setTitle(title);
|
||||||
this.setClosable(true);
|
this.setClosable(true);
|
||||||
this.setSizable(true);
|
this.setSizable(true);
|
||||||
|
@ -67,7 +92,7 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
|
||||||
this.setBorder("normal");
|
this.setBorder("normal");
|
||||||
this.setContentStyle("background-color:#ffffff;");
|
this.setContentStyle("background-color:#ffffff;");
|
||||||
|
|
||||||
this.setId(title);
|
//this.setId(title);
|
||||||
|
|
||||||
lblMsg.setEncode(false);
|
lblMsg.setEncode(false);
|
||||||
lblMsg.setValue(header);
|
lblMsg.setValue(header);
|
||||||
|
@ -81,6 +106,57 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
|
||||||
Separator sep = new Separator("horizontal");
|
Separator sep = new Separator("horizontal");
|
||||||
pnlMessage.appendChild(sep);
|
pnlMessage.appendChild(sep);
|
||||||
|
|
||||||
|
Hbox pnlImage = new Hbox();
|
||||||
|
img.setSrc((pi != null && pi.isError()) ? ERROR:INFORMATION);
|
||||||
|
pnlImage.setWidth("72px");
|
||||||
|
pnlImage.setAlign("center");
|
||||||
|
pnlImage.setPack("center");
|
||||||
|
pnlImage.appendChild(img);
|
||||||
|
|
||||||
|
Hbox north = new Hbox();
|
||||||
|
north.setAlign("center");
|
||||||
|
north.setStyle("margin: 20pt 10pt 20pt 10pt;"); // trbl
|
||||||
|
this.appendChild(north);
|
||||||
|
north.appendChild(pnlImage);
|
||||||
|
|
||||||
|
pnlMessage.appendChild(new Text(Msg.getMsg(Env.getCtx(), pi.isError()?"Error":"Success")));
|
||||||
|
pnlMessage.appendChild(new Separator("horizontal"));
|
||||||
|
|
||||||
|
north.appendChild(pnlMessage);
|
||||||
|
Hbox pnlButtons = new Hbox();
|
||||||
|
pnlButtons.setHeight("52px");
|
||||||
|
pnlButtons.setAlign("center");
|
||||||
|
pnlButtons.setPack("end");
|
||||||
|
pnlButtons.appendChild(btnOk);
|
||||||
|
|
||||||
|
Separator separator = new Separator();
|
||||||
|
|
||||||
|
separator.setWidth("100%");
|
||||||
|
separator.setBar(true);
|
||||||
|
this.appendChild(separator);
|
||||||
|
|
||||||
|
Hbox south = new Hbox();
|
||||||
|
south.setPack("end");
|
||||||
|
south.setWidth("100%");
|
||||||
|
this.appendChild(south);
|
||||||
|
south.appendChild(pnlButtons);
|
||||||
|
|
||||||
|
if (pi != null){
|
||||||
|
m_logs = pi.getLogs();
|
||||||
|
String summary = pi.getSummary();
|
||||||
|
if (summary != null && summary.indexOf('@') != -1)
|
||||||
|
summary = Msg.parseTranslation(Env.getCtx(), summary);
|
||||||
|
|
||||||
|
if (summary != null && summary.trim().length() > 0 && !summary.trim().equalsIgnoreCase("Report")){
|
||||||
|
pnlMessage.appendChild(new Text(summary));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_logs != null && m_logs.length > 0){
|
||||||
|
separator = new Separator();
|
||||||
|
separator.setWidth("100%");
|
||||||
|
separator.setBar(true);
|
||||||
|
pnlMessage.appendChild(separator);
|
||||||
for (int loopCtr = 0; loopCtr < m_logs.length; loopCtr++) {
|
for (int loopCtr = 0; loopCtr < m_logs.length; loopCtr++) {
|
||||||
ProcessInfoLog log = m_logs[loopCtr];
|
ProcessInfoLog log = m_logs[loopCtr];
|
||||||
if (log.getP_Msg() != null || log.getP_Date() != null || log.getP_Number() != null) {
|
if (log.getP_Msg() != null || log.getP_Date() != null || log.getP_Number() != null) {
|
||||||
|
@ -111,41 +187,8 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
|
||||||
pnlMessage.appendChild(new Separator("horizontal"));
|
pnlMessage.appendChild(new Separator("horizontal"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Hbox pnlImage = new Hbox();
|
|
||||||
img.setSrc(INFORMATION);
|
|
||||||
pnlImage.setWidth("72px");
|
|
||||||
pnlImage.setAlign("center");
|
|
||||||
pnlImage.setPack("center");
|
|
||||||
pnlImage.appendChild(img);
|
|
||||||
|
|
||||||
Hbox north = new Hbox();
|
|
||||||
north.setAlign("center");
|
|
||||||
north.setStyle("margin: 20pt 10pt 20pt 10pt;"); // trbl
|
|
||||||
this.appendChild(north);
|
|
||||||
north.appendChild(pnlImage);
|
|
||||||
north.appendChild(pnlMessage);
|
|
||||||
|
|
||||||
Hbox pnlButtons = new Hbox();
|
|
||||||
pnlButtons.setHeight("52px");
|
|
||||||
pnlButtons.setAlign("center");
|
|
||||||
pnlButtons.setPack("end");
|
|
||||||
pnlButtons.appendChild(btnOk);
|
|
||||||
|
|
||||||
Separator separator = new Separator();
|
|
||||||
|
|
||||||
separator.setWidth("100%");
|
|
||||||
separator.setBar(true);
|
|
||||||
this.appendChild(separator);
|
|
||||||
|
|
||||||
Hbox south = new Hbox();
|
|
||||||
south.setPack("end");
|
|
||||||
south.setWidth("100%");
|
|
||||||
this.appendChild(south);
|
|
||||||
south.appendChild(pnlButtons);
|
|
||||||
|
|
||||||
this.setBorder("normal");
|
|
||||||
this.setContentStyle("background-color:#ffffff;");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
|
@ -165,13 +208,7 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
|
||||||
* just pass false, other pass true to avoid duplicate message
|
* 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 void showProcessInfo (ProcessInfo pi, int windowNo, final Component comp, boolean needFillLogFromDb) {
|
||||||
// Get Log Info
|
ProcessInfoDialog dialog = new ProcessInfoDialog(AEnv.getDialogHeader(Env.getCtx(), windowNo),AEnv.getDialogHeader(Env.getCtx(), windowNo), pi, needFillLogFromDb);
|
||||||
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);;
|
final ISupportMask supportMask = LayoutUtils.showWindowWithMask(dialog, comp, LayoutUtils.OVERLAP_PARENT);;
|
||||||
dialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
dialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -179,8 +216,5 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
|
||||||
supportMask.hideMask();
|
supportMask.hideMask();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,6 @@ import org.adempiere.webui.factory.InfoManager;
|
||||||
import org.adempiere.webui.part.ITabOnSelectHandler;
|
import org.adempiere.webui.part.ITabOnSelectHandler;
|
||||||
import org.adempiere.webui.part.WindowContainer;
|
import org.adempiere.webui.part.WindowContainer;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.adempiere.webui.window.FDialog;
|
|
||||||
import org.compiere.minigrid.ColumnInfo;
|
import org.compiere.minigrid.ColumnInfo;
|
||||||
import org.compiere.minigrid.IDColumn;
|
import org.compiere.minigrid.IDColumn;
|
||||||
import org.compiere.model.MInfoColumn;
|
import org.compiere.model.MInfoColumn;
|
||||||
|
@ -72,8 +71,6 @@ import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.model.X_AD_CtxHelp;
|
import org.compiere.model.X_AD_CtxHelp;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
import org.compiere.process.ProcessInfoLog;
|
|
||||||
import org.compiere.process.ProcessInfoUtil;
|
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -1550,27 +1547,11 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
||||||
// enable or disable control button rely selected record status
|
// enable or disable control button rely selected record status
|
||||||
enableButtons();
|
enableButtons();
|
||||||
}else if (m_pi.isError()){
|
}else if (m_pi.isError()){
|
||||||
// show error info
|
ProcessInfoDialog.showProcessInfo(m_pi, p_WindowNo, InfoPanel.this, true);
|
||||||
ProcessInfoUtil.setLogFromDB(m_pi);
|
|
||||||
ProcessInfoLog m_logs[] = m_pi.getLogs();
|
|
||||||
if (m_logs != null && m_logs.length > 0) {
|
|
||||||
ProcessInfoDialog.showProcessInfo(m_pi, p_WindowNo, InfoPanel.this, false);
|
|
||||||
}else{
|
|
||||||
FDialog.error(p_WindowNo, m_pi.getSummary());
|
|
||||||
}
|
|
||||||
// enable or disable control button rely selected record status
|
// enable or disable control button rely selected record status
|
||||||
enableButtons();
|
enableButtons();
|
||||||
}else if (!m_pi.isError()){
|
}else if (!m_pi.isError()){
|
||||||
ProcessInfoUtil.setLogFromDB(m_pi);
|
ProcessInfoDialog.showProcessInfo(m_pi, p_WindowNo, InfoPanel.this, true);
|
||||||
ProcessInfoLog m_logs[] = m_pi.getLogs();
|
|
||||||
if (m_logs != null && m_logs.length > 0) {
|
|
||||||
ProcessInfoDialog.showProcessInfo(m_pi, p_WindowNo, InfoPanel.this, false);
|
|
||||||
|
|
||||||
// when success, show summary if exists
|
|
||||||
}else if (m_pi.getSummary() != null && m_pi.getSummary().trim().length() > 0){
|
|
||||||
FDialog.info(p_WindowNo, null, m_pi.getSummary());
|
|
||||||
}
|
|
||||||
|
|
||||||
Clients.response(new AuEcho(InfoPanel.this, "onQueryCallback", m_results));
|
Clients.response(new AuEcho(InfoPanel.this, "onQueryCallback", m_results));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue