diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/views/attributes/providers/ChoiceSetFactory.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/views/attributes/providers/ChoiceSetFactory.java index 08afb3271aa..eee3bb45805 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/views/attributes/providers/ChoiceSetFactory.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/views/attributes/providers/ChoiceSetFactory.java @@ -39,6 +39,7 @@ import org.eclipse.birt.report.model.api.metadata.IPropertyType; import org.eclipse.birt.report.model.api.metadata.IStructureDefn; import org.eclipse.birt.report.model.api.olap.CubeHandle; +import org.eclipse.birt.report.model.metadata.ChoiceSet; /** * ChoiceSetFactory provides common interface to access all kinds of collection @@ -196,11 +197,61 @@ public static IChoiceSet getDimensionChoiceSet( String elementName, */ public static IChoiceSet getStructChoiceSet( String structName, String property ) + { + return getStructChoiceSet( structName, property, false ); + } + + /** + * Gets the collection that given structure property value can selected from + * them. + * @param structName + * The name of the element. + * @param property + * DE Property key. + * @param removeNoSupportFilters + * indicate to shorter the choices excluding Top/Bottom N and others + * @return The ChoiceSet instance contains all the allowed values. + */ + public static IChoiceSet getStructChoiceSet( String structName, + String property , boolean removeNoSupportFilters ) { IPropertyDefn propertyDefn = DEUtil.getMetaDataDictionary( ) .getStructure( structName ) .findProperty( property ); - return propertyDefn.getAllowedChoices( ); + IChoiceSet cs = propertyDefn.getAllowedChoices( ); + if( removeNoSupportFilters ) + { + return removeNoSupportedChoices( cs ); + } + return cs; + } + + private static IChoiceSet removeNoSupportedChoices( IChoiceSet cs ) + { + if ( cs == null ) + { + return null; + } + ArrayList notSupportedList = new ArrayList( ); + notSupportedList.add( DesignChoiceConstants.FILTER_OPERATOR_TOP_N ); + notSupportedList.add( DesignChoiceConstants.FILTER_OPERATOR_BOTTOM_N ); + notSupportedList + .add( DesignChoiceConstants.FILTER_OPERATOR_TOP_PERCENT ); + notSupportedList + .add( DesignChoiceConstants.FILTER_OPERATOR_BOTTOM_PERCENT ); + IChoice[] choiceList = cs.getChoices( ); + ArrayList newChoiceList = new ArrayList( ); + for ( int i = 0; i < choiceList.length; i++ ) + { + if ( !notSupportedList.contains( choiceList[i].getName( ) ) ) + { + newChoiceList.add( choiceList[i] ); + } + } + ChoiceSet newcs = new ChoiceSet( cs.getName( ) ); + newcs.setChoices( + newChoiceList.toArray( new IChoice[newChoiceList.size( )] ) ); + return newcs; } /** diff --git a/xtab/org.eclipse.birt.report.item.crosstab.ui/src/org/eclipse/birt/report/item/crosstab/ui/views/dialogs/CrosstabFilterConditionBuilder.java b/xtab/org.eclipse.birt.report.item.crosstab.ui/src/org/eclipse/birt/report/item/crosstab/ui/views/dialogs/CrosstabFilterConditionBuilder.java index 10a9bcd4261..00efafc7093 100644 --- a/xtab/org.eclipse.birt.report.item.crosstab.ui/src/org/eclipse/birt/report/item/crosstab/ui/views/dialogs/CrosstabFilterConditionBuilder.java +++ b/xtab/org.eclipse.birt.report.item.crosstab.ui/src/org/eclipse/birt/report/item/crosstab/ui/views/dialogs/CrosstabFilterConditionBuilder.java @@ -190,7 +190,7 @@ public class CrosstabFilterConditionBuilder extends BaseTitleAreaDialog static { IChoiceSet chset = ChoiceSetFactory.getStructChoiceSet( FilterCondition.FILTER_COND_STRUCT, - FilterCondition.OPERATOR_MEMBER ); + FilterCondition.OPERATOR_MEMBER, true ); IChoice[] chs = chset.getChoices( new AlphabeticallyComparator( ) ); OPERATOR = new String[chs.length][2];