Package com.brsanthu.dataexporter.model

Examples of com.brsanthu.dataexporter.model.Column


        for (int j = 0; j < maxRowHeight; j++) {
            rowLines.add(new ArrayList<String>());
        }

        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);
            }

            List<String> cells = column.align(cellDetails, column.format(cellDetails));
            for (int j = 0; j < maxRowHeight; j++) {
                rowLines.get(j).add(cells.get(j));
            }

            if (callback != null) {
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);
           
View Full Code Here

            headerLines.add(new ArrayList<String>());
        }
       
        for (int i = 0; i < columns.size(); i++) {
           
            Column column = columns.get(i);
            AlignType align = getTextTableExportOptions().getHeaderAlignment();
            if (align == null) {
                align = column.getAlign();
            }

            List<String> cells = Column.align(column.getWidth(), maxHeaderHeight, align, column.getTitle());
            for (int j = 0; j < maxHeaderHeight; j++) {
                headerLines.get(j).add(cells.get(j));
            }
        }
       
View Full Code Here

        //be less number of cell values in the row. We need to fill those
        //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);
           
View Full Code Here

TOP

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

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.