IDEMPIERE-1157 Adding functionality to add charts on the standard windows / QA

This commit is contained in:
Carlos Ruiz 2013-08-23 09:37:43 -05:00
parent 29e8859bbc
commit abd74af7bb
15 changed files with 164 additions and 73 deletions

View File

@ -0,0 +1,33 @@
-- Aug 23, 2013 9:21:49 AM COT
-- IDEMPIERE-1157 Adding functionality to add charts on the standard windows
UPDATE AD_Element SET Description='Type of chart to render',Updated=TO_DATE('2013-08-23 09:21:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=53894
;
-- Aug 23, 2013 9:21:49 AM COT
-- IDEMPIERE-1157 Adding functionality to add charts on the standard windows
UPDATE AD_Column SET ColumnName='ChartType', Name='Chart Type', Description='Type of chart to render', Help=NULL WHERE AD_Element_ID=53894
;
-- Aug 23, 2013 9:21:49 AM COT
-- IDEMPIERE-1157 Adding functionality to add charts on the standard windows
UPDATE AD_Process_Para SET ColumnName='ChartType', Name='Chart Type', Description='Type of chart to render', Help=NULL, AD_Element_ID=53894 WHERE UPPER(ColumnName)='CHARTTYPE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Aug 23, 2013 9:21:49 AM COT
-- IDEMPIERE-1157 Adding functionality to add charts on the standard windows
UPDATE AD_Process_Para SET ColumnName='ChartType', Name='Chart Type', Description='Type of chart to render', Help=NULL WHERE AD_Element_ID=53894 AND IsCentrallyMaintained='Y'
;
-- Aug 23, 2013 9:21:49 AM COT
-- IDEMPIERE-1157 Adding functionality to add charts on the standard windows
UPDATE AD_InfoColumn SET ColumnName='ChartType', Name='Chart Type', Description='Type of chart to render', Help=NULL WHERE AD_Element_ID=53894 AND IsCentrallyMaintained='Y'
;
-- Aug 23, 2013 9:21:49 AM COT
-- IDEMPIERE-1157 Adding functionality to add charts on the standard windows
UPDATE AD_Field SET Name='Chart Type', Description='Type of chart to render', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=53894) AND IsCentrallyMaintained='Y'
;
SELECT register_migration_script('201308230922_IDEMPIERE-1157.sql') FROM dual
;

View File

@ -0,0 +1,33 @@
-- Aug 23, 2013 9:21:49 AM COT
-- IDEMPIERE-1157 Adding functionality to add charts on the standard windows
UPDATE AD_Element SET Description='Type of chart to render',Updated=TO_TIMESTAMP('2013-08-23 09:21:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=53894
;
-- Aug 23, 2013 9:21:49 AM COT
-- IDEMPIERE-1157 Adding functionality to add charts on the standard windows
UPDATE AD_Column SET ColumnName='ChartType', Name='Chart Type', Description='Type of chart to render', Help=NULL WHERE AD_Element_ID=53894
;
-- Aug 23, 2013 9:21:49 AM COT
-- IDEMPIERE-1157 Adding functionality to add charts on the standard windows
UPDATE AD_Process_Para SET ColumnName='ChartType', Name='Chart Type', Description='Type of chart to render', Help=NULL, AD_Element_ID=53894 WHERE UPPER(ColumnName)='CHARTTYPE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Aug 23, 2013 9:21:49 AM COT
-- IDEMPIERE-1157 Adding functionality to add charts on the standard windows
UPDATE AD_Process_Para SET ColumnName='ChartType', Name='Chart Type', Description='Type of chart to render', Help=NULL WHERE AD_Element_ID=53894 AND IsCentrallyMaintained='Y'
;
-- Aug 23, 2013 9:21:49 AM COT
-- IDEMPIERE-1157 Adding functionality to add charts on the standard windows
UPDATE AD_InfoColumn SET ColumnName='ChartType', Name='Chart Type', Description='Type of chart to render', Help=NULL WHERE AD_Element_ID=53894 AND IsCentrallyMaintained='Y'
;
-- Aug 23, 2013 9:21:49 AM COT
-- IDEMPIERE-1157 Adding functionality to add charts on the standard windows
UPDATE AD_Field SET Name='Chart Type', Description='Type of chart to render', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=53894) AND IsCentrallyMaintained='Y'
;
SELECT register_migration_script('201308230922_IDEMPIERE-1157.sql') FROM dual
;

View File

