Package org.displaytag.model

Examples of org.displaytag.model.RowIterator


     * @throws BadElementException errors while generating content
     */
    protected void generateRows() throws JspException, BadElementException
    {
        // get the correct iterator (full or partial list according to the exportFull field)
        RowIterator rowIterator = this.model.getRowIterator(this.exportFull);
        // iterator on rows
        while (rowIterator.hasNext())
        {
            Row row = rowIterator.next();

            // iterator on columns
            ColumnIterator columnIterator = row.getColumnIterator(this.model.getHeaderCellList());

            while (columnIterator.hasNext())
View Full Code Here


        {
            write(out, doHeaders());
        }

        // get the correct iterator (full or partial list according to the exportFull field)
        RowIterator rowIterator = this.model.getRowIterator(this.exportFull);

        // iterator on rows
        while (rowIterator.hasNext())
        {
            Row row = rowIterator.next();

            if (this.model.getTableDecorator() != null)
            {

                String stringStartRow = this.model.getTableDecorator().startRow();
                write(out, stringStartRow);
            }

            // iterator on columns
            ColumnIterator columnIterator = row.getColumnIterator(this.model.getHeaderCellList());

            write(out, ROW_START);

            while (columnIterator.hasNext())
            {
                Column column = columnIterator.nextColumn();

                // Get the value to be displayed for the column
                String value = escapeColumnValue(column.getValue(this.decorated));

                write(out, CELL_START);

                write(out, value);

                if (ALWAYS_APPEND_CELL_END || columnIterator.hasNext())
                {
                    write(out, CELL_END);
                }

            }
            if (ALWAYS_APPEND_ROW_END || rowIterator.hasNext())
            {
                write(out, ROW_END);
            }
        }
View Full Code Here

     * @throws JspException for errors during value retrieving from the table model
     */
    protected void generateRows() throws JspException
    {
        // get the correct iterator (full or partial list according to the exportFull field)
        RowIterator rowIterator = this.model.getRowIterator(this.exportFull);
        // iterator on rows
        while (rowIterator.hasNext())
        {
            Row row = rowIterator.next();

            // iterator on columns
            ColumnIterator columnIterator = row.getColumnIterator(this.model.getHeaderCellList());

            while (columnIterator.hasNext())
View Full Code Here

                    cell.setCellStyle(createHeaderStyle(getWb(), headerCell));
                }
            }

            // get the correct iterator (full or partial list according to the exportFull field)
            RowIterator rowIterator = this.model.getRowIterator(this.exportFull);

            // iterator on rows
            while (rowIterator.hasNext())
            {
                Row row = rowIterator.next();
                HSSFRow xlsRow = getSheet().createRow(rowNum++);
                colNum = 0;

                // iterator on columns
                ColumnIterator columnIterator = row.getColumnIterator(this.model.getHeaderCellList());
View Full Code Here

        boolean fullList = false;
        if (!MediaTypeEnum.HTML.equals(model.getMedia()) && model.getProperties().getExportFullList())
        {
            fullList = true;
        }
        RowIterator rowIterator = model.getRowIterator(fullList);
        TableTotaler totalsTableDecorator = model.getTotaler();
        if (totalsTableDecorator == null)
        {
            totalsTableDecorator = TableTotaler.NULL;
        }

        // iterator on rows
        TableDecorator tableDecorator = model.getTableDecorator();
        Row previousRow = null;
        Row currentRow = null;
        Row nextRow = null;
        Map<Integer, CellStruct> previousRowValues = new HashMap<Integer, CellStruct>(10);
        Map<Integer, CellStruct> currentRowValues = new HashMap<Integer, CellStruct>(10);
        Map<Integer, CellStruct> nextRowValues = new HashMap<Integer, CellStruct>(10);

        while (nextRow != null || rowIterator.hasNext())
        {
            // The first pass
            if (currentRow == null)
            {
                currentRow = rowIterator.next();
            }
            else
            {
                previousRow = currentRow;
                currentRow = nextRow;
            }

            if (previousRow != null)
            {
                previousRowValues.putAll(currentRowValues);
            }
            if (!nextRowValues.isEmpty())
            {
                currentRowValues.putAll(nextRowValues);
            }
            // handle the first pass
            else
            {
                ColumnIterator columnIterator = currentRow.getColumnIterator(model.getHeaderCellList());
                // iterator on columns
                if (log.isDebugEnabled())
                {
                    log.debug(" creating ColumnIterator on " + model.getHeaderCellList());
                }
                while (columnIterator.hasNext())
                {
                    Column column = columnIterator.nextColumn();

                    // Get the value to be displayed for the column
                    column.initialize();

                    @SuppressWarnings("deprecation")
                    String cellvalue = MediaTypeEnum.HTML.equals(model.getMedia())
                        ? column.getChoppedAndLinkedValue()
                        : ObjectUtils.toString(column.getValue(true));

                    CellStruct struct = new CellStruct(column, cellvalue);
                    currentRowValues.put(new Integer(column.getHeaderCell().getColumnNumber()), struct);
                }
            }

            nextRowValues.clear();
            // Populate the next row values
            nextRow = rowIterator.hasNext() ? rowIterator.next() : null;
            if (nextRow != null)
            {
                ColumnIterator columnIterator = nextRow.getColumnIterator(model.getHeaderCellList());
                // iterator on columns
                if (log.isDebugEnabled())
                {
                    log.debug(" creating ColumnIterator on " + model.getHeaderCellList());
                }
                while (columnIterator.hasNext())
                {
                    Column column = columnIterator.nextColumn();
                    column.initialize();
                    // Get the value to be displayed for the column

                    @SuppressWarnings("deprecation")
                    String cellvalue = MediaTypeEnum.HTML.equals(model.getMedia())
                        ? column.getChoppedAndLinkedValue()
                        : ObjectUtils.toString(column.getValue(true));

                    CellStruct struct = new CellStruct(column, cellvalue);
                    nextRowValues.put(new Integer(column.getHeaderCell().getColumnNumber()), struct);
                }
            }
            // now we are going to create the current row; reset the decorator to the current row
            if (tableDecorator != null)
            {
                tableDecorator.initRow(currentRow.getObject(), currentRow.getRowNumber(), currentRow.getRowNumber()
                    + rowIterator.getPageOffset());
            }
            if (totalsTableDecorator != null)
            {
                totalsTableDecorator.initRow(
                    currentRow.getRowNumber(),
                    currentRow.getRowNumber() + rowIterator.getPageOffset());
            }

            ArrayList<CellStruct> structsForRow = new ArrayList<CellStruct>(model.getHeaderCellList().size());
            lowestEndedGroup = NO_RESET_GROUP;
            lowestStartedGroup = NO_RESET_GROUP;
View Full Code Here

        MultilevelTotalTableDecorator decorator = new MultilevelTotalTableDecorator();
        decorator.init(null, rawData, model);
        model.setTableDecorator(decorator);

        RowIterator iterator = model.getRowIterator(false);
        while (iterator.hasNext())
        {
            iterator.next();
        }

        assertEquals(decorator.isLastRow(), true);
    }
View Full Code Here

        MultilevelTotalTableDecorator decorator = new MultilevelTotalTableDecorator();
        decorator.init(null, rawData, model);
        model.setTableDecorator(decorator);

        RowIterator iterator = model.getRowIterator(false);
        while (iterator.hasNext())
        {
            iterator.next();
        }

        assertEquals(decorator.isLastRow(), true);
    }
View Full Code Here

        MultilevelTotalTableDecorator decorator = new MultilevelTotalTableDecorator();
        decorator.init(null, rawData, model);
        model.setTableDecorator(decorator);

        RowIterator iterator = model.getRowIterator(false);
        while (iterator.hasNext())
        {
            iterator.next();
        }

        assertEquals(decorator.isLastRow(), true);
    }
View Full Code Here

        {
            write(out, doHeaders());
        }

        // get the correct iterator (full or partial list according to the exportFull field)
        RowIterator rowIterator = this.model.getRowIterator(this.exportFull);

        // iterator on rows
        while (rowIterator.hasNext())
        {
            Row row = rowIterator.next();

            if (this.model.getTableDecorator() != null)
            {

                String stringStartRow = this.model.getTableDecorator().startRow();
                write(out, stringStartRow);
            }

            // iterator on columns
            ColumnIterator columnIterator = row.getColumnIterator(this.model.getHeaderCellList());

            write(out, ROW_START);

            while (columnIterator.hasNext())
            {
                Column column = columnIterator.nextColumn();

                // Get the value to be displayed for the column
                String value = escapeColumnValue(column.getValue(this.decorated));

                write(out, CELL_START);

                write(out, value);

                if (ALWAYS_APPEND_CELL_END || columnIterator.hasNext())
                {
                    write(out, CELL_END);
                }

            }
            if (ALWAYS_APPEND_ROW_END || rowIterator.hasNext())
            {
                write(out, ROW_END);
            }
        }
View Full Code Here

     * @throws Exception if an error is encountered while writing the table body.
     */
    private void writeTableBody(TableModel model) throws Exception
    {
        // Ok, start bouncing through our list (only the visible part)
        RowIterator rowIterator = model.getRowIterator(false);

        // iterator on rows
        TableDecorator tableDecorator = model.getTableDecorator();
        Row previousRow = null;
        Row currentRow = null;
        Row nextRow = null;
        Map previousRowValues = new HashMap(10);
        Map currentRowValues = new HashMap(10);
        Map nextRowValues = new HashMap(10);

        while (nextRow != null || rowIterator.hasNext())
        {
            // The first pass
            if (currentRow == null)
            {
                currentRow = rowIterator.next();
            }
            else
            {
                previousRow = currentRow;
                currentRow = nextRow;
            }

            if (previousRow != null)
            {
                previousRowValues.putAll(currentRowValues);
            }
            if (!nextRowValues.isEmpty())
            {
                currentRowValues.putAll(nextRowValues);
            }
            // handle the first pass
            else
            {
                ColumnIterator columnIterator = currentRow.getColumnIterator(model.getHeaderCellList());
                // iterator on columns
                if (log.isDebugEnabled())
                {
                    log.debug(" creating ColumnIterator on " + model.getHeaderCellList());
                }
                while (columnIterator.hasNext())
                {
                    Column column = columnIterator.nextColumn();

                    // Get the value to be displayed for the column
                    column.initialize();
                    CellStruct struct = new CellStruct(column, column.getChoppedAndLinkedValue());
                    currentRowValues.put(new Integer(column.getHeaderCell().getColumnNumber()), struct);
                }
            }

            nextRowValues.clear();
            // Populate the next row values
            nextRow = rowIterator.hasNext() ? rowIterator.next() : null;
            if (nextRow != null)
            {
                ColumnIterator columnIterator = nextRow.getColumnIterator(model.getHeaderCellList());
                // iterator on columns
                if (log.isDebugEnabled())
                {
                    log.debug(" creating ColumnIterator on " + model.getHeaderCellList());
                }
                while (columnIterator.hasNext())
                {
                    Column column = columnIterator.nextColumn();
                    column.initialize();
                    // Get the value to be displayed for the column
                    CellStruct struct = new CellStruct(column, column.getChoppedAndLinkedValue());
                    nextRowValues.put(new Integer(column.getHeaderCell().getColumnNumber()), struct);
                }
            }
            // now we are going to create the current row; reset the decorator to the current row
            if (tableDecorator != null)
            {
                tableDecorator.initRow(currentRow.getObject(), currentRow.getRowNumber(), currentRow.getRowNumber()
                    + rowIterator.getPageOffset());
            }

            if (tableDecorator != null)
            {
                writeDecoratedRowStart(model);
View Full Code Here

TOP

Related Classes of org.displaytag.model.RowIterator

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.