summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorning.zhang2012-01-13 03:24:04 (EST)
committer dgao2012-01-13 03:24:04 (EST)
commitac87cec10cd6a5c036780bb1917bd503b9b27572 (patch)
treedcd88a8445ec47d26dbb949f17a61485bf3556ad
parent62a211d36e3de3bc64b124337f3da6e7465d72f8 (diff)
downloadorg.eclipse.birt-ac87cec10cd6a5c036780bb1917bd503b9b27572.zip
org.eclipse.birt-ac87cec10cd6a5c036780bb1917bd503b9b27572.tar.gz
org.eclipse.birt-ac87cec10cd6a5c036780bb1917bd503b9b27572.tar.bz2
Remember last used reference date history.
-rw-r--r--xtab/org.eclipse.birt.report.item.crosstab.ui/src/org/eclipse/birt/report/item/crosstab/internal/ui/dialogs/CrosstabBindingDialogHelper.java90
1 files changed, 63 insertions, 27 deletions
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 e18061a..7a032b7 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
@@ -1000,43 +1000,35 @@ public class CrosstabBindingDialogHelper extends AbstractBindingDialogHelper
private void initReferenceDate( )
{
- String dimensionName = getTimeDimsionName( );;
+ String dimensionName = getTimeDimsionName( );
boolean inUseDimsion = isUseDimension( dimensionName );
- if ( getBinding( ) == null )
+ if ( getBinding( ) == null ) // new Relative Time Period
{
- todayButton.setSelection( true );
-
- }
- else
- {
-
- String type = getBinding( ).getReferenceDateType( );
-
- if ( DesignChoiceConstants.REFERENCE_DATE_TYPE_TODAY.equals( type ) )
+ ExtendedItemHandle handle = (ExtendedItemHandle) getBindingHolder( ) ;
+
+ List<ComputedColumnHandle> dimensionHandle = new ArrayList();
+
+ for (Iterator<ComputedColumnHandle> iter = handle.columnBindingsIterator(); iter.hasNext();)
{
- todayButton.setSelection( true );
- }
- else if ( DesignChoiceConstants.REFERENCE_DATE_TYPE_FIXED_DATE.equals( type ) )
- {
- dateSelectionButton.setSelection( true );
- ExpressionHandle value = getBinding( ).getReferenceDateValue( );
+ ComputedColumnHandle cHandle = iter.next();
- dateText.setText( value == null
- || value.getExpression( ) == null ? "" : (String) value.getExpression( ) ); //$NON-NLS-1$
- dateText.setData( ExpressionButtonUtil.EXPR_TYPE, value == null
- || value.getType( ) == null ? ExpressionType.CONSTANT
- : (String) value.getType( ) );
- ExpressionButton button = (ExpressionButton) dateText.getData( ExpressionButtonUtil.EXPR_BUTTON );
- if ( button != null )
- button.refresh( );
+ if (cHandle.getTimeDimension() != null && !cHandle.getTimeDimension().equals(EMPTY_STRING))
+ {
+ dimensionHandle.add(0, cHandle);
+ }
}
- else if ( DesignChoiceConstants.REFERENCE_DATE_TYPE_ENDING_DATE_IN_DIMENSION.equals( type ) )
+
+ if(0 == dimensionHandle.size() || !setRefDate(dimensionHandle.get(0), inUseDimsion))
{
- recentButton.setSelection( true );
+ todayButton.setSelection( true );
}
}
+ else // edit Relative Time Period
+ {
+ setRefDate(getBinding(), inUseDimsion);
+ }
if ( inUseDimsion )
{
recentButton.setEnabled( true );
@@ -1050,6 +1042,50 @@ public class CrosstabBindingDialogHelper extends AbstractBindingDialogHelper
}
+ private boolean setRefDate (ComputedColumnHandle handle, boolean inUseDimsion)
+ {
+ String type = handle.getReferenceDateType( );
+
+ if (type == null)
+ return false;
+
+ if ( DesignChoiceConstants.REFERENCE_DATE_TYPE_TODAY.equals( type ) )
+ {
+ todayButton.setSelection( true );
+ return true;
+ }
+ else if ( DesignChoiceConstants.REFERENCE_DATE_TYPE_FIXED_DATE.equals( type ) )
+ {
+ dateSelectionButton.setSelection( true );
+ ExpressionHandle value = handle.getReferenceDateValue( );
+
+ dateText.setText( value == null
+ || value.getExpression( ) == null ? "" : (String) value.getExpression( ) ); //$NON-NLS-1$
+ dateText.setData( ExpressionButtonUtil.EXPR_TYPE, value == null
+ || value.getType( ) == null ? ExpressionType.CONSTANT
+ : (String) value.getType( ) );
+ ExpressionButton button = (ExpressionButton) dateText.getData( ExpressionButtonUtil.EXPR_BUTTON );
+ if ( button != null )
+ button.refresh( );
+
+ return true;
+ }
+ else if ( DesignChoiceConstants.REFERENCE_DATE_TYPE_ENDING_DATE_IN_DIMENSION.equals( type ) )
+ {
+ if(getBinding() == null && !inUseDimsion )
+ {
+ return false;
+ }
+ else
+ {
+ recentButton.setSelection( true );
+ return true;
+ }
+ }
+
+ return false;
+ }
+
private void initTimeDimension( )
{
String[] strs = getTimeDimensions( );