Examples of TableDecorator


Examples of autotest.common.table.TableDecorator

            }
           
            public void onTableRefreshed() {}
        });

        tableDecorator = new TableDecorator(recurringTable);
        tableDecorator.addPaginators();
        selectionManager = tableDecorator.addSelectionManager(false);
        recurringTable.setWidgetFactory(selectionManager);
        tableDecorator.addTableActionsPanel(this, true);
        addWidget(tableDecorator, "recurring_table");
View Full Code Here

Examples of autotest.common.table.TableDecorator

        table.sinkRightClickEvents();
        table.addListener(this);
        table.setWidgetFactory(this);
        restoreTableSorting();

        tableDecorator = new TableDecorator(table);
        tableDecorator.addPaginators();
        selectionManager = tableDecorator.addSelectionManager(false);
        tableDecorator.addTableActionsWithExportCsvListener(this);
        tablePanel.clear();
        tablePanel.add(tableDecorator);
View Full Code Here

Examples of autotest.common.table.TableDecorator

            }
           
            public void onTableRefreshed() {}
        });
       
        tableDecorator = new TableDecorator(jobTable);
        tableDecorator.addPaginators();
        selectionManager = tableDecorator.addSelectionManager(false);
        jobTable.setWidgetFactory(selectionManager);
        tableDecorator.addTableActionsPanel(this, true);
        addWidget(tableDecorator, "job_table");
View Full Code Here

Examples of org.displaytag.decorator.TableDecorator

     * Decorators that help render the table to an iText document must implement ItextDecorator.
     * @see org.displaytag.render.TableWriterTemplate#writeDecoratedRowStart(org.displaytag.model.TableModel)
     */
    protected void writeDecoratedRowStart(TableModel model)
    {
        TableDecorator decorator =  model.getTableDecorator();
        if (decorator instanceof ItextDecorator)
        {
          ItextDecorator idecorator = (ItextDecorator) decorator;
            idecorator.setTable(this.table);
            idecorator.setFont(this.defaultFont);
        }
        decorator.startRow();
    }
View Full Code Here

