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

Examples of org.jfree.layouting.renderer.model.table.TableRenderBox


  {
    // first step: Check, whether the column model is complete.
    validatePredefinedColumns();
    validateRowStructure();

    final TableRenderBox table = currentTable.getTable();
    if (table.isOpen() == false)
    {
      table.setStructureValidated(true);
    }
  }
View Full Code Here


  private void validateRowStructure()
  {
    // check all the newly closed rows and look at their number of columns
    // (cache that one for faster access)
    final TableRenderBox table = currentTable.getTable();
    if (table.isPredefinedColumnsValidated() == false)
    {
      // the predefined columns must be validated first ...
      return;
    }

    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();
View Full Code Here

    return cellPosition;
  }

  private void validatePredefinedColumns()
  {
    final TableRenderBox table = currentTable.getTable();
    if (table.isPredefinedColumnsValidated())
    {
      // all work as been done already ...
      return;
    }

    final TableColumnModel columnModel = table.getColumnModel();

    int colCount = 0;
    RenderNode node = table.getFirstChild();
    while (node != null)
    {
      if (node instanceof TableColumnNode)
      {
        final TableColumnNode columnNode = (TableColumnNode) node;
        if (colCount >= columnModel.getColumnCount())
        {
          // No column exists at that position ..
          final BoxDefinition boxDefinition = columnNode.getBoxDefinition();
          final Border border = boxDefinition.getBorder();
          final RenderLength width = boxDefinition.getPreferredWidth();
          final TableColumn column = new TableColumn(border, width, false);
          final TableColumnGroup group = new TableColumnGroup();
          group.addColumn(column);
          columnModel.addColumnGroup(group);
          colCount += 1;
        }
        else
        {
          // We do not change existing columns. That validation should be the
          // first that checks column definitions, so that state should always
          // be correct.
        }
      }
      else if (node instanceof TableColumnGroupNode)
      {
        final TableColumnGroupNode groupNode = (TableColumnGroupNode) node;

        final boolean newGroupGenerated;
        final TableColumnGroup group;
        if (colCount >= columnModel.getColumnCount())
        {
          group = new TableColumnGroup(groupNode.getBorder());
          newGroupGenerated = true;
        }
        else
        {
          group = columnModel.getGroupForIndex(colCount);
          newGroupGenerated = false;
        }

        RenderNode groupColNode = groupNode.getFirstChild();
        while (groupColNode != null)
        {
          if (groupColNode instanceof TableColumnNode)
          {
            final TableColumnNode columnNode = (TableColumnNode) groupColNode;
            if (colCount >= columnModel.getColumnCount())
            {
              final BoxDefinition boxDefinition = columnNode.getBoxDefinition();
              final Border border = boxDefinition.getBorder();
              final RenderLength width = boxDefinition.getPreferredWidth();
              final TableColumn column = new TableColumn(border, width, false);
              group.addColumn(column);
            }
            else
            {
              colCount += 1;
            }
          }
          else
          {
            // ignore silently ..
          }
          groupColNode = groupColNode.getNext();
        }

        if (newGroupGenerated)
        {
          columnModel.addColumnGroup(group);
          colCount += group.getColumnCount();
        }

      }
      else if (node instanceof TableSectionRenderBox)
      {
        // OK; nice we are done. All other column definitions will be ignored
        table.setPredefinedColumnsValidated(true);
      }
      else
      {
        // ignore ...
      }
View Full Code Here

      {
        maxRowSpan = cs;
      }
    }

    final TableRenderBox table = getTableSection().getTable();
    rowSpacing = table.getRowSpacing().resolve(0);

    preferredSize = (rowCount - 1) * rowSpacing;

    // first, find out how much space is already used.
    final long[] preferredSizes = new long[rowCount];
View Full Code Here

  protected void processBlockLevelChild(final RenderNode node)
  {
    if (node instanceof TableRenderBox)
    {
      final TableRenderBox table = (TableRenderBox) node;
      processTable(table);
    }
    else
    {
      super.processBlockLevelChild(node);
View Full Code Here

  protected boolean startBlockLevelBox(final RenderBox box)
  {
    box.setY(box.getY() + shiftDistance);
    if (box instanceof TableRenderBox)
    {
      final TableRenderBox table = (TableRenderBox) box;
      currentTable = new TableInfoStructure(table);
      currentTable.setPosition(table.getY());

      tableStack.push(currentTable);
    }
    else if (box instanceof TableSectionRenderBox)
    {
View Full Code Here

      return false;
    }

    if (box instanceof TableRenderBox)
    {
      final TableRenderBox table = (TableRenderBox) box;
      if (table.isAutoLayout())
      {
        // Auto-Layout means, we have to see the complete table.
        // Yes, that is expensive ..
        layoutFailureNodeId = box.getInstanceId();
        layoutFailureResolution = BOX_MUST_BE_CLOSED;
        return false;
      }

      // 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;
View Full Code Here

  protected void processBlockLevelChild(final RenderNode node)
  {
    if (node instanceof TableRenderBox)
    {
      final TableRenderBox table = (TableRenderBox) node;
      processTable(table);
    }
    else
    {
      super.processBlockLevelChild(node);
View Full Code Here

  protected boolean startBlockLevelBox(final RenderBox box)
  {
    box.setY(box.getY() + shiftDistance);
    if (box instanceof TableRenderBox)
    {
      final TableRenderBox table = (TableRenderBox) box;
      currentTable = new TableInfoStructure(table);
      currentTable.setPosition(table.getY());

      tableStack.push(currentTable);
    }
    else if (box instanceof TableSectionRenderBox)
    {
View Full Code Here

  protected boolean startBlockBox(BlockRenderBox box)
  {
    if (box instanceof TableRenderBox)
    {
      final TableRenderBox table = (TableRenderBox) box;
      currentTable = new TableInfoStructure(table);
      tableStack.push(currentTable);
    }
    else if (box instanceof TableSectionRenderBox)
    {
View Full Code Here

TOP

Related Classes of org.jfree.layouting.renderer.model.table.TableRenderBox

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.