protected void setColumnsFinalWidth() {
        log.debug("Setting columns final width.");
        float factor;
        int printableArea = report.getOptions().getColumnWidth();

        //Create a list with only the visible columns.
        List visibleColums = getVisibleColumns();


        if (report.getOptions().isUseFullPageWidth()) {
            int columnsWidth = 0;
            int notRezisableWidth = 0;

            //Store in a variable the total with of all visible columns
            for (Object visibleColum : visibleColums) {
                AbstractColumn col = (AbstractColumn) visibleColum;
                columnsWidth += col.getWidth();
                if (col.isFixedWidth())
                    notRezisableWidth += col.getWidth();
            }


            factor = (float) (printableArea - notRezisableWidth) / (float) (columnsWidth - notRezisableWidth);

            log.debug("printableArea = " + printableArea
                    + ", columnsWidth = " + columnsWidth
                    + ", columnsWidth = " + columnsWidth
                    + ", notRezisableWidth = " + notRezisableWidth
                    + ", factor = " + factor);

            int acumulated = 0;
            int colFinalWidth;

            //Select the non-resizable columns
            Collection resizableColumns = CollectionUtils.select(visibleColums, new Predicate() {
                public boolean evaluate(Object arg0) {
                    return !((AbstractColumn) arg0).isFixedWidth();
                }

            });

            //Finally, set the new width to the resizable columns
            for (Iterator iter = resizableColumns.iterator(); iter.hasNext(); ) {
                AbstractColumn col = (AbstractColumn) iter.next();

                if (!iter.hasNext()) {
                    col.setWidth(printableArea - notRezisableWidth - acumulated);
                } else {
                    colFinalWidth = (new Float(col.getWidth() * factor)).intValue();
                    acumulated += colFinalWidth;
                    col.setWidth(colFinalWidth);
                }
            }
        }

        // If the columns width changed, the X position must be setted again.
        int posx = 0;
        for (Object visibleColum : visibleColums) {
            AbstractColumn col = (AbstractColumn) visibleColum;
            col.setPosX(posx);
            posx += col.getWidth();
        }
    }
protected void setColumnsFinalWidth ( ) { log . debug ( "Setting columns final width." ) ; float factor ; int printableArea = report . getOptions ( ) . getColumnWidth ( ) ; List visibleColums = getVisibleColumns ( ) ; if ( report . getOptions ( ) . isUseFullPageWidth ( ) ) { int columnsWidth = 0 ; int notRezisableWidth = 0 ; for ( Object visibleColum : visibleColums ) { AbstractColumn col = ( AbstractColumn ) visibleColum ; columnsWidth += col . getWidth ( ) ; if ( col . isFixedWidth ( ) ) notRezisableWidth += col . getWidth ( ) ; } factor = ( float ) ( printableArea - notRezisableWidth ) / ( float ) ( columnsWidth - notRezisableWidth ) ; log . debug ( "printableArea = " + printableArea + ", columnsWidth = " + columnsWidth + ", columnsWidth = " + columnsWidth + ", notRezisableWidth = " + notRezisableWidth + ", factor = " + factor ) ; int acumulated = 0 ; int colFinalWidth ; Collection resizableColumns = CollectionUtils . select ( visibleColums , new Predicate ( ) { public boolean evaluate ( Object arg0 ) { return ! ( ( AbstractColumn ) arg0 ) . isFixedWidth ( ) ; } } ) ; for ( Iterator iter = resizableColumns . iterator ( ) ; iter . hasNext ( ) ; ) { AbstractColumn col = ( AbstractColumn ) iter . next ( ) ; if ( ! iter . hasNext ( ) ) { col . setWidth ( printableArea - notRezisableWidth - acumulated ) ; } else { colFinalWidth = ( new Float ( col . getWidth ( ) * factor ) ) . intValue ( ) ; acumulated += colFinalWidth ; col . setWidth ( colFinalWidth ) ; } } } int posx = 0 ; for ( Object visibleColum : visibleColums ) { AbstractColumn col = ( AbstractColumn ) visibleColum ; col . setPosX ( posx ) ; posx += col . getWidth ( ) ; } }
Sets the columns width by reading some report options like the
printableArea and useFullPageWidth.
columns with fixedWidth property set in TRUE will not be modified