merge experimental into development

This commit is contained in:
Carlos Ruiz 2015-04-08 17:02:31 -05:00
commit 247b9cadd2
31 changed files with 1392 additions and 576 deletions

View File

@ -0,0 +1,34 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Feb 4, 2015 3:19:23 PM IST
-- IDEMPIERE-2389 Add ReportType and AD_PrintFormat_ID in AD_PInstance Table
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202814,0,0,'Y',TO_DATE('2015-02-04 15:19:22','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-04 15:19:22','YYYY-MM-DD HH24:MI:SS'),100,'ReportType','Report Type','Report Type','D','84422b03-ffa2-435b-a485-9ac5de986f0c')
;
-- Feb 4, 2015 3:20:47 PM IST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (211830,0,'Report Type',282,'ReportType',NULL,5,'N','N','N','N','N',0,'N',10,NULL,0,0,'Y',TO_DATE('2015-02-04 15:20:46','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-04 15:20:46','YYYY-MM-DD HH24:MI:SS'),100,202814,'Y','N','D','N','N','N','Y','613c626e-e9a4-4efb-a39c-88529c27aea4','Y',0,'N','N')
;
-- Feb 4, 2015 3:20:54 PM IST
ALTER TABLE AD_PInstance ADD ReportType VARCHAR2(5) DEFAULT NULL
;
-- Feb 4, 2015 4:10:38 PM IST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (211834,0,'Print Format','Data Print Format','The print format determines how data is rendered for print.',282,'AD_PrintFormat_ID',NULL,22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_DATE('2015-02-04 16:10:36','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-04 16:10:36','YYYY-MM-DD HH24:MI:SS'),100,1790,'Y','N','D','N','N','N','Y','d2dbfea7-01e4-4fd5-8d75-cfe123ccf422','Y',0,'N','N')
;
-- Feb 4, 2015 4:10:41 PM IST
UPDATE AD_Column SET IsToolbarButton='N', FKConstraintName='ADPrintFormat_ADPInstance', FKConstraintType='N',Updated=TO_DATE('2015-02-04 16:10:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211834
;
-- Feb 4, 2015 4:10:41 PM IST
ALTER TABLE AD_PInstance ADD AD_PrintFormat_ID NUMBER(10) DEFAULT NULL
;
-- Feb 4, 2015 4:10:42 PM IST
ALTER TABLE AD_PInstance ADD CONSTRAINT ADPrintFormat_ADPInstance FOREIGN KEY (AD_PrintFormat_ID) REFERENCES ad_printformat(ad_printformat_id) DEFERRABLE INITIALLY DEFERRED
;
SELECT register_migration_script('201502041515_IDEMPIERE-2389.sql') FROM dual
;

View File

@ -0,0 +1,12 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Feb 16, 2015 9:52:26 AM ICT
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (211837,0,'Summary Level','This is a summary entity','A summary entity represents a branch in a tree rather than an end-node. Summary entities are used for reporting and do not have own values.',282,'IsSummary',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_DATE('2015-02-16 09:52:25','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-16 09:52:25','YYYY-MM-DD HH24:MI:SS'),100,416,'Y','N','D','N','N','N','N','d7123c51-3508-4264-be07-7d6c48216795','Y',0,'N','N')
;
-- Feb 16, 2015 9:52:42 AM ICT
ALTER TABLE AD_PInstance ADD IsSummary CHAR(1) DEFAULT NULL CHECK (IsSummary IN ('Y','N'))
;
SELECT register_migration_script('201502161604_IDEMPIERE-2389.sql') FROM dual
;

View File

@ -0,0 +1,20 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
-- Mar 13, 2015 3:58:49 AM ICT
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (211868,0,'Language ID',282,'AD_Language_ID','@SQL=SELECT NVL(MAX(AD_Language_ID),0)+1 AS DefaultValue FROM AD_Language',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_DATE('2015-03-13 03:58:48','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-03-13 03:58:48','YYYY-MM-DD HH24:MI:SS'),100,2159,'N','N','D','N','N','N','Y','f813543d-ec4b-4673-8bb2-8a7099f9fbb0','N',0,'N','N')
;
-- Mar 13, 2015 3:59:05 AM ICT
ALTER TABLE AD_PInstance ADD AD_Language_ID NUMBER(10) DEFAULT NULL
;
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
-- Mar 13, 2015 4:59:52 AM ICT
UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_DATE('2015-03-13 04:59:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211868
;
SELECT register_migration_script('201503131604-IDEMPIERE-2389.sql') FROM dual
;

View File

@ -0,0 +1,32 @@
-- Feb 4, 2015 3:19:23 PM IST
-- IDEMPIERE-2389 Add ReportType and AD_PrintFormat_ID in AD_PInstance Table
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202814,0,0,'Y',TO_TIMESTAMP('2015-02-04 15:19:22','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-04 15:19:22','YYYY-MM-DD HH24:MI:SS'),100,'ReportType','Report Type','Report Type','D','84422b03-ffa2-435b-a485-9ac5de986f0c')
;
-- Feb 4, 2015 3:20:47 PM IST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (211830,0,'Report Type',282,'ReportType',NULL,5,'N','N','N','N','N',0,'N',10,NULL,0,0,'Y',TO_TIMESTAMP('2015-02-04 15:20:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-04 15:20:46','YYYY-MM-DD HH24:MI:SS'),100,202814,'Y','N','D','N','N','N','Y','613c626e-e9a4-4efb-a39c-88529c27aea4','Y',0,'N','N')
;
-- Feb 4, 2015 3:20:54 PM IST
ALTER TABLE AD_PInstance ADD COLUMN ReportType VARCHAR(5) DEFAULT NULL
;
-- Feb 4, 2015 4:10:38 PM IST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (211834,0,'Print Format','Data Print Format','The print format determines how data is rendered for print.',282,'AD_PrintFormat_ID',NULL,22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2015-02-04 16:10:36','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-04 16:10:36','YYYY-MM-DD HH24:MI:SS'),100,1790,'Y','N','D','N','N','N','Y','d2dbfea7-01e4-4fd5-8d75-cfe123ccf422','Y',0,'N','N')
;
-- Feb 4, 2015 4:10:41 PM IST
UPDATE AD_Column SET IsToolbarButton='N', FKConstraintName='ADPrintFormat_ADPInstance', FKConstraintType='N',Updated=TO_TIMESTAMP('2015-02-04 16:10:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211834
;
-- Feb 4, 2015 4:10:41 PM IST
ALTER TABLE AD_PInstance ADD COLUMN AD_PrintFormat_ID NUMERIC(10) DEFAULT NULL
;
-- Feb 4, 2015 4:10:42 PM IST
ALTER TABLE AD_PInstance ADD CONSTRAINT ADPrintFormat_ADPInstance FOREIGN KEY (AD_PrintFormat_ID) REFERENCES ad_printformat(ad_printformat_id) DEFERRABLE INITIALLY DEFERRED
;
SELECT register_migration_script('201502041515_IDEMPIERE-2389.sql') FROM dual
;

View File

@ -0,0 +1,11 @@
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
-- Feb 16, 2015 9:52:26 AM ICT
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (211837,0,'Summary Level','This is a summary entity','A summary entity represents a branch in a tree rather than an end-node. Summary entities are used for reporting and do not have own values.',282,'IsSummary',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2015-02-16 09:52:25','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-16 09:52:25','YYYY-MM-DD HH24:MI:SS'),100,416,'Y','N','D','N','N','N','N','d7123c51-3508-4264-be07-7d6c48216795','Y',0,'N','N')
;
-- Feb 16, 2015 9:52:42 AM ICT
ALTER TABLE AD_PInstance ADD COLUMN IsSummary CHAR(1) DEFAULT NULL CHECK (IsSummary IN ('Y','N'))
;
SELECT register_migration_script('201502161604_IDEMPIERE-2389.sql') FROM dual
;

View File

@ -0,0 +1,15 @@
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
-- Mar 13, 2015 3:58:49 AM ICT
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (211868,0,'Language ID',282,'AD_Language_ID','@SQL=SELECT NVL(MAX(AD_Language_ID),0)+1 AS DefaultValue FROM AD_Language',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2015-03-13 03:58:48','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-03-13 03:58:48','YYYY-MM-DD HH24:MI:SS'),100,2159,'N','N','D','N','N','N','Y','f813543d-ec4b-4673-8bb2-8a7099f9fbb0','N',0,'N','N')
;
-- Mar 13, 2015 3:59:05 AM ICT
ALTER TABLE AD_PInstance ADD COLUMN AD_Language_ID NUMERIC(10) DEFAULT NULL
;
UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_TIMESTAMP('2015-03-13 04:59:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211868
;
SELECT register_migration_script('201503131604-IDEMPIERE-2389.sql') FROM dual
;

View File

@ -84,6 +84,36 @@ public interface I_AD_PInstance
/** Get AD_PInstance_UU */
public String getAD_PInstance_UU();
/** Column name AD_PrintFormat_ID */
public static final String COLUMNNAME_AD_PrintFormat_ID = "AD_PrintFormat_ID";
public static final String COLUMNNAME_AD_Language_ID = "AD_Language_ID";
/** Set Print Format.
* Data Print Format
*/
public void setAD_PrintFormat_ID (int AD_PrintFormat_ID);
/** Get Print Format.
* Data Print Format
*/
public int getAD_PrintFormat_ID();
/** Column name IsSummary */
public static final String COLUMNNAME_IsSummary = "IsSummary";
/** Set IsSummary.
* Data IsSummary
*/
public void setIsSummary (boolean isSummary);
/** Get IsSummary.
* Data IsSummary
*/
public boolean getIsSummary();
public org.compiere.model.I_AD_PrintFormat getAD_PrintFormat() throws RuntimeException;
/** Column name AD_Process_ID */
public static final String COLUMNNAME_AD_Process_ID = "AD_Process_ID";
@ -209,6 +239,15 @@ public interface I_AD_PInstance
*/
public int getRecord_ID();
/** Column name ReportType */
public static final String COLUMNNAME_ReportType = "ReportType";
/** Set Report Type */
public void setReportType (String ReportType);
/** Get Report Type */
public String getReportType();
/** Column name Result */
public static final String COLUMNNAME_Result = "Result";

View File

@ -449,6 +449,13 @@ public class MPInstance extends X_AD_PInstance
.append(ip.getInfo_To()).append("|")
.append(")");
}
if (getAD_Process().isReport()){
cksum.append(this.getAD_Language_ID()).append("|")
.append(this.getAD_PrintFormat_ID())
.append(this.getAD_Language_ID())
.append(this.getReportType())
.append(this.getIsSummary());
}
return cksum.toString();
}

View File

@ -30,7 +30,7 @@ public class X_AD_PInstance extends PO implements I_AD_PInstance, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20141030L;
private static final long serialVersionUID = 20150204L;
/** Standard Constructor */
public X_AD_PInstance (Properties ctx, int AD_PInstance_ID, String trxName)
@ -44,6 +44,8 @@ public class X_AD_PInstance extends PO implements I_AD_PInstance, I_Persistent
setIsRunAsJob (false);
// N
setRecord_ID (0);
setReportType (null);
// P
} */
}
@ -120,6 +122,86 @@ public class X_AD_PInstance extends PO implements I_AD_PInstance, I_Persistent
return (String)get_Value(COLUMNNAME_AD_PInstance_UU);
}
public org.compiere.model.I_AD_PrintFormat getAD_PrintFormat() throws RuntimeException
{
return (org.compiere.model.I_AD_PrintFormat)MTable.get(getCtx(), org.compiere.model.I_AD_PrintFormat.Table_Name)
.getPO(getAD_PrintFormat_ID(), get_TrxName()); }
/** Set Print Format.
@param AD_PrintFormat_ID
Data Print Format
*/
public void setAD_PrintFormat_ID (int AD_PrintFormat_ID)
{
if (AD_PrintFormat_ID < 1)
set_Value (COLUMNNAME_AD_PrintFormat_ID, null);
else
set_Value (COLUMNNAME_AD_PrintFormat_ID, Integer.valueOf(AD_PrintFormat_ID));
}
/** Get Print Format.
@return Data Print Format
*/
public int getAD_PrintFormat_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_PrintFormat_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_AD_Language getAD_Language() throws RuntimeException
{
return (org.compiere.model.I_AD_Language)MTable.get(getCtx(), org.compiere.model.I_AD_Language.Table_Name)
.getPO(getAD_PrintFormat_ID(), get_TrxName()); }
/** Set Print Format.
@param AD_PrintFormat_ID
Data Print Format
*/
public void setAD_Language_ID (int AD_Language_ID)
{
if (AD_Language_ID < 1)
set_Value (COLUMNNAME_AD_Language_ID, null);
else
set_Value (COLUMNNAME_AD_Language_ID, Integer.valueOf(AD_Language_ID));
}
/** Get Print Format.
@return Data Print Format
*/
public int getAD_Language_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Language_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set IsSummary.
@param IsSummary
Data IsSummary
*/
public void setIsSummary (boolean isSummary)
{
set_Value (COLUMNNAME_IsSummary, Boolean.valueOf(isSummary));
}
/** Get IsSummary.
@return Data IsSummary
*/
public boolean getIsSummary ()
{
Object oo = get_Value(COLUMNNAME_IsSummary);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
public org.compiere.model.I_AD_Process getAD_Process() throws RuntimeException
{
return (org.compiere.model.I_AD_Process)MTable.get(getCtx(), org.compiere.model.I_AD_Process.Table_Name)
@ -300,6 +382,27 @@ public class X_AD_PInstance extends PO implements I_AD_PInstance, I_Persistent
return ii.intValue();
}
/** PDF = P */
public static final String REPORTTYPE_PDF = "P";
/** HTML = H */
public static final String REPORTTYPE_HTML = "H";
/** XLS = X */
public static final String REPORTTYPE_XLS = "X";
/** Set Report Type.
@param ReportType Report Type */
public void setReportType (String ReportType)
{
set_Value (COLUMNNAME_ReportType, ReportType);
}
/** Get Report Type.
@return Report Type */
public String getReportType ()
{
return (String)get_Value(COLUMNNAME_ReportType);
}
/** Set Result.
@param Result
Result of the action taken

View File

@ -118,6 +118,7 @@ import org.eevolution.model.X_PP_Order;
*/
public class ReportEngine implements PrintServiceAttributeListener
{
/**
* Constructor
* @param ctx context
@ -130,16 +131,43 @@ public class ReportEngine implements PrintServiceAttributeListener
this(ctx, pf, query, info, null);
} // ReportEngine
/**
* Set report engine with summary and null transaction
* @param ctx
* @param pf
* @param query
* @param info
* @param isSummary
*/
public ReportEngine (Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, boolean isSummary)
{
this(ctx, pf, query, info, isSummary, null);
} // ReportEngine
/**
* Set report engine with summary = false
* @param ctx
* @param pf
* @param query
* @param info
* @param trxName
*/
public ReportEngine (Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, String trxName){
this(ctx, pf, query, info, false, trxName);
}
/**
* Constructor
* @param ctx context
* @param pf Print Format
* @param query Optional Query
* @param info print info
* @param isSummary
* @param trxName
*/
public ReportEngine (Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, String trxName)
public ReportEngine (Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, boolean isSummary, String trxName)
{
m_summary = isSummary;
if (pf == null)
throw new IllegalArgumentException("ReportEngine - no PrintFormat");
if (log.isLoggable(Level.INFO)) log.info(pf + " -- " + query);
@ -177,6 +205,8 @@ public class ReportEngine implements PrintServiceAttributeListener
/** Window */
private int m_windowNo = 0;
private int m_language_id = 0;
private boolean m_summary = false;
private List<IReportEngineEventListener> eventListeners = new ArrayList<IReportEngineEventListener>();
@ -1310,7 +1340,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
PrintInfo info = new PrintInfo (pi);
info.setAD_Table_ID(AD_Table_ID);
return new ReportEngine(ctx, format, query, info, pi.getTransactionName());
return new ReportEngine(ctx, format, query, info, pi.isSummary(), pi.getTransactionName());
} // get
/*************************************************************************/
@ -1764,4 +1794,32 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
{
m_summary = summary;
}
public boolean isSummary()
{
return m_summary;
}
public void setLanguageID(int languageID)
{
m_language_id = languageID;
}
public int getLanguageID()
{
return m_language_id;
}
private String reportType;
public void setReportType(String type)
{
reportType = type;
}
public String getReportType()
{
return reportType;
}
} // ReportEngine

View File

@ -40,10 +40,11 @@ import org.compiere.util.Util;
*/
public class ProcessInfo implements Serializable
{
/**
*
*/
private static final long serialVersionUID = -1084726411940456050L;
private static final long serialVersionUID = -7810177110347837681L;
/**
* Constructor
@ -144,6 +145,36 @@ public class ProcessInfo implements Serializable
private transient PO m_po = null;
private String reportType = null;
private boolean isSummary = false;
private int languageID = 0;
public int getLanguageID() {
return languageID;
}
public void setLanguageID(int languageID) {
this.languageID = languageID;
}
public String getReportType() {
return reportType;
}
public void setReportType(String reportType) {
this.reportType = reportType;
}
public void setIsSummary(boolean isSummary) {
this.isSummary = isSummary;
}
public boolean isSummary() {
return this.isSummary;
}
/**
* String representation
* @return String representation

View File

@ -20,17 +20,35 @@ import org.zkoss.zk.ui.Component;
/**
* interface for any component want support show other window over it with a
* mask. object manage component as AbstractUIPart also implement this interface
* consider below case.
* 1. show a dialog => show mask
* 2. process a event
* 2.1. show other dialog => show mask
* 2.1. hidden dialog in step 1 => hidden mask
* 3. result dialog show without mask
* to void this case process as below
* in {@link #showMask()} set a flag to request scope by call: {@link Component#setAttribute(String, Object, int)}
* key is {@link #READY_SHOW_MASK_FLAG} value is Integer(1) and scope is {@link Component#REQUEST_SCOPE}
* in {@link #hideMask()} check flag before hidden mask. when has flag, don't hidden mask
*
* component want support show mask can implement this interface or use support class {@link ShowMaskWrapper} as composite object
*/
public interface ISupportMask {
public static String READY_SHOW_MASK_FLAG = "ISupportMask_READY_SHOW_MASK_FLAG";
/**
* show mask over this component
* when override, remember call {@link Component#setAttribute(String, Object, int)} with
* key is {@link #READY_SHOW_MASK_FLAG} value is Integer(1) and scope is {@link Component#REQUEST_SCOPE}
* by call {@link LayoutUtils#setFlagShowMask(Component)}
*/
public void showMask();
/**
* Hide mask. at code call showMask will hand reference to this object. and
* call this function in handle close event of window
* when override, remember check exists of key {@link #READY_SHOW_MASK_FLAG} at scope {@link Component#REQUEST_SCOPE} in attribute
* by call {@link LayoutUtils#hasFlagShowMask(Component)}
* if exists flag, don't hidden mask
*/
public void hideMask();
@ -46,4 +64,4 @@ public interface ISupportMask {
* @return
*/
public Component getMaskComponent();
}
}

View File

@ -0,0 +1,117 @@
/******************************************************************************
* Copyright (C) 2015 iDempiere *
* Product: iDempiere ERP & CRM Smart Business Solution *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui;
import org.adempiere.webui.component.Mask;
import org.adempiere.webui.part.UIPart;
import org.zkoss.zk.ui.Component;
/**
* Helper class for any component want implement {@link ISupportMask}
* Just make a instance of this class and let it do everything
* @author hieplq
*
*/
public class ShowMaskWrapper implements ISupportMask {
/**
* component will implement ISupportMask;
*/
private Component comp;
/**
* cache {@link Mask} Object
*/
private Mask maskObj;
/**
* comp is component want implement this interface
* @param comp
*/
public ShowMaskWrapper (Component comp){
this.comp = comp;
}
/**
* this mask will show over component from {@link UIPart#getComponent()}
* @param uiPart
*/
public ShowMaskWrapper (UIPart uiPart){
this.comp = uiPart.getComponent();
}
/**
* {@inheritDoc}
*/
@Override
public void showMask() {
maskObj = getMaskObj ();
if (maskObj.getParent() == null){
comp.appendChild(maskObj);
}
ShowMaskWrapper.setFlagShowMask(comp);
}
/**
* {@inheritDoc}
*/
@Override
public void hideMask() {
if (maskObj != null || maskObj.getParent() != null){
// in same request, not yet call to show mask
if (!ShowMaskWrapper.hasFlagShowMask(comp)){
maskObj.detach();
}
}
}
/**
* {@inheritDoc}
* return new {@link Mask} when mask is not yet create
*/
@Override
public Mask getMaskObj() {
if (maskObj == null)
maskObj = new Mask();
return maskObj;
}
/**
* {@inheritDoc}
*/
@Override
public Component getMaskComponent() {
return comp;
}
/**
* Set flag {@link ISupportMask#READY_SHOW_MASK_FLAG} to Component.REQUEST_SCOPE
* @param comp
*/
public static void setFlagShowMask (Component comp){
comp.setAttribute(ISupportMask.READY_SHOW_MASK_FLAG, new Integer(1), Component.REQUEST_SCOPE);
}
/**
* check flag {@link ISupportMask#READY_SHOW_MASK_FLAG} ready in scope Component.REQUEST_SCOPE
* @param comp
* @return
*/
public static boolean hasFlagShowMask (Component comp){
return (comp.getAttribute(ISupportMask.READY_SHOW_MASK_FLAG, Component.REQUEST_SCOPE) != null);
}
}

View File

@ -2428,7 +2428,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
final ProcessModalDialog dialog = new ProcessModalDialog(AbstractADWindowContent.this, getWindowNo(), AD_Process_ID,table_ID, record_ID, true);
if (dialog.isValid()) {
dialog.setWidth("500px");
//dialog.setWidth("500px");
dialog.setBorder("normal");
getComponent().getParent().appendChild(dialog);
showBusyMask(dialog);
@ -2936,7 +2936,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (dialog.isValid())
{
dialog.setWidth("500px");
//dialog.setWidth("500px");
dialog.setBorder("normal");
getComponent().getParent().appendChild(dialog);
showBusyMask(dialog);

View File

@ -37,6 +37,7 @@ import javax.servlet.ServletRequest;
import org.adempiere.webui.adwindow.ADWindow;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.desktop.IDesktop;
import org.adempiere.webui.editor.WTableDirEditor;
import org.adempiere.webui.info.InfoWindow;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ThemeManager;
@ -47,7 +48,10 @@ import org.compiere.model.GridWindowVO;
import org.compiere.model.I_AD_Window;
import org.compiere.model.Lookup;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MClient;
import org.compiere.model.MLanguage;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MQuery;
import org.compiere.model.MSession;
import org.compiere.model.MTable;
@ -787,4 +791,15 @@ public final class AEnv
return adWindowID;
}
public static WTableDirEditor getListDocumentLanguage (MClient client) throws Exception {
WTableDirEditor fLanguageType = null;
if (client.isMultiLingualDocument()){
Lookup lookupLanguage = MLookupFactory.get (Env.getCtx(), 0, 0, DisplayType.TableDir,
Env.getLanguage(Env.getCtx()), MLanguage.COLUMNNAME_AD_Language_ID, 0, false,
" IsActive='Y' AND IsLoginLocale = 'Y' ");
fLanguageType = new WTableDirEditor(MLanguage.COLUMNNAME_AD_Language_ID, false, false, true, lookupLanguage);
}
return fLanguageType;
}
} // AEnv

View File

@ -29,76 +29,91 @@ import org.adempiere.util.Callback;
import org.adempiere.util.ContextRunnable;
import org.adempiere.util.IProcessUI;
import org.adempiere.util.ServerContext;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.Columns;
import org.adempiere.webui.component.ComboItem;
import org.adempiere.webui.component.Combobox;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WTableDirEditor;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.factory.ButtonFactory;
import org.adempiere.webui.process.WProcessInfo;
import org.adempiere.webui.window.FDialog;
import org.adempiere.webui.window.MultiFileDownloadDialog;
import org.compiere.Adempiere;
import org.compiere.model.Lookup;
import org.compiere.model.MAttachment;
import org.compiere.model.MClient;
import org.compiere.model.MLanguage;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MLookupInfo;
import org.compiere.model.MNote;
import org.compiere.model.MPInstance;
import org.compiere.model.MPInstancePara;
import org.compiere.model.MProcess;
import org.compiere.model.MRole;
import org.compiere.model.MSysConfig;
import org.compiere.model.MTable;
import org.compiere.model.MUser;
import org.compiere.model.Query;
import org.compiere.model.X_AD_ReportView;
import org.compiere.print.MPrintFormat;
import org.compiere.process.ProcessInfo;
import org.compiere.process.ProcessInfoUtil;
import org.compiere.process.ServerProcessCtl;
import org.compiere.util.AdempiereSystemError;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Trx;
import org.compiere.util.Util;
import org.zkoss.zk.au.out.AuEcho;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Desktop;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.HtmlBasedComponent;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Div;
import org.zkoss.zul.Hlayout;
import org.zkoss.zul.Html;
import org.zkoss.zul.Space;
import org.zkoss.zul.Vlayout;
public abstract class AbstractProcessDialog extends Window implements IProcessUI, EventListener<Event>
{
/**
*
*/
private static final long serialVersionUID = 761285757875594250L;
private static final long serialVersionUID = -4807787318205732697L;
private static final String ON_COMPLETE = "onComplete";
private static final String ON_STATUS_UPDATE = "onStatusUpdate";
private static CLogger log = CLogger.getCLogger(AbstractProcessDialog.class);
private int m_WindowNo;
protected int m_WindowNo;
private Properties m_ctx;
private int m_AD_Process_ID;
private ProcessInfo m_pi = null;
private boolean m_disposeOnComplete;
private Html message = null;
private Panel centerPanel = null;
private ProcessParameterPanel parameterPanel = null;
private Checkbox runAsJobField = null;
private WTableDirEditor notificationTypeField = null;
@ -120,11 +135,21 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
protected AbstractProcessDialog()
{
super();
message = new Html();
centerPanel = new Panel();
}
protected boolean init(Properties ctx, int WindowNo, int AD_Process_ID, ProcessInfo pi, String innerWidth, boolean autoStart, boolean isDisposeOnComplete)
/**
* layout as below
*
* @param ctx
* @param WindowNo
* @param AD_Process_ID
* @param pi
* @param innerWidth
* @param autoStart
* @param isDisposeOnComplete
* @return
*/
protected boolean init(Properties ctx, int WindowNo, int AD_Process_ID, ProcessInfo pi, boolean autoStart, boolean isDisposeOnComplete)
{
m_ctx = ctx;
m_WindowNo = WindowNo;
@ -144,7 +169,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
+ "WHERE p.AD_Process_ID=t.AD_Process_ID"
+ " AND p.AD_Process_ID=? AND t.AD_Language=?";
PreparedStatement pstmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
@ -186,7 +211,6 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
//
this.setTitle(m_Name);
initialMessage = m_messageText.toString();
message.setContent(initialMessage);
// Move from APanel.actionButton
if (m_pi == null)
@ -194,11 +218,9 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
m_pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx()));
m_pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
m_pi.setTitle(m_Name);
parameterPanel = new ProcessParameterPanel(m_WindowNo, m_pi, innerWidth);
centerPanel.getChildren().clear();
if ( parameterPanel.init() ) {
centerPanel.appendChild(parameterPanel);
} else {
parameterPanel = new ProcessParameterPanel(m_WindowNo, m_pi);
if ( !parameterPanel.init() ) {
if (m_ShowHelp != null && m_ShowHelp.equals("N"))
autoStart = true;
@ -216,11 +238,84 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
return true;
}
layout();
return true;
}
protected HtmlBasedComponent topParameterLayout;
protected HtmlBasedComponent bottomParameterLayout;
protected HtmlBasedComponent mainParameterLayout;
private WTableDirEditor fPrintFormat;
private WEditor fLanguageType;
private Listbox freportType;
private Checkbox chbIsSummary;
protected Button bOK;
protected Button bCancel;
protected Combobox fSavedName=new Combobox();
private Button bSave=ButtonFactory.createNamedButton("Save");
private Button bDelete=ButtonFactory.createNamedButton("Delete");
private List<MPInstance> savedParams;
private Label lSaved;
protected void layout(){
overalLayout();
topLayout(topParameterLayout);
bottomLayout(bottomParameterLayout);
}
protected void overalLayout(){
mainParameterLayout = new Div();
mainParameterLayout.setSclass("main-parameter-layout");
this.appendChild(mainParameterLayout);
// header and input component
topParameterLayout = new Vlayout();
topParameterLayout.setSclass("top-parameter-layout");
mainParameterLayout.appendChild(topParameterLayout);
topParameterLayout.setVflex("true");
// button and advanced control
bottomParameterLayout = new Vlayout();
bottomParameterLayout.setSclass("bottom-parameter-layout");
mainParameterLayout.appendChild(bottomParameterLayout);
}
protected void topLayout(HtmlBasedComponent topParameterLayout) {
// message
setHeadMessage (topParameterLayout, getMessageText().toString());
// input component
HtmlBasedComponent inputParameterLayout = new Div();
inputParameterLayout.setSclass("input-paramenter-layout");
topParameterLayout.appendChild(inputParameterLayout);
// input parameter content
inputParameterLayout(inputParameterLayout);
}
protected HtmlBasedComponent setHeadMessage (HtmlBasedComponent parent, String contentMsg){
// message
HtmlBasedComponent messageParameterLayout = new Vlayout();
parent.appendChild(messageParameterLayout);
messageParameterLayout.setSclass("message-parameter-layout");
// header content
HtmlBasedComponent messageDiv = new Div();
Html content = new Html(contentMsg);
messageDiv.appendChild(content);
messageDiv.setSclass("message-paramenter");
messageParameterLayout.appendChild(messageDiv);
return messageParameterLayout;
}
protected void inputParameterLayout (HtmlBasedComponent parent) {
parent.appendChild(parameterPanel);
if (MSysConfig.getBooleanValue(MSysConfig.BACKGROUND_JOB_ALLOWED, false))
{
Grid grid = GridFactory.newGridLayout();
centerPanel.appendChild(grid);
grid.setInnerWidth(innerWidth);
parent.appendChild(grid);
Columns columns = new Columns();
grid.appendChild(columns);
@ -270,8 +365,220 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
runAsJobField.setChecked(MSysConfig.getBooleanValue(MSysConfig.BACKGROUND_JOB_BY_DEFAULT, false));
notificationTypeField.getComponent().getParent().setVisible(runAsJobField.isChecked());
}
}
protected void bottomLayout(HtmlBasedComponent bottomParameterLayout) {
reportOptionLayout(bottomParameterLayout);
HtmlBasedComponent bottomContainer = new Div ();
bottomContainer.setSclass("bottom-container");
bottomParameterLayout.appendChild(bottomContainer);
MProcess process = MProcess.get(Env.getCtx(), m_AD_Process_ID);
int count = process.getParameters().length;
if (count > 0)
savePrameterLayout (bottomContainer);
buttonLayout (bottomContainer);
}
protected void reportOptionLayout(HtmlBasedComponent bottomParameterLayout) {
if (!isReport())
return;//if not a report not need show this pannel
// option control
HtmlBasedComponent reportOptionLayout = new Hlayout();
reportOptionLayout.setSclass("report-option-container");
bottomParameterLayout.appendChild(reportOptionLayout);
freportType = new Listbox();
freportType.setSclass("option-input-parameter");
chbIsSummary = new Checkbox();
chbIsSummary.setSclass("option-input-parameter");
Label lPrintFormat = new Label(Msg.translate(Env.getCtx(), "AD_PrintFormat_ID"));
lPrintFormat.setSclass("option-input-parameter");
Label lreportType = new Label(Msg.translate(Env.getCtx(), "view.report"));
lreportType.setSclass("option-input-parameter");
Label lIsSummary = new Label(Msg.translate(Env.getCtx(), "Summary"));
lIsSummary.setSclass("option-input-parameter");
MClient client = MClient.get(m_ctx);
listPrintFormat(client);
reportOptionLayout.appendChild(lPrintFormat);
reportOptionLayout.appendChild(fPrintFormat.getComponent());
if (client.isMultiLingualDocument()){
Label lLanguageType = new Label(Msg.translate(Env.getCtx(), MLanguage.COLUMNNAME_AD_Language_ID));
reportOptionLayout.appendChild(lLanguageType);
reportOptionLayout.appendChild(fLanguageType.getComponent());
((Combobox)fLanguageType.getComponent()).setSclass("option-input-parameter");
}
fPrintFormat.getComponent().setSclass("option-input-parameter");
reportOptionLayout.appendChild(lreportType);
reportOptionLayout.appendChild(freportType);
reportOptionLayout.appendChild(lIsSummary);
reportOptionLayout.appendChild(chbIsSummary);
}
return true;
protected boolean isReport () {
MProcess pr = new MProcess(m_ctx, m_AD_Process_ID, null);
return pr.isReport() && pr.getJasperReport() == null;
}
protected void savePrameterLayout(HtmlBasedComponent bottomParameterLayout) {
HtmlBasedComponent savePrameterLayout = new Div();
savePrameterLayout.setSclass("save-parameter-container");
bottomParameterLayout.appendChild(savePrameterLayout);
lSaved = new Label(Msg.getMsg(Env.getCtx(), "SavedParameter"));
savePrameterLayout.appendChild(lSaved);
fSavedName = new Combobox();
fSavedName.addEventListener(Events.ON_CHANGE, this);
savePrameterLayout.appendChild(fSavedName);
bSave.setEnabled(false);
bSave.addActionListener(this);
savePrameterLayout.appendChild(bSave);
bDelete.setEnabled(false);
bDelete.addActionListener(this);
savePrameterLayout.appendChild(bDelete);
querySaved();
}
protected void querySaved()
{
//user query
savedParams = MPInstance.get(Env.getCtx(), getAD_Process_ID(), Env.getContextAsInt(Env.getCtx(), "#AD_User_ID"));
fSavedName.removeAllItems();
for (MPInstance instance : savedParams)
{
String queries = instance.get_ValueAsString("Name");
fSavedName.appendItem(queries);
}
fSavedName.setValue("");
}
protected void buttonLayout (HtmlBasedComponent bottomParameterLayout) {
HtmlBasedComponent confParaPanel =new Div();
confParaPanel.setSclass("button-container");
bottomParameterLayout.appendChild(confParaPanel);
// Invert - Unify OK/Cancel IDEMPIERE-77
bOK = ButtonFactory.createNamedButton(ConfirmPanel.A_OK, true, true);
bOK.setId("Ok");
bOK.addEventListener(Events.ON_CLICK, this);
confParaPanel.appendChild(bOK);
bCancel = ButtonFactory.createNamedButton(ConfirmPanel.A_CANCEL, true, true);
bCancel.setId("Cancel");
bCancel.addEventListener(Events.ON_CLICK, this);
confParaPanel.appendChild(bCancel);
}
private void listPrintFormat(MClient client)
{
int AD_Column_ID = 0;
boolean m_isCanExport = false;
MProcess pr = new MProcess(m_ctx, m_AD_Process_ID, null);
int table_ID = 0;
try
{
if (pr.getAD_ReportView_ID() > 0)
{
X_AD_ReportView m_Reportview = new X_AD_ReportView(m_ctx, pr.getAD_ReportView_ID(), null);
table_ID = m_Reportview.getAD_Table_ID();
}
else if (pr.getAD_PrintFormat_ID() > 0)
{
MPrintFormat format = new MPrintFormat(m_ctx, pr.getAD_PrintFormat_ID(), null);
table_ID = format.getAD_Table_ID();
}
String valCode = null;
if (table_ID > 0)
{
valCode = "AD_PrintFormat.AD_Table_ID=" + table_ID;
m_isCanExport = MRole.getDefault().isCanExport(table_ID);
}
Lookup lookup = MLookupFactory.get (Env.getCtx(), m_WindowNo,
AD_Column_ID, DisplayType.TableDir,
Env.getLanguage(Env.getCtx()), "AD_PrintFormat_ID", 0, false,
valCode);
fPrintFormat = new WTableDirEditor("AD_PrintFormat_ID", false, false, true, lookup);
if (client.isMultiLingualDocument()){
fLanguageType = AEnv.getListDocumentLanguage(client);
}
}
catch (Exception e)
{
log.log(Level.SEVERE, e.getLocalizedMessage());
}
freportType.removeAllItems();
freportType.setMold("select");
freportType.appendItem("HTML", "HTML");
if (m_isCanExport)
{
freportType.appendItem("PDF", "PDF");
freportType.appendItem("Excel", "XLS");
}
freportType.setSelectedIndex(0);
String where = "AD_Process_ID = ? AND AD_User_ID = ? AND Name IS NULL ";
MPInstance lastrun = MTable.get(Env.getCtx(), MPInstance.Table_Name).createQuery(where, null).setOnlyActiveRecords(true).setClient_ID()
.setParameters(m_AD_Process_ID, Env.getContextAsInt(Env.getCtx(), "#AD_User_ID")).setOrderBy("Created DESC").first();
setReportTypeAndPrintFormat(lastrun);
}
private void setReportTypeAndPrintFormat(MPInstance instance)
{
if (fPrintFormat != null && instance != null) {
fPrintFormat.setValue((Integer) instance.getAD_PrintFormat_ID());
}
if (fLanguageType != null && instance != null) {
fLanguageType.setValue((Integer) instance.getAD_Language_ID());
}
if (freportType != null && instance != null) {
if (instance.getReportType() == null)
freportType.setValue("HTML");
else
freportType.setValue(instance.getReportType());
}
if (instance != null && chbIsSummary != null)
chbIsSummary.setSelected(instance.getIsSummary());
}
protected void saveReportOption (){
if (!isReport()){
return;
}
if(freportType.getSelectedItem() != null) {
getProcessInfo().setReportType(freportType.getSelectedItem().getValue().toString());
}
if(fPrintFormat != null && fPrintFormat.getValue() != null) {
MPrintFormat format = new MPrintFormat(m_ctx, (Integer) fPrintFormat.getValue(), null);
if (format != null) {
getProcessInfo().setSerializableObject(format);
}
}
getProcessInfo().setIsSummary(chbIsSummary.isChecked());
if (fLanguageType != null)
getProcessInfo().setLanguageID(fLanguageType.getValue() == null?0:(int)fLanguageType.getValue());
}
protected void autoStart()
@ -285,12 +592,143 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
if (component == runAsJobField && event.getName().equals(Events.ON_CHECK))
{
notificationTypeField.getComponent().getParent().setVisible(runAsJobField.isChecked());
centerPanel.invalidate();
}
else if (event.getName().equals(ON_COMPLETE))
onComplete();
else if (event.getName().equals(ON_STATUS_UPDATE))
onStatusUpdate(event);
else if (event.getTarget().equals(bSave) || event.getTarget().equals(bDelete) || event.getTarget().equals(fSavedName)){
String saveName = null;
boolean lastRun = false;
if (fSavedName.getRawText() != null) {
saveName = fSavedName.getRawText();
lastRun = ("** " + Msg.getMsg(Env.getCtx(), "LastRun") + " **")
.equals(saveName);
}
if (bSave.equals(event.getTarget()))
updateSaveParameter(saveName);
else if (bDelete.equals(event.getTarget()))
deleteSaveParameter(saveName);
else
chooseSaveParameter(saveName, lastRun);
}else if (event.getTarget().equals(bOK)){
saveReportOption();
}
}
protected void updateSaveParameter(String saveName) {
// Update existing
if (fSavedName.getSelectedIndex() > -1 && savedParams != null) {
for (int i = 0; i < savedParams.size(); i++) {
if (savedParams.get(i).getName().equals(saveName)) {
getProcessInfo().setAD_PInstance_ID(savedParams.get(i)
.getAD_PInstance_ID());
for (MPInstancePara para : savedParams.get(i)
.getParameters()) {
para.deleteEx(true);
}
getParameterPanel().saveParameters();
saveReportOptionToInstance(savedParams.get(i));
savedParams.get(i).saveEx();
}
}
}
// create new
else {
MPInstance instance = null;
try {
instance = new MPInstance(Env.getCtx(),
getProcessInfo().getAD_Process_ID(), getProcessInfo().getRecord_ID());
instance.setName(saveName);
saveReportOptionToInstance(instance);
instance.saveEx();
getProcessInfo().setAD_PInstance_ID(instance.getAD_PInstance_ID());
// Get Parameters
if (getParameterPanel() != null) {
if (!getParameterPanel().saveParameters()) {
throw new AdempiereSystemError(Msg.getMsg(
Env.getCtx(), "SaveParameterError"));
}
}
} catch (Exception ex) {
log.log(Level.SEVERE, ex.getLocalizedMessage(), ex);
}
}
querySaved();
fSavedName.setSelectedItem(getComboItem(saveName));
}
protected void saveReportOptionToInstance (MPInstance instance){
if (!isReport())
return;
Object value = fPrintFormat.getValue();
if (value == null){
instance.setAD_PrintFormat_ID(0);
}else{
instance.setAD_PrintFormat_ID((Integer)value);
}
if (fLanguageType != null){
value = fLanguageType.getValue();
if (value == null){
instance.setAD_Language_ID(0);
}else{
instance.setAD_Language_ID((Integer)value);
}
}
instance.setReportType(freportType.getSelectedItem().getValue().toString());
instance.setIsSummary(chbIsSummary.isSelected());
}
public Comboitem getComboItem( String value) {
Comboitem item = null;
for (int i = 0; i < fSavedName.getItems().size(); i++) {
if (fSavedName.getItems().get(i) != null) {
item = (Comboitem)fSavedName.getItems().get(i);
if (value.equals(item.getLabel().toString())) {
break;
}
}
}
return item;
}
protected void deleteSaveParameter(String saveName) {
Object o = fSavedName.getSelectedItem();
if (savedParams != null && o != null) {
String selected = fSavedName.getSelectedItem().getLabel();
for (int i = 0; i < savedParams.size(); i++) {
if (savedParams.get(i).getName().equals(selected)) {
savedParams.get(i).deleteEx(true);
}
}
}
querySaved();
}
protected void chooseSaveParameter(String saveName, boolean lastRun) {
if (savedParams != null && saveName != null) {
for (int i = 0; i < savedParams.size(); i++) {
if (savedParams.get(i).getName().equals(saveName)) {
loadSavedParams(savedParams.get(i));
}
}
}
boolean enabled = !Util.isEmpty(saveName);
bSave.setEnabled(enabled && !lastRun);
bDelete.setEnabled(enabled && fSavedName.getSelectedIndex() > -1
&& !lastRun);
}
private void loadSavedParams(MPInstance instance) {
getParameterPanel().loadParameters(instance);
setReportTypeAndPrintFormat(instance);
}
protected void startProcess()
@ -554,17 +992,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
{
return m_AD_Process_ID;
}
public Html getMessage()
{
return message;
}
public Panel getCenterPanel()
{
return centerPanel;
}
public ProcessParameterPanel getParameterPanel()
{
return parameterPanel;

View File

@ -27,19 +27,11 @@ import java.util.logging.Level;
import org.adempiere.util.Callback;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Combobox;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.DocumentLink;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Mask;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.desktop.IDesktop;
import org.adempiere.webui.factory.ButtonFactory;
import org.adempiere.webui.panel.IHelpContext;
import org.adempiere.webui.part.WindowContainer;
import org.adempiere.webui.process.WProcessInfo;
@ -47,15 +39,11 @@ import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.window.FDialog;
import org.adempiere.webui.window.SimplePDFViewer;
import org.compiere.model.MPInstance;
import org.compiere.model.MPInstancePara;
import org.compiere.model.MProcess;
import org.compiere.model.X_AD_CtxHelp;
import org.compiere.print.ReportEngine;
import org.compiere.process.ProcessInfo;
import org.compiere.process.ProcessInfoLog;
import org.compiere.process.ProcessInfoUtil;
import org.compiere.util.AdempiereSystemError;
import org.compiere.util.CLogger;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
@ -68,19 +56,16 @@ import org.zkoss.zhtml.Tr;
import org.zkoss.zk.au.out.AuEcho;
import org.zkoss.zk.au.out.AuScript;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.HtmlBasedComponent;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.A;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Html;
import org.zkoss.zul.Label;
import org.zkoss.zul.North;
import org.zkoss.zul.South;
import org.zkoss.zul.Vlayout;
import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfContentByte;
@ -100,33 +85,26 @@ import com.lowagie.text.pdf.PdfWriter;
*/
public class ProcessDialog extends AbstractProcessDialog implements EventListener<Event>, IHelpContext
{
/**
*
*/
private static final long serialVersionUID = 1320565116095846687L;
private static final long serialVersionUID = 5958768001208626552L;
public static final String ON_INITIAL_FOCUS_EVENT = "onInitialFocus";
private static final String MESSAGE_DIV_STYLE = "max-height: 150pt; overflow: auto; margin: 10px;";
public static final String ON_INITIAL_FOCUS_EVENT = "onInitialFocus";
/** Logger */
private static CLogger log = CLogger.getCLogger(ProcessDialog.class);
//
private Div messageDiv;
private Center center;
private Table logMessageTable;
private North north;
private Table logMessageTable;
private int[] m_ids = null;
private Button bOK = null;
private boolean isParameterPage = true;
private Mask mask;
private boolean showLastRun = false;
private Grid southRowPanel = GridFactory.newGridLayout();
private HtmlBasedComponent resultPanelLayout;
private HtmlBasedComponent messageResultContent;
private HtmlBasedComponent infoResultContent;
/**
* Dialog to start a process/report
@ -146,15 +124,10 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
int WindowNo = SessionManager.getAppDesktop().registerWindow(this);
this.setAttribute(IDesktop.WINDOWNO_ATTRIBUTE, WindowNo);
Env.setContext(Env.getCtx(), WindowNo, "IsSOTrx", isSOTrx ? "Y" : "N");
try
{
MProcess process = MProcess.get(Env.getCtx(), AD_Process_ID);
int count = process.getParameters().length;
if (count > 0)
showLastRun = true;
initComponents();
init(Env.getCtx(), WindowNo, AD_Process_ID, null, "70%", false, false);
init(Env.getCtx(), WindowNo, AD_Process_ID, null, false, false);
querySaved();
addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this);
addEventListener(ON_INITIAL_FOCUS_EVENT, this);
@ -164,97 +137,7 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
log.log(Level.SEVERE, "", ex);
}
} // ProcessDialog
private void querySaved()
{
//user query
savedParams = MPInstance.get(Env.getCtx(), getAD_Process_ID(), Env.getContextAsInt(Env.getCtx(), "#AD_User_ID"));
fSavedName.removeAllItems();
for (MPInstance instance : savedParams)
{
String queries = instance.get_ValueAsString("Name");
fSavedName.appendItem(queries);
}
fSavedName.setValue("");
}
private void initComponents() {
this.setStyle("position: absolute; width: 100%; height: 100%");
Borderlayout layout = new Borderlayout();
layout.setStyle("position: absolute; width: 100%; height: 100%; border: none;");
messageDiv = new Div();
messageDiv.appendChild(getMessage());
messageDiv.setStyle(MESSAGE_DIV_STYLE);
messageDiv.setId("message");
north = new North();
north.appendChild(messageDiv);
layout.appendChild(north);
north.setAutoscroll(true);
north.setStyle("border: none;");
center = new Center();
layout.appendChild(center);
center.appendChild(getCenterPanel());
getCenterPanel().setHflex("1");
getCenterPanel().setVflex("1");
center.setAutoscroll(true);
center.setStyle("border: none");
Rows rows = southRowPanel.newRows();
Row row = rows.newRow();
Hbox hBox = new Hbox();
lSaved = new Label(Msg.getMsg(Env.getCtx(), "SavedParameter"));
hBox.appendChild(lSaved);
fSavedName.addEventListener(Events.ON_CHANGE, this);
hBox.appendChild(fSavedName);
bSave.setEnabled(false);
bSave.addActionListener(this);
hBox.appendChild(bSave);
bDelete.setEnabled(false);
bDelete.addActionListener(this);
hBox.appendChild(bDelete);
row.appendChild(hBox);
if(!showLastRun)
hBox.setVisible(false);
Panel confParaPanel =new Panel();
confParaPanel.setAlign("right");
// Invert - Unify OK/Cancel IDEMPIERE-77
bOK = ButtonFactory.createNamedButton(ConfirmPanel.A_OK, true, true);
bOK.setId("Ok");
bOK.addEventListener(Events.ON_CLICK, this);
confParaPanel.appendChild(bOK);
bCancel = ButtonFactory.createNamedButton(ConfirmPanel.A_CANCEL, true, true);
bCancel.setId("Cancel");
bCancel.addEventListener(Events.ON_CLICK, this);
confParaPanel.appendChild(bCancel);
row.appendChild(confParaPanel);
South south = new South();
south.setSclass("dialog-footer");
layout.appendChild(south);
south.appendChild(southRowPanel);
this.appendChild(layout);
}
private Button bCancel = null;
//saved parameters
private Combobox fSavedName=new Combobox();
private Button bSave=ButtonFactory.createNamedButton("Save");
private Button bDelete=ButtonFactory.createNamedButton("Delete");
private List<MPInstance> savedParams;
private Label lSaved;
/**
* Set Visible
* (set focus to OK if visible)
@ -276,94 +159,21 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
public void onEvent(Event event) {
Component component = event.getTarget();
String saveName = null;
boolean lastRun = false;
if (fSavedName.getRawText() != null) {
saveName = fSavedName.getRawText();
lastRun = ("** " + Msg.getMsg(Env.getCtx(), "LastRun") + " **")
.equals(saveName);
}
if(component instanceof A && event.getName().equals((Events.ON_CLICK))){
doOnClick((A)component);
} else if (component instanceof Button) {
Button element = (Button)component;
if ("Ok".equalsIgnoreCase(element.getId())) {
if (isParameterPage)
startProcess();
else
restart();
} else if ("Cancel".equalsIgnoreCase(element.getId())) {
cancelProcess();
} else if (event.getTarget().equals(bSave) && fSavedName != null
&& !lastRun) {
// Update existing
if (fSavedName.getSelectedIndex() > -1 && savedParams != null) {
for (int i = 0; i < savedParams.size(); i++) {
if (savedParams.get(i).getName().equals(saveName)) {
getProcessInfo().setAD_PInstance_ID(savedParams.get(i)
.getAD_PInstance_ID());
for (MPInstancePara para : savedParams.get(i)
.getParameters()) {
para.deleteEx(true);
}
getParameterPanel().saveParameters();
}
}
}
// create new
else {
MPInstance instance = null;
try {
instance = new MPInstance(Env.getCtx(),
getProcessInfo().getAD_Process_ID(), getProcessInfo().getRecord_ID());
instance.setName(saveName);
instance.saveEx();
getProcessInfo().setAD_PInstance_ID(instance.getAD_PInstance_ID());
// Get Parameters
if (getParameterPanel() != null) {
if (!getParameterPanel().saveParameters()) {
throw new AdempiereSystemError(Msg.getMsg(
Env.getCtx(), "SaveParameterError"));
}
}
} catch (Exception ex) {
log.log(Level.SEVERE, ex.getLocalizedMessage(), ex);
}
}
querySaved();
fSavedName.setSelectedItem(getComboItem(saveName));
}
else if (event.getTarget().equals(bDelete) && fSavedName != null
&& !lastRun) {
Object o = fSavedName.getSelectedItem();
if (savedParams != null && o != null) {
String selected = fSavedName.getSelectedItem().getLabel();
for (int i = 0; i < savedParams.size(); i++) {
if (savedParams.get(i).getName().equals(selected)) {
savedParams.get(i).deleteEx(true);
}
}
}
querySaved();
}
} else if (bOK.equals(component)) {
super.onEvent(event);
if (isParameterPage)
startProcess();
else
restart();
}else if (bCancel.equals(component)){
super.onEvent(event);
cancelProcess();
} else if (event.getName().equals(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT)) {
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Process, getAD_Process_ID());
} else if (event.getTarget().equals(fSavedName)) {
if (savedParams != null && saveName != null) {
for (int i = 0; i < savedParams.size(); i++) {
if (savedParams.get(i).getName().equals(saveName)) {
loadSavedParams(savedParams.get(i));
}
}
}
boolean enabled = !Util.isEmpty(saveName);
bSave.setEnabled(enabled && !lastRun);
bDelete.setEnabled(enabled && fSavedName.getSelectedIndex() > -1
&& !lastRun);
} else if (event.getName().equals(ON_INITIAL_FOCUS_EVENT)) {
if (!isUILocked())
{
@ -377,23 +187,6 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
}
}
public Comboitem getComboItem( String value) {
Comboitem item = null;
for (int i = 0; i < fSavedName.getItems().size(); i++) {
if (fSavedName.getItems().get(i) != null) {
item = (Comboitem)fSavedName.getItems().get(i);
if (value.equals(item.getLabel().toString())) {
break;
}
}
}
return item;
}
private void loadSavedParams(MPInstance instance) {
getParameterPanel().loadParameters(instance);
}
private void doOnClick(A btn) {
int Record_ID = 0;
int AD_Table_ID =0;
@ -457,35 +250,56 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
@Override
public void updateUI() {
swithToFinishScreen();
}
protected void swithToFinishScreen() {
ProcessInfo pi = getProcessInfo();
ProcessInfoUtil.setLogFromDB(pi);
getMessageText().append("<p><font color=\"").append(pi.isError() ? "#FF0000" : "#0000FF").append("\">** ")
.append(pi.getSummary())
.append("</font></p>");
getMessage().setContent(getMessageText().toString());
layoutResultPanel (topParameterLayout);
// Add Log info with zoom on record id
appendRecordLogInfo(pi.getLogs());
appendRecordLogInfo(pi.getLogs(), infoResultContent);
bOK.setLabel(Msg.getMsg(Env.getCtx(), "Parameter"));
bOK.setImage(ThemeManager.getThemeResource("images/Reset16.png"));
bCancel.setLabel(Msg.getMsg(Env.getCtx(), "Close"));
bCancel.setImage(ThemeManager.getThemeResource("images/Cancel16.png"));
isParameterPage = false;
m_ids = pi.getIDs();
//move message div to center to give more space to display potentially very long log info
getCenterPanel().detach();
messageDiv.detach();
messageDiv.setStyle("");
north.setVisible(false);
center.appendChild(messageDiv);
messageDiv.setVflex("1");
messageDiv.setHflex("1");
replaceComponent (resultPanelLayout, topParameterLayout);
invalidate();
Clients.response(new AuEcho(this, "onAfterProcess", null));
}
private void appendRecordLogInfo(ProcessInfoLog[] m_logs) {
private void layoutResultPanel (HtmlBasedComponent topParameterLayout){
if (resultPanelLayout == null){
resultPanelLayout = new Vlayout();
resultPanelLayout.setSclass("result-parameter-layout");
resultPanelLayout.setVflex("true");
// reference for update late
messageResultContent = setHeadMessage(resultPanelLayout, getMessageText().toString());
infoResultContent = new Div();
resultPanelLayout.appendChild(infoResultContent);
}
}
protected void replaceComponent(HtmlBasedComponent newComponent, HtmlBasedComponent oldComponent) {
oldComponent.getParent().insertBefore(newComponent, oldComponent);
oldComponent.detach();
}
private void appendRecordLogInfo(ProcessInfoLog[] m_logs, HtmlBasedComponent infoResultContent) {
if (m_logs == null)
return;
@ -499,7 +313,7 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
logMessageTable.setDynamicProperty("cellspacing", "0");
logMessageTable.setDynamicProperty("width", "100%");
this.appendChild(logMessageTable);
infoResultContent.appendChild(logMessageTable);
boolean datePresents = false;
boolean numberPresents = false;
@ -558,27 +372,19 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
tr.appendChild(td);
}
}
messageDiv.appendChild(logMessageTable);
//messageDiv.appendChild(logMessageTable);
}
private void restart() {
setMessageText(new StringBuffer(getInitialMessage()));
getMessage().setContent(getInitialMessage());
north.setVisible(true);
messageDiv.detach();
if(logMessageTable!=null){
messageDiv.removeChild(logMessageTable);
}
messageDiv.setStyle(MESSAGE_DIV_STYLE);
north.appendChild(messageDiv);
center.appendChild(getCenterPanel());
replaceComponent (topParameterLayout, resultPanelLayout);
isParameterPage = true;
bOK.setLabel(Msg.getMsg(Env.getCtx(), "Start"));
bOK.setImage(ThemeManager.getThemeResource("images/Ok16.png"));
bCancel.setLabel(Util.cleanAmp(Msg.translate(Env.getCtx(), ConfirmPanel.A_CANCEL)));
bCancel.setImage(ThemeManager.getThemeResource("images/Cancel16.png"));
//recreate process info
ProcessInfo m_pi = new WProcessInfo(getName(), getAD_Process_ID());
@ -588,7 +394,8 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
getParameterPanel().setProcessInfo(m_pi);
m_ids = null;
if (fSavedName != null)
querySaved();
invalidate();
}
@ -642,7 +449,7 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
public void onCallback(Boolean result) {
if (result) {
getMessageText().append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintShipments")).append("</p>");
getMessage().setContent(getMessageText().toString());
((Html)messageResultContent).setContent(getMessageText().toString());
showBusyDialog();
Clients.response(new AuEcho(ProcessDialog.this, "onPrintShipments", null));
}
@ -726,7 +533,7 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
if (result)
{
getMessageText().append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintInvoices")).append("</p>");
getMessage().setContent(getMessageText().toString());
((Html)messageResultContent).setContent(getMessageText().toString());
showBusyDialog();
Clients.response(new AuEcho(ProcessDialog.this, "onPrintInvoices", null));
}

View File

@ -19,11 +19,8 @@ package org.adempiere.webui.apps;
import java.util.logging.Level;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.factory.ButtonFactory;
import org.adempiere.webui.session.SessionManager;
import org.compiere.process.ProcessInfo;
import org.compiere.util.CLogger;
@ -31,11 +28,6 @@ import org.compiere.util.Env;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Div;
import org.zkoss.zul.Hlayout;
import org.zkoss.zul.Layout;
import org.zkoss.zul.Vlayout;
/**
*
@ -53,8 +45,7 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
/**
*
*/
private static final long serialVersionUID = -3260639688339379279L;
private static final long serialVersionUID = -6227339628038418701L;
/** Logger */
private static CLogger log = CLogger.getCLogger(ProcessModalDialog.class);
//
@ -89,8 +80,10 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
log.info("Process=" + pi.getAD_Process_ID());
try
{
initComponents();
init(Env.getCtx(), WindowNo, pi.getAD_Process_ID(), pi, "100%", autoStart, true);
init(Env.getCtx(), WindowNo, pi.getAD_Process_ID(), pi, autoStart, true);
if (mainParameterLayout != null)// when auto start it's null
mainParameterLayout.setStyle("max-height:" + (SessionManager.getAppDesktop().getClientInfo().desktopHeight - 150) + "px");
this.setSclass("popup-dialog");
}
catch(Exception ex)
{
@ -135,50 +128,6 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
this(WindowNo, AD_Process_ID, tableId, recordId, autoStart);
} // ProcessDialog
private void initComponents() {
this.setBorder("normal");
Layout dialogBody = new Vlayout();
dialogBody.setHflex("1");
dialogBody.setStyle(dialogBody.getStyle() + ";max-height:" + (SessionManager.getAppDesktop().getClientInfo().desktopHeight - 100) + "px");
Vlayout dialogContent = new Vlayout();
dialogContent.setHflex("1");
dialogContent.setVflex("1");
dialogContent.setSclass("dialog-content");
dialogContent.setStyle("overflow-y: auto;");
dialogBody.appendChild(dialogContent);
// description
Div div = new Div();
div.setId("message");
div.appendChild(getMessage());
div.setStyle("max-height: 150pt; overflow: auto;");
dialogContent.appendChild(div);
dialogContent.appendChild(getCenterPanel());
// button panel
Layout hbox = new Hlayout();
hbox.setStyle("bottom:0;text-align:right");
dialogBody.appendChild(hbox);
hbox.setWidth("100%");
hbox.setSclass("dialog-footer");
Button btn = ButtonFactory.createNamedButton(ConfirmPanel.A_OK);
btn.setId("Ok");
btn.addEventListener(Events.ON_CLICK, this);
hbox.appendChild(btn);
btn = ButtonFactory.createNamedButton(ConfirmPanel.A_CANCEL);
btn.setId("Cancel");
btn.addEventListener(Events.ON_CLICK, this);
hbox.appendChild(btn);
dialogBody.appendChild(hbox);
this.appendChild(dialogBody);
this.setSclass("popup-dialog");
}
/**
* Set Visible
* (set focus to OK if visible)
@ -199,13 +148,6 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
this.detach();
} // dispose
@Override
public void autoStart()
{
this.getFirstChild().setVisible(false);
super.autoStart();
}
@Override
public void showBusyDialog() {
BusyDialog progressWindow = createBusyDialog();
@ -232,13 +174,13 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
*/
public void onEvent(Event event) {
Component component = event.getTarget();
if (component instanceof Button) {
Button element = (Button)component;
if ("Ok".equalsIgnoreCase(element.getId()))
startProcess();
else if ("Cancel".equalsIgnoreCase(element.getId()))
cancelProcess();
} else {
if (component.equals(bOK)) {
super.onEvent(event);
startProcess();
} else if (component.equals(bCancel)) {
super.onEvent(event);
cancelProcess();
}else {
super.onEvent(event);
}
}

View File

@ -77,9 +77,7 @@ public class ProcessParameterPanel extends Panel implements
/**
*
*/
private static final long serialVersionUID = -5730428618898681676L;
private String width;
private static final long serialVersionUID = -6190176000439901932L;
/**
* Dynamic generated Parameter panel.
@ -90,23 +88,10 @@ public class ProcessParameterPanel extends Panel implements
* process info
*/
public ProcessParameterPanel(int WindowNo, ProcessInfo pi) {
this(WindowNo, pi, "100%");
} // ProcessParameterPanel
/**
* Dynamic generated Parameter panel.
*
* @param WindowNo
* window
* @param pi
* process info
*/
public ProcessParameterPanel(int WindowNo, ProcessInfo pi, String width) {
//
m_WindowNo = WindowNo;
m_processInfo = pi;
m_AD_Window_ID = AEnv.getADWindowID (WindowNo);
this.width = width;
this.m_InfoWindowID = pi.getAD_InfoWindow_ID();
//
initComponent();
@ -115,7 +100,6 @@ public class ProcessParameterPanel extends Panel implements
private void initComponent() {
centerPanel = GridFactory.newGridLayout();
centerPanel.setInnerWidth(width);
this.appendChild(centerPanel);
// setup columns
@ -495,6 +479,9 @@ public class ProcessParameterPanel extends Panel implements
} // for every field
//TODO: consider also call processDependencies per each time set value for field to validate, call callout,...
dynamicDisplay();
return true;
} // loadParameters

View File

@ -19,7 +19,12 @@ package org.adempiere.webui.apps;
import java.util.logging.Level;
import org.adempiere.util.IProcessUI;
import org.adempiere.webui.ISupportMask;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Mask;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.session.SessionManager;
import org.compiere.apps.AbstractProcessCtl;
import org.compiere.apps.IProcessParameter;
import org.compiere.model.MPInstance;
@ -28,6 +33,7 @@ import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Trx;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
@ -96,11 +102,32 @@ public class WProcessCtl extends AbstractProcessCtl {
ProcessModalDialog para = new ProcessModalDialog(listener, WindowNo, pi, false);
if (para.isValid())
{
para.setWidth("500px");
//para.setWidth("500px");
para.setVisible(true);
para.setPosition("center");
para.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
AEnv.showWindow(para);
Object window = SessionManager.getAppDesktop().findWindow(WindowNo);
if (window != null && window instanceof Component && window instanceof ISupportMask){
final ISupportMask parent = LayoutUtils.showWindowWithMask(para, (Component)window, LayoutUtils.OVERLAP_PARENT);
para.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
parent.hideMask();
}
});
}else if (window != null && window instanceof Component){
final Mask mask = LayoutUtils.showWindowWithMask(para, (Component)window, null);
para.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
mask.hideMask();
}
});
}else{
para.setPosition("center");
para.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
AEnv.showWindow(para);
}
}
} // execute
@ -126,34 +153,34 @@ public class WProcessCtl extends AbstractProcessCtl {
{
if (log.isLoggable(Level.FINE)) log.fine("WindowNo=" + WindowNo + " - " + pi);
if (pi.getAD_PInstance_ID() < 1) { //red1 bypass if PInstance exists
MPInstance instance = null;
try
{
instance = new MPInstance(Env.getCtx(), pi.getAD_Process_ID(), pi.getRecord_ID());
}
catch (Exception e)
{
pi.setSummary (e.getLocalizedMessage());
pi.setError (true);
log.warning(pi.toString());
return;
}
catch (Error e)
{
pi.setSummary (e.getLocalizedMessage());
pi.setError (true);
log.warning(pi.toString());
return;
}
if (!instance.save())
{
pi.setSummary (Msg.getMsg(Env.getCtx(), "ProcessNoInstance"));
pi.setError (true);
return;
}
pi.setAD_PInstance_ID (instance.getAD_PInstance_ID());
// if (pi.getAD_PInstance_ID() < 1) { //red1 bypass if PInstance exists
MPInstance instance = null;
try
{
instance = new MPInstance(Env.getCtx(), pi.getAD_Process_ID(), pi.getRecord_ID());
}
catch (Exception e)
{
pi.setSummary (e.getLocalizedMessage());
pi.setError (true);
log.warning(pi.toString());
return;
}
catch (Error e)
{
pi.setSummary (e.getLocalizedMessage());
pi.setError (true);
log.warning(pi.toString());
return;
}
if (!instance.save())
{
pi.setSummary (Msg.getMsg(Env.getCtx(), "ProcessNoInstance"));
pi.setError (true);
return;
}
pi.setAD_PInstance_ID (instance.getAD_PInstance_ID());
// }
// Get Parameters
if (parameter != null) {

View File

@ -428,7 +428,7 @@ public class WPaySelect extends PaySelect
AD_Proces_ID, X_C_PaySelection.Table_ID, m_ps.getC_PaySelection_ID(), false);
if (dialog.isValid()) {
try {
dialog.setWidth("500px");
//dialog.setWidth("500px");
dialog.setVisible(true);
dialog.setPage(form.getPage());
dialog.doHighlighted();

View File

@ -42,10 +42,11 @@ import org.zkoss.zul.Separator;
* @author Deepak Pansheriya
*/
public class ProcessInfoDialog extends Window implements EventListener<Event> {
/**
*
*/
private static final long serialVersionUID = 4479446865514015847L;
private static final long serialVersionUID = -1712025652050086903L;
private static final String MESSAGE_PANEL_STYLE = "text-align:left; word-break: break-all; overflow: auto; max-height: 250pt; min-width: 230pt; max-width: 450pt;";
@ -53,21 +54,46 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
private Button btnOk = ButtonFactory.createNamedButton(ConfirmPanel.A_OK);
private Image img = new Image();
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,
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.setClosable(true);
this.setSizable(true);
this.setBorder("normal");
this.setContentStyle("background-color:#ffffff;");
this.setId(title);
//this.setId(title);
lblMsg.setEncode(false);
lblMsg.setValue(header);
@ -81,51 +107,23 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
Separator sep = new Separator("horizontal");
pnlMessage.appendChild(sep);
for (int loopCtr = 0; loopCtr < m_logs.length; loopCtr++) {
ProcessInfoLog log = m_logs[loopCtr];
if (log.getP_Msg() != null || log.getP_Date() != null || log.getP_Number() != null) {
SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.DateTime);
StringBuffer sb = new StringBuffer ();
//
if (log.getP_Date() != null)
sb.append(dateFormat.format(log.getP_Date()))
.append(" \t");
//
if (log.getP_Number() != null)
sb.append(log.getP_Number())
.append(" \t");
//
if (log.getP_Msg() != null)
sb.append(Msg.parseTranslation(Env.getCtx(), log.getP_Msg()));
//
if (log.getAD_Table_ID() > 0
&& log.getRecord_ID() > 0) {
DocumentLink recordLink = new DocumentLink(sb.toString(), log.getAD_Table_ID(), log.getRecord_ID());
pnlMessage.appendChild(recordLink);
} else {
Text recordText = new Text(sb.toString());
pnlMessage.appendChild(recordText);
}
pnlMessage.appendChild(new Separator("horizontal"));
}
}
Hbox pnlImage = new Hbox();
img.setSrc(INFORMATION);
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");
@ -143,9 +141,55 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
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++) {
ProcessInfoLog log = m_logs[loopCtr];
if (log.getP_Msg() != null || log.getP_Date() != null || log.getP_Number() != null) {
SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.DateTime);
StringBuffer sb = new StringBuffer ();
//
if (log.getP_Date() != null)
sb.append(dateFormat.format(log.getP_Date()))
.append(" \t");
//
if (log.getP_Number() != null)
sb.append(log.getP_Number())
.append(" \t");
//
if (log.getP_Msg() != null)
sb.append(Msg.parseTranslation(Env.getCtx(), log.getP_Msg()));
//
if (log.getAD_Table_ID() > 0
&& log.getRecord_ID() > 0) {
DocumentLink recordLink = new DocumentLink(sb.toString(), log.getAD_Table_ID(), log.getRecord_ID());
pnlMessage.appendChild(recordLink);
} else {
Text recordText = new Text(sb.toString());
pnlMessage.appendChild(recordText);
}
pnlMessage.appendChild(new Separator("horizontal"));
}
}
}
this.setBorder("normal");
this.setContentStyle("background-color:#ffffff;");
}
public void onEvent(Event event) throws Exception {
@ -165,22 +209,13 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
* just pass false, other pass true to avoid duplicate message
*/
public static void showProcessInfo (ProcessInfo pi, int windowNo, final Component comp, boolean needFillLogFromDb) {
// Get Log Info
if (needFillLogFromDb)
ProcessInfoUtil.setLogFromDB(pi);
ProcessInfoLog m_logs[] = pi.getLogs();
if (m_logs != null && m_logs.length > 0) {
ProcessInfoDialog dialog = new ProcessInfoDialog(AEnv.getDialogHeader(Env.getCtx(), windowNo),AEnv.getDialogHeader(Env.getCtx(), windowNo), m_logs);
final ISupportMask supportMask = LayoutUtils.showWindowWithMask(dialog, comp, LayoutUtils.OVERLAP_PARENT);;
dialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
supportMask.hideMask();
}
});
}
ProcessInfoDialog dialog = new ProcessInfoDialog(AEnv.getDialogHeader(Env.getCtx(), windowNo),AEnv.getDialogHeader(Env.getCtx(), windowNo), pi, needFillLogFromDb);
final ISupportMask supportMask = LayoutUtils.showWindowWithMask(dialog, comp, LayoutUtils.OVERLAP_PARENT);;
dialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
supportMask.hideMask();
}
});
}
}