@ -1,6 +1,6 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* 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 *
@ -21,8 +21,8 @@ import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for AD_Chart
* @author Adempiere (generated)
* @version Release 3.6.0LTS
* @author iDempiere (generated)
* @version Release 1.0c
*/
public interface I_AD_Chart
{
@ -31,7 +31,7 @@ public interface I_AD_Chart
public static final String Table_Name = "AD_Chart";
/** AD_Table_ID=53284 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
public static final int Table_ID = 53284;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
@ -50,6 +50,15 @@ public interface I_AD_Chart
/** Get Chart */
public int getAD_Chart_ID();
/** Column name AD_Chart_UU */
public static final String COLUMNNAME_AD_Chart_UU = "AD_Chart_UU";
/** Set AD_Chart_UU */
public void setAD_Chart_UU (String AD_Chart_UU);
/** Get AD_Chart_UU */
public String getAD_Chart_UU();
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";

View File

@ -1,6 +1,6 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* 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 *
@ -21,8 +21,8 @@ import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for AD_ChartDatasource
* @author Adempiere (generated)
* @version 360LTS.013
* @author iDempiere (generated)
* @version Release 1.0c
*/
public interface I_AD_ChartDatasource
{
@ -31,7 +31,7 @@ public interface I_AD_ChartDatasource
public static final String Table_Name = "AD_ChartDatasource";
/** AD_Table_ID=53282 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
public static final int Table_ID = 53282;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
@ -50,6 +50,15 @@ public interface I_AD_ChartDatasource
/** Get Chart Datasource */
public int getAD_ChartDatasource_ID();
/** Column name AD_ChartDatasource_UU */
public static final String COLUMNNAME_AD_ChartDatasource_UU = "AD_ChartDatasource_UU";
/** Set AD_ChartDatasource_UU */
public void setAD_ChartDatasource_UU (String AD_ChartDatasource_UU);
/** Get AD_ChartDatasource_UU */
public String getAD_ChartDatasource_UU();
/** Column name AD_Chart_ID */
public static final String COLUMNNAME_AD_Chart_ID = "AD_Chart_ID";
@ -59,7 +68,7 @@ public interface I_AD_ChartDatasource
/** Get Chart */
public int getAD_Chart_ID();
public I_AD_Chart getAD_Chart() throws RuntimeException;
public org.compiere.model.I_AD_Chart getAD_Chart() throws RuntimeException;
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
@ -72,13 +81,13 @@ public interface I_AD_ChartDatasource
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organisation.
* Organisational entity within client
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organisation.
* Organisational entity within client
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
@ -95,7 +104,7 @@ public interface I_AD_ChartDatasource
*/
public int getAD_Table_ID();
public I_AD_Table getAD_Table() throws RuntimeException;
public org.compiere.model.I_AD_Table getAD_Table() throws RuntimeException;
/** Column name CategoryColumn */
public static final String COLUMNNAME_CategoryColumn = "CategoryColumn";

View File

@ -96,12 +96,12 @@ public interface I_PA_Goal
public static final String COLUMNNAME_ChartType = "ChartType";
/** Set Chart Type.
* Type fo chart to render
* Type of chart to render
*/
public void setChartType (String ChartType);
/** Get Chart Type.
* Type fo chart to render
* Type of chart to render
*/
public String getChartType();

View File

@ -117,18 +117,11 @@ public class MChartDatasource extends X_AD_ChartDatasource {
sql += category + ">=TRUNC(" + DB.TO_DATE(new Timestamp(startDate.getTime())) + ", '" + unit + "') AND ";
sql += category + "<=TRUNC(" + DB.TO_DATE(new Timestamp(endDate.getTime())) + ", '" + unit + "') ";
}
int startIndex=0;
if ((startIndex = sql.indexOf('@')) != -1){
String variable = sql.substring(startIndex);
int endIndex = variable.indexOf('@',1);
if(endIndex != -1){
variable = variable.substring(0,endIndex+1);
String val = Env.getContext(getCtx(), variable.replace('@',' ').trim());
sql=sql.replaceFirst(variable, val);
}
if (sql.indexOf('@') >= 0) {
sql = Env.parseContext(getCtx(), 0, sql, false, true);
}
MRole role = MRole.getDefault(getCtx(), false);
sql = role.addAccessSQL(sql, null, true, false);
@ -254,26 +247,6 @@ public class MChartDatasource extends X_AD_ChartDatasource {
return cal.getTime();
}
private String formatDate(Date date, String timeUnit)
{
String key = null;
String unitFormat = "yyyy-MM-dd";
if ( timeUnit.equals(MChart.TIMEUNIT_Week))
unitFormat = "yyyy-w";
else if ( timeUnit.equals(MChart.TIMEUNIT_Month))
unitFormat = "yyyy-MMM";
else if ( timeUnit.equals(MChart.TIMEUNIT_Quarter))
unitFormat = "yyyy-MM";
else if ( timeUnit.equals(MChart.TIMEUNIT_Year))
unitFormat = "yyyy";
SimpleDateFormat format = new SimpleDateFormat(unitFormat);
key = format.format(date);
if ( timeUnit.equals(MChart.TIMEUNIT_Quarter) )
key = convertToQuarter(format.format(date));
return key;
}
/**
* Convert date formatted as yyyy-MM to yyyy-QQ
* @param month

View File

@ -727,6 +727,8 @@ public class MColumn extends X_AD_Column
foreignTable = "AD_Image";
} else if (DisplayType.Color == refid) {
foreignTable = "AD_Color";
} else if (DisplayType.Chart == refid) {
foreignTable = "AD_Chart";
}
return foreignTable;

View File

@ -1,6 +1,6 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* 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 *
@ -21,15 +21,15 @@ import java.sql.ResultSet;
import java.util.Properties;
/** Generated Model for AD_Chart
* @author Adempiere (generated)
* @version 1.03 - $Id$ */
* @author iDempiere (generated)
* @version Release 1.0c - $Id$ */
public class X_AD_Chart extends PO implements I_AD_Chart, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20120608L;
private static final long serialVersionUID = 20130823L;
/** Standard Constructor */
public X_AD_Chart (Properties ctx, int AD_Chart_ID, String trxName)
@ -97,6 +97,20 @@ public class X_AD_Chart extends PO implements I_AD_Chart, I_Persistent
return ii.intValue();
}
/** Set AD_Chart_UU.
@param AD_Chart_UU AD_Chart_UU */
public void setAD_Chart_UU (String AD_Chart_UU)
{
set_ValueNoCheck (COLUMNNAME_AD_Chart_UU, AD_Chart_UU);
}
/** Get AD_Chart_UU.
@return AD_Chart_UU */
public String getAD_Chart_UU ()
{
return (String)get_Value(COLUMNNAME_AD_Chart_UU);
}
/** ChartOrientation AD_Reference_ID=53375 */
public static final int CHARTORIENTATION_AD_Reference_ID=53375;
/** Horizontal = H */
@ -149,7 +163,7 @@ public class X_AD_Chart extends PO implements I_AD_Chart, I_Persistent
public static final String CHARTTYPE_RingChart = "RC";
/** Set Chart Type.
@param ChartType
Type fo chart to render
Type of chart to render
*/
public void setChartType (String ChartType)
{
@ -158,7 +172,7 @@ public class X_AD_Chart extends PO implements I_AD_Chart, I_Persistent
}
/** Get Chart Type.
@return Type fo chart to render
@return Type of chart to render
*/
public String getChartType ()
{

View File

@ -1,6 +1,6 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* 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 *
@ -22,15 +22,15 @@ import java.util.Properties;
import org.compiere.util.KeyNamePair;
/** Generated Model for AD_ChartDatasource
* @author Adempiere (generated)
* @version 1.03 - $Id$ */
* @author iDempiere (generated)
* @version Release 1.0c - $Id$ */
public class X_AD_ChartDatasource extends PO implements I_AD_ChartDatasource, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20120608L;
private static final long serialVersionUID = 20130823L;
/** Standard Constructor */
public X_AD_ChartDatasource (Properties ctx, int AD_ChartDatasource_ID, String trxName)
@ -40,6 +40,7 @@ public class X_AD_ChartDatasource extends PO implements I_AD_ChartDatasource, I_
{
setAD_ChartDatasource_ID (0);
setAD_Chart_ID (0);
setCategoryColumn (null);
setEntityType (null);
// U
setFromClause (null);
@ -98,9 +99,23 @@ public class X_AD_ChartDatasource extends PO implements I_AD_ChartDatasource, I_
return ii.intValue();
}
public I_AD_Chart getAD_Chart() throws RuntimeException
/** Set AD_ChartDatasource_UU.
@param AD_ChartDatasource_UU AD_ChartDatasource_UU */
public void setAD_ChartDatasource_UU (String AD_ChartDatasource_UU)
{
set_ValueNoCheck (COLUMNNAME_AD_ChartDatasource_UU, AD_ChartDatasource_UU);
}
/** Get AD_ChartDatasource_UU.
@return AD_ChartDatasource_UU */
public String getAD_ChartDatasource_UU ()
{
return (String)get_Value(COLUMNNAME_AD_ChartDatasource_UU);
}
public org.compiere.model.I_AD_Chart getAD_Chart() throws RuntimeException
{
return (I_AD_Chart)MTable.get(getCtx(), I_AD_Chart.Table_Name)
return (org.compiere.model.I_AD_Chart)MTable.get(getCtx(), org.compiere.model.I_AD_Chart.Table_Name)
.getPO(getAD_Chart_ID(), get_TrxName()); }
/** Set Chart.
@ -123,9 +138,9 @@ public class X_AD_ChartDatasource extends PO implements I_AD_ChartDatasource, I_
return ii.intValue();
}
public I_AD_Table getAD_Table() throws RuntimeException
public org.compiere.model.I_AD_Table getAD_Table() throws RuntimeException
{
return (I_AD_Table)MTable.get(getCtx(), I_AD_Table.Table_Name)
return (org.compiere.model.I_AD_Table)MTable.get(getCtx(), org.compiere.model.I_AD_Table.Table_Name)
.getPO(getAD_Table_ID(), get_TrxName()); }
/** Set Table.

View File

@ -157,7 +157,7 @@ public class X_PA_Goal extends PO implements I_PA_Goal, I_Persistent
public static final String CHARTTYPE_WaterfallChart = "WC";
/** Set Chart Type.
@param ChartType
Type fo chart to render
Type of chart to render
*/
public void setChartType (String ChartType)
{
@ -166,7 +166,7 @@ public class X_PA_Goal extends PO implements I_PA_Goal, I_Persistent
}
/** Get Chart Type.
@return Type fo chart to render
@return Type of chart to render
*/
public String getChartType ()
{

View File

@ -479,7 +479,7 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem
|| ColumnName.equals("IsActive")
|| displayType == DisplayType.Button || displayType == DisplayType.Binary
|| displayType == DisplayType.ID || displayType == DisplayType.Image
|| displayType == DisplayType.RowID
|| displayType == DisplayType.RowID || displayType == DisplayType.Chart
|| seqNo == 0 )
{
pfi.setIsPrinted(false);
@ -565,7 +565,7 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem
//
if (displayType == DisplayType.Button || displayType == DisplayType.Binary
|| displayType == DisplayType.ID || displayType == DisplayType.Image
|| displayType == DisplayType.RowID
|| displayType == DisplayType.RowID || displayType == DisplayType.Chart
|| seqNo == 0)
{
pfi.setIsPrinted(false);

View File

@ -189,7 +189,7 @@ public final class DisplayType
if (displayType == ID || displayType == Table || displayType == TableDir
|| displayType == Search || displayType == Location || displayType == Locator
|| displayType == Account || displayType == Assignment || displayType == PAttribute
|| displayType == Image || displayType == Color)
|| displayType == Image || displayType == Chart || displayType == Color)
return true;
List<IDisplayTypeFactory> factoryList = Service.locator().list(IDisplayTypeFactory.class).getServices();
@ -711,6 +711,8 @@ public final class DisplayType
return "PrinterName";
if (displayType == Payment)
return "Payment";
if (displayType == Chart)
return "Chart";
List<IDisplayTypeFactory> factoryList = Service.locator().list(IDisplayTypeFactory.class).getServices();
for(IDisplayTypeFactory factory : factoryList){

View File

@ -56,6 +56,7 @@ public class WChartEditor extends WEditor
{
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK};
@SuppressWarnings("unused")
private static final CLogger logger;
static
@ -161,7 +162,7 @@ public class WChartEditor extends WEditor
count++;
}
myImage.addEventListener(Events.ON_CLICK, new EventListener() {
myImage.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
MouseEvent me = (MouseEvent) event;
String areaId = me.getArea();
@ -189,7 +190,6 @@ public class WChartEditor extends WEditor
private void init()
{
AImage img = null;
}
@Override

View File

@ -123,7 +123,7 @@ public class DefaultEditorFactory implements IEditorFactory {
/** Chart */
else if(displayType == DisplayType.Chart)
{
editor = new WChartEditor(gridField, gridTab.getWindowNo());
editor = new WChartEditor(gridField, (gridTab == null ? 0 : gridTab.getWindowNo()));
}
/** Button */

View File

@ -932,6 +932,7 @@ public class DB_Oracle implements AdempiereDatabase
case DisplayType.Table:
case DisplayType.TableDir:
case DisplayType.Image:
case DisplayType.Chart:
retValue = "NUMBER(10)";
break;