Package org.jfree.layouting.renderer.model

Examples of org.jfree.layouting.renderer.model.RenderNode


      processor.initialize(sequence, lineStart, lineEnd, pageGrid);
    }

    while (processor.hasNext())
    {
      final RenderNode linebox = processor.next();
      if (linebox instanceof ParagraphPoolBox == false)
      {
        throw new NullPointerException("Line must not be null");
      }
View Full Code Here


  protected abstract void processParagraphChilds(final ParagraphRenderBox box);

  protected void processBoxChilds(final RenderBox box)
  {
    RenderNode node = box.getFirstChild();
    while (node != null)
    {
      startProcessing(node);
      node = node.getNext();
    }
  }
View Full Code Here

    // Todo: Include orphan and widow stuff ..

    // First: Check the number of lines. (Should have been precomputed)
    // Second: Check whether and where the orphans- and widows-rules apply
    // Third: Shift the lines.
    RenderNode node = box.getVisibleFirst();
    while (node != null)
    {
      // all childs of the linebox container must be inline boxes. They
      // represent the lines in the paragraph. Any other element here is
      // a error that must be reported
      if (node instanceof ParagraphPoolBox == false)
      {
        throw new IllegalStateException("Encountered " + node.getClass());
      }
      final ParagraphPoolBox inlineRenderBox = (ParagraphPoolBox) node;
      if (startLine(inlineRenderBox))
      {
        processBoxChilds(inlineRenderBox);
      }
      finishLine(inlineRenderBox);

      node = node.getVisibleNext();
    }
  }
View Full Code Here

  }

  private void processTableSection(final TableRenderBox box,
                                   final CSSConstant role)
  {
    RenderNode rowGroupNode = box.getFirstChild();
    while (rowGroupNode != null)
    {
      if (rowGroupNode instanceof TableSectionRenderBox == false)
      {
        rowGroupNode = rowGroupNode.getNext();
        continue;
      }

      final TableSectionRenderBox sectionBox =
          (TableSectionRenderBox) rowGroupNode;
      if (role.equals
          (sectionBox.getDisplayRole()) == false)
      {
        // not a header ..
        rowGroupNode = rowGroupNode.getNext();
        continue;
      }

      startProcessing(rowGroupNode);
      rowGroupNode = rowGroupNode.getNext();
    }
  }
View Full Code Here

    long position = currentTable.getPosition();

    // Second step: Apply the row heights to all cells.
    // + Align all cells.
    final TableRow[] rows = rowModel.getRows();
    RenderNode rowNode = section.getFirstChild();
    boolean firstRow = true;
    while (rowNode != null)
    {
      if (rowNode instanceof TableRowRenderBox == false)
      {
        rowNode = rowNode.getNext();
        continue;
      }
      if (rowNode.isDirty() == false)
      {
        throw new IllegalStateException("The row is not dirty?");
      }

      final TableRowRenderBox rowBox = (TableRowRenderBox) rowNode;
      final int rowNumber = rowBox.getRowInfoStructure().getRowNumber();
      final TableRow row = rows[rowNumber];
      final long validatedRowHeight = row.getValidateSize();

      if (firstRow)
      {
        firstRow = false;
      }
      else
      {
        position += rowModel.getRowSpacing();
      }

      final long oldPosition = rowBox.getY();
      final long shift = position - oldPosition;
      if (shift < 0)
      {
        throw new IllegalStateException("Shift-back is not allowed.");
      }

      shift(rowBox, shift);
      shiftDistance += shift;

      RenderNode cellNode = rowBox.getFirstChild();
      while (cellNode != null)
      {
        if (cellNode instanceof TableCellRenderBox == false)
        {
          cellNode = cellNode.getNext();
          continue;
        }

        final TableCellRenderBox cellBox = (TableCellRenderBox) cellNode;
        final long cellShift = position - cellBox.getY();
        if (cellShift != 0)
        {
          shift(cellBox, cellShift);
          // this is an inner shift and therefore it has no influence on the
          // global shiftdistance
        }

        cellBox.setHeight(validatedRowHeight);
        // Todo: now align all the childs of the cellbox.

        cellNode = cellNode.getNext();
      }

      rowBox.setHeight(validatedRowHeight);
      rowBox.setDirty(false);
      position += validatedRowHeight;
      rowNode = rowNode.getNext();
    }

    // finally shift down all the content that comes afterwards.
    // We have to update our parent's height as well as we extended the height
    // of the table ..
    final long newHeight = position - section.getY();
    final long extendedHeight = newHeight - section.getHeight();
    section.setHeight(newHeight);
    if (extendedHeight != 0)
    {
      RenderNode parent = section.getParent();
      while (parent != null)
      {
        parent.setHeight(parent.getHeight() + extendedHeight);
        parent = parent.getParent();
      }

      shiftDistance += extendedHeight;
    }
