private int calculateRowHeaderMaxWidth ( DJCrosstabColumn crosstabColumn ) { int auxWidth = 0 ; boolean firstTime = true ; List < DJCrosstabColumn > auxList = new ArrayList < DJCrosstabColumn > ( djcross . getColumns ( ) ) ; Collections . reverse ( auxList ) ; for ( DJCrosstabColumn col : auxList ) { if ( col . equals ( crosstabColumn ) ) { if ( auxWidth == 0 ) auxWidth = col . getWidth ( ) ; break ; } if ( firstTime ) { auxWidth += col . getWidth ( ) ; firstTime = false ; } if ( col . isShowTotals ( ) ) { auxWidth += col . getWidth ( ) ; } } return auxWidth ; }
The max possible width can be calculated doing the sum of of the inner cells and its totals