summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorning.zhang2011-11-01 06:12:38 (EDT)
committer dgao2011-11-01 06:12:38 (EDT)
commit31165149d0c29033fb2df5d727709644f21b3ff4 (patch)
tree8f14b812dc1ded368cea6888792437f51d667649
parent8676f8efb11a26aa532cb89eace6d99c0ed395eb (diff)
downloadorg.eclipse.birt-31165149d0c29033fb2df5d727709644f21b3ff4.zip
org.eclipse.birt-31165149d0c29033fb2df5d727709644f21b3ff4.tar.gz
org.eclipse.birt-31165149d0c29033fb2df5d727709644f21b3ff4.tar.bz2
- Summary:
Support Calculated Measure feature on GUI - Bugzilla Bug (s) Resolved: None - Description: Support Calculated Measure feature on GUI - 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/dialog/MeasureDialog.java66
-rw-r--r--UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/nls/messages.properties7
-rw-r--r--UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/page/CubeGroupContent.java8
-rw-r--r--UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/provider/CubeLabelProvider.java5
-rw-r--r--UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/util/BuilderConstants.java1
5 files changed, 84 insertions, 3 deletions
diff --git a/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/dialog/MeasureDialog.java b/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/dialog/MeasureDialog.java
index 1661a8e..24ed816 100644
--- a/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/dialog/MeasureDialog.java
+++ b/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/dialog/MeasureDialog.java
@@ -35,6 +35,7 @@ import org.eclipse.birt.report.designer.ui.newelement.DesignElementFactory;
import org.eclipse.birt.report.designer.ui.util.ExceptionUtil;
import org.eclipse.birt.report.designer.ui.views.ElementAdapterManager;
import org.eclipse.birt.report.designer.ui.views.attributes.providers.ChoiceSetFactory;
+import org.eclipse.birt.report.designer.util.ColorManager;
import org.eclipse.birt.report.designer.util.DEUtil;
import org.eclipse.birt.report.model.api.Expression;
import org.eclipse.birt.report.model.api.FormatValueHandle;
@@ -58,6 +59,7 @@ import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -73,10 +75,14 @@ public class MeasureDialog extends TitleAreaDialog
{
private boolean isEdit = false;
+ private boolean isAutoPrimaryKeyChecked = false;
private Combo typeCombo;
private Text expressionText;
private Combo functionCombo;
+ private Button derivedMeasureBtn, visibilityBtn;
+ private Label exprDesc;
+
private TabularMeasureHandle input;
private Text nameText;
private static IChoice[] dataTypes = DEUtil.getMetaDataDictionary( )
@@ -198,6 +204,11 @@ public class MeasureDialog extends TitleAreaDialog
this.input = input;
}
+ public void setAutoPrimaryKeyStatus( boolean isChecked )
+ {
+ this.isAutoPrimaryKeyChecked = isChecked;
+ }
+
/*
* (non-Javadoc) Method declared on Dialog.
*/
@@ -217,6 +228,9 @@ public class MeasureDialog extends TitleAreaDialog
contents.setLayoutData( data );
createMeasureArea( contents );
+
+ createVisibilityGroup( contents );
+
WidgetUtil.createGridPlaceholder( contents, 1, true );
initMeasureDialog( );
@@ -330,6 +344,7 @@ public class MeasureDialog extends TitleAreaDialog
input.setName( nameText.getText( ) );
}
+ measure.setCalculated( derivedMeasureBtn.getSelection( ) );
measure.setFunction( getFunctions( )[functionCombo.getSelectionIndex( )].getName( ) );
measure.setDataType( getDataTypeNames( )[typeCombo.getSelectionIndex( )] );
if ( expressionText.isEnabled( ) )
@@ -373,11 +388,13 @@ public class MeasureDialog extends TitleAreaDialog
}
}
+ measure.setVisible(!visibilityBtn.getSelection());
result = measure;
}
else
{
input.setName( nameText.getText( ) );
+ input.setCalculated( derivedMeasureBtn.getSelection( ) );
input.setFunction( getFunctions( )[functionCombo.getSelectionIndex( )].getName( ) );
input.setDataType( getDataTypeNames( )[typeCombo.getSelectionIndex( )] );
if ( expressionText.isEnabled( ) )
@@ -423,6 +440,7 @@ public class MeasureDialog extends TitleAreaDialog
}
}
+ input.setVisible(!visibilityBtn.getSelection());
result = input;
}
@@ -469,6 +487,22 @@ public class MeasureDialog extends TitleAreaDialog
} );
+ new Label( group, SWT.NONE );
+ derivedMeasureBtn = new Button( group, SWT.CHECK );
+ derivedMeasureBtn.setText( Messages.getString( "MeasureDialog.Label.DerivedMeasure" ) ); //$NON-NLS-1$
+ derivedMeasureBtn.setSelection( input.isCalculated( ) );
+
+ derivedMeasureBtn.addSelectionListener( new SelectionAdapter( ) {
+
+ public void widgetSelected( SelectionEvent e )
+ {
+ functionCombo.setEnabled( !( derivedMeasureBtn.getSelection( ) || isAutoPrimaryKeyChecked ) );
+ exprDesc.setText( Messages.getString( derivedMeasureBtn.getSelection( ) ? "MeasureDialog.Label.ExprDesc.Derived" : "MeasureDialog.Label.ExprDesc" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ } );
+ new Label( group, SWT.NONE );
+
Label functionLabel = new Label( group, SWT.NONE );
functionLabel.setText( Messages.getString( "MeasureDialog.Label.Function" ) ); //$NON-NLS-1$
functionCombo = new Combo( group, SWT.BORDER | SWT.READ_ONLY );
@@ -485,6 +519,7 @@ public class MeasureDialog extends TitleAreaDialog
}
} );
+ functionCombo.setEnabled( !( derivedMeasureBtn.getSelection( ) || isAutoPrimaryKeyChecked ) );
Label typeLabel = new Label( group, SWT.NONE );
typeLabel.setText( Messages.getString( "MeasureDialog.Label.DataType" ) ); //$NON-NLS-1$
@@ -519,7 +554,6 @@ public class MeasureDialog extends TitleAreaDialog
public void modifyText( ModifyEvent e )
{
checkOkButtonStatus( );
-
}
} );
@@ -529,6 +563,16 @@ public class MeasureDialog extends TitleAreaDialog
new CubeExpressionProvider( input ),
input );
+ new Label( group, SWT.NONE );
+ exprDesc = new Label( group, SWT.NONE );
+ gd = new GridData( GridData.FILL_HORIZONTAL );
+ gd.horizontalSpan = 2;
+ gd.grabExcessHorizontalSpace = true;
+ exprDesc.setLayoutData( gd );
+ exprDesc.setText( Messages.getString( Messages.getString( derivedMeasureBtn.getSelection( ) ? "MeasureDialog.Label.ExprDesc.Derived" : "MeasureDialog.Label.ExprDesc" ) ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ exprDesc.setForeground( ColorManager.getColor( 128, 128, 128 ) );
+ // new Label( group, SWT.NONE );
+
createSecurityPart( group );
createHyperLinkPart( group );
createFormatPart( group );
@@ -536,6 +580,26 @@ public class MeasureDialog extends TitleAreaDialog
return group;
}
+ private Composite createVisibilityGroup( Composite parent )
+ {
+ Group group = new Group( parent, SWT.NONE );
+ GridData gd = new GridData( );
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalAlignment = SWT.FILL;
+ group.setLayoutData( gd );
+
+ GridLayout layout = new GridLayout( );
+ layout.numColumns = 2;
+ group.setLayout( layout );
+
+ group.setText( Messages.getString( "MeasureDialog.Label.Visibility.Group" ) ); //$NON-NLS-1$
+
+ visibilityBtn = new Button( group, SWT.CHECK );
+ visibilityBtn.setText( Messages.getString( "MeasureDialog.Label.Visibility" ) ); //$NON-NLS-1$
+
+ return group;
+ }
+
private IDialogHelper createHyperLinkPart( Composite parent )
{
Object[] helperProviders = ElementAdapterManager.getAdapters( input,
diff --git a/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/nls/messages.properties b/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/nls/messages.properties
index 6b32107..802d14b 100644
--- a/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/nls/messages.properties
+++ b/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/nls/messages.properties
@@ -75,7 +75,7 @@ SimpleCubeBuilder.Title.Title=Cross Tab Cube Builder
SimpleCubeBuilder.Title.Message=Organize your data for the cross tab by specifying grouping hierarchies and summary data fields.
SimpleCubeBuilder.Title=Cross Tab Cube Builder
SimpleCubeBuilder.Label.Name=Name:
-DatasetSelectionPage.Label.Auto.Primary.Key=&Check this option if the data in the primary dataset has been grouped and aggregated in a way that matches the cube definition.
+DatasetSelectionPage.Label.Auto.Primary.Key=&Check this option to avoid preaggregation in primary data set during cube generation.
DatasetSelectionPage.Text.Auto.Primary.Key=Hint - If this option is checked, BIRT will skip the grouping and aggregation calculation during cube generation to achieve better cube generation performance.
DatasetSelectionPage.Combo.NewDataSet0=<New Data Set...>
GroupsPage.Button.Add=&Add
@@ -119,6 +119,11 @@ MeasureDialog.Title.Description=Summary Field
MeasureDialog.Text.Description=To modify the summary field, specify a summary function and an expression that uses data fields
MeasureDialog.Message.NumericName=Name cannot be pure number
MeasureDialog.Message.BlankName=Measure name cannot be blank
+MeasureDialog.Label.DerivedMeasure=&Is Derived Measure
+MeasureDialog.Label.ExprDesc=e.g. dataSetRow["QUANTITYORDERED"]
+MeasureDialog.Label.ExprDesc.Derived=e.g. measure["QuantityOrdered"] * measure["PriceEach"]
+MeasureDialog.Label.Visibility=&Hide Measure
+MeasureDialog.Label.Visibility.Group=Visibility
LevelPropertyDialog.Access.Control.List.Expression=&Access Control List Expression:
LevelPropertyDialog.Title.Add=Add Group Level
LevelPropertyDialog.Title.Edit=Edit Group Level
diff --git a/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/page/CubeGroupContent.java b/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/page/CubeGroupContent.java
index 80199cd..a4d0743 100644
--- a/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/page/CubeGroupContent.java
+++ b/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/page/CubeGroupContent.java
@@ -687,6 +687,7 @@ public class CubeGroupContent extends Composite implements Listener
{
MeasureDialog dialog = new MeasureDialog( false );
dialog.setInput( measure );
+ dialog.setAutoPrimaryKeyStatus( input.autoPrimaryKey( ) );
if ( dialog.open( ) == Window.CANCEL )
{
SessionHandleAdapter.getInstance( )
@@ -792,6 +793,7 @@ public class CubeGroupContent extends Composite implements Listener
{
MeasureDialog dialog = new MeasureDialog( false );
dialog.setInput( measure );
+ dialog.setAutoPrimaryKeyStatus( input.autoPrimaryKey( ) );
if ( dialog.open( ) == Window.CANCEL )
{
SessionHandleAdapter.getInstance( )
@@ -865,6 +867,7 @@ public class CubeGroupContent extends Composite implements Listener
{
MeasureDialog dialog = new MeasureDialog( false );
dialog.setInput( measure );
+ dialog.setAutoPrimaryKeyStatus( input.autoPrimaryKey( ) );
if ( dialog.open( ) == Window.CANCEL )
{
SessionHandleAdapter.getInstance( )
@@ -1681,6 +1684,7 @@ public class CubeGroupContent extends Composite implements Listener
measure );
MeasureDialog dialog = new MeasureDialog( true );
dialog.setInput( measure );
+ dialog.setAutoPrimaryKeyStatus( input.autoPrimaryKey( ) );
if ( dialog.open( ) == Window.CANCEL )
{
stack.rollback( );
@@ -1709,6 +1713,7 @@ public class CubeGroupContent extends Composite implements Listener
.add( IMeasureGroupModel.MEASURES_PROP, measure );
MeasureDialog dialog = new MeasureDialog( true );
dialog.setInput( measure );
+ dialog.setAutoPrimaryKeyStatus( input.autoPrimaryKey( ) );
if ( dialog.open( ) == Window.CANCEL )
{
stack.rollback( );
@@ -2185,6 +2190,7 @@ public class CubeGroupContent extends Composite implements Listener
{
MeasureDialog dialog = new MeasureDialog( false );
dialog.setInput( measure );
+ dialog.setAutoPrimaryKeyStatus( input.autoPrimaryKey( ) );
if ( dialog.open( ) == Window.CANCEL )
{
stack.rollback( );
@@ -2239,6 +2245,7 @@ public class CubeGroupContent extends Composite implements Listener
{
MeasureDialog dialog = new MeasureDialog( false );
dialog.setInput( measure );
+ dialog.setAutoPrimaryKeyStatus( input.autoPrimaryKey( ) );
if ( dialog.open( ) == Window.CANCEL )
{
stack.rollback( );
@@ -2463,6 +2470,7 @@ public class CubeGroupContent extends Composite implements Listener
stack.startTrans( "" ); //$NON-NLS-1$
MeasureDialog dialog = new MeasureDialog( false );
dialog.setInput( level );
+ dialog.setAutoPrimaryKeyStatus( input.autoPrimaryKey( ) );
if ( dialog.open( ) == Window.OK )
{
stack.commit( );
diff --git a/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/provider/CubeLabelProvider.java b/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/provider/CubeLabelProvider.java
index f786351..97101cf 100644
--- a/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/provider/CubeLabelProvider.java
+++ b/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/provider/CubeLabelProvider.java
@@ -75,6 +75,8 @@ public class CubeLabelProvider extends LabelProvider
private static final Image IMG_MEASUREGROUP = UIHelper.getImage( BuilderConstants.IMAGE_MEASUREGROUP );
+ private static final Image IMG_DERIVED_MEASURE = UIHelper.getImage( BuilderConstants.IMAGE_DERIVED_MEASURE );
+
private static final Image IMG_LEVEL = UIHelper.getImage( BuilderConstants.IMAGE_LEVEL );
private static final Image IMG_OTHER_DATASETS = UIHelper.getImage( BuilderConstants.IMAGE_OTHER_DATASETS );
@@ -157,7 +159,8 @@ public class CubeLabelProvider extends LabelProvider
}
else if ( element instanceof MeasureHandle )
{
- return IMG_MEASURE;
+ return ( (MeasureHandle) element ).isCalculated( ) ? IMG_DERIVED_MEASURE
+ : IMG_MEASURE;
}
else if ( element instanceof MeasureGroupHandle )
{
diff --git a/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/util/BuilderConstants.java b/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/util/BuilderConstants.java
index a54a493..8ad792f 100644
--- a/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/util/BuilderConstants.java
+++ b/UI/org.eclipse.birt.report.designer.ui.cubebuilder/src/org/eclipse/birt/report/designer/ui/cubebuilder/util/BuilderConstants.java
@@ -23,6 +23,7 @@ public class BuilderConstants
public static final String IMAGE_LINK_CUBE = "icons/obj16/cube_link.gif"; //$NON-NLS-1$
public static final String IMAGE_DIMENSION = "icons/obj16/dimension.gif"; //$NON-NLS-1$
public static final String IMAGE_MEASUREGROUP = "icons/obj16/measure_group.gif"; //$NON-NLS-1$
+ public static final String IMAGE_DERIVED_MEASURE = "icons/obj16/derived_measure.gif"; //$NON-NLS-1$
public static final String IMAGE_LEVEL = "icons/obj16/data_column.gif"; //$NON-NLS-1$
public static final String IMAGE_COLUMN_USED = "icons/obj16/data_column_used.gif"; //$NON-NLS-1$
public static final String IMAGE_DIMENSION_FOLDER = "icons/obj16/dimensions.gif"; //$NON-NLS-1$