Skip to content

Commit

Permalink
Merge pull request #364 from baswani/master
Browse files Browse the repository at this point in the history
CrosstabCellHandle returns empty contents after hiding the row details in Crosstab
  • Loading branch information
Yulin Wang committed Jan 30, 2017
2 parents 7ff4890 + d9cf6b0 commit 7960382
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,10 @@ private void hideDetail( CrosstabReportItemHandle crosstab,
for ( MeasureViewHandle mv : crosstab.getAllMeasures( ) )
{
AggregationCellHandle cell = mv.getCell( );
cell.getModelHandle( ).setProperty( hideRow
? IStyleModel.HEIGHT_PROP : IStyleModel.WIDTH_PROP,
ZERO );

// If hiding row, have to remove all items in the measure cell and
// grand total cell
if ( hideRow )
{
// Remove all items in the measure cell and grand total cell
clearCellContents( cell );
clearCellContents( mv.getAggregationCell(
cell.getDimensionName(
Expand All @@ -119,11 +115,16 @@ private void hideDetail( CrosstabReportItemHandle crosstab,
null,
null ) );
}
else
{
cell.getModelHandle( ).setProperty( IStyleModel.WIDTH_PROP,
ZERO );
}
}

// If hiding row, have to remove all items in the dimension cell
if ( hideRow )
{
// Remove all items in the dimension cell
int dimCount = crosstab
.getDimensionCount( ICrosstabConstants.ROW_AXIS_TYPE );
for ( int i = 0; i < dimCount; i++ )
Expand All @@ -136,6 +137,11 @@ private void hideDetail( CrosstabReportItemHandle crosstab,
clearCellContents( level.getCell( ) );
}
}

// Hide measure header to avoid meaningless header
handle.setProperty(
ICrosstabReportItemConstants.HIDE_MEASURE_HEADER_PROP,
true );
}

// Set big pageBreakInterval to avoid page break
Expand All @@ -145,18 +151,11 @@ private void hideDetail( CrosstabReportItemHandle crosstab,
: ICrosstabConstants.COLUMN_PAGE_BREAK_INTERVAL_PROP,
NO_PAGE_BREAK );

// If hiding row, hide measure header to avoid meaningless header
if ( hideRow )
{
handle.setProperty(
ICrosstabReportItemConstants.HIDE_MEASURE_HEADER_PROP,
true );
}

// Fixed Layout to avoid white space
( (ReportDesignHandle) crosstab.getModuleHandle( ) )
.setLayoutPreference(
DesignChoiceConstants.REPORT_LAYOUT_PREFERENCE_FIXED_LAYOUT );

}

private void clearCellContents( CrosstabCellHandle cell )
Expand Down Expand Up @@ -188,13 +187,14 @@ private void clearCellContents( CrosstabCellHandle cell )
ZERO );
cell.getModelHandle( ).setProperty( IStyleModel.PADDING_RIGHT_PROP,
ZERO );

// No contents
for ( Object child : cell.getContents( ) )
{
if ( child instanceof DesignElementHandle )
{
( (DesignElementHandle) child ).dropAndClear( );
DesignElementHandle designElement = (DesignElementHandle) child;
designElement.setProperty( IStyleModel.DISPLAY_PROP,
DesignChoiceConstants.DISPLAY_NONE );
}
}
}
Expand Down

0 comments on commit 7960382

Please sign in to comment.