View File

@ -17,7 +17,8 @@
package org.adempiere.webui.component;
import org.adempiere.webui.ISupportMask;
import org.adempiere.webui.ISupportMask;
import org.adempiere.webui.ShowMaskWrapper;
import org.adempiere.webui.panel.ITabOnCloseHandler;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.IdSpace;
@ -42,6 +43,8 @@ public class Tabpanel extends org.zkoss.zul.Tabpanel implements IdSpace, ISuppor
private int tabLevel;
protected ShowMaskWrapper showMaskWrapper = new ShowMaskWrapper(this);
public boolean isEnabled()
{
return enabled;
@ -88,21 +91,12 @@ public class Tabpanel extends org.zkoss.zul.Tabpanel implements IdSpace, ISuppor
this.onCloseHandler = handler;
}
/**
* cache {@link Mask} Object
*/
private Mask maskObj;
/**
* {@inheritDoc}
*/
@Override
public void showMask() {
maskObj = getMaskObj ();
if (maskObj.getParent() == null){
this.appendChild(maskObj);
}
showMaskWrapper.showMask();
}
/**
@ -110,10 +104,7 @@ public class Tabpanel extends org.zkoss.zul.Tabpanel implements IdSpace, ISuppor
*/
@Override
public void hideMask() {
if (maskObj != null || maskObj.getParent() != null){
maskObj.detach();
}
showMaskWrapper.hideMask();
}
/**
@ -121,10 +112,7 @@ public class Tabpanel extends org.zkoss.zul.Tabpanel implements IdSpace, ISuppor
*/
@Override
public Mask getMaskObj() {
if (maskObj == null)
maskObj = new Mask();
return maskObj;
return showMaskWrapper.getMaskObj();
}
/**
@ -132,6 +120,6 @@ public class Tabpanel extends org.zkoss.zul.Tabpanel implements IdSpace, ISuppor
*/
@Override
public Component getMaskComponent() {
return this;
return showMaskWrapper.getMaskComponent();
}
}