Examples of org.displaytag.decorator.TableDecorator

        {
            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;

            for (HeaderCell header : model.getHeaderCellList())
            {

                // Get the value to be displayed for the column
                CellStruct struct = currentRowValues.get(new Integer(header.getColumnNumber()));
                struct.decoratedValue = struct.bodyValue;
                // Check and see if there is a grouping transition. If there is, then notify the decorator
                if (header.getGroup() != -1)
                {
                    CellStruct prior = previousRowValues.get(new Integer(header.getColumnNumber()));
                    CellStruct next = nextRowValues.get(new Integer(header.getColumnNumber()));
                    // Why npe?
                    String priorBodyValue = prior != null ? prior.bodyValue : null;
                    String nextBodyValue = next != null ? next.bodyValue : null;
                    short groupingValue = groupColumns(
                        struct.bodyValue,
                        priorBodyValue,
                        nextBodyValue,
                        header.getGroup());

                    if (tableDecorator != null || totalsTableDecorator != null)
                    {
                        switch (groupingValue)
                        {
                            case GROUP_START :
                                totalsTableDecorator.startGroup(struct.bodyValue, header.getGroup());
                                if (tableDecorator != null)
                                {
                                    tableDecorator.startOfGroup(struct.bodyValue, header.getGroup());
                                }
                                break;
                            case GROUP_END :
                                totalsTableDecorator.stopGroup(struct.bodyValue, header.getGroup());
                                if (tableDecorator != null)
                                {
                                    tableDecorator.endOfGroup(struct.bodyValue, header.getGroup());
                                }
                                break;
                            case GROUP_START_AND_END :
                                totalsTableDecorator.startGroup(struct.bodyValue, header.getGroup());
                                if (tableDecorator != null)
                                {
                                    tableDecorator.startOfGroup(struct.bodyValue, header.getGroup());
                                }
                                totalsTableDecorator.stopGroup(struct.bodyValue, header.getGroup());
                                if (tableDecorator != null)
                                {
                                    tableDecorator.endOfGroup(struct.bodyValue, header.getGroup());
                                }

                                break;
                            default :
                                break;
                        }
                    }
                    if (tableDecorator != null)
                    {
                        struct.decoratedValue = tableDecorator.displayGroupedValue(
                            struct.bodyValue,
                            groupingValue,
                            header.getColumnNumber());
                    }
                    else if (groupingValue == GROUP_END || groupingValue == GROUP_NO_CHANGE)
View Full Code Here

Examples of org.displaytag.decorator.TableDecorator

        if (this.tableModel.isEmpty())
        {
            describeEmptyTable();
        }

        TableDecorator tableDecorator = this.properties.getDecoratorFactoryInstance().loadTableDecorator(
            this.pageContext,
            getConfiguredDecoratorName());

        setupViewableData();

        if (tableDecorator != null)
        {
            tableDecorator.init(this.pageContext, this.list, this.tableModel);
            this.tableModel.setTableDecorator(tableDecorator);
        }

        TableTotaler totaler = this.properties.getDecoratorFactoryInstance().loadTableTotaler(
            pageContext,
View Full Code Here

Examples of org.displaytag.decorator.TableDecorator

     * @see org.displaytag.render.TableWriterTemplate#writeDecoratedRowStart(org.displaytag.model.TableModel)
     */
    @Override
    protected void writeDecoratedRowStart(TableModel model)
    {
        TableDecorator decorator = model.getTableDecorator();
        if (decorator instanceof ItextDecorator)
        {
            ItextDecorator idecorator = (ItextDecorator) decorator;
            idecorator.setTable(this.table);
            idecorator.setFont(this.defaultFont);
        }
        decorator.startRow();
    }
View Full Code Here

Examples of org.displaytag.decorator.TableDecorator

     * @see org.displaytag.render.TableWriterTemplate#writeDecoratedRowFinish(org.displaytag.model.TableModel)
     */
    @Override
    protected void writeDecoratedRowFinish(TableModel model) throws Exception
    {
        TableDecorator decorator = model.getTableDecorator();
        if (decorator instanceof DecoratesHssf)
        {
            DecoratesHssf hdecorator = (DecoratesHssf) decorator;
            hdecorator.setSheet(this.sheet);
        }
        decorator.finishRow();
        this.sheetRowNum = this.sheet.getLastRowNum();
        this.sheetRowNum++;
    }
View Full Code Here

Examples of org.displaytag.decorator.TableDecorator

    {
        // 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);
            }
            // open row
            writeRowOpener(currentRow);

            Iterator headerCellsIter = model.getHeaderCellList().iterator();
            boolean hasReachedGroupEnd = false;
            ArrayList structsForRow = new ArrayList(model.getHeaderCellList().size());
            while (headerCellsIter.hasNext())
            {
                HeaderCell header = (HeaderCell) headerCellsIter.next();

                // Get the value to be displayed for the column
                CellStruct struct = (CellStruct) currentRowValues.get(new Integer(header.getColumnNumber()));
                struct.decoratedValue = struct.bodyValue;
                // Check and see if there is a grouping transition. If there is, then notify the decorator
                if (header.getGroup() != -1)
                {
                    CellStruct prior = (CellStruct) previousRowValues.get(new Integer(header.getColumnNumber()));
                    CellStruct next = (CellStruct) nextRowValues.get(new Integer(header.getColumnNumber()));
                    // Why npe?
                    String priorBodyValue = prior != null ? prior.bodyValue : null;
                    String nextBodyValue = next != null ? next.bodyValue : null;
                    short groupingValue = groupColumns(struct.bodyValue, priorBodyValue, nextBodyValue);
                    hasReachedGroupEnd = hasReachedGroupEnd
                        || groupingValue == GROUP_END
                        || groupingValue == GROUP_NO_CHANGE;

                    if (tableDecorator != null)
                    {
                        switch (groupingValue)
                        {
                            case GROUP_START :
                                tableDecorator.startOfGroup(struct.bodyValue, header.getGroup());
                                break;
                            case GROUP_END :
                                tableDecorator.endOfGroup(struct.bodyValue, header.getGroup());
                                break;
                            case GROUP_START_AND_END :
                                tableDecorator.startOfGroup(struct.bodyValue, header.getGroup());
                                tableDecorator.endOfGroup(struct.bodyValue, header.getGroup());
                                break;
                            default :
                                break;
                        }
                    }
                    if (tableDecorator != null)
                    {
                        struct.decoratedValue = tableDecorator.displayGroupedValue(struct.bodyValue, groupingValue);
                    }
                    else if (groupingValue == GROUP_END || groupingValue == GROUP_NO_CHANGE)
                    {
                        struct.decoratedValue = TagConstants.EMPTY_STRING;
                    }
View Full Code Here

Examples of org.displaytag.decorator.TableDecorator

        }
        else if (!MediaTypeEnum.HTML.equals(this.currentMediaType))
        {
            tableDecoratorName = this.properties.getExportDecoratorName(this.currentMediaType);
        }
        TableDecorator tableDecorator = this.properties.getDecoratorFactoryInstance().loadTableDecorator(
            this.pageContext,
            tableDecoratorName);

        if (tableDecorator != null)
        {
            tableDecorator.init(this.pageContext, this.list, this.tableModel);
            this.tableModel.setTableDecorator(tableDecorator);
        }

        setupViewableData();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.