Package org.jfree.layouting.renderer.model.table.cells

Examples of org.jfree.layouting.renderer.model.table.cells.TableCell


        {
          // ok, we can take the shortcut ..
          final int cellCount = rowInfoStructure.getCellCount();
          for (int i = 0; i < cellCount; i++)
          {
            final TableCell cellAt = rowInfoStructure.getCellAt(i);
            expectedRows = Math.max (expectedRows, cellAt.getRowSpan() - 1);
          }
        }
        else
        {
          // the slow-lane: Look at the already declared cells ..
View Full Code Here


    row.setPreferredSize(preferredHeight.resolve(rowComputedWidth.resolve(0)));

    final int cellCount = rowInfoStructure.getCellCount();
    for (int i = 0; i < cellCount; i++)
    {
      final TableCell cellAt = rowInfoStructure.getCellAt(i);
      if (cellAt instanceof DataCell == false)
      {
        continue;
      }
View Full Code Here

      final TableRowInfoStructure rowInfo = lastRow.getRowInfoStructure();
      for (int i = 0; i < rowInfo.getCellCount(); i++)
      {
        // seek row-spanning cells ..
        final TableCell cell = rowInfo.getCellAt(i);
        if (cell.getRowSpan() > 1)
        {
          // that's one, for instance ...
          if (autoGeneratedRow == null)
          {
            autoGeneratedRow =
                    new TableRowRenderBox(EmptyBoxDefinition.getInstance(), true);
            rowModel.addRow(new TableRow());

            autoRowInfo = autoGeneratedRow.getRowInfoStructure();
            for (int emptyCellCnt = 0; emptyCellCnt < i; emptyCellCnt += 1)
            {
              final TableCellRenderBox autoCell =
                      new TableCellRenderBox(EmptyBoxDefinition.getInstance(), true);
              autoCell.close();
              autoCell.setColumnIndex(emptyCellCnt);
              final DataCell dataCell = new DataCell
                  (1, 1, autoCell.getInstanceId());
              autoRowInfo.addCell(dataCell);
              autoGeneratedRow.addChild(autoCell);
            }
          }

          final PlaceHolderCell placeHolder;
          if (cell instanceof DataCell)
          {
            placeHolder = new PlaceHolderCell
                    ((DataCell) cell, cell.getRowSpan() - 1, cell.getColSpan());
          }
          else if (cell instanceof PlaceHolderCell)
          {
            final PlaceHolderCell prevCell = (PlaceHolderCell) cell;
            placeHolder = new PlaceHolderCell
                    (prevCell.getSourceCell(), cell.getRowSpan() - 1, cell.getColSpan());
          }
          else
          {
            throw new IllegalStateException("Unexpected cell type.");
          }
View Full Code Here

          // if there's a previous cell at the current position - check it
          // maybe we have a conflicting instruction here

          if (cellPosition < prevInfoStruct.getCellCount())
          {
            final TableCell prevCell = prevInfoStruct.getCellAt(cellPosition);
            if (prevCell.getRowSpan() > 1)
            {
              // thats a conflict. Oh, no!
              final ConflictingCell conflictingCell =
                      new ConflictingCell(dataCell, rowSpan, colSpan - i);
              if (prevCell instanceof ConflictingCell)
              {
                // Oh, there's already a conflict? Coooool...
                // (damn, users, fix your table definitions!)
                final ConflictingCell prevConflictCell = (ConflictingCell) prevCell;
                final int count = prevConflictCell.getConflictingCellCount();
                for (int x = 0; x < count; x++)
                {
                  final PlaceHolderCell phc = prevConflictCell.getConflictingCell(x);
                  if (phc.getRowSpan() > 1)
                  {
                    final PlaceHolderCell placeHolderCell =
                            new PlaceHolderCell(phc.getSourceCell(),
                                    phc.getRowSpan() - 1,
                                    phc.getColSpan());
                    conflictingCell.addConflictingCell(placeHolderCell);
                  }
                }
              }
              else if (prevCell instanceof PlaceHolderCell)
              {
                final PlaceHolderCell prevPHCell = (PlaceHolderCell) prevCell;
                // a new conflict ...
                final PlaceHolderCell placeHolderCell =
                        new PlaceHolderCell(prevPHCell.getSourceCell(),
                                prevCell.getRowSpan() - 1,
                                prevCell.getColSpan());
                conflictingCell.addConflictingCell(placeHolderCell);
              }
              else if (prevCell instanceof DataCell)
              {
                final PlaceHolderCell placeHolderCell =
                        new PlaceHolderCell((DataCell) prevCell,
                                prevCell.getRowSpan() - 1,
                                prevCell.getColSpan());
                conflictingCell.addConflictingCell(placeHolderCell);
              }
              else
              {
                throw new IllegalStateException("Unexpected cell type.");
View Full Code Here

    // lets search for a proper insertation point.
    // first, skip all row-spanning cellpositions.
    while (cellPosition < prevInfoStruct.getCellCount())
    {
      // look at the prev-cell definition
      final TableCell prevCell = prevInfoStruct.getCellAt(cellPosition);
      if (prevCell.getRowSpan() > 1)
      {
        final DataCell dataCell;
        if (prevCell instanceof DataCell)
        {
          dataCell = (DataCell) prevCell;
        }
        else if (prevCell instanceof PlaceHolderCell)
        {
          final PlaceHolderCell placeHolderCell = (PlaceHolderCell) prevCell;
          dataCell = placeHolderCell.getSourceCell();
        }
        else
        {
          throw new IllegalStateException("Unexpected cell type.");
        }
        // oh no, a spanned cell that conflicts with the current cell.
        // that means: Push the insertation point to the left ..
        // and add placeholders to the current row-info-struct ..
        final int colSpan = prevCell.getColSpan();
        // reduce the rowspan by one, as this is a new row ..
        final int rowSpan = prevCell.getRowSpan() - 1;
        for (int i = 0; i < colSpan; i++)
        {
          final PlaceHolderCell placeHolderCell =
                  new PlaceHolderCell
                          (dataCell, rowSpan, colSpan - i);
          infoStruct.addCell(placeHolderCell);
        }
        cellPosition += prevCell.getColSpan();
      }
      else
      {
        // found a sweet-spot ..
        break;
View Full Code Here

      final TableRowRenderBox row = (TableRowRenderBox) box;
      final TableRowInfoStructure rowInfoStructure = row.getRowInfoStructure();

      for (int i = 0; i < rowInfoStructure.getCellCount(); i++)
      {
        final TableCell cell = rowInfoStructure.getCellAt(i);
        logger.debug ("CELL: " + i + " = " + cell.getRowSpan() + ' ' + cell.getColSpan() + ' ' + cell);
      }
    }
    else if (box instanceof TableRenderBox)
    {
      final TableRenderBox table = (TableRenderBox) box;
View Full Code Here

      final TableRowRenderBox row = (TableRowRenderBox) box;
      final TableRowInfoStructure rowInfoStructure = row.getRowInfoStructure();

      for (int i = 0; i < rowInfoStructure.getCellCount(); i++)
      {
        final TableCell cell = rowInfoStructure.getCellAt(i);
        Log.debug ("CELL: " + i + " = " + cell.getRowSpan() + ' ' + cell.getColSpan() + ' ' + cell);
      }
    }
    else if (box instanceof TableRenderBox)
    {
      final TableRenderBox table = (TableRenderBox) box;
View Full Code Here

      final TableRowInfoStructure rowInfo = lastRow.getRowInfoStructure();
      for (int i = 0; i < rowInfo.getCellCount(); i++)
      {
        // seek row-spanning cells ..
        final TableCell cell = rowInfo.getCellAt(i);
        if (cell.getRowSpan() > 1)
        {
          // that's one, for instance ...
          if (autoGeneratedRow == null)
          {
            autoGeneratedRow =
                    new TableRowRenderBox(EmptyBoxDefinition.getInstance(), true);
            rowModel.addRow(new TableRow());

            autoRowInfo = autoGeneratedRow.getRowInfoStructure();
            for (int emptyCellCnt = 0; emptyCellCnt < i; emptyCellCnt += 1)
            {
              final TableCellRenderBox autoCell =
                      new TableCellRenderBox(EmptyBoxDefinition.getInstance(), true);
              autoCell.close();
              autoCell.setColumnIndex(emptyCellCnt);
              final DataCell dataCell = new DataCell
                  (1, 1, autoCell.getInstanceId());
              autoRowInfo.addCell(dataCell);
              autoGeneratedRow.addChild(autoCell);
            }
          }

          final PlaceHolderCell placeHolder;
          if (cell instanceof DataCell)
          {
            placeHolder = new PlaceHolderCell
                    ((DataCell) cell, cell.getRowSpan() - 1, cell.getColSpan());
          }
          else if (cell instanceof PlaceHolderCell)
          {
            final PlaceHolderCell prevCell = (PlaceHolderCell) cell;
            placeHolder = new PlaceHolderCell
                    (prevCell.getSourceCell(), cell.getRowSpan() - 1, cell.getColSpan());
          }
          else
          {
            throw new IllegalStateException("Unexpected cell type.");
          }
View Full Code Here

          // if there's a previous cell at the current position - check it
          // maybe we have a conflicting instruction here

          if (cellPosition < prevInfoStruct.getCellCount())
          {
            final TableCell prevCell = prevInfoStruct.getCellAt(cellPosition);
            if (prevCell.getRowSpan() > 1)
            {
              // thats a conflict. Oh, no!
              final ConflictingCell conflictingCell =
                      new ConflictingCell(dataCell, rowSpan, colSpan - i);
              if (prevCell instanceof ConflictingCell)
              {
                // Oh, there's already a conflict? Coooool...
                // (damn, users, fix your table definitions!)
                final ConflictingCell prevConflictCell = (ConflictingCell) prevCell;
                final int count = prevConflictCell.getConflictingCellCount();
                for (int x = 0; x < count; x++)
                {
                  final PlaceHolderCell phc = prevConflictCell.getConflictingCell(x);
                  if (phc.getRowSpan() > 1)
                  {
                    final PlaceHolderCell placeHolderCell =
                            new PlaceHolderCell(phc.getSourceCell(),
                                    phc.getRowSpan() - 1,
                                    phc.getColSpan());
                    conflictingCell.addConflictingCell(placeHolderCell);
                  }
                }
              }
              else if (prevCell instanceof PlaceHolderCell)
              {
                final PlaceHolderCell prevPHCell = (PlaceHolderCell) prevCell;
                // a new conflict ...
                final PlaceHolderCell placeHolderCell =
                        new PlaceHolderCell(prevPHCell.getSourceCell(),
                                prevCell.getRowSpan() - 1,
                                prevCell.getColSpan());
                conflictingCell.addConflictingCell(placeHolderCell);
              }
              else if (prevCell instanceof DataCell)
              {
                final PlaceHolderCell placeHolderCell =
                        new PlaceHolderCell((DataCell) prevCell,
                                prevCell.getRowSpan() - 1,
                                prevCell.getColSpan());
                conflictingCell.addConflictingCell(placeHolderCell);
              }
              else
              {
                throw new IllegalStateException("Unexpected cell type.");
View Full Code Here

    // lets search for a proper insertation point.
    // first, skip all row-spanning cellpositions.
    while (cellPosition < prevInfoStruct.getCellCount())
    {
      // look at the prev-cell definition
      final TableCell prevCell = prevInfoStruct.getCellAt(cellPosition);
      if (prevCell.getRowSpan() > 1)
      {
        final DataCell dataCell;
        if (prevCell instanceof DataCell)
        {
          dataCell = (DataCell) prevCell;
        }
        else if (prevCell instanceof PlaceHolderCell)
        {
          final PlaceHolderCell placeHolderCell = (PlaceHolderCell) prevCell;
          dataCell = placeHolderCell.getSourceCell();
        }
        else
        {
          throw new IllegalStateException("Unexpected cell type.");
        }
        // oh no, a spanned cell that conflicts with the current cell.
        // that means: Push the insertation point to the left ..
        // and add placeholders to the current row-info-struct ..
        final int colSpan = prevCell.getColSpan();
        // reduce the rowspan by one, as this is a new row ..
        final int rowSpan = prevCell.getRowSpan() - 1;
        for (int i = 0; i < colSpan; i++)
        {
          final PlaceHolderCell placeHolderCell =
                  new PlaceHolderCell
                          (dataCell, rowSpan, colSpan - i);
          infoStruct.addCell(placeHolderCell);
        }
        cellPosition += prevCell.getColSpan();
      }
      else
      {
        // found a sweet-spot ..
        break;
View Full Code Here

TOP

Related Classes of org.jfree.layouting.renderer.model.table.cells.TableCell

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.