IDEMPIERE-115 Implement feedback for process and report
(transplanted from c14cc7c6a518225ed55d15de5dc854ade05e28aa)
This commit is contained in:
parent
857badd5fc
commit
53cad636f6
|
@ -35,6 +35,7 @@ import org.compiere.process.ProcessInfoParameter;
|
||||||
import org.compiere.process.SvrProcess;
|
import org.compiere.process.SvrProcess;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Msg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate shipment for Vendor RMA.
|
* Generate shipment for Vendor RMA.
|
||||||
|
@ -228,6 +229,7 @@ public class InOutGenerateRMA extends SvrProcess
|
||||||
private void generateShipment(int M_RMA_ID)
|
private void generateShipment(int M_RMA_ID)
|
||||||
{
|
{
|
||||||
MRMA rma = new MRMA(getCtx(), M_RMA_ID, get_TrxName());
|
MRMA rma = new MRMA(getCtx(), M_RMA_ID, get_TrxName());
|
||||||
|
statusUpdate(Msg.getMsg(getCtx(), "Processing") + " " + rma.getDocumentInfo());
|
||||||
|
|
||||||
MInOut shipment = createShipment(rma);
|
MInOut shipment = createShipment(rma);
|
||||||
MInOutLine shipmentLines[] = createShipmentLines(rma, shipment);
|
MInOutLine shipmentLines[] = createShipmentLines(rma, shipment);
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.compiere.process.ProcessInfoParameter;
|
||||||
import org.compiere.process.SvrProcess;
|
import org.compiere.process.SvrProcess;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Msg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate invoice for Vendor RMA
|
* Generate invoice for Vendor RMA
|
||||||
|
@ -189,6 +190,7 @@ public class InvoiceGenerateRMA extends SvrProcess
|
||||||
private void generateInvoice(int M_RMA_ID)
|
private void generateInvoice(int M_RMA_ID)
|
||||||
{
|
{
|
||||||
MRMA rma = new MRMA(getCtx(), M_RMA_ID, get_TrxName());
|
MRMA rma = new MRMA(getCtx(), M_RMA_ID, get_TrxName());
|
||||||
|
statusUpdate(Msg.getMsg(getCtx(), "Processing") + " " + rma.getDocumentInfo());
|
||||||
|
|
||||||
MInvoice invoice = createInvoice(rma);
|
MInvoice invoice = createInvoice(rma);
|
||||||
MInvoiceLine invoiceLines[] = createInvoiceLines(rma, invoice);
|
MInvoiceLine invoiceLines[] = createInvoiceLines(rma, invoice);
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.compiere.model.MStorage;
|
||||||
import org.compiere.util.AdempiereUserError;
|
import org.compiere.util.AdempiereUserError;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Msg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate Shipments.
|
* Generate Shipments.
|
||||||
|
@ -214,6 +215,8 @@ public class InOutGenerate extends SvrProcess
|
||||||
while (rs.next ()) // Order
|
while (rs.next ()) // Order
|
||||||
{
|
{
|
||||||
MOrder order = new MOrder (getCtx(), rs, get_TrxName());
|
MOrder order = new MOrder (getCtx(), rs, get_TrxName());
|
||||||
|
statusUpdate(Msg.getMsg(getCtx(), "Processing") + " " + order.getDocumentInfo());
|
||||||
|
|
||||||
// New Header different Shipper, Shipment Location
|
// New Header different Shipper, Shipment Location
|
||||||
if (!p_ConsolidateDocument
|
if (!p_ConsolidateDocument
|
||||||
|| (m_shipment != null
|
|| (m_shipment != null
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.compiere.util.DB;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Language;
|
import org.compiere.util.Language;
|
||||||
|
import org.compiere.util.Msg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate Invoices
|
* Generate Invoices
|
||||||
|
@ -196,6 +197,7 @@ public class InvoiceGenerate extends SvrProcess
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
MOrder order = new MOrder (getCtx(), rs, get_TrxName());
|
MOrder order = new MOrder (getCtx(), rs, get_TrxName());
|
||||||
|
statusUpdate(Msg.getMsg(getCtx(), "Processing") + " " + order.getDocumentInfo());
|
||||||
|
|
||||||
// New Invoice Location
|
// New Invoice Location
|
||||||
if (!p_ConsolidateDocument
|
if (!p_ConsolidateDocument
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package org.adempiere.util;
|
||||||
|
|
||||||
|
import org.compiere.process.ProcessInfo;
|
||||||
|
|
||||||
|
public interface IProcessMonitor {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lock User Interface.
|
||||||
|
* Called from the Worker before processing
|
||||||
|
* @param pi process info
|
||||||
|
*/
|
||||||
|
public void lockUI (ProcessInfo pi);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unlock User Interface.
|
||||||
|
* Called from the Worker when processing is done
|
||||||
|
* @param pi process info
|
||||||
|
*/
|
||||||
|
public void unlockUI (ProcessInfo pi);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the UI locked
|
||||||
|
* @return true, if UI is locked
|
||||||
|
*/
|
||||||
|
public boolean isUILocked();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
public void statusUpdate(String message);
|
||||||
|
|
||||||
|
}
|
|
@ -134,6 +134,17 @@ public final class ProcessUtil {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static boolean startJavaProcess(Properties ctx, ProcessInfo pi, Trx trx, boolean managedTrx) {
|
public static boolean startJavaProcess(Properties ctx, ProcessInfo pi, Trx trx, boolean managedTrx) {
|
||||||
|
return startJavaProcess(ctx, pi, trx, managedTrx, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ctx
|
||||||
|
* @param pi
|
||||||
|
* @param trx
|
||||||
|
* @param managedTrx false if trx is managed by caller
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static boolean startJavaProcess(Properties ctx, ProcessInfo pi, Trx trx, boolean managedTrx, IProcessMonitor processMonitor) {
|
||||||
String className = pi.getClassName();
|
String className = pi.getClassName();
|
||||||
if (className == null) {
|
if (className == null) {
|
||||||
MProcess proc = new MProcess(ctx, pi.getAD_Process_ID(), trx.getTrxName());
|
MProcess proc = new MProcess(ctx, pi.getAD_Process_ID(), trx.getTrxName());
|
||||||
|
@ -197,6 +208,7 @@ public final class ProcessUtil {
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
process.setProcessMonitor(processMonitor);
|
||||||
success = process.startProcess(ctx, pi, trx);
|
success = process.startProcess(ctx, pi, trx);
|
||||||
if (success && trx != null && managedTrx)
|
if (success && trx != null && managedTrx)
|
||||||
{
|
{
|
||||||
|
|
|
@ -207,6 +207,8 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
|
|
||||||
private DataStatusEvent m_lastDataStatusEvent;
|
private DataStatusEvent m_lastDataStatusEvent;
|
||||||
|
|
||||||
|
private String m_parsedWhere;
|
||||||
|
|
||||||
// Context property names:
|
// Context property names:
|
||||||
public static final String CTX_KeyColumnName = "_TabInfo_KeyColumnName";
|
public static final String CTX_KeyColumnName = "_TabInfo_KeyColumnName";
|
||||||
public static final String CTX_LinkColumnName = "_TabInfo_LinkColumnName";
|
public static final String CTX_LinkColumnName = "_TabInfo_LinkColumnName";
|
||||||
|
@ -695,6 +697,23 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
|
|
||||||
m_extendedWhere = where.toString();
|
m_extendedWhere = where.toString();
|
||||||
|
|
||||||
|
if (m_extendedWhere.indexOf("@") > 1)
|
||||||
|
{
|
||||||
|
String s = Env.parseContext(Env.getCtx(), getWindowNo(), m_extendedWhere, false);
|
||||||
|
if (s != null)
|
||||||
|
{
|
||||||
|
if (!(s.equals(m_parsedWhere)))
|
||||||
|
{
|
||||||
|
refresh = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
refresh = false;
|
||||||
|
}
|
||||||
|
m_parsedWhere = s;
|
||||||
|
}
|
||||||
|
|
||||||
// Final Query
|
// Final Query
|
||||||
if (m_query.isActive())
|
if (m_query.isActive())
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.compiere.process.DocAction;
|
import org.compiere.process.DocAction;
|
||||||
import org.compiere.process.DocumentEngine;
|
import org.compiere.process.DocumentEngine;
|
||||||
import org.compiere.process.ProcessCall;
|
import org.compiere.process.ProcessCall;
|
||||||
|
@ -1590,6 +1591,7 @@ public final class MPayment extends X_C_Payment
|
||||||
private String m_processMsg = null;
|
private String m_processMsg = null;
|
||||||
/** Just Prepared Flag */
|
/** Just Prepared Flag */
|
||||||
private boolean m_justPrepared = false;
|
private boolean m_justPrepared = false;
|
||||||
|
private IProcessMonitor m_processMonitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unlock Document.
|
* Unlock Document.
|
||||||
|
@ -2599,4 +2601,10 @@ public final class MPayment extends X_C_Payment
|
||||||
return getPayAmt();
|
return getPayAmt();
|
||||||
} // getApprovalAmt
|
} // getApprovalAmt
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setProcessMonitor(IProcessMonitor processMonitor) {
|
||||||
|
m_processMonitor = processMonitor;
|
||||||
|
}
|
||||||
|
|
||||||
} // MPayment
|
} // MPayment
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.util.StringTokenizer;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.exceptions.FillMandatoryException;
|
import org.adempiere.exceptions.FillMandatoryException;
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.compiere.process.SvrProcess;
|
import org.compiere.process.SvrProcess;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Language;
|
import org.compiere.util.Language;
|
||||||
|
@ -232,6 +233,7 @@ public class MYear extends X_C_Year
|
||||||
cal.set(Calendar.MILLISECOND, 0);
|
cal.set(Calendar.MILLISECOND, 0);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
IProcessMonitor processMonitor = Env.getProcessMonitor(getCtx());
|
||||||
for (int month = 0; month < 12; month++)
|
for (int month = 0; month < 12; month++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -255,6 +257,10 @@ public class MYear extends X_C_Year
|
||||||
period.setStartDate(start);
|
period.setStartDate(start);
|
||||||
period.setEndDate(end);
|
period.setEndDate(end);
|
||||||
}
|
}
|
||||||
|
if (processMonitor != null)
|
||||||
|
{
|
||||||
|
processMonitor.statusUpdate(period.toString());
|
||||||
|
}
|
||||||
period.saveEx(get_TrxName()); // Creates Period Control
|
period.saveEx(get_TrxName()); // Creates Period Control
|
||||||
// get first day of next month
|
// get first day of next month
|
||||||
cal.add(Calendar.DAY_OF_YEAR, 1);
|
cal.add(Calendar.DAY_OF_YEAR, 1);
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.compiere.process;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.compiere.util.Trx;
|
import org.compiere.util.Trx;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,4 +46,9 @@ public interface ProcessCall
|
||||||
*/
|
*/
|
||||||
public boolean startProcess (Properties ctx, ProcessInfo pi, Trx trx);
|
public boolean startProcess (Properties ctx, ProcessInfo pi, Trx trx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param processMonitor
|
||||||
|
*/
|
||||||
|
public void setProcessMonitor(IProcessMonitor processMonitor);
|
||||||
|
|
||||||
} // ProcessCall
|
} // ProcessCall
|
||||||
|
|
|
@ -25,9 +25,9 @@ import java.sql.Timestamp;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.compiere.model.MPInstance;
|
import org.compiere.model.MPInstance;
|
||||||
import org.compiere.model.PO;
|
import org.compiere.model.PO;
|
||||||
import org.compiere.util.CLogMgt;
|
|
||||||
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;
|
||||||
|
@ -51,6 +51,9 @@ import org.compiere.util.Trx;
|
||||||
*/
|
*/
|
||||||
public abstract class SvrProcess implements ProcessCall
|
public abstract class SvrProcess implements ProcessCall
|
||||||
{
|
{
|
||||||
|
public static final String PROCESS_INFO_CTX_KEY = "ProcessInfo";
|
||||||
|
public static final String PROCESS_MONITOR_CTX_KEY = "ProcessMonitor";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server Process.
|
* Server Process.
|
||||||
* Note that the class is initiated by startProcess.
|
* Note that the class is initiated by startProcess.
|
||||||
|
@ -72,6 +75,7 @@ public abstract class SvrProcess implements ProcessCall
|
||||||
private PO m_lockedObject = null;
|
private PO m_lockedObject = null;
|
||||||
/** Process Main transaction */
|
/** Process Main transaction */
|
||||||
private Trx m_trx;
|
private Trx m_trx;
|
||||||
|
private IProcessMonitor processMonitor;
|
||||||
|
|
||||||
/** Common Error Message */
|
/** Common Error Message */
|
||||||
protected static String MSG_SaveErrorRowNotFound = "@SaveErrorRowNotFound@";
|
protected static String MSG_SaveErrorRowNotFound = "@SaveErrorRowNotFound@";
|
||||||
|
@ -102,8 +106,18 @@ public abstract class SvrProcess implements ProcessCall
|
||||||
//
|
//
|
||||||
lock();
|
lock();
|
||||||
|
|
||||||
boolean success = process();
|
boolean success = false;
|
||||||
//
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_ctx.put(PROCESS_INFO_CTX_KEY, m_pi);
|
||||||
|
m_ctx.put(PROCESS_MONITOR_CTX_KEY, processMonitor);
|
||||||
|
success = process();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
m_ctx.remove(PROCESS_INFO_CTX_KEY);
|
||||||
|
m_ctx.remove(PROCESS_MONITOR_CTX_KEY);
|
||||||
if (localTrx)
|
if (localTrx)
|
||||||
{
|
{
|
||||||
if (success)
|
if (success)
|
||||||
|
@ -128,6 +142,7 @@ public abstract class SvrProcess implements ProcessCall
|
||||||
|
|
||||||
// outside transaction processing [ teo_sarca, 1646891 ]
|
// outside transaction processing [ teo_sarca, 1646891 ]
|
||||||
postProcess(!m_pi.isError());
|
postProcess(!m_pi.isError());
|
||||||
|
}
|
||||||
|
|
||||||
return !m_pi.isError();
|
return !m_pi.isError();
|
||||||
} // startProcess
|
} // startProcess
|
||||||
|
@ -519,4 +534,21 @@ public abstract class SvrProcess implements ProcessCall
|
||||||
return null;
|
return null;
|
||||||
} // get_TrxName
|
} // get_TrxName
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setProcessMonitor(IProcessMonitor monitor)
|
||||||
|
{
|
||||||
|
processMonitor = monitor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* publish status update message
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
protected void statusUpdate(String message)
|
||||||
|
{
|
||||||
|
if (processMonitor != null)
|
||||||
|
{
|
||||||
|
processMonitor.statusUpdate(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
} // SvrProcess
|
} // SvrProcess
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.util;
|
package org.compiere.util;
|
||||||
|
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,29 +36,10 @@ import org.compiere.process.ProcessInfo;
|
||||||
*
|
*
|
||||||
* @author Jorg Janke
|
* @author Jorg Janke
|
||||||
* @version $Id: ASyncProcess.java,v 1.2 2006/07/30 00:51:05 jjanke Exp $
|
* @version $Id: ASyncProcess.java,v 1.2 2006/07/30 00:51:05 jjanke Exp $
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public interface ASyncProcess
|
public interface ASyncProcess extends IProcessMonitor
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Lock User Interface.
|
|
||||||
* Called from the Worker before processing
|
|
||||||
* @param pi process info
|
|
||||||
*/
|
|
||||||
public void lockUI (ProcessInfo pi);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unlock User Interface.
|
|
||||||
* Called from the Worker when processing is done
|
|
||||||
* @param pi result of execute ASync call
|
|
||||||
*/
|
|
||||||
public void unlockUI (ProcessInfo pi);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is the UI locked (Internal method)
|
|
||||||
* @return true, if UI is locked
|
|
||||||
*/
|
|
||||||
boolean isUILocked();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to be executed async.
|
* Method to be executed async.
|
||||||
* Called from the Worker
|
* Called from the Worker
|
||||||
|
|
|
@ -47,6 +47,7 @@ import javax.swing.JFrame;
|
||||||
|
|
||||||
import org.adempiere.base.Core;
|
import org.adempiere.base.Core;
|
||||||
import org.adempiere.base.IResourceFinder;
|
import org.adempiere.base.IResourceFinder;
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.adempiere.util.ServerContextProvider;
|
import org.adempiere.util.ServerContextProvider;
|
||||||
import org.compiere.db.CConnection;
|
import org.compiere.db.CConnection;
|
||||||
import org.compiere.model.GridWindowVO;
|
import org.compiere.model.GridWindowVO;
|
||||||
|
@ -55,6 +56,8 @@ import org.compiere.model.MLookupCache;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.model.MSession;
|
import org.compiere.model.MSession;
|
||||||
import org.compiere.model.PO;
|
import org.compiere.model.PO;
|
||||||
|
import org.compiere.process.ProcessInfo;
|
||||||
|
import org.compiere.process.SvrProcess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* System Environment and static variables.
|
* System Environment and static variables.
|
||||||
|
@ -1691,6 +1694,17 @@ public final class Env
|
||||||
return mWindowVO;
|
return mWindowVO;
|
||||||
} // getWindow
|
} // getWindow
|
||||||
|
|
||||||
|
//Current Process
|
||||||
|
public static IProcessMonitor getProcessMonitor(Properties ctx)
|
||||||
|
{
|
||||||
|
return (IProcessMonitor) ctx.get(SvrProcess.PROCESS_MONITOR_CTX_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ProcessInfo getProcessInfo(Properties ctx)
|
||||||
|
{
|
||||||
|
return (ProcessInfo) ctx.get(SvrProcess.PROCESS_INFO_CTX_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Static Variables
|
* Static Variables
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -64,6 +64,7 @@ import net.sf.jasperreports.engine.util.JRSwapFile;
|
||||||
import org.adempiere.base.Service;
|
import org.adempiere.base.Service;
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
import org.adempiere.exceptions.DBException;
|
import org.adempiere.exceptions.DBException;
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.compiere.model.MAttachment;
|
import org.compiere.model.MAttachment;
|
||||||
import org.compiere.model.MAttachmentEntry;
|
import org.compiere.model.MAttachmentEntry;
|
||||||
import org.compiere.model.MProcess;
|
import org.compiere.model.MProcess;
|
||||||
|
@ -118,6 +119,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
|
||||||
|
|
||||||
private ProcessInfo processInfo;
|
private ProcessInfo processInfo;
|
||||||
private MAttachment attachment;
|
private MAttachment attachment;
|
||||||
|
private IProcessMonitor m_processMonitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author rlemeill
|
* @author rlemeill
|
||||||
|
@ -1195,4 +1197,9 @@ public class ReportStarter implements ProcessCall, ClientProcess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setProcessMonitor(IProcessMonitor processMonitor) {
|
||||||
|
m_processMonitor = processMonitor;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -59,6 +59,7 @@ import javax.swing.SwingUtilities;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
|
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.compiere.apps.form.FormFrame;
|
import org.compiere.apps.form.FormFrame;
|
||||||
import org.compiere.apps.search.Find;
|
import org.compiere.apps.search.Find;
|
||||||
import org.compiere.grid.APanelTab;
|
import org.compiere.grid.APanelTab;
|
||||||
|
@ -94,7 +95,6 @@ import org.compiere.process.DocAction;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
import org.compiere.process.ProcessInfoUtil;
|
import org.compiere.process.ProcessInfoUtil;
|
||||||
import org.compiere.swing.CPanel;
|
import org.compiere.swing.CPanel;
|
||||||
import org.compiere.util.ASyncProcess;
|
|
||||||
import org.compiere.util.CLogMgt;
|
import org.compiere.util.CLogMgt;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
|
@ -141,7 +141,7 @@ import org.compiere.util.Util;
|
||||||
* @sponsor www.metas.de
|
* @sponsor www.metas.de
|
||||||
*/
|
*/
|
||||||
public final class APanel extends CPanel
|
public final class APanel extends CPanel
|
||||||
implements DataStatusListener, ChangeListener, ActionListener, ASyncProcess
|
implements DataStatusListener, ChangeListener, ActionListener, IProcessMonitor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -2894,4 +2894,13 @@ public final class APanel extends CPanel
|
||||||
public JTabbedPane getCurrentTabbedPane() {
|
public JTabbedPane getCurrentTabbedPane() {
|
||||||
return m_curWinTab;
|
return m_curWinTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void statusUpdate(String message) {
|
||||||
|
JFrame frame = AEnv.getFrame(this);
|
||||||
|
if (frame == null) // during init
|
||||||
|
return;
|
||||||
|
if (frame instanceof AWindow)
|
||||||
|
((AWindow)frame).setBusyMessage(message);
|
||||||
|
}
|
||||||
} // APanel
|
} // APanel
|
||||||
|
|
|
@ -2,9 +2,9 @@ package org.compiere.apps;
|
||||||
|
|
||||||
import java.awt.Container;
|
import java.awt.Container;
|
||||||
|
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.compiere.model.MPInstance;
|
import org.compiere.model.MPInstance;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
import org.compiere.util.ASyncProcess;
|
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
@ -34,7 +34,7 @@ public class ClientProcessCtrl {
|
||||||
* @param trx Transaction
|
* @param trx Transaction
|
||||||
* @return worker started ProcessCtl instance or null for workflow
|
* @return worker started ProcessCtl instance or null for workflow
|
||||||
*/
|
*/
|
||||||
public static ProcessCtl process (ASyncProcess parent, int WindowNo, ProcessInfo pi, Trx trx)
|
public static ProcessCtl process (IProcessMonitor parent, int WindowNo, ProcessInfo pi, Trx trx)
|
||||||
{
|
{
|
||||||
log.fine("WindowNo=" + WindowNo + " - " + pi);
|
log.fine("WindowNo=" + WindowNo + " - " + pi);
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,9 @@ import java.awt.Container;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.compiere.model.MPInstance;
|
import org.compiere.model.MPInstance;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
import org.compiere.util.ASyncProcess;
|
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
@ -64,7 +64,7 @@ public class ProcessCtl extends AbstractProcessCtl
|
||||||
* @param trx Transaction
|
* @param trx Transaction
|
||||||
* @return worker started ProcessCtl instance or null for workflow
|
* @return worker started ProcessCtl instance or null for workflow
|
||||||
*/
|
*/
|
||||||
public static ProcessCtl process (ASyncProcess parent, int WindowNo, ProcessInfo pi, Trx trx)
|
public static ProcessCtl process (IProcessMonitor parent, int WindowNo, ProcessInfo pi, Trx trx)
|
||||||
{
|
{
|
||||||
log.fine("WindowNo=" + WindowNo + " - " + pi);
|
log.fine("WindowNo=" + WindowNo + " - " + pi);
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ public class ProcessCtl extends AbstractProcessCtl
|
||||||
* @param trx Transaction
|
* @param trx Transaction
|
||||||
* @return worker started ProcessCtl instance or null for workflow
|
* @return worker started ProcessCtl instance or null for workflow
|
||||||
*/
|
*/
|
||||||
public static ProcessCtl process(ASyncProcess parent, int WindowNo, IProcessParameter parameter, ProcessInfo pi, Trx trx)
|
public static ProcessCtl process(IProcessMonitor parent, int WindowNo, IProcessParameter parameter, ProcessInfo pi, Trx trx)
|
||||||
{
|
{
|
||||||
log.fine("WindowNo=" + WindowNo + " - " + pi);
|
log.fine("WindowNo=" + WindowNo + " - " + pi);
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ public class ProcessCtl extends AbstractProcessCtl
|
||||||
* @param trx Transaction
|
* @param trx Transaction
|
||||||
* Created in process(), VInvoiceGen.generateInvoices
|
* Created in process(), VInvoiceGen.generateInvoices
|
||||||
*/
|
*/
|
||||||
public ProcessCtl (ASyncProcess parent, int WindowNo, ProcessInfo pi, Trx trx)
|
public ProcessCtl (IProcessMonitor parent, int WindowNo, ProcessInfo pi, Trx trx)
|
||||||
{
|
{
|
||||||
super(parent, WindowNo, pi, trx);
|
super(parent, WindowNo, pi, trx);
|
||||||
} // ProcessCtl
|
} // ProcessCtl
|
||||||
|
@ -223,12 +223,12 @@ public class ProcessCtl extends AbstractProcessCtl
|
||||||
{
|
{
|
||||||
// log.info("...");
|
// log.info("...");
|
||||||
//m_parent is null for synchrous execution
|
//m_parent is null for synchrous execution
|
||||||
if (getParent() != null)
|
if (getProcessMonitor() != null)
|
||||||
{
|
{
|
||||||
if (getParent() instanceof Container)
|
if (getProcessMonitor() instanceof Container)
|
||||||
{
|
{
|
||||||
//swing client
|
//swing client
|
||||||
JFrame frame = AEnv.getFrame((Container)getParent());
|
JFrame frame = AEnv.getFrame((Container)getProcessMonitor());
|
||||||
if (frame instanceof AWindow)
|
if (frame instanceof AWindow)
|
||||||
((AWindow)frame).setBusyTimer(getProcessInfo().getEstSeconds());
|
((AWindow)frame).setBusyTimer(getProcessInfo().getEstSeconds());
|
||||||
else
|
else
|
||||||
|
@ -247,7 +247,7 @@ public class ProcessCtl extends AbstractProcessCtl
|
||||||
parent.lockUI(pi);
|
parent.lockUI(pi);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
runnable.setParent(getParent());
|
runnable.setParent(getProcessMonitor());
|
||||||
runnable.setProcessInfo(getProcessInfo());
|
runnable.setProcessInfo(getProcessInfo());
|
||||||
SwingUtilities.invokeLater(runnable);
|
SwingUtilities.invokeLater(runnable);
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ public class ProcessCtl extends AbstractProcessCtl
|
||||||
{
|
{
|
||||||
//other client
|
//other client
|
||||||
log.finer("lock");
|
log.finer("lock");
|
||||||
getParent().lockUI(getProcessInfo());
|
getProcessMonitor().lockUI(getProcessInfo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // lock
|
} // lock
|
||||||
|
@ -317,14 +317,14 @@ public class ProcessCtl extends AbstractProcessCtl
|
||||||
abstract class ProcessUpdateRunnable implements Runnable
|
abstract class ProcessUpdateRunnable implements Runnable
|
||||||
{
|
{
|
||||||
protected ProcessInfo pi = null;
|
protected ProcessInfo pi = null;
|
||||||
protected ASyncProcess parent = null;
|
protected IProcessMonitor parent = null;
|
||||||
|
|
||||||
public void setProcessInfo(ProcessInfo pi)
|
public void setProcessInfo(ProcessInfo pi)
|
||||||
{
|
{
|
||||||
this.pi = pi;
|
this.pi = pi;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParent(ASyncProcess parent)
|
public void setParent(IProcessMonitor parent)
|
||||||
{
|
{
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ import javax.swing.JSeparator;
|
||||||
|
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
import org.adempiere.exceptions.DBException;
|
import org.adempiere.exceptions.DBException;
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.compiere.print.ReportCtl;
|
import org.compiere.print.ReportCtl;
|
||||||
import org.compiere.print.ReportEngine;
|
import org.compiere.print.ReportEngine;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
|
@ -43,7 +44,6 @@ import org.compiere.process.ProcessInfoUtil;
|
||||||
import org.compiere.swing.CButton;
|
import org.compiere.swing.CButton;
|
||||||
import org.compiere.swing.CFrame;
|
import org.compiere.swing.CFrame;
|
||||||
import org.compiere.swing.CPanel;
|
import org.compiere.swing.CPanel;
|
||||||
import org.compiere.util.ASyncProcess;
|
|
||||||
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;
|
||||||
|
@ -67,7 +67,7 @@ import org.compiere.util.Msg;
|
||||||
* <li>BF [ 1963128 ] Running a process w/o trl should display an error
|
* <li>BF [ 1963128 ] Running a process w/o trl should display an error
|
||||||
*/
|
*/
|
||||||
public class ProcessDialog extends CFrame
|
public class ProcessDialog extends CFrame
|
||||||
implements ActionListener, ASyncProcess
|
implements ActionListener, IProcessMonitor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -516,4 +516,9 @@ public class ProcessDialog extends CFrame
|
||||||
PrintScreenPainter.printScreen (this);
|
PrintScreenPainter.printScreen (this);
|
||||||
} // printScreen
|
} // printScreen
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void statusUpdate(String status) {
|
||||||
|
message.setText(status);
|
||||||
|
}
|
||||||
|
|
||||||
} // ProcessDialog
|
} // ProcessDialog
|
||||||
|
|
|
@ -32,11 +32,11 @@ import javax.swing.JScrollPane;
|
||||||
import javax.swing.JSeparator;
|
import javax.swing.JSeparator;
|
||||||
|
|
||||||
import org.adempiere.exceptions.DBException;
|
import org.adempiere.exceptions.DBException;
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
import org.compiere.swing.CButton;
|
import org.compiere.swing.CButton;
|
||||||
import org.compiere.swing.CDialog;
|
import org.compiere.swing.CDialog;
|
||||||
import org.compiere.swing.CPanel;
|
import org.compiere.swing.CPanel;
|
||||||
import org.compiere.util.ASyncProcess;
|
|
||||||
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;
|
||||||
|
@ -76,13 +76,13 @@ public class ProcessModalDialog extends CDialog
|
||||||
* @param autoStart
|
* @param autoStart
|
||||||
*/
|
*/
|
||||||
public ProcessModalDialog (Properties ctx, Frame parent, String title,
|
public ProcessModalDialog (Properties ctx, Frame parent, String title,
|
||||||
ASyncProcess aProcess, int WindowNo, int AD_Process_ID,
|
IProcessMonitor aProcess, int WindowNo, int AD_Process_ID,
|
||||||
int tableId, int recordId, boolean autoStart)
|
int tableId, int recordId, boolean autoStart)
|
||||||
{
|
{
|
||||||
super(parent, title, true);
|
super(parent, title, true);
|
||||||
log.info("Process=" + AD_Process_ID );
|
log.info("Process=" + AD_Process_ID );
|
||||||
m_ctx = ctx;
|
m_ctx = ctx;
|
||||||
m_ASyncProcess = aProcess;
|
m_processMonitor = aProcess;
|
||||||
m_WindowNo = WindowNo;
|
m_WindowNo = WindowNo;
|
||||||
m_AD_Process_ID = AD_Process_ID;
|
m_AD_Process_ID = AD_Process_ID;
|
||||||
m_tableId = tableId;
|
m_tableId = tableId;
|
||||||
|
@ -99,7 +99,7 @@ public class ProcessModalDialog extends CDialog
|
||||||
}
|
}
|
||||||
} // ProcessDialog
|
} // ProcessDialog
|
||||||
|
|
||||||
private ASyncProcess m_ASyncProcess;
|
private IProcessMonitor m_processMonitor;
|
||||||
private int m_WindowNo;
|
private int m_WindowNo;
|
||||||
private Properties m_ctx;
|
private Properties m_ctx;
|
||||||
private int m_tableId;
|
private int m_tableId;
|
||||||
|
@ -332,7 +332,7 @@ public class ProcessModalDialog extends CDialog
|
||||||
{
|
{
|
||||||
if (e.getSource() == bOK)
|
if (e.getSource() == bOK)
|
||||||
{
|
{
|
||||||
ProcessCtl.process(m_ASyncProcess, m_WindowNo, parameterPanel, m_pi, null);
|
ProcessCtl.process(m_processMonitor, m_WindowNo, parameterPanel, m_pi, null);
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ import javax.swing.event.TableModelEvent;
|
||||||
import javax.swing.event.TableModelListener;
|
import javax.swing.event.TableModelListener;
|
||||||
|
|
||||||
import org.adempiere.plaf.AdempierePLAF;
|
import org.adempiere.plaf.AdempierePLAF;
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.compiere.apps.ADialog;
|
import org.compiere.apps.ADialog;
|
||||||
import org.compiere.apps.ADialogDialog;
|
import org.compiere.apps.ADialogDialog;
|
||||||
import org.compiere.apps.AEnv;
|
import org.compiere.apps.AEnv;
|
||||||
|
@ -49,7 +50,6 @@ import org.compiere.process.ProcessInfoUtil;
|
||||||
import org.compiere.swing.CPanel;
|
import org.compiere.swing.CPanel;
|
||||||
import org.compiere.swing.CTabbedPane;
|
import org.compiere.swing.CTabbedPane;
|
||||||
import org.compiere.swing.CTextPane;
|
import org.compiere.swing.CTextPane;
|
||||||
import org.compiere.util.ASyncProcess;
|
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
@ -58,7 +58,7 @@ import org.compiere.util.Msg;
|
||||||
* Generate custom form panel
|
* Generate custom form panel
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class VGenPanel extends CPanel implements ActionListener, ChangeListener, TableModelListener, ASyncProcess
|
public class VGenPanel extends CPanel implements ActionListener, ChangeListener, TableModelListener, IProcessMonitor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -380,4 +380,9 @@ public class VGenPanel extends CPanel implements ActionListener, ChangeListener,
|
||||||
{
|
{
|
||||||
return statusBar;
|
return statusBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void statusUpdate(String message) {
|
||||||
|
statusBar.setStatusLine(message);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -35,6 +35,7 @@ import javax.swing.JScrollPane;
|
||||||
import javax.swing.event.TableModelEvent;
|
import javax.swing.event.TableModelEvent;
|
||||||
import javax.swing.event.TableModelListener;
|
import javax.swing.event.TableModelListener;
|
||||||
|
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.compiere.apps.ADialog;
|
import org.compiere.apps.ADialog;
|
||||||
import org.compiere.apps.AEnv;
|
import org.compiere.apps.AEnv;
|
||||||
import org.compiere.apps.ConfirmPanel;
|
import org.compiere.apps.ConfirmPanel;
|
||||||
|
@ -50,7 +51,6 @@ import org.compiere.plaf.CompiereColor;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
import org.compiere.swing.CLabel;
|
import org.compiere.swing.CLabel;
|
||||||
import org.compiere.swing.CPanel;
|
import org.compiere.swing.CPanel;
|
||||||
import org.compiere.util.ASyncProcess;
|
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.KeyNamePair;
|
import org.compiere.util.KeyNamePair;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
@ -65,7 +65,7 @@ import org.compiere.util.ValueNamePair;
|
||||||
* @author Jorg Janke
|
* @author Jorg Janke
|
||||||
* @version $Id: VPaySelect.java,v 1.2 2008/07/11 08:20:12 cruiz Exp $
|
* @version $Id: VPaySelect.java,v 1.2 2008/07/11 08:20:12 cruiz Exp $
|
||||||
*/
|
*/
|
||||||
public class VPaySelect extends PaySelect implements FormPanel, ActionListener, TableModelListener, ASyncProcess
|
public class VPaySelect extends PaySelect implements FormPanel, ActionListener, TableModelListener, IProcessMonitor
|
||||||
{
|
{
|
||||||
/** @todo withholding */
|
/** @todo withholding */
|
||||||
private CPanel panel = new CPanel();
|
private CPanel panel = new CPanel();
|
||||||
|
@ -438,4 +438,9 @@ public class VPaySelect extends PaySelect implements FormPanel, ActionListener,
|
||||||
{
|
{
|
||||||
log.config("-");
|
log.config("-");
|
||||||
} // executeASync
|
} // executeASync
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void statusUpdate(String message) {
|
||||||
|
dataStatus.setText(message);
|
||||||
|
}
|
||||||
} // VPaySelect
|
} // VPaySelect
|
||||||
|
|
|
@ -27,6 +27,7 @@ import javax.sql.RowSet;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JPopupMenu;
|
import javax.swing.JPopupMenu;
|
||||||
|
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.compiere.apps.ADialog;
|
import org.compiere.apps.ADialog;
|
||||||
import org.compiere.apps.ClientProcessCtrl;
|
import org.compiere.apps.ClientProcessCtrl;
|
||||||
import org.compiere.apps.ProcessCtl;
|
import org.compiere.apps.ProcessCtl;
|
||||||
|
@ -35,7 +36,6 @@ import org.compiere.model.MRole;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.model.PrintInfo;
|
import org.compiere.model.PrintInfo;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
import org.compiere.util.ASyncProcess;
|
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.KeyNamePair;
|
import org.compiere.util.KeyNamePair;
|
||||||
|
@ -73,7 +73,7 @@ public class AReport implements ActionListener
|
||||||
* @param parent The invoking parent window
|
* @param parent The invoking parent window
|
||||||
* @param WindowNo The invoking parent window number
|
* @param WindowNo The invoking parent window number
|
||||||
*/
|
*/
|
||||||
public AReport (int AD_Table_ID, JComponent invoker, MQuery query, ASyncProcess parent, int WindowNo)
|
public AReport (int AD_Table_ID, JComponent invoker, MQuery query, IProcessMonitor parent, int WindowNo)
|
||||||
{
|
{
|
||||||
log.config("AD_Table_ID=" + AD_Table_ID + " " + query);
|
log.config("AD_Table_ID=" + AD_Table_ID + " " + query);
|
||||||
if (!MRole.getDefault().isCanReport(AD_Table_ID))
|
if (!MRole.getDefault().isCanReport(AD_Table_ID))
|
||||||
|
@ -100,7 +100,7 @@ public class AReport implements ActionListener
|
||||||
* @param whereExtended The filtering where clause
|
* @param whereExtended The filtering where clause
|
||||||
* @param WindowNo The invoking parent window number
|
* @param WindowNo The invoking parent window number
|
||||||
*/
|
*/
|
||||||
public AReport (int AD_Table_ID, JComponent invoker, MQuery query, ASyncProcess parent, int WindowNo, String whereExtended)
|
public AReport (int AD_Table_ID, JComponent invoker, MQuery query, IProcessMonitor parent, int WindowNo, String whereExtended)
|
||||||
{
|
{
|
||||||
log.config("AD_Table_ID=" + AD_Table_ID + " " + query);
|
log.config("AD_Table_ID=" + AD_Table_ID + " " + query);
|
||||||
if (!MRole.getDefault().isCanReport(AD_Table_ID))
|
if (!MRole.getDefault().isCanReport(AD_Table_ID))
|
||||||
|
@ -129,7 +129,7 @@ public class AReport implements ActionListener
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger log = CLogger.getCLogger(AReport.class);
|
private static CLogger log = CLogger.getCLogger(AReport.class);
|
||||||
/** The parent window for locking/unlocking during process execution */
|
/** The parent window for locking/unlocking during process execution */
|
||||||
ASyncProcess parent;
|
IProcessMonitor parent;
|
||||||
/** The filter to apply to this report */
|
/** The filter to apply to this report */
|
||||||
String m_whereExtended;
|
String m_whereExtended;
|
||||||
/** The parent window number */
|
/** The parent window number */
|
||||||
|
|
|
@ -38,6 +38,7 @@ import javax.swing.event.TableModelEvent;
|
||||||
import javax.swing.event.TableModelListener;
|
import javax.swing.event.TableModelListener;
|
||||||
|
|
||||||
import org.adempiere.plaf.AdempierePLAF;
|
import org.adempiere.plaf.AdempierePLAF;
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.compiere.apps.ADialog;
|
import org.compiere.apps.ADialog;
|
||||||
import org.compiere.apps.ADialogDialog;
|
import org.compiere.apps.ADialogDialog;
|
||||||
import org.compiere.apps.AEnv;
|
import org.compiere.apps.AEnv;
|
||||||
|
@ -66,7 +67,6 @@ import org.compiere.swing.CLabel;
|
||||||
import org.compiere.swing.CPanel;
|
import org.compiere.swing.CPanel;
|
||||||
import org.compiere.swing.CTabbedPane;
|
import org.compiere.swing.CTabbedPane;
|
||||||
import org.compiere.swing.CTextPane;
|
import org.compiere.swing.CTextPane;
|
||||||
import org.compiere.util.ASyncProcess;
|
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
|
@ -83,7 +83,7 @@ import org.compiere.util.Trx;
|
||||||
*/
|
*/
|
||||||
public class VInOutInvoiceGen extends CPanel
|
public class VInOutInvoiceGen extends CPanel
|
||||||
implements FormPanel, ActionListener, VetoableChangeListener,
|
implements FormPanel, ActionListener, VetoableChangeListener,
|
||||||
ChangeListener, TableModelListener, ASyncProcess
|
ChangeListener, TableModelListener, IProcessMonitor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -895,4 +895,9 @@ public class VInOutInvoiceGen extends CPanel
|
||||||
public void executeASync (ProcessInfo pi)
|
public void executeASync (ProcessInfo pi)
|
||||||
{
|
{
|
||||||
} // executeASync
|
} // executeASync
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void statusUpdate(String message) {
|
||||||
|
statusBar.setStatusLine(message);
|
||||||
|
}
|
||||||
} // VInOutGen
|
} // VInOutGen
|
||||||
|
|
|
@ -249,6 +249,7 @@ public class AdempiereWebUI extends Window implements EventListener, IWebClient
|
||||||
}
|
}
|
||||||
|
|
||||||
currSess.setAttribute(ZK_DESKTOP_SESSION_KEY, this.getPage().getDesktop());
|
currSess.setAttribute(ZK_DESKTOP_SESSION_KEY, this.getPage().getDesktop());
|
||||||
|
ctx.put(ZK_DESKTOP_SESSION_KEY, this.getPage().getDesktop());
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
//restore fail
|
//restore fail
|
||||||
appDesktop = null;
|
appDesktop = null;
|
||||||
|
@ -267,6 +268,7 @@ public class AdempiereWebUI extends Window implements EventListener, IWebClient
|
||||||
ExecutionCarryOver eco = new ExecutionCarryOver(this.getPage().getDesktop());
|
ExecutionCarryOver eco = new ExecutionCarryOver(this.getPage().getDesktop());
|
||||||
currSess.setAttribute(EXECUTION_CARRYOVER_SESSION_KEY, eco);
|
currSess.setAttribute(EXECUTION_CARRYOVER_SESSION_KEY, eco);
|
||||||
currSess.setAttribute(ZK_DESKTOP_SESSION_KEY, this.getPage().getDesktop());
|
currSess.setAttribute(ZK_DESKTOP_SESSION_KEY, this.getPage().getDesktop());
|
||||||
|
ctx.put(ZK_DESKTOP_SESSION_KEY, this.getPage().getDesktop());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("Y".equalsIgnoreCase(Env.getContext(ctx, BrowserToken.REMEMBER_ME)) && MSystem.isZKRememberUserAllowed())
|
if ("Y".equalsIgnoreCase(Env.getContext(ctx, BrowserToken.REMEMBER_ME)) && MSystem.isZKRememberUserAllowed())
|
||||||
|
|
|
@ -36,6 +36,7 @@ import java.util.logging.Level;
|
||||||
|
|
||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
|
|
||||||
|
import org.adempiere.webui.AdempiereWebUI;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.adempiere.webui.theme.ThemeManager;
|
import org.adempiere.webui.theme.ThemeManager;
|
||||||
|
@ -55,6 +56,7 @@ import org.compiere.util.Ini;
|
||||||
import org.compiere.util.Language;
|
import org.compiere.util.Language;
|
||||||
import org.zkoss.web.servlet.Servlets;
|
import org.zkoss.web.servlet.Servlets;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Desktop;
|
||||||
import org.zkoss.zk.ui.Execution;
|
import org.zkoss.zk.ui.Execution;
|
||||||
import org.zkoss.zk.ui.Executions;
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
|
||||||
|
@ -739,4 +741,35 @@ public final class AEnv
|
||||||
header = ThemeManager.getBrowserTitle();
|
header = ThemeManager.getBrowserTitle();
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute task that required access to the zk desktop
|
||||||
|
* @param runnable
|
||||||
|
*/
|
||||||
|
public static void executeDesktopTask(Runnable runnable) {
|
||||||
|
boolean inUIThread = Executions.getCurrent() != null;
|
||||||
|
boolean desktopActivated = false;
|
||||||
|
|
||||||
|
Desktop desktop = null;
|
||||||
|
try {
|
||||||
|
if (!inUIThread) {
|
||||||
|
desktop = (Desktop) Env.getCtx().get(AdempiereWebUI.ZK_DESKTOP_SESSION_KEY);
|
||||||
|
if (desktop == null)
|
||||||
|
return;
|
||||||
|
//1 second timeout
|
||||||
|
if (Executions.activate(desktop, 1000)) {
|
||||||
|
desktopActivated = true;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
runnable.run();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e.getLocalizedMessage(), e);
|
||||||
|
} finally {
|
||||||
|
if (!inUIThread && desktopActivated) {
|
||||||
|
Executions.deactivate(desktop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} // AEnv
|
} // AEnv
|
||||||
|
|
|
@ -28,13 +28,15 @@ import org.zkoss.zul.Image;
|
||||||
public class BusyDialog extends Window {
|
public class BusyDialog extends Window {
|
||||||
|
|
||||||
private static final long serialVersionUID = -779475945298887887L;
|
private static final long serialVersionUID = -779475945298887887L;
|
||||||
|
private Label label;
|
||||||
|
|
||||||
public BusyDialog() {
|
public BusyDialog() {
|
||||||
super();
|
super();
|
||||||
Hbox box = new Hbox();
|
Hbox box = new Hbox();
|
||||||
box.setStyle("padding: 5px");
|
box.setStyle("padding: 5px");
|
||||||
appendChild(box);
|
appendChild(box);
|
||||||
box.appendChild(new Label(Msg.getMsg(Env.getCtx(), "Processing")));
|
label = new Label(Msg.getMsg(Env.getCtx(), "Processing"));
|
||||||
|
box.appendChild(label);
|
||||||
Image image = new Image();
|
Image image = new Image();
|
||||||
box.appendChild(image);
|
box.appendChild(image);
|
||||||
image.setHeight("16px");
|
image.setHeight("16px");
|
||||||
|
@ -44,4 +46,10 @@ public class BusyDialog extends Window {
|
||||||
setShadow(true);
|
setShadow(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void statusUpdate(String message) {
|
||||||
|
if (label != null) {
|
||||||
|
label.setText(message);
|
||||||
|
this.invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,10 @@ import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
|
import org.adempiere.util.ServerContext;
|
||||||
|
import org.adempiere.webui.AdempiereWebUI;
|
||||||
|
import org.adempiere.webui.apps.ProcessDialog.ProcessDialogRunnable;
|
||||||
import org.adempiere.webui.component.Button;
|
import org.adempiere.webui.component.Button;
|
||||||
import org.adempiere.webui.component.Panel;
|
import org.adempiere.webui.component.Panel;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
|
@ -28,6 +32,9 @@ import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
import org.zkoss.zk.au.out.AuEcho;
|
import org.zkoss.zk.au.out.AuEcho;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Desktop;
|
||||||
|
import org.zkoss.zk.ui.Execution;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
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;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
|
@ -73,7 +80,7 @@ import com.lowagie.text.pdf.PdfWriter;
|
||||||
* @author arboleda - globalqss
|
* @author arboleda - globalqss
|
||||||
* - Implement ShowHelp option on processes and reports
|
* - Implement ShowHelp option on processes and reports
|
||||||
*/
|
*/
|
||||||
public class ProcessDialog extends Window implements EventListener//, ASyncProcess
|
public class ProcessDialog extends Window implements EventListener, IProcessMonitor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* generate serial version ID
|
* generate serial version ID
|
||||||
|
@ -192,6 +199,9 @@ public class ProcessDialog extends Window implements EventListener//, ASyncProce
|
||||||
private boolean isParameterPage = true;
|
private boolean isParameterPage = true;
|
||||||
private String initialMessage;
|
private String initialMessage;
|
||||||
private BusyDialog progressWindow;
|
private BusyDialog progressWindow;
|
||||||
|
private Thread thread;
|
||||||
|
private String statusUpdate;
|
||||||
|
private ProcessDialogRunnable processDialogRunnable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -307,9 +317,48 @@ public class ProcessDialog extends Window implements EventListener//, ASyncProce
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runProcess() {
|
public void runProcess() {
|
||||||
|
//prepare context for background thread
|
||||||
|
Properties p = new Properties();
|
||||||
|
Properties env = Env.getCtx();
|
||||||
|
for(Object key : env.keySet()) {
|
||||||
|
if (key instanceof String) {
|
||||||
|
String sKey = (String) key;
|
||||||
|
Object value = env.get(sKey);
|
||||||
|
if (value instanceof String) {
|
||||||
|
String sValue = (String) value;
|
||||||
|
p.put(sKey, sValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Desktop desktop = this.getDesktop();
|
||||||
|
p.put(AdempiereWebUI.ZK_DESKTOP_SESSION_KEY, desktop);
|
||||||
|
|
||||||
|
processDialogRunnable = new ProcessDialogRunnable(p);
|
||||||
|
thread = new Thread(processDialogRunnable);
|
||||||
|
thread.start();
|
||||||
|
|
||||||
|
Clients.response(new AuEcho(this, "checkProgress", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkProgress() {
|
||||||
try {
|
try {
|
||||||
WProcessCtl.process(null, m_WindowNo, parameterPanel, m_pi, null);
|
Thread.sleep(500);
|
||||||
} finally {
|
} catch (InterruptedException e) {
|
||||||
|
Thread.interrupted();
|
||||||
|
}
|
||||||
|
if (thread.isAlive()) {
|
||||||
|
synchronized(this) {
|
||||||
|
if (statusUpdate != null) {
|
||||||
|
if (progressWindow != null)
|
||||||
|
progressWindow.statusUpdate(statusUpdate);
|
||||||
|
statusUpdate = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Clients.response(new AuEcho(this, "checkProgress", null));
|
||||||
|
} else {
|
||||||
|
Env.getCtx().putAll(processDialogRunnable.getProperties());
|
||||||
|
thread = null;
|
||||||
|
processDialogRunnable = null;
|
||||||
unlockUI(m_pi);
|
unlockUI(m_pi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -334,7 +383,7 @@ public class ProcessDialog extends Window implements EventListener//, ASyncProce
|
||||||
}
|
}
|
||||||
|
|
||||||
public void lockUI(ProcessInfo pi) {
|
public void lockUI(ProcessInfo pi) {
|
||||||
if (m_isLocked) return;
|
if (m_isLocked || Executions.getCurrent() == null) return;
|
||||||
|
|
||||||
m_isLocked = true;
|
m_isLocked = true;
|
||||||
|
|
||||||
|
@ -348,7 +397,7 @@ public class ProcessDialog extends Window implements EventListener//, ASyncProce
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unlockUI(ProcessInfo pi) {
|
public void unlockUI(ProcessInfo pi) {
|
||||||
if (!m_isLocked) return;
|
if (!m_isLocked || Executions.getCurrent() == null) return;
|
||||||
|
|
||||||
m_isLocked = false;
|
m_isLocked = false;
|
||||||
hideBusyDialog();
|
hideBusyDialog();
|
||||||
|
@ -591,10 +640,34 @@ public class ProcessDialog extends Window implements EventListener//, ASyncProce
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void executeASync(ProcessInfo pi) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isUILocked() {
|
public boolean isUILocked() {
|
||||||
return m_isLocked;
|
return m_isLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ProcessDialogRunnable implements Runnable {
|
||||||
|
private Properties properties;
|
||||||
|
|
||||||
|
ProcessDialogRunnable(Properties properties) {
|
||||||
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
ServerContext.setCurrentInstance(properties);
|
||||||
|
log.log(Level.INFO, "Process Info="+m_pi+" AD_Client_ID="+Env.getAD_Client_ID(Env.getCtx()));
|
||||||
|
WProcessCtl.process(ProcessDialog.this, m_WindowNo, parameterPanel, m_pi, null);
|
||||||
|
} finally {
|
||||||
|
ServerContext.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Properties getProperties() {
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void statusUpdate(String message) {
|
||||||
|
statusUpdate = message;
|
||||||
|
}
|
||||||
} // ProcessDialog
|
} // ProcessDialog
|
||||||
|
|
|
@ -22,19 +22,23 @@ import java.sql.SQLException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
|
import org.adempiere.util.ServerContext;
|
||||||
|
import org.adempiere.webui.AdempiereWebUI;
|
||||||
import org.adempiere.webui.LayoutUtils;
|
import org.adempiere.webui.LayoutUtils;
|
||||||
import org.adempiere.webui.component.Button;
|
import org.adempiere.webui.component.Button;
|
||||||
import org.adempiere.webui.component.Panel;
|
import org.adempiere.webui.component.Panel;
|
||||||
import org.adempiere.webui.component.VerticalBox;
|
import org.adempiere.webui.component.VerticalBox;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
import org.compiere.util.ASyncProcess;
|
|
||||||
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;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
import org.zkoss.zk.au.out.AuEcho;
|
import org.zkoss.zk.au.out.AuEcho;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Desktop;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
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;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
|
@ -54,7 +58,7 @@ import org.zkoss.zul.Html;
|
||||||
* @author arboleda - globalqss
|
* @author arboleda - globalqss
|
||||||
* - Implement ShowHelp option on processes and reports
|
* - Implement ShowHelp option on processes and reports
|
||||||
*/
|
*/
|
||||||
public class ProcessModalDialog extends Window implements EventListener
|
public class ProcessModalDialog extends Window implements EventListener, IProcessMonitor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* generated serial version ID
|
* generated serial version ID
|
||||||
|
@ -69,10 +73,10 @@ public class ProcessModalDialog extends Window implements EventListener
|
||||||
* @param pi
|
* @param pi
|
||||||
* @param autoStart
|
* @param autoStart
|
||||||
*/
|
*/
|
||||||
public ProcessModalDialog(ASyncProcess aProcess, int WindowNo, ProcessInfo pi, boolean autoStart)
|
public ProcessModalDialog(IProcessMonitor aProcess, int WindowNo, ProcessInfo pi, boolean autoStart)
|
||||||
{
|
{
|
||||||
m_ctx = Env.getCtx();
|
m_ctx = Env.getCtx();
|
||||||
m_ASyncProcess = aProcess;
|
m_processMonitor = aProcess;
|
||||||
m_WindowNo = WindowNo;
|
m_WindowNo = WindowNo;
|
||||||
m_pi = pi;
|
m_pi = pi;
|
||||||
m_autoStart = autoStart;
|
m_autoStart = autoStart;
|
||||||
|
@ -99,7 +103,7 @@ public class ProcessModalDialog extends Window implements EventListener
|
||||||
* @param recordId
|
* @param recordId
|
||||||
* @param autoStart
|
* @param autoStart
|
||||||
*/
|
*/
|
||||||
public ProcessModalDialog ( ASyncProcess aProcess, int WindowNo, int AD_Process_ID, int tableId, int recordId, boolean autoStart)
|
public ProcessModalDialog ( IProcessMonitor aProcess, int WindowNo, int AD_Process_ID, int tableId, int recordId, boolean autoStart)
|
||||||
{
|
{
|
||||||
this(aProcess, WindowNo, new ProcessInfo("", AD_Process_ID, tableId, recordId), autoStart);
|
this(aProcess, WindowNo, new ProcessInfo("", AD_Process_ID, tableId, recordId), autoStart);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +122,7 @@ public class ProcessModalDialog extends Window implements EventListener
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public ProcessModalDialog (Window parent, String title,
|
public ProcessModalDialog (Window parent, String title,
|
||||||
ASyncProcess aProcess, int WindowNo, int AD_Process_ID,
|
IProcessMonitor aProcess, int WindowNo, int AD_Process_ID,
|
||||||
int tableId, int recordId, boolean autoStart)
|
int tableId, int recordId, boolean autoStart)
|
||||||
{
|
{
|
||||||
this(aProcess, WindowNo, AD_Process_ID, tableId, recordId, autoStart);
|
this(aProcess, WindowNo, AD_Process_ID, tableId, recordId, autoStart);
|
||||||
|
@ -155,7 +159,7 @@ public class ProcessModalDialog extends Window implements EventListener
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ASyncProcess m_ASyncProcess;
|
private IProcessMonitor m_processMonitor;
|
||||||
private int m_WindowNo;
|
private int m_WindowNo;
|
||||||
private Properties m_ctx;
|
private Properties m_ctx;
|
||||||
private String m_Name = null;
|
private String m_Name = null;
|
||||||
|
@ -173,6 +177,10 @@ public class ProcessModalDialog extends Window implements EventListener
|
||||||
|
|
||||||
private ProcessInfo m_pi = null;
|
private ProcessInfo m_pi = null;
|
||||||
private BusyDialog progressWindow;
|
private BusyDialog progressWindow;
|
||||||
|
private boolean isLocked = false;
|
||||||
|
private org.adempiere.webui.apps.ProcessModalDialog.ProcessDialogRunnable processDialogRunnable;
|
||||||
|
private Thread thread;
|
||||||
|
private String statusUpdate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Visible
|
* Set Visible
|
||||||
|
@ -299,12 +307,12 @@ public class ProcessModalDialog extends Window implements EventListener
|
||||||
{
|
{
|
||||||
m_pi.setPrintPreview(true);
|
m_pi.setPrintPreview(true);
|
||||||
|
|
||||||
if (m_ASyncProcess != null) {
|
if (m_processMonitor != null) {
|
||||||
m_ASyncProcess.lockUI(m_pi);
|
m_processMonitor.lockUI(m_pi);
|
||||||
Clients.showBusy(null, false);
|
Clients.showBusy(null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
showBusyDialog();
|
lockUI(m_pi);
|
||||||
|
|
||||||
//use echo, otherwise lock ui wouldn't work
|
//use echo, otherwise lock ui wouldn't work
|
||||||
Clients.response(new AuEcho(this, "runProcess", null));
|
Clients.response(new AuEcho(this, "runProcess", null));
|
||||||
|
@ -323,14 +331,53 @@ public class ProcessModalDialog extends Window implements EventListener
|
||||||
* internal use, don't call this directly
|
* internal use, don't call this directly
|
||||||
*/
|
*/
|
||||||
public void runProcess() {
|
public void runProcess() {
|
||||||
try {
|
//prepare context for background thread
|
||||||
WProcessCtl.process(null, m_WindowNo, parameterPanel, m_pi, null);
|
Properties p = new Properties();
|
||||||
} finally {
|
Properties env = Env.getCtx();
|
||||||
dispose();
|
for(Object key : env.keySet()) {
|
||||||
if (m_ASyncProcess != null) {
|
if (key instanceof String) {
|
||||||
m_ASyncProcess.unlockUI(m_pi);
|
String sKey = (String) key;
|
||||||
|
Object value = env.get(sKey);
|
||||||
|
if (value instanceof String) {
|
||||||
|
String sValue = (String) value;
|
||||||
|
p.put(sKey, sValue);
|
||||||
}
|
}
|
||||||
hideBusyDialog();
|
}
|
||||||
|
}
|
||||||
|
Desktop desktop = this.getDesktop();
|
||||||
|
p.put(AdempiereWebUI.ZK_DESKTOP_SESSION_KEY, desktop);
|
||||||
|
|
||||||
|
processDialogRunnable = new ProcessDialogRunnable(p);
|
||||||
|
thread = new Thread(processDialogRunnable);
|
||||||
|
thread.start();
|
||||||
|
|
||||||
|
Clients.response(new AuEcho(this, "checkProgress", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkProgress() {
|
||||||
|
try {
|
||||||
|
Thread.sleep(500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.interrupted();
|
||||||
|
}
|
||||||
|
if (thread.isAlive()) {
|
||||||
|
synchronized(this) {
|
||||||
|
if (statusUpdate != null) {
|
||||||
|
if (progressWindow != null)
|
||||||
|
progressWindow.statusUpdate(statusUpdate);
|
||||||
|
statusUpdate = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Clients.response(new AuEcho(this, "checkProgress", null));
|
||||||
|
} else {
|
||||||
|
Env.getCtx().putAll(processDialogRunnable.getProperties());
|
||||||
|
thread = null;
|
||||||
|
processDialogRunnable = null;
|
||||||
|
dispose();
|
||||||
|
if (m_processMonitor != null) {
|
||||||
|
m_processMonitor.unlockUI(m_pi);
|
||||||
|
}
|
||||||
|
unlockUI(m_pi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,4 +403,53 @@ public class ProcessModalDialog extends Window implements EventListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void lockUI(ProcessInfo pi) {
|
||||||
|
if (isLocked || Executions.getCurrent() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
showBusyDialog();
|
||||||
|
isLocked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unlockUI(ProcessInfo pi) {
|
||||||
|
if (!isLocked || Executions.getCurrent() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
hideBusyDialog();
|
||||||
|
isLocked = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUILocked() {
|
||||||
|
return isLocked;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void statusUpdate(String message) {
|
||||||
|
statusUpdate = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ProcessDialogRunnable implements Runnable {
|
||||||
|
private Properties properties;
|
||||||
|
|
||||||
|
ProcessDialogRunnable(Properties properties) {
|
||||||
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
ServerContext.setCurrentInstance(properties);
|
||||||
|
log.log(Level.INFO, "Process Info="+m_pi+" AD_Client_ID="+Env.getAD_Client_ID(Env.getCtx()));
|
||||||
|
WProcessCtl.process(ProcessModalDialog.this, m_WindowNo, parameterPanel, m_pi, null);
|
||||||
|
} finally {
|
||||||
|
ServerContext.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Properties getProperties() {
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
}
|
||||||
} // ProcessDialog
|
} // ProcessDialog
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.adempiere.webui.apps;
|
package org.adempiere.webui.apps;
|
||||||
|
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.compiere.apps.AbstractProcessCtl;
|
import org.compiere.apps.AbstractProcessCtl;
|
||||||
import org.compiere.apps.IProcessParameter;
|
import org.compiere.apps.IProcessParameter;
|
||||||
import org.compiere.model.MPInstance;
|
import org.compiere.model.MPInstance;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
import org.compiere.util.ASyncProcess;
|
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
@ -48,12 +48,12 @@ public class WProcessCtl extends AbstractProcessCtl {
|
||||||
* lockUI and unlockUI if parent is a ASyncProcess
|
* lockUI and unlockUI if parent is a ASyncProcess
|
||||||
* <br>
|
* <br>
|
||||||
*
|
*
|
||||||
* @param aProcess ASyncProcess & Container
|
* @param aProcessMonitor ASyncProcess & Container
|
||||||
* @param WindowNo window no
|
* @param WindowNo window no
|
||||||
* @param pi ProcessInfo process info
|
* @param pi ProcessInfo process info
|
||||||
* @param trx Transaction
|
* @param trx Transaction
|
||||||
*/
|
*/
|
||||||
public static void process (ASyncProcess aProcess, int WindowNo, ProcessInfo pi, Trx trx)
|
public static void process (IProcessMonitor aProcessMonitor, int WindowNo, ProcessInfo pi, Trx trx)
|
||||||
{
|
{
|
||||||
log.fine("WindowNo=" + WindowNo + " - " + pi);
|
log.fine("WindowNo=" + WindowNo + " - " + pi);
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ public class WProcessCtl extends AbstractProcessCtl {
|
||||||
pi.setAD_PInstance_ID (instance.getAD_PInstance_ID());
|
pi.setAD_PInstance_ID (instance.getAD_PInstance_ID());
|
||||||
|
|
||||||
// Get Parameters (Dialog)
|
// Get Parameters (Dialog)
|
||||||
ProcessModalDialog para = new ProcessModalDialog(aProcess, WindowNo, pi, false);
|
ProcessModalDialog para = new ProcessModalDialog(aProcessMonitor, WindowNo, pi, false);
|
||||||
if (para.isValid())
|
if (para.isValid())
|
||||||
{
|
{
|
||||||
para.setWidth("500px");
|
para.setWidth("500px");
|
||||||
|
@ -105,13 +105,13 @@ public class WProcessCtl extends AbstractProcessCtl {
|
||||||
* <br>
|
* <br>
|
||||||
* Called from ProcessDialog.actionPerformed
|
* Called from ProcessDialog.actionPerformed
|
||||||
*
|
*
|
||||||
* @param parent ASyncProcess & Container
|
* @param aProcessMonitor ASyncProcess & Container
|
||||||
* @param WindowNo window no
|
* @param WindowNo window no
|
||||||
* @param paraPanel Process Parameter Panel
|
* @param paraPanel Process Parameter Panel
|
||||||
* @param pi ProcessInfo process info
|
* @param pi ProcessInfo process info
|
||||||
* @param trx Transaction
|
* @param trx Transaction
|
||||||
*/
|
*/
|
||||||
public static void process(ASyncProcess parent, int WindowNo, IProcessParameter parameter, ProcessInfo pi, Trx trx)
|
public static void process(IProcessMonitor aProcessMonitor, int WindowNo, IProcessParameter parameter, ProcessInfo pi, Trx trx)
|
||||||
{
|
{
|
||||||
log.fine("WindowNo=" + WindowNo + " - " + pi);
|
log.fine("WindowNo=" + WindowNo + " - " + pi);
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ public class WProcessCtl extends AbstractProcessCtl {
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute
|
// execute
|
||||||
WProcessCtl worker = new WProcessCtl(parent, WindowNo, pi, trx);
|
WProcessCtl worker = new WProcessCtl(aProcessMonitor, WindowNo, pi, trx);
|
||||||
worker.run();
|
worker.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,9 +163,9 @@ public class WProcessCtl extends AbstractProcessCtl {
|
||||||
* @param pi
|
* @param pi
|
||||||
* @param trx
|
* @param trx
|
||||||
*/
|
*/
|
||||||
public WProcessCtl(ASyncProcess parent, int WindowNo, ProcessInfo pi,
|
public WProcessCtl(IProcessMonitor aProcessMonitor, int WindowNo, ProcessInfo pi,
|
||||||
Trx trx) {
|
Trx trx) {
|
||||||
super(parent, WindowNo, pi, trx);
|
super(aProcessMonitor, WindowNo, pi, trx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -178,15 +178,15 @@ public class WProcessCtl extends AbstractProcessCtl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void lock() {
|
protected void lock() {
|
||||||
if (getParent() != null) {
|
if (getProcessMonitor() != null) {
|
||||||
getParent().lockUI(getProcessInfo());
|
getProcessMonitor().lockUI(getProcessInfo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void unlock() {
|
protected void unlock() {
|
||||||
if (getParent() != null) {
|
if (getProcessMonitor() != null) {
|
||||||
getParent().unlockUI(getProcessInfo());
|
getProcessMonitor().unlockUI(getProcessInfo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.sql.Timestamp;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.adempiere.webui.apps.ProcessModalDialog;
|
import org.adempiere.webui.apps.ProcessModalDialog;
|
||||||
import org.adempiere.webui.component.Button;
|
import org.adempiere.webui.component.Button;
|
||||||
import org.adempiere.webui.component.Checkbox;
|
import org.adempiere.webui.component.Checkbox;
|
||||||
|
@ -72,7 +73,7 @@ import org.zkoss.zul.Space;
|
||||||
* @version $Id: VPaySelect.java,v 1.3 2006/07/30 00:51:28 jjanke Exp $
|
* @version $Id: VPaySelect.java,v 1.3 2006/07/30 00:51:28 jjanke Exp $
|
||||||
*/
|
*/
|
||||||
public class WPaySelect extends PaySelect
|
public class WPaySelect extends PaySelect
|
||||||
implements IFormController, EventListener, WTableModelListener, ASyncProcess
|
implements IFormController, EventListener, WTableModelListener, IProcessMonitor
|
||||||
{
|
{
|
||||||
/** @todo withholding */
|
/** @todo withholding */
|
||||||
|
|
||||||
|
@ -444,4 +445,8 @@ public class WPaySelect extends PaySelect
|
||||||
public ADForm getForm() {
|
public ADForm getForm() {
|
||||||
return form;
|
return form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void statusUpdate(String message) {
|
||||||
|
}
|
||||||
} // VPaySelect
|
} // VPaySelect
|
||||||
|
|
|
@ -29,6 +29,7 @@ import java.util.TreeMap;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.adempiere.webui.WArchive;
|
import org.adempiere.webui.WArchive;
|
||||||
import org.adempiere.webui.WRequest;
|
import org.adempiere.webui.WRequest;
|
||||||
import org.adempiere.webui.WZoomAcross;
|
import org.adempiere.webui.WZoomAcross;
|
||||||
|
@ -70,7 +71,6 @@ import org.compiere.model.MRole;
|
||||||
import org.compiere.process.DocAction;
|
import org.compiere.process.DocAction;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
import org.compiere.process.ProcessInfoUtil;
|
import org.compiere.process.ProcessInfoUtil;
|
||||||
import org.compiere.util.ASyncProcess;
|
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
|
@ -117,7 +117,7 @@ import org.zkoss.zul.Menupopup;
|
||||||
* https://sourceforge.net/tracker/?func=detail&aid=2985892&group_id=176962&atid=955896
|
* https://sourceforge.net/tracker/?func=detail&aid=2985892&group_id=176962&atid=955896
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractADWindowPanel extends AbstractUIPart implements ToolbarListener,
|
public abstract class AbstractADWindowPanel extends AbstractUIPart implements ToolbarListener,
|
||||||
EventListener, DataStatusListener, ActionListener, ASyncProcess
|
EventListener, DataStatusListener, ActionListener, IProcessMonitor
|
||||||
{
|
{
|
||||||
private static final CLogger logger;
|
private static final CLogger logger;
|
||||||
|
|
||||||
|
@ -2331,6 +2331,11 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void statusUpdate(String message) {
|
||||||
|
statusBar.setStatusLine(message);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateUI(ProcessInfo pi) {
|
private void updateUI(ProcessInfo pi) {
|
||||||
// Refresh data
|
// Refresh data
|
||||||
curTab.dataRefresh(false);
|
curTab.dataRefresh(false);
|
||||||
|
|
|
@ -34,6 +34,8 @@ import org.zkoss.zk.ui.event.EventThreadCleanup;
|
||||||
import org.zkoss.zk.ui.event.EventThreadInit;
|
import org.zkoss.zk.ui.event.EventThreadInit;
|
||||||
import org.zkoss.zk.ui.event.EventThreadResume;
|
import org.zkoss.zk.ui.event.EventThreadResume;
|
||||||
import org.zkoss.zk.ui.event.EventThreadSuspend;
|
import org.zkoss.zk.ui.event.EventThreadSuspend;
|
||||||
|
import org.zkoss.zk.ui.sys.DesktopCtrl;
|
||||||
|
import org.zkoss.zk.ui.sys.ServerPush;
|
||||||
import org.zkoss.zk.ui.util.ExecutionCleanup;
|
import org.zkoss.zk.ui.util.ExecutionCleanup;
|
||||||
import org.zkoss.zk.ui.util.ExecutionInit;
|
import org.zkoss.zk.ui.util.ExecutionInit;
|
||||||
|
|
||||||
|
@ -96,14 +98,18 @@ public class SessionContextListener implements ExecutionInit,
|
||||||
*/
|
*/
|
||||||
public void init(Execution exec, Execution parent)
|
public void init(Execution exec, Execution parent)
|
||||||
{
|
{
|
||||||
|
//in servlet thread
|
||||||
if (parent == null)
|
if (parent == null)
|
||||||
{
|
{
|
||||||
//in servlet thread
|
ServerPush serverPush = ((DesktopCtrl)exec.getDesktop()).getServerPush();
|
||||||
|
if (serverPush == null || !serverPush.isActive())
|
||||||
|
{
|
||||||
setupExecutionContextFromSession(Executions.getCurrent());
|
setupExecutionContextFromSession(Executions.getCurrent());
|
||||||
//set locale
|
//set locale
|
||||||
Locales.setThreadLocal(Env.getLanguage(ServerContext.getCurrentInstance()).getLocale());
|
Locales.setThreadLocal(Env.getLanguage(ServerContext.getCurrentInstance()).getLocale());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param exec
|
* @param exec
|
||||||
|
@ -115,10 +121,14 @@ public class SessionContextListener implements ExecutionInit,
|
||||||
{
|
{
|
||||||
//in servlet thread
|
//in servlet thread
|
||||||
if (parent == null)
|
if (parent == null)
|
||||||
|
{
|
||||||
|
ServerPush serverPush = ((DesktopCtrl)exec.getDesktop()).getServerPush();
|
||||||
|
if (serverPush == null || !serverPush.isActive())
|
||||||
{
|
{
|
||||||
ServerContext.dispose();
|
ServerContext.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get from servlet thread's ThreadLocal
|
* get from servlet thread's ThreadLocal
|
||||||
|
|
|
@ -3,19 +3,27 @@ package org.adempiere.webui.window;
|
||||||
import net.sf.jasperreports.engine.JRException;
|
import net.sf.jasperreports.engine.JRException;
|
||||||
import net.sf.jasperreports.engine.JasperPrint;
|
import net.sf.jasperreports.engine.JasperPrint;
|
||||||
|
|
||||||
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.compiere.report.JRViewerProvider;
|
import org.compiere.report.JRViewerProvider;
|
||||||
|
|
||||||
public class ZkJRViewerProvider implements JRViewerProvider {
|
public class ZkJRViewerProvider implements JRViewerProvider {
|
||||||
|
|
||||||
public void openViewer(JasperPrint jasperPrint, String title)
|
public void openViewer(final JasperPrint jasperPrint, final String title)
|
||||||
throws JRException {
|
throws JRException {
|
||||||
|
Runnable runnable = new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
Window viewer = new ZkJRViewer(jasperPrint, title);
|
Window viewer = new ZkJRViewer(jasperPrint, title);
|
||||||
|
|
||||||
viewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
|
viewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
|
||||||
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
|
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
|
||||||
SessionManager.getAppDesktop().showWindow(viewer);
|
SessionManager.getAppDesktop().showWindow(viewer);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
AEnv.executeDesktopTask(runnable);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.adempiere.webui.window;
|
package org.adempiere.webui.window;
|
||||||
|
|
||||||
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.compiere.print.ReportEngine;
|
import org.compiere.print.ReportEngine;
|
||||||
|
@ -28,11 +29,17 @@ import org.compiere.print.ReportViewerProvider;
|
||||||
*/
|
*/
|
||||||
public class ZkReportViewerProvider implements ReportViewerProvider {
|
public class ZkReportViewerProvider implements ReportViewerProvider {
|
||||||
|
|
||||||
public void openViewer(ReportEngine report) {
|
public void openViewer(final ReportEngine report) {
|
||||||
|
Runnable runnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
Window viewer = new ZkReportViewer(report, report.getName());
|
Window viewer = new ZkReportViewer(report, report.getName());
|
||||||
|
|
||||||
viewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
|
viewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
|
||||||
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
|
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
|
||||||
SessionManager.getAppDesktop().showWindow(viewer);
|
SessionManager.getAppDesktop().showWindow(viewer);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
AEnv.executeDesktopTask(runnable);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -22,6 +22,7 @@ import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.adempiere.util.ProcessUtil;
|
import org.adempiere.util.ProcessUtil;
|
||||||
import org.compiere.db.CConnection;
|
import org.compiere.db.CConnection;
|
||||||
import org.compiere.interfaces.Server;
|
import org.compiere.interfaces.Server;
|
||||||
|
@ -30,7 +31,6 @@ import org.compiere.print.ReportCtl;
|
||||||
import org.compiere.process.ClientProcess;
|
import org.compiere.process.ClientProcess;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
import org.compiere.process.ProcessInfoUtil;
|
import org.compiere.process.ProcessInfoUtil;
|
||||||
import org.compiere.util.ASyncProcess;
|
|
||||||
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;
|
||||||
|
@ -62,10 +62,10 @@ public abstract class AbstractProcessCtl implements Runnable
|
||||||
* @param trx Transaction
|
* @param trx Transaction
|
||||||
* Created in process(), VInvoiceGen.generateInvoices
|
* Created in process(), VInvoiceGen.generateInvoices
|
||||||
*/
|
*/
|
||||||
public AbstractProcessCtl (ASyncProcess parent, int WindowNo, ProcessInfo pi, Trx trx)
|
public AbstractProcessCtl (IProcessMonitor aProcessMonitor, int WindowNo, ProcessInfo pi, Trx trx)
|
||||||
{
|
{
|
||||||
windowno = WindowNo;
|
windowno = WindowNo;
|
||||||
m_parent = parent;
|
m_processMonitor = aProcessMonitor;
|
||||||
m_pi = pi;
|
m_pi = pi;
|
||||||
m_trx = trx; // handeled correctly
|
m_trx = trx; // handeled correctly
|
||||||
} // ProcessCtl
|
} // ProcessCtl
|
||||||
|
@ -73,7 +73,7 @@ public abstract class AbstractProcessCtl implements Runnable
|
||||||
/** Windowno */
|
/** Windowno */
|
||||||
private int windowno;
|
private int windowno;
|
||||||
/** Parenr */
|
/** Parenr */
|
||||||
private ASyncProcess m_parent;
|
private IProcessMonitor m_processMonitor;
|
||||||
/** Process Info */
|
/** Process Info */
|
||||||
private ProcessInfo m_pi;
|
private ProcessInfo m_pi;
|
||||||
private Trx m_trx;
|
private Trx m_trx;
|
||||||
|
@ -276,7 +276,7 @@ public abstract class AbstractProcessCtl implements Runnable
|
||||||
{
|
{
|
||||||
m_pi.setReportingProcess(true);
|
m_pi.setReportingProcess(true);
|
||||||
// Start Report -----------------------------------------------
|
// Start Report -----------------------------------------------
|
||||||
boolean ok = ReportCtl.start(m_parent, windowno, m_pi, IsDirectPrint);
|
boolean ok = ReportCtl.start(m_processMonitor, windowno, m_pi, IsDirectPrint);
|
||||||
m_pi.setSummary("Report", !ok);
|
m_pi.setSummary("Report", !ok);
|
||||||
unlock ();
|
unlock ();
|
||||||
}
|
}
|
||||||
|
@ -322,9 +322,14 @@ public abstract class AbstractProcessCtl implements Runnable
|
||||||
return m_pi;
|
return m_pi;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ASyncProcess getParent()
|
protected IProcessMonitor getProcessMonitor()
|
||||||
{
|
{
|
||||||
return m_parent;
|
return m_processMonitor;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IProcessMonitor getParent()
|
||||||
|
{
|
||||||
|
return getProcessMonitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isServerProcess()
|
protected boolean isServerProcess()
|
||||||
|
@ -440,7 +445,7 @@ public abstract class AbstractProcessCtl implements Runnable
|
||||||
if (m_pi.getClassName().toLowerCase().startsWith(MRule.SCRIPT_PREFIX)) {
|
if (m_pi.getClassName().toLowerCase().startsWith(MRule.SCRIPT_PREFIX)) {
|
||||||
return ProcessUtil.startScriptProcess(Env.getCtx(), m_pi, m_trx);
|
return ProcessUtil.startScriptProcess(Env.getCtx(), m_pi, m_trx);
|
||||||
} else {
|
} else {
|
||||||
return ProcessUtil.startJavaProcess(Env.getCtx(), m_pi, m_trx);
|
return ProcessUtil.startJavaProcess(Env.getCtx(), m_pi, m_trx, true, m_processMonitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !m_pi.isError();
|
return !m_pi.isError();
|
||||||
|
|
|
@ -21,13 +21,13 @@ import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.base.Service;
|
import org.adempiere.base.Service;
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
|
import org.adempiere.util.IProcessMonitor;
|
||||||
import org.compiere.model.MPaySelectionCheck;
|
import org.compiere.model.MPaySelectionCheck;
|
||||||
import org.compiere.model.MProcess;
|
import org.compiere.model.MProcess;
|
||||||
import org.compiere.model.MQuery;
|
import org.compiere.model.MQuery;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.model.PrintInfo;
|
import org.compiere.model.PrintInfo;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
import org.compiere.util.ASyncProcess;
|
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ public class ReportCtl
|
||||||
* @param IsDirectPrint if true, prints directly - otherwise View
|
* @param IsDirectPrint if true, prints directly - otherwise View
|
||||||
* @return true if created
|
* @return true if created
|
||||||
*/
|
*/
|
||||||
static public boolean start (ASyncProcess parent, int WindowNo, ProcessInfo pi, boolean IsDirectPrint)
|
static public boolean start (IProcessMonitor parent, int WindowNo, ProcessInfo pi, boolean IsDirectPrint)
|
||||||
{
|
{
|
||||||
pi.setPrintPreview(!IsDirectPrint);
|
pi.setPrintPreview(!IsDirectPrint);
|
||||||
return start(parent, WindowNo, pi);
|
return start(parent, WindowNo, pi);
|
||||||
|
@ -108,7 +108,7 @@ public class ReportCtl
|
||||||
* @param IsDirectPrint if true, prints directly - otherwise View
|
* @param IsDirectPrint if true, prints directly - otherwise View
|
||||||
* @return true if created
|
* @return true if created
|
||||||
*/
|
*/
|
||||||
static public boolean start (ASyncProcess parent, int WindowNo, ProcessInfo pi)
|
static public boolean start (IProcessMonitor parent, int WindowNo, ProcessInfo pi)
|
||||||
{
|
{
|
||||||
s_log.info("start - " + pi);
|
s_log.info("start - " + pi);
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ public class ReportCtl
|
||||||
* @param printerName Specified printer name
|
* @param printerName Specified printer name
|
||||||
* @return true if success
|
* @return true if success
|
||||||
*/
|
*/
|
||||||
public static boolean startDocumentPrint(int type, MPrintFormat customPrintFormat, int Record_ID, ASyncProcess parent, int WindowNo, String printerName)
|
public static boolean startDocumentPrint(int type, MPrintFormat customPrintFormat, int Record_ID, IProcessMonitor parent, int WindowNo, String printerName)
|
||||||
{
|
{
|
||||||
return(startDocumentPrint(type, customPrintFormat, Record_ID, parent, WindowNo, true, printerName));
|
return(startDocumentPrint(type, customPrintFormat, Record_ID, parent, WindowNo, true, printerName));
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ public class ReportCtl
|
||||||
* @param IsDirectPrint if true, prints directly - otherwise View
|
* @param IsDirectPrint if true, prints directly - otherwise View
|
||||||
* @return true if success
|
* @return true if success
|
||||||
*/
|
*/
|
||||||
public static boolean startDocumentPrint(int type, int Record_ID, ASyncProcess parent, int WindowNo,
|
public static boolean startDocumentPrint(int type, int Record_ID, IProcessMonitor parent, int WindowNo,
|
||||||
boolean IsDirectPrint)
|
boolean IsDirectPrint)
|
||||||
{
|
{
|
||||||
return(startDocumentPrint(type, null, Record_ID, parent, WindowNo, IsDirectPrint, null ));
|
return(startDocumentPrint(type, null, Record_ID, parent, WindowNo, IsDirectPrint, null ));
|
||||||
|
@ -290,7 +290,7 @@ public class ReportCtl
|
||||||
* @param printerName Specified printer name
|
* @param printerName Specified printer name
|
||||||
* @return true if success
|
* @return true if success
|
||||||
*/
|
*/
|
||||||
public static boolean startDocumentPrint (int type, MPrintFormat customPrintFormat, int Record_ID, ASyncProcess parent, int WindowNo,
|
public static boolean startDocumentPrint (int type, MPrintFormat customPrintFormat, int Record_ID, IProcessMonitor parent, int WindowNo,
|
||||||
boolean IsDirectPrint, String printerName)
|
boolean IsDirectPrint, String printerName)
|
||||||
{
|
{
|
||||||
ReportEngine re = ReportEngine.get (Env.getCtx(), type, Record_ID);
|
ReportEngine re = ReportEngine.get (Env.getCtx(), type, Record_ID);
|
||||||
|
|
Loading…
Reference in New Issue