summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpshi2012-01-12 02:31:14 (EST)
committer mwu2012-01-12 02:31:14 (EST)
commitf567128ddc3e4e3f0bb4b267b654a60ce2af17ce (patch)
treef32b0d29ac93204cba0ad6e4b43cacfdabf19a35
parent8597b067b8f754fd61a0cd6ae97529e898f96323 (diff)
downloadorg.eclipse.birt-f567128ddc3e4e3f0bb4b267b654a60ce2af17ce.zip
org.eclipse.birt-f567128ddc3e4e3f0bb4b267b654a60ce2af17ce.tar.gz
org.eclipse.birt-f567128ddc3e4e3f0bb4b267b654a60ce2af17ce.tar.bz2
fix ted 46642
-rw-r--r--data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/DataAdapterUtil.java16
-rw-r--r--data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/timeFunction/BaseTimeFunction.java9
-rw-r--r--data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/timeFunction/IArgumentInfo.java27
-rw-r--r--data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/timeFunction/TimeFunctionManager.java11
-rw-r--r--data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/Messages.properties11
-rw-r--r--data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/ResourceConstants.java5
-rw-r--r--xtab/org.eclipse.birt.report.item.crosstab.ui/src/org/eclipse/birt/report/item/crosstab/internal/ui/dialogs/CrosstabBindingDialogHelper.java2
7 files changed, 75 insertions, 6 deletions
diff --git a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/DataAdapterUtil.java b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/DataAdapterUtil.java
index 7f6ae69..603caf9 100644
--- a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/DataAdapterUtil.java
+++ b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/DataAdapterUtil.java
@@ -512,6 +512,22 @@ public class DataAdapterUtil
{
return TimePeriodType.DAY;
}
+ else if ( type.equals( "Year to Date" ))
+ {
+ return TimePeriodType.YEAR;
+ }
+ else if ( type.equals( "Quarter to Date" ))
+ {
+ return TimePeriodType.QUARTER;
+ }
+ else if ( type.equals( "Month to Date" ))
+ {
+ return TimePeriodType.MONTH;
+ }
+ else if ( type.equals( "Week to Date" ))
+ {
+ return TimePeriodType.WEEK;
+ }
return null;
}
diff --git a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/timeFunction/BaseTimeFunction.java b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/timeFunction/BaseTimeFunction.java
index 9a11f42..fd5d902 100644
--- a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/timeFunction/BaseTimeFunction.java
+++ b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/timeFunction/BaseTimeFunction.java
@@ -41,6 +41,15 @@ public class BaseTimeFunction implements ITimeFunction
period_type2.addAll( timeType );
}
+ public BaseTimeFunction( ITimeFunction function, List<IArgumentInfo.Period_Type> timeType1, List<IArgumentInfo.Period_Type> timeType2)
+ {
+ this( function.getName( ), function.getDisplayName( ), function.getDescription( ) );
+ period_type1 = new ArrayList<Period_Type>( );
+ period_type2 = new ArrayList<Period_Type>( );
+ period_type1.addAll( timeType1 );
+ period_type2.addAll( timeType2 );
+ }
+
/**
* Get time function name
* @return the time function name
diff --git a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/timeFunction/IArgumentInfo.java b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/timeFunction/IArgumentInfo.java
index 55d4fcf..919925c 100644
--- a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/timeFunction/IArgumentInfo.java
+++ b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/timeFunction/IArgumentInfo.java
@@ -63,11 +63,21 @@ public interface IArgumentInfo
private Period_Type_ENUM type;
private ULocale locale;
+ private boolean isPeriodToDate = false;
+
public Period_Type( Period_Type_ENUM type, ULocale locale )
{
this.type = type;
this.locale = locale;
+ this.isPeriodToDate = false;
+ }
+
+ public Period_Type( Period_Type_ENUM type, ULocale locale, boolean isPeriodToDate )
+ {
+ this.type = type;
+ this.locale = locale;
+ this.isPeriodToDate = isPeriodToDate;
}
/**
@@ -79,6 +89,7 @@ public interface IArgumentInfo
return this.type.name();
}
+
/**
*
* @return
@@ -87,18 +98,34 @@ public interface IArgumentInfo
{
if( this.type.equals( Period_Type_ENUM.YEAR ) )
{
+ if (isPeriodToDate)
+ {
+ return Message.getMessage( ResourceConstants.TIMEFUNCITON_PERIODCHOICE_PERIODTODATE_YEAR_DISPLAYNAME, locale );
+ }
return Message.getMessage( ResourceConstants.TIMEFUNCITON_PERIODCHOICE_YEAR_DISPLAYNAME, locale );
}
if( this.type.equals( Period_Type_ENUM.QUARTER ) )
{
+ if (isPeriodToDate)
+ {
+ return Message.getMessage( ResourceConstants.TIMEFUNCITON_PERIODCHOICE_PERIODTODATE_QUARTER_DISPLAYNAME, locale );
+ }
return Message.getMessage( ResourceConstants.TIMEFUNCITON_PERIODCHOICE_QUARTER_DISPLAYNAME , locale );
}
if( this.type.equals( Period_Type_ENUM.MONTH ) )
{
+ if (isPeriodToDate)
+ {
+ return Message.getMessage( ResourceConstants.TIMEFUNCITON_PERIODCHOICE_PERIODTODATE_MONTH_DISPLAYNAME, locale );
+ }
return Message.getMessage( ResourceConstants.TIMEFUNCITON_PERIODCHOICE_MONTH_DISPLAYNAME, locale );
}
if( this.type.equals( Period_Type_ENUM.WEEK ) )
{
+ if (isPeriodToDate)
+ {
+ return Message.getMessage( ResourceConstants.TIMEFUNCITON_PERIODCHOICE_PERIODTODATE_WEEK_DISPLAYNAME, locale );
+ }
return Message.getMessage( ResourceConstants.TIMEFUNCITON_PERIODCHOICE_WEEK_DISPLAYNAME, locale );
}
if( this.type.equals( Period_Type_ENUM.DAY ) )
diff --git a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/timeFunction/TimeFunctionManager.java b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/timeFunction/TimeFunctionManager.java
index 152b47a..fd99c55 100644
--- a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/timeFunction/TimeFunctionManager.java
+++ b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/api/timeFunction/TimeFunctionManager.java
@@ -117,8 +117,10 @@ public class TimeFunctionManager
}
List<IArgumentInfo.Period_Type> periodType = new ArrayList<IArgumentInfo.Period_Type>( );
-
+ List<IArgumentInfo.Period_Type> periodToDateType = new ArrayList<IArgumentInfo.Period_Type>( );
+
TimeFunctionHandle handle = TimeFunctionHandle.getInstance( locale );
+
if ( timeType.contains( DesignChoiceConstants.DATE_TIME_LEVEL_TYPE_YEAR ) )
{
availableFunctions.add( handle.getFunction( IBuildInBaseTimeFunction.CURRENT_YEAR ) );
@@ -127,6 +129,7 @@ public class TimeFunctionManager
availableFunctions.add( handle.getFunction( IBuildInBaseTimeFunction.YEAR_TO_DATE ) );
periodType.add( new Period_Type( IArgumentInfo.Period_Type.Period_Type_ENUM.YEAR, locale ) );
+ periodToDateType.add( new Period_Type( IArgumentInfo.Period_Type.Period_Type_ENUM.YEAR, locale, true ) );
}
if ( timeType.contains( DesignChoiceConstants.DATE_TIME_LEVEL_TYPE_QUARTER )
|| timeType.contains( DesignChoiceConstants.DATE_TIME_LEVEL_TYPE_WEEK_OF_YEAR )
@@ -139,6 +142,7 @@ public class TimeFunctionManager
availableFunctions.add( handle.getFunction( IBuildInBaseTimeFunction.QUARTER_TO_DATE_LAST_YEAR ) );
periodType.add( new Period_Type( IArgumentInfo.Period_Type.Period_Type_ENUM.QUARTER, locale ) );
+ periodToDateType.add( new Period_Type( IArgumentInfo.Period_Type.Period_Type_ENUM.QUARTER, locale, true ) );
}
if ( timeType.contains( DesignChoiceConstants.DATE_TIME_LEVEL_TYPE_MONTH )
|| timeType.contains( DesignChoiceConstants.DATE_TIME_LEVEL_TYPE_WEEK_OF_YEAR )
@@ -152,6 +156,7 @@ public class TimeFunctionManager
availableFunctions.add( handle.getFunction( IBuildInBaseTimeFunction.MONTH_TO_DATE_LAST_YEAR ) );
periodType.add( new Period_Type( IArgumentInfo.Period_Type.Period_Type_ENUM.MONTH, locale ) );
+ periodToDateType.add( new Period_Type( IArgumentInfo.Period_Type.Period_Type_ENUM.MONTH, locale, true ) );
}
// for WTD, only support static reference date
@@ -162,6 +167,7 @@ public class TimeFunctionManager
availableFunctions.add( handle.getFunction( IBuildInBaseTimeFunction.PREVIOUS_WEEK_TO_DATE ) );
availableFunctions.add( handle.getFunction( IBuildInBaseTimeFunction.WEEK_TO_DATE_LAST_YEAR ) );
periodType.add( new Period_Type( IArgumentInfo.Period_Type.Period_Type_ENUM.WEEK, locale ) );
+ periodToDateType.add( new Period_Type( IArgumentInfo.Period_Type.Period_Type_ENUM.WEEK, locale, true ) );
}
if ( timeType.contains( DesignChoiceConstants.DATE_TIME_LEVEL_TYPE_DAY_OF_YEAR ) )
@@ -172,10 +178,11 @@ public class TimeFunctionManager
// availableFunctions.add( handle.getFunction( IBuildInBaseTimeFunction.TRAILING_120_DAYS ) );
// periodType.add( new Period_Type( IArgumentInfo.Period_Type.Period_Type_ENUM.DAY, locale ) );
}
+
availableFunctions.add( new BaseTimeFunction( handle.getFunction( IBuildInBaseTimeFunction.CURRENT_PERIOD_FROM_N_PERIOD_AGO ),
periodType ) );
availableFunctions.add( new BaseTimeFunction( handle.getFunction( IBuildInBaseTimeFunction.PERIOD_TO_DATE_FROM_N_PERIOD_AGO ),
- periodType ) );
+ periodToDateType, periodType ) );
availableFunctions.add( new BaseTimeFunction( handle.getFunction( IBuildInBaseTimeFunction.TRAILING_N_PERIOD_FROM_N_PERIOD_AGO ),
periodType ) );
availableFunctions.add( new BaseTimeFunction( handle.getFunction( IBuildInBaseTimeFunction.NEXT_N_PERIODS ),
diff --git a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/Messages.properties b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/Messages.properties
index 582cf28..a20d5af 100644
--- a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/Messages.properties
+++ b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/Messages.properties
@@ -86,11 +86,11 @@ timeFunction.CURRENT_YEAR.name = Current Year
timeFunction.CURRENT_YEAR.description = Calculate the specified metric for current year
timeFunction.WEEK_TO_DATE.name = Week to Date(WTD)
timeFunction.WEEK_TO_DATE.description = Calculate the specified metric for same week
-timeFunction.CURRENT_PERIOD_FROM_N_PERIOD_AGO.name = Current Period from N Periods Ago
+timeFunction.CURRENT_PERIOD_FROM_N_PERIOD_AGO.name = Current Period
timeFunction.CURRENT_PERIOD_FROM_N_PERIOD_AGO.description = Calculate the specified metric for current period from N period ago
-timeFunction.PERIOD_TO_DATE_FROM_N_PERIOD_AGO.name = Period to Date from N Periods Ago
+timeFunction.PERIOD_TO_DATE_FROM_N_PERIOD_AGO.name = Period to Date
timeFunction.PERIOD_TO_DATE_FROM_N_PERIOD_AGO.description = Calculate the specified metric for same period from N period ago
-timeFunction.TRAILING_N_PERIOD_FROM_N_PERIOD_AGO.name = Trailing N Periods from N Periods Ago
+timeFunction.TRAILING_N_PERIOD_FROM_N_PERIOD_AGO.name = Trailing N Periods
timeFunction.TRAILING_N_PERIOD_FROM_N_PERIOD_AGO.description = Calculate the specified metric for trailing N period from N period ago
timeFunction.NEXT_N_PERIODS.name = Next N Periods
timeFunction.NEXT_N_PERIODS.description = Calculate the specified metric for next N periods
@@ -131,6 +131,11 @@ timeFunction.PERIODCHOICE.MONTH_displayName =MONTH
timeFunction.PERIODCHOICE.WEEK_displayName =WEEK
timeFunction.PERIODCHOICE.DAY_displayName =DAY
+timeFunction.PERIODCHOICE.PeriodToDate.YEAR_displayName =Year to Date
+timeFunction.PERIODCHOICE.PeriodToDate.QUARTER_displayName =Quarter to Date
+timeFunction.PERIODCHOICE.PeriodToDate.MONTH_displayName =Month to Date
+timeFunction.PERIODCHOICE.PeriodToDate.WEEK_displayName =Week to Date
+
timeFunction.toolTip.to=To
diff --git a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/ResourceConstants.java b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/ResourceConstants.java
index 5a560ae..6251db4 100644
--- a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/ResourceConstants.java
+++ b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/ResourceConstants.java
@@ -131,6 +131,11 @@ public class ResourceConstants
public final static String TIMEFUNCITON_PERIODCHOICE_MONTH_DISPLAYNAME = "timeFunction.PERIODCHOICE.MONTH_displayName";
public final static String TIMEFUNCITON_PERIODCHOICE_WEEK_DISPLAYNAME = "timeFunction.PERIODCHOICE.WEEK_displayName";
public final static String TIMEFUNCITON_PERIODCHOICE_DAY_DISPLAYNAME = "timeFunction.PERIODCHOICE.DAY_displayName";
+
+ public final static String TIMEFUNCITON_PERIODCHOICE_PERIODTODATE_YEAR_DISPLAYNAME = "timeFunction.PERIODCHOICE.PeriodToDate.YEAR_displayName";
+ public final static String TIMEFUNCITON_PERIODCHOICE_PERIODTODATE_QUARTER_DISPLAYNAME = "timeFunction.PERIODCHOICE.PeriodToDate.QUARTER_displayName";
+ public final static String TIMEFUNCITON_PERIODCHOICE_PERIODTODATE_MONTH_DISPLAYNAME = "timeFunction.PERIODCHOICE.PeriodToDate.MONTH_displayName";
+ public final static String TIMEFUNCITON_PERIODCHOICE_PERIODTODATE_WEEK_DISPLAYNAME = "timeFunction.PERIODCHOICE.PeriodToDate.WEEK_displayName";
//toolTip
public final static String TIMEFUNCTION_TOOLTIP_TO = "timeFunction.toolTip.to";
diff --git a/xtab/org.eclipse.birt.report.item.crosstab.ui/src/org/eclipse/birt/report/item/crosstab/internal/ui/dialogs/CrosstabBindingDialogHelper.java b/xtab/org.eclipse.birt.report.item.crosstab.ui/src/org/eclipse/birt/report/item/crosstab/internal/ui/dialogs/CrosstabBindingDialogHelper.java
index 1256ca2..e18061a 100644
--- a/xtab/org.eclipse.birt.report.item.crosstab.ui/src/org/eclipse/birt/report/item/crosstab/internal/ui/dialogs/CrosstabBindingDialogHelper.java
+++ b/xtab/org.eclipse.birt.report.item.crosstab.ui/src/org/eclipse/birt/report/item/crosstab/internal/ui/dialogs/CrosstabBindingDialogHelper.java
@@ -870,7 +870,7 @@ public class CrosstabBindingDialogHelper extends AbstractBindingDialogHelper
String[] strs = new String[list.size( )];
for ( int i = 0; i < list.size( ); i++ )
{
- strs[i] = list.get( i ).name( );
+ strs[i] = list.get( i ).displayName( );
}
cmbDataField.setItems( strs );
if ( calculationParamsValueMap.containsKey( name ) )