Skip to content

Commit

Permalink
Add constants to property value of "hideDetail". Throw exception if the
Browse files Browse the repository at this point in the history
value is not expected.
  • Loading branch information
Yulin Wang committed Jul 11, 2016
1 parent abaa8d6 commit 04a31fb
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,28 @@ public interface ICrosstabConstants
String COLUMN_PAGE_BREAK_INTERVAL_PROP = "columnPageBreakInterval"; //$NON-NLS-1$

/**
* Name of the hide detail property. Value can be either row or column.
* Name of the hide detail property. Value can be either
* {@link #HIDE_DETAIL_ROW} or #{@link HIDE_DETAIL_COLUMN}.
*
* @since 4.6
*/
String HIDE_DETAIL_PROP = "hideDetail";//$NON-NLS-1$

/**
* The value of hide detail property. It means all cells of row dimensions,
* measures and grand total in row direction will be hidden.
*
* @since 4.6
*/
String HIDE_DETAIL_ROW = "row";//$NON-NLS-1$

/**
* The value of hide detail property. It means all cells of column
* dimensions, measures and grand total in column direction will be hidden.
*
* @since 4.6
*/
String HIDE_DETAIL_COLUMN = "column";//$NON-NLS-1$

/**
* Aggregation location constants.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ CrosstabReportItemTask.msg.pivot.crosstab=Pivot Crosstab

CrosstabReportItemHandle.Error.HasNoCube=The Cross Tab must be able to access one cube.
CrosstabReportItemHandle.log.validate=validating(...)
CrosstabReportItemPreparation.Exception.HideDetailPropertyValueIsWrong=The value of property "{0}" should be either "{1}" or "{2}".

CrosstabScriptHandler.error.javascript={0} at line {1} of JavaScript:\r\n{2}\r\n
CrosstabScriptHandler.info.try.register.crosstab.javascript.content=Try registering crosstab javascript content...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.report.engine.extension.ReportItemPreparationBase;
import org.eclipse.birt.report.item.crosstab.core.CrosstabException;
import org.eclipse.birt.report.item.crosstab.core.ICrosstabConstants;
import org.eclipse.birt.report.item.crosstab.core.ICrosstabReportItemConstants;
import org.eclipse.birt.report.item.crosstab.core.de.AggregationCellHandle;
Expand All @@ -21,6 +22,7 @@
import org.eclipse.birt.report.item.crosstab.core.de.DimensionViewHandle;
import org.eclipse.birt.report.item.crosstab.core.de.LevelViewHandle;
import org.eclipse.birt.report.item.crosstab.core.de.MeasureViewHandle;
import org.eclipse.birt.report.item.crosstab.core.i18n.Messages;
import org.eclipse.birt.report.item.crosstab.core.script.internal.handler.CrosstabPreparationHandler;
import org.eclipse.birt.report.model.api.DesignElementHandle;
import org.eclipse.birt.report.model.api.ExtendedItemHandle;
Expand Down Expand Up @@ -56,8 +58,26 @@ public void prepare( ) throws BirtException
.getProperty( ICrosstabConstants.HIDE_DETAIL_PROP );
if ( hideDetail != null )
{
hideDetail( crosstab,
hideDetail.toString( ).toLowerCase( ).equals( "row" ) ); //$NON-NLS-1$
if ( hideDetail.toString( ).toLowerCase( ).equals(
ICrosstabConstants.HIDE_DETAIL_ROW ) )
{
hideDetail( crosstab, true );
}
else if ( hideDetail.toString( ).toLowerCase( ).equals(
ICrosstabConstants.HIDE_DETAIL_COLUMN ) )
{
hideDetail( crosstab, false );
}
else
{
throw new CrosstabException( Messages.getString(
"CrosstabReportItemPreparation.Exception.HideDetailPropertyValueIsWrong", //$NON-NLS-1$
new String[]{
ICrosstabConstants.HIDE_DETAIL_PROP,
ICrosstabConstants.HIDE_DETAIL_ROW,
ICrosstabConstants.HIDE_DETAIL_COLUMN
} ) );
}
}

ExtendedItemHandle modelHandle = (ExtendedItemHandle) crosstab
Expand Down

0 comments on commit 04a31fb

Please sign in to comment.