View File

@ -18,6 +18,7 @@
package org.adempiere.webui.component;
import org.adempiere.webui.ISupportMask;
import org.adempiere.webui.ShowMaskWrapper;
import org.adempiere.webui.event.DialogEvents;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
@ -38,6 +39,7 @@ public class Window extends org.zkoss.zul.Window implements ISupportMask
*/
private static final long serialVersionUID = -8249071775776387012L;
protected ShowMaskWrapper showMaskWrapper = new ShowMaskWrapper(this);
/*** Show as modal window ***/
public static final String MODE_MODAL = "modal";
/*** Show as popup window ***/
@ -109,21 +111,13 @@ public class Window extends org.zkoss.zul.Window implements ISupportMask
}
}
/**
* cache {@link Mask} Object
*/
private Mask maskObj;
/**
* {@inheritDoc}
*/
@Override
public void showMask() {
maskObj = getMaskObj ();
if (maskObj.getParent() == null){
this.appendChild(maskObj);
}
showMaskWrapper.showMask();
}
/**
@ -131,9 +125,7 @@ public class Window extends org.zkoss.zul.Window implements ISupportMask
*/
@Override
public void hideMask() {
if (maskObj != null || maskObj.getParent() != null){
maskObj.detach();
}
showMaskWrapper.hideMask();
}
@ -142,10 +134,7 @@ public class Window extends org.zkoss.zul.Window implements ISupportMask
*/
@Override
public Mask getMaskObj() {
if (maskObj == null)
maskObj = new Mask();
return maskObj;
return showMaskWrapper.getMaskObj();
}
/**
@ -153,6 +142,6 @@ public class Window extends org.zkoss.zul.Window implements ISupportMask
*/
@Override
public Component getMaskComponent() {
return this;
return showMaskWrapper.getMaskComponent();
}
}

