Package com.brsanthu.dataexporter.model

Examples of com.brsanthu.dataexporter.model.CellDetails


        }

        for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) {
            Column column = columns.get(columnIndex);
           
            CellDetails cellDetails = new CellDetails(rowDetails, columnIndex);
            cellDetails.setRowHeight(maxRowHeight);
            cellDetails.setCellValue(rowDetails.getRow().getCellValue(cellDetails));
            cellDetails.setCellAlign(cellDetails.getColumn().getAlign());
           
            if (callback != null) {
                callback.beforeCell(cellDetails);
            }
View Full Code Here


    public int getMaxRowHeight(RowDetails rowDetails) {
        int height = 1;
        TextAligner textAligner = new TextAligner();
        for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) {
            CellDetails cellDetails = new CellDetails(rowDetails, columnIndex);
            Column column = columns.get(columnIndex);
           
            Object cellValue = null;
            if (column.isGeneratesOwnData()) {
                cellValue = column.getCellValueGenerator().generateCellValue(cellDetails);
            } else {
                cellValue = rowDetails.getRow().getCellValue(cellDetails);
            }
            cellDetails.setCellValue(cellValue);
           
            //height = Math.max(height, column.getMaxRowHeight(cellDetails));
            height = Math.max(height, textAligner.getRowHeight(cellDetails.getColumn().getWidth(), String.valueOf(cellDetails.getCellValue()), cellDetails.getCellAlign()));
        }
       
        return height;
    }
View Full Code Here

        }
       
        beforeRow(rowDetails);
       
        for (int columnIndex = 0; columnIndex < rowDetails.getTable().getColumns().size(); columnIndex++) {
            CellDetails cellDetails = new CellDetails(rowDetails, columnIndex);
            cellDetails.setCellValue(rowDetails.getRow().getCellValue(cellDetails));
            cellDetails.setCellValue(rowDetails.getRow().getCellValue(cellDetails));
           
            if (callback != null) {
                callback.beforeCell(cellDetails);
            }
           
View Full Code Here

        //missing cell values with null before asking call back to generate
        //the data. This is to make sure column index reference is consistent.
        int skippedColumns = 0;
        for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) {
            Column column = columns.get(columnIndex);
            CellDetails cellDetails = new CellDetails(rowDetails, columnIndex - skippedColumns);
            cellDetails.setColumn(column);
           
            if (column.isGeneratesOwnData()) {
                cellValues.add(null);
                skippedColumns++;
            } else {
                Object cellValue = null;
               
                if (rowDetails.getRow() instanceof BeanRow) {
                    BeanRow beanRow = (BeanRow) rowDetails.getRow();
                    cellValue = beanRow.getCellValue(column.getName());
                } else {
                    //If there are less number of cells added to the row than there are columns,
                    //we would assume rest of the cells as nulls.
                    if (rowDetails.getRow().getCellValues().size() > cellDetails.getColumnIndex()) {
                        cellValue = rowDetails.getRow().getCellValue(cellDetails);
                    }
                }
               
                if (cellValue == null) {
                    cellValue = options.getNullString();
                }
                cellValues.add(cellValue);
            }
        }
       
        rowDetails.getRow().setCellValues(cellValues);
       
        //Go ahead and ask the call back to generate the data for such column.
        //After generating the data, go ahead and ask the callback to override if
        //applicable.
        for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) {
           
            CellDetails cellDetails = new CellDetails(rowDetails, columnIndex);
            Object cellValue = null;
            Column column = columns.get(columnIndex);
           
            if (column.isGeneratesOwnData()) {
                if (column.getCellValueGenerator() == null) {
                    throw new RuntimeException("Column " + column +  " configured as own data generator but callback is not configured.");
                }
                cellValue = column.getCellValueGenerator().generateCellValue(cellDetails);
            } else {
                cellValue = rowDetails.getRow().getCellValue(cellDetails);
            }
            cellDetails.setCellValue(cellValue);
           
            rowDetails.getRow().setCellValue(columnIndex, cellValue);
        }
    }
View Full Code Here

TOP

Related Classes of com.brsanthu.dataexporter.model.CellDetails

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.