summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorning.zhang2011-12-05 03:20:43 (EST)
committer dgao2011-12-05 03:38:27 (EST)
commit3aed6089e4b7fa7144c0844a059d8bc741cdc934 (patch)
tree17d4e0014ed8b9a6271eb28469e7df1070244e97
parent1f4316b96bddc0342372869a41da7ffcd41c4a0d (diff)
downloadorg.eclipse.birt-3aed6089e4b7fa7144c0844a059d8bc741cdc934.zip
org.eclipse.birt-3aed6089e4b7fa7144c0844a059d8bc741cdc934.tar.gz
org.eclipse.birt-3aed6089e4b7fa7144c0844a059d8bc741cdc934.tar.bz2
- Summary:
Enable cube measure selection on the expression builder when the measure is a derived measure; Don't check data type when the measure is a derived measure. - Bugzilla Bug (s) Resolved: None - Description: Enable cube measure selection on the expression builder when the measure is a derived measure; Don't check data type when the measure is a derived measure. - Tests Description: Manual test - Notes to Build Team: None - Notes to Developers: None - Notes to QA: None - Notes to Documentation: None - Files Edited: - Files Added: - Files Deleted:
-rw-r--r--UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/provider/CubeMeasureExpressionProvider.java146
1 files changed, 146 insertions, 0 deletions
diff --git a/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/provider/CubeMeasureExpressionProvider.java b/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/provider/CubeMeasureExpressionProvider.java
new file mode 100644
index 0000000..7525896
--- /dev/null
+++ b/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/provider/CubeMeasureExpressionProvider.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Actuate Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.birt.report.designer.ui.cubebuilder.provider;
+
+import java.util.List;
+
+import org.eclipse.birt.report.designer.ui.dialogs.ExpressionProvider;
+import org.eclipse.birt.report.designer.ui.expressions.ExpressionFilter;
+import org.eclipse.birt.report.model.api.DataSetHandle;
+import org.eclipse.birt.report.model.api.DesignElementHandle;
+import org.eclipse.birt.report.model.api.PropertyHandle;
+import org.eclipse.birt.report.model.api.olap.TabularCubeHandle;
+import org.eclipse.birt.report.model.api.olap.TabularMeasureHandle;
+import org.eclipse.birt.report.model.elements.interfaces.ICubeModel;
+
+public class CubeMeasureExpressionProvider extends CubeExpressionProvider
+{
+ private TabularMeasureHandle handle = null;
+ private DataSetHandle dataSetHandle = null;
+ private ExpressionFilter filter = null;
+
+ private boolean isDerivedMeasure;
+
+ public boolean isDerivedMeasure()
+ {
+ return isDerivedMeasure;
+ }
+
+ public void setDerivedMeasure(boolean isDerivedMeasure)
+ {
+ this.isDerivedMeasure = isDerivedMeasure;
+
+ this.clearFilters();
+ this.addFilterToProvider(handle);
+ }
+
+ public CubeMeasureExpressionProvider(TabularMeasureHandle handle, boolean isDerivedMeasure)
+ {
+ super(handle);
+ this.isDerivedMeasure = isDerivedMeasure;
+ this.handle = handle;
+ this.clearFilters();
+
+ if(isDerivedMeasure)
+ {
+ dataSetHandle = null;
+ }
+ else
+ {
+ Object parent = ( (TabularMeasureHandle) handle ).getContainer( ).getContainer( );
+ if ( parent instanceof TabularCubeHandle )
+ {
+ dataSetHandle = ( (TabularCubeHandle) parent ).getDataSet( );
+ }
+ }
+
+ addFilterToProvider( handle );
+ }
+
+ protected void addFilterToProvider( final DesignElementHandle handle )
+ {
+ filter = new ExpressionFilter( ) {
+
+ public boolean select( Object parentElement, Object element )
+ {
+ if(isDerivedMeasure) // filters DATA_SET
+ {
+ if ( ExpressionFilter.CATEGORY.equals( parentElement )
+ && ExpressionProvider.DATASETS.equals( element ) )
+ {
+ return false;
+ }
+ }
+ else
+ {
+ if ( ExpressionFilter.CATEGORY.equals( parentElement )
+ && ExpressionProvider.CURRENT_CUBE.equals( element ) )
+ {
+ return false;
+ }
+ if ( ExpressionFilter.CATEGORY.equals( parentElement )
+ && ExpressionProvider.MEASURE.equals( element ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ };
+
+ this.addFilter( filter );
+ }
+
+ protected List getCategoryList( )
+ {
+ List categoryList = super.getCategoryList( );
+
+ if(isDerivedMeasure)
+ {
+ categoryList.add(CURRENT_CUBE);
+ }
+ return categoryList;
+ }
+
+ public Object[] getChildren( Object parent )
+ {
+ Object[] children = super.getChildren(parent);
+
+ if ( CURRENT_CUBE.equals( parent ) )
+ {
+ ExpressionFilter ft = new ExpressionFilter( ) {
+
+ public boolean select( Object parentElement, Object element )
+ {
+ // Derived measure expression can only use measure of cube.
+ if ( CURRENT_CUBE.equals( parentElement ) && element instanceof PropertyHandle)
+ {
+ if ( ((PropertyHandle)element).getPropertyDefn( )
+ .getName( )
+ .equals( ICubeModel.MEASURE_GROUPS_PROP ) )
+ {
+ return true;
+ }
+ return false;
+ }
+ return true;
+ }
+ };
+
+ children = ft.filter( parent, children );
+ }
+
+ return children;
+ }
+
+}