Skip to content

Commit

Permalink
Setting the display property to 'none'
Browse files Browse the repository at this point in the history
BIRT-2403 CrosstabCellHandle returns empty contents after hiding the row
details in Crosstab
Setting the display property to 'none' instead of removing the cell
content

Reported-by: Sathya Thiruvengada
Signed-off-by: aswanib@opentext.com
  • Loading branch information
aswanib authored and aswanib committed Jan 24, 2017
1 parent df1805e commit bdde687
Showing 1 changed file with 22 additions and 20 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 )

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,15 @@ 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 )
{
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,34 +136,36 @@ 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
final int NO_PAGE_BREAK = 10000;
crosstab.getModelHandle( ).setProperty(
hideRow ? ICrosstabConstants.ROW_PAGE_BREAK_INTERVAL_PROP
: 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 )
throws BirtException
{
if ( cell != null )
{


// No outline
cell.getModelHandle( ).setProperty(
IStyleModel.BORDER_TOP_STYLE_PROP,
Expand All @@ -188,13 +190,13 @@ 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, "none");
}
}
}
Expand Down

0 comments on commit bdde687

Please sign in to comment.