View Full Code Here

      return;
    }

    // Argghhh, a render box. Shift all childs too..
    final RenderBox box = (RenderBox) node;
    RenderNode child = box.getFirstChild();
    while (child != null)
    {
      shift(child, shift);
      child = child.getNext();
    }
  }
View Full Code Here

      // We dont handle spanned cells here; thats done indirectly by the
      // column model itself.
      final DataCell dataCell = (DataCell) cellAt;

      final RenderNode cell = findCellInRow(box, dataCell.getCellRenderBox());
      if (cell == null)
      {
        throw new IllegalStateException
            ("No such cell: " + dataCell.getCellRenderBox());
      }
      final TableColumn column = columnModel.getColumn(i);
      final int colSpan = dataCell.getColSpan();

      column.updateMinimumChunkSize(colSpan, cell.getMinimumChunkWidth());
      column.updateMaxBoxSize(colSpan, cell.getMaximumBoxWidth());

      final RenderLength computedWidth =
          cell.getComputedLayoutProperties().getComputedWidth();
      if (computedWidth == RenderLength.AUTO == false)
      {
        // if we have a computed width, set it. If the user explicitly specified
        // a width, then that one is returned as computed width.
        column.updatePreferredSize(colSpan, computedWidth.getValue());
View Full Code Here

    currentTable.increaseRowNumber();
  }

  private RenderNode findCellInRow(final TableRowRenderBox box, final Object instanceId)
  {
    RenderNode node = box.getFirstChild();
    while (node != null)
    {
      if (node.getInstanceId() == instanceId)
      {
        return node;
      }
      node = node.getNext();
    }
    return null;
  }
View Full Code Here

  private void validateFinalRows(final TableSectionRenderBox section)
  {
    // check the last row for row-spanning cells ..

    // first, find the last row of the section ..
    RenderNode rowNode = section.getLastChild();
    TableRowRenderBox lastRow = null;
    while (rowNode != null)
    {
      if (rowNode instanceof TableRowRenderBox)
      {
        lastRow = (TableRowRenderBox) rowNode;
        break;
      }
      rowNode = rowNode.getVisiblePrev();
    }

    final TableRowModel rowModel = section.getRowModel();
    // There is no last row - so this sections is empty.
    while (lastRow != null)
View Full Code Here

    }

    final TableColumnModel columnModel = currentTable.getColumnModel();
    // ok, the real work starts here. Forward-Traverse the table by its table-
    // sections.
    RenderNode node = table.getFirstChild();
    while (node != null)
    {
      if (node instanceof TableSectionRenderBox == false)
      {
        node = node.getNext();
        continue;
      }
      // OK; nice we are done. All other column definitions will be ignored
      final TableSectionRenderBox section = (TableSectionRenderBox) node;

      if (section.isStructureValidated() == false)
      {
        // we start with an empty prev-struct; that signals that there are no
        // spanned cells in a first row.
        TableRowInfoStructure prevInfoStruct =
                new TableRowInfoStructure();
        RenderNode rowNode = section.getFirstChild();
        while (rowNode != null)
        {
          if (rowNode.isOpen())
          {
            throw new IllegalStateException
                    ("An open row cannot be part of a layoutable model.");
          }

          // OK, we got a non open row. Now we traverse through the table from
          // top to bottom building the validated row model.
          if (rowNode instanceof TableRowRenderBox == false)
          {
            rowNode = rowNode.getNext();
            continue;
          }

          final TableRowInfoStructure infoStruct =
                  validateRow(section, rowNode, prevInfoStruct);
          final int cellCount = infoStruct.getCellCount();
          if (currentTable.getColumns() < cellCount)
          {
            currentTable.setColumns(cellCount);
          }
          // And finally ... add the new columns to the model ..
          while (cellCount > columnModel.getColumnCount())
          {
            columnModel.addAutoColumn();
          }

          rowNode = rowNode.getNext();
          prevInfoStruct = infoStruct;
        }

        if (section.isOpen() == false)
        {
View Full Code Here

TOP

Related Classes of org.jfree.layouting.renderer.model.RenderNode

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.