View File

@ -19,6 +19,7 @@ import java.util.List;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.ClientInfo;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.exception.ApplicationException;
@ -151,6 +152,8 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
}
/**
* when width of win set by stylesheet (css class or in style) win sometime don't in center.
* fix by find out method change to {@link LayoutUtils#openOverlappedWindow(org.zkoss.zk.ui.Component, org.zkoss.zul.Window, String)}
* @param win
* @param pos
*/

View File

@ -60,7 +60,6 @@ import org.adempiere.webui.factory.InfoManager;
import org.adempiere.webui.part.ITabOnSelectHandler;
import org.adempiere.webui.part.WindowContainer;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.window.FDialog;
import org.compiere.minigrid.ColumnInfo;
import org.compiere.minigrid.IDColumn;
import org.compiere.model.MInfoColumn;
@ -72,8 +71,6 @@ import org.compiere.model.MSysConfig;
import org.compiere.model.MTable;
import org.compiere.model.X_AD_CtxHelp;
import org.compiere.process.ProcessInfo;
import org.compiere.process.ProcessInfoLog;
import org.compiere.process.ProcessInfoUtil;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
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
enableButtons();
}else if (m_pi.isError()){
// show error info
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());
}
ProcessInfoDialog.showProcessInfo(m_pi, p_WindowNo, InfoPanel.this, true);
// enable or disable control button rely selected record status
enableButtons();
}else if (!m_pi.isError()){
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);
// 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());
}
ProcessInfoDialog.showProcessInfo(m_pi, p_WindowNo, InfoPanel.this, true);
Clients.response(new AuEcho(InfoPanel.this, "onQueryCallback", m_results));
}

