Package org.jfree.layouting.renderer.model

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


    {
      // check, if the section contains row-spanning cell declarations.
      // if it does, check whether there are enough rows to make these
      // constraints valid. If there are rows missing, then the section
      // is not layoutable..
      RenderNode node = box.getFirstChild();
      int expectedRows = 0;
      while (node != null)
      {
        if (node instanceof TableRowRenderBox == false)
        {
          node = node.getNext();
          continue;
        }

        expectedRows -= 1;

        final TableRowRenderBox row = (TableRowRenderBox) node;
        final TableRowInfoStructure rowInfoStructure = row.getRowInfoStructure();
        if (rowInfoStructure.isValidationDone())
        {
          // 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 ..
          RenderNode nodeCell = row.getFirstChild();
          while (nodeCell != null)
          {
            if (nodeCell instanceof TableCellRenderBox)
            {
              final TableCellRenderBox cellBox = (TableCellRenderBox) nodeCell;
              expectedRows = Math.max (expectedRows, cellBox.getRowSpan() - 1);
            }
            nodeCell = nodeCell.getNext();
          }
        }
        node = node.getNext();
      }
View Full Code Here


      }

      // now dive deeper. Seek the first occurence of an table-body element..
      boolean foundBodyGroup = false;

      RenderNode node = table.getFirstChild();
      while (node != null)
      {
        if (node instanceof TableSectionRenderBox)
        {
          final TableSectionRenderBox section = (TableSectionRenderBox) node;
          if (DisplayRole.TABLE_ROW_GROUP.equals(section.getDisplayRole()))
          {
            foundBodyGroup = true;
            boolean foundRow = false;
            // We found a tbody element ..
            // next - check whether the first row is closed ..
            RenderNode maybeRow = section.getVisibleFirst();
            while (maybeRow != null)
            {
              if (maybeRow instanceof TableRowRenderBox)
              {
                if (maybeRow.isOpen())
                {
                  // not layoutable - bail out ..
                  layoutFailureNodeId = maybeRow.getInstanceId();
                  layoutFailureResolution = BOX_MUST_BE_CLOSED;
                  return false;
                }
                foundRow = true;
              }
              maybeRow = maybeRow.getNext();
            }

            if (foundRow == false)
            {
              // not layoutable - bail out ..
View Full Code Here

      return;
    }
    if (breakState.getSuspendItem() != null ||
        node instanceof RenderableText == false)
    {
      final RenderNode child = node.deriveFrozen(false);
      breakState.getInsertationPoint().addGeneratedChild(child);
      return;
    }

    final RenderableText text = (RenderableText) node;
    final RenderNode child = text.deriveFrozen(false);
    breakState.getInsertationPoint().addGeneratedChild(child);

    if (text.isForceLinebreak() == false)
    {
      return;
View Full Code Here

  protected abstract void processParagraphChilds(final ParagraphRenderBox box);

  protected void processBoxChilds(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..
    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(TableRowRenderBox box, Object instanceId)
  {
    RenderNode node = box.getFirstChild();
    while (node != null)
    {
      if (node.getInstanceId() == instanceId)
      {
        return node;
      }
      node = node.getNext();
    }
    return null;
  }
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.