View File

@ -15,6 +15,7 @@ package org.adempiere.webui.part;
import java.awt.BorderLayout;
import org.adempiere.webui.ISupportMask;
import org.adempiere.webui.ShowMaskWrapper;
import org.adempiere.webui.component.Mask;
import org.adempiere.webui.desktop.IDesktop;
import org.zkoss.zk.ui.Component;
@ -30,6 +31,8 @@ public abstract class AbstractUIPart implements UIPart, ISupportMask {
protected Page page = null;
protected ShowMaskWrapper showMaskWrapper = new ShowMaskWrapper(this);
public Component createPart(Object parent) {
if (parent == null)
throw new IllegalArgumentException("Null parent.");
@ -49,19 +52,11 @@ public abstract class AbstractUIPart implements UIPart, ISupportMask {
protected abstract Component doCreatePart(Component parent);
/**
* cache {@link Mask} Object
*/
private Mask maskObj;
/**
* {@inheritDoc}
*/
@Override public void showMask() {
maskObj = getMaskObj ();
if (maskObj.getParent() == null){
this.getMaskComponent().appendChild(maskObj);
}
showMaskWrapper.showMask();
}
@ -70,9 +65,7 @@ public abstract class AbstractUIPart implements UIPart, ISupportMask {
*/
@Override
public void hideMask() {
if (maskObj != null || maskObj.getParent() != null){
maskObj.detach();
}
showMaskWrapper.hideMask();
}
@ -81,10 +74,7 @@ public abstract class AbstractUIPart implements UIPart, ISupportMask {
*/
@Override
public Mask getMaskObj() {
if (maskObj == null)
maskObj = new Mask();
return maskObj;
return showMaskWrapper.getMaskObj();
}
/**

View File

@ -48,6 +48,7 @@ import org.adempiere.webui.component.Mask;
import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.editor.WTableDirEditor;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.event.DrillEvent;
import org.adempiere.webui.event.ZoomEvent;
@ -63,6 +64,7 @@ import org.compiere.Adempiere;
import org.compiere.model.GridField;
import org.compiere.model.MArchive;
import org.compiere.model.MClient;
import org.compiere.model.MLanguage;
import org.compiere.model.MQuery;
import org.compiere.model.MRole;
import org.compiere.model.MSysConfig;
@ -79,6 +81,7 @@ import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Language;
import org.compiere.util.Msg;
import org.compiere.util.Util;
import org.zkoss.util.media.AMedia;
@ -166,6 +169,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
private ToolBarButton bExport = new ToolBarButton();
private ToolBarButton bWizard = new ToolBarButton();
private Listbox comboReport = new Listbox();
private WTableDirEditor wLanguage;
private Label labelDrill = new Label();
private Listbox comboDrill = new Listbox();
private Listbox previewType = new Listbox();
@ -262,22 +266,33 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
previewType.addEventListener(Events.ON_SELECT, this);
toolBar.appendChild(new Separator("vertical"));
//set default type
String type = m_reportEngine.getPrintFormat().isForm()
// a42niem - provide explicit default and check on client/org specifics
? MSysConfig.getValue(MSysConfig.ZK_REPORT_FORM_OUTPUT_TYPE,"PDF",Env.getAD_Client_ID(m_ctx),Env.getAD_Org_ID(m_ctx))
: MSysConfig.getValue(MSysConfig.ZK_REPORT_TABLE_OUTPUT_TYPE,"PDF",Env.getAD_Client_ID(m_ctx),Env.getAD_Org_ID(m_ctx));
if ("HTML".equals(type)) {
previewType.setSelectedIndex(0);
} else if ("PDF".equals(type) && m_isCanExport) {
previewType.setSelectedIndex(1);
} else if ("XLS".equals(type) && m_isCanExport) {
previewType.setSelectedIndex(2);
} else {
// XXX - provide hint if unexpected value
previewType.setSelectedIndex(0); //fall back to HTML
int pTypeIndex = 0;
if (m_reportEngine.getReportType() != null)
{
if (m_reportEngine.getReportType().equals("PDF") && m_isCanExport)
pTypeIndex = 1;
else if (m_reportEngine.getReportType().equals("XLS") && m_isCanExport)
pTypeIndex = 2;
}
else
{
//set default type
String type = m_reportEngine.getPrintFormat().isForm()
// a42niem - provide explicit default and check on client/org specifics
? MSysConfig.getValue(MSysConfig.ZK_REPORT_FORM_OUTPUT_TYPE,"PDF",Env.getAD_Client_ID(m_ctx),Env.getAD_Org_ID(m_ctx))
: MSysConfig.getValue(MSysConfig.ZK_REPORT_TABLE_OUTPUT_TYPE,"PDF",Env.getAD_Client_ID(m_ctx),Env.getAD_Org_ID(m_ctx));
if ("HTML".equals(type)) {
pTypeIndex = 0;
} else if ("PDF".equals(type) && m_isCanExport) {
pTypeIndex = 1;
} else if ("XLS".equals(type) && m_isCanExport) {
pTypeIndex = 2;
}
}
previewType.setSelectedIndex(pTypeIndex);
labelDrill.setValue(Msg.getMsg(Env.getCtx(), "Drill") + ": ");
toolBar.appendChild(labelDrill);
@ -294,9 +309,24 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
toolBar.appendChild(new Separator("vertical"));
MClient client = MClient.get(m_ctx);
if (client.isMultiLingualDocument()){
try {
wLanguage = AEnv.getListDocumentLanguage(client);
wLanguage.getComponent().setTooltiptext(Msg.translate(Env.getCtx(), "AD_PrintFormat_ID"));
toolBar.appendChild(wLanguage.getComponent());
wLanguage.setValue(m_reportEngine.getLanguageID());
wLanguage.getComponent().addEventListener(Events.ON_SELECT, this);
} catch (Exception e) {
log.log(Level.SEVERE, e.getLocalizedMessage());
}
}
toolBar.appendChild(new Separator("vertical"));
summary.setText(Msg.getMsg(Env.getCtx(), "Summary"));
toolBar.appendChild(summary);
summary.setChecked(m_reportEngine.isSummary());
toolBar.appendChild(new Separator("vertical"));
bCustomize.setName("Customize");
@ -754,7 +784,9 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
return;
if (e.getTarget() == comboReport)
cmd_report();
else if (e.getTarget() == bFind)
else if (MClient.get(m_ctx).isMultiLingualDocument() && e.getTarget() == wLanguage.getComponent()){
cmd_report();
}else if (e.getTarget() == bFind)
cmd_find();
else if (e.getTarget() == bExport)
cmd_export();
@ -1048,8 +1080,19 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
postRenderReportEvent();
} // cmd_report
protected void setLanguage (){
if (MClient.get(m_ctx).isMultiLingualDocument() && wLanguage.getValue() != null){
MLanguage language = new MLanguage (m_ctx, (int)wLanguage.getValue(), null);
Language lang = new Language(language.getName(), language.getAD_Language(), language.getLocale());
m_reportEngine.setLanguageID(language.getAD_Language_ID());
m_reportEngine.getPrintFormat().setLanguage(lang);
m_reportEngine.getPrintFormat().setTranslationLanguage(lang);
}
}
private void postRenderReportEvent() {
showBusyDialog();
setLanguage();
Events.echoEvent(ON_RENDER_REPORT_EVENT, this, null);
}
@ -1357,7 +1400,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
}
File file = File.createTempFile(prefix, ".html", new File(path));
viewer.m_reportEngine.createHTML(file, false, AEnv.getLanguage(Env.getCtx()), new HTMLExtension(contextPath, "rp", viewer.getUuid()));
viewer.m_reportEngine.createHTML(file, false, viewer.m_reportEngine.getPrintFormat().getLanguage(), new HTMLExtension(contextPath, "rp", viewer.getUuid()));
viewer.media = new AMedia(file.getName(), "html", "text/html", file, false);
} catch (Exception e) {
if (e instanceof RuntimeException)
@ -1403,7 +1446,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
}
File file = File.createTempFile(prefix, ".xls", new File(path));
viewer.m_reportEngine.createXLS(file, AEnv.getLanguage(Env.getCtx()));
viewer.m_reportEngine.createXLS(file, viewer.m_reportEngine.getPrintFormat().getLanguage());
viewer.media = new AMedia(file.getName(), "xls", "application/vnd.ms-excel", file, true);
} catch (Exception e) {
if (e instanceof RuntimeException)

View File

@ -0,0 +1,63 @@
/* .z-window.z-window-noborder.z-window-noheader.z-window-embedded
.z-window.z-window-noborder.z-window-noheader.z-window-embedded .z-window-content
twwo css make height of window always 100% its parent,
it fix some issue relate resize, but can make side effect
when detect side effect, fix to only apply for parameter window*/
.z-window.z-window-noborder.z-window-noheader.z-window-embedded,
.z-window.z-window-noborder.z-window-noheader.z-window-embedded .z-window-content,
.main-parameter-layout{
height: 100%;
}
.main-parameter-layout,
.top-parameter-layout,
.bottom-parameter-layout,
.message-parameter-layout,
.input-paramenter-layout,
.option-paramenter-layout,
.report-option-container,
.bottom-container{
width: 100%;
}
.top-parameter-layout{
overflow: auto;
}
.bottom-parameter-layout{
}
.message-paramenter{
max-height: 150pt;
overflow: hidden;
margin: 10px;
}
.option-input-parameter{
}
.bottom-container{
overflow: auto;
}
.button-container{
float: right;
}
.save-parameter-container{
float: left;
}
.popup-dialog.z-window.z-window-overlapped.z-window-shadow,
.popup-dialog.z-window.z-window-noborder.z-window-highlighted.z-window-shadow{
width:600px;
}
.input-paramenter-layout{
width: 70%;
}
.popup-dialog .input-paramenter-layout{
width: 90%;
}

View File

@ -81,3 +81,5 @@ table.z-vbox > tbody > tr > td > table {
<c:include page="fragment/help-window.css.dsp" />
<c:include page="fragment/borderlayout.css.dsp" />
<c:include page="fragment/parameter-process.css.dsp" />

View File

@ -32,6 +32,7 @@ import java.util.logging.Level;
import org.adempiere.base.Service;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.util.IProcessUI;
import org.compiere.model.MPInstance;
import org.compiere.model.MPaySelectionCheck;
import org.compiere.model.MProcess;
import org.compiere.model.MQuery;
@ -124,6 +125,17 @@ public class ReportCtl
if (s_log.isLoggable(Level.INFO)) s_log.info("start - " + pi);
m_pi = pi;
MPInstance instance = new MPInstance(Env.getCtx(), pi.getAD_PInstance_ID(), null);
if (pi.getReportType() != null)
instance.setReportType(pi.getReportType());
if (pi.getSerializableObject() != null)
instance.setAD_PrintFormat_ID(((MPrintFormat)pi.getSerializableObject()).getAD_PrintFormat_ID());
instance.setIsSummary(pi.isSummary());
instance.setAD_Language_ID(pi.getLanguageID());
instance.saveEx();
/**
* Order Print
*/
@ -232,10 +244,7 @@ public class ReportCtl
String TableName = MTable.getTableName(ctx, format.getAD_Table_ID());
MQuery query = MQuery.get (ctx, pi.getAD_PInstance_ID(), TableName);
PrintInfo info = new PrintInfo(pi);
re = new ReportEngine(ctx, format, query, info);
re.setWindowNo(WindowNo);
createOutput(re, pi.isPrintPreview(), null);
return true;
re = new ReportEngine(ctx, format, query, info, pi.isSummary());
}
//
// Create Report Engine normally
@ -246,9 +255,13 @@ public class ReportCtl
pi.setSummary("No ReportEngine");
return false;
}
re.setWindowNo(WindowNo);
}
if (pi.getReportType() != null) {
re.setReportType(pi.getReportType());
}
re.setLanguageID(pi.getLanguageID());
re.setWindowNo(WindowNo);
createOutput(re, pi.isPrintPreview(), null);
return true;
} // startStandardReport
@ -289,8 +302,14 @@ public class ReportCtl
}
PrintInfo info = new PrintInfo(pi);
ReportEngine re = new ReportEngine(Env.getCtx(), format, query, info);
ReportEngine re = new ReportEngine(Env.getCtx(), format, query, info, pi.isSummary());
re.setWindowNo(WindowNo);
if (pi.getReportType() != null) {
re.setReportType(pi.getReportType());
}
re.setLanguageID(pi.getLanguageID());
createOutput(re, pi.isPrintPreview(), null);
return true;
} // startFinReport