Package org.jfree.layouting.renderer.border

Examples of org.jfree.layouting.renderer.border.RenderLength


  {
    // grab the block-context width ..
    final RenderBox blockContext = node.getParentBlockContext();
    if (blockContext == null)
    {
      return new RenderLength(root.getPageWidth(), false);
    }
    else
    {
      final ComputedLayoutProperties layoutProperties =
              blockContext.getComputedLayoutProperties();
View Full Code Here


    {
      return null;
    }

    final CSSValue widthVal = context.getValue(BoxStyleKeys.WIDTH);
    final RenderLength width = DefaultBoxDefinitionFactory.computeWidth
        (widthVal, context, layoutProcess.getOutputMetaData(), true, false);

    final CSSValue heightVal = context.getValue(BoxStyleKeys.HEIGHT);
    final RenderLength height = DefaultBoxDefinitionFactory.computeWidth
        (heightVal, context, layoutProcess.getOutputMetaData(), true, false);
    final StrictDimension dims = StrictGeomUtility.createDimension
        (image.getWidth(null), image.getHeight(null));
    final CSSValue valign =
        context.getValue(LineStyleKeys.VERTICAL_ALIGN);
View Full Code Here

      dims.setWidth(StrictGeomUtility.toInternalValue(preferredSize.getWidth()));
      dims.setHeight(StrictGeomUtility.toInternalValue(preferredSize.getHeight()));
    }

    final CSSValue widthVal = context.getValue(BoxStyleKeys.WIDTH);
    final RenderLength width = DefaultBoxDefinitionFactory.computeWidth
        (widthVal, context, layoutProcess.getOutputMetaData(), true, false);

    final CSSValue heightVal = context.getValue(BoxStyleKeys.HEIGHT);
    final RenderLength height = DefaultBoxDefinitionFactory.computeWidth
        (heightVal, context, layoutProcess.getOutputMetaData(), true, false);

    final CSSValue valign =
        context.getValue(LineStyleKeys.VERTICAL_ALIGN);
    return new RenderableReplacedContent(image, source, dims, width, height, valign);
View Full Code Here

      {
        return RenderLength.convertToInternal(widthValue, boxContext, metaData);
      }
      else if (nval.getValue() > 0)
      {
        final RenderLength renderLength = RenderLength.convertToInternal(widthValue, boxContext, metaData);
        if (renderLength.getValue() > 0)
        {
          return renderLength;
        }
      }
      return RenderLength.EMPTY;
View Full Code Here

    else
    {
      final CSSNumericValue nval = (CSSNumericValue) widthValue;
      if (nval.getValue() > 0)
      {
        final RenderLength renderLength =
            RenderLength.convertToInternal(widthValue, null, metaData);
        if (renderLength.getValue() > 0)
        {
          return renderLength;
        }
      }
      return RenderLength.EMPTY;
View Full Code Here

    }

    if (node instanceof RenderableReplacedContent)
    {
      final RenderableReplacedContent rpc = (RenderableReplacedContent) node;
      final RenderLength requestedWidth = rpc.getRequestedWidth();
      final StrictDimension contentSize = rpc.getContentSize();

      if (requestedWidth == RenderLength.AUTO)
      {
        node.setMaximumBoxWidth(contentSize.getWidth());
      }
      else
      {
        node.setMaximumBoxWidth(requestedWidth.resolve(contentSize.getWidth()));
      }

      node.setMinimumChunkWidth(0);
      // replaced content cannot have any childs anymore, so it is safe to
      // set this flag to an unconditional true.
View Full Code Here

    }

    if (node instanceof RenderableReplacedContent)
    {
      final RenderableReplacedContent rpc = (RenderableReplacedContent) node;
      final RenderLength requestedWidth = rpc.getRequestedWidth();
      final StrictDimension contentSize = rpc.getContentSize();

      if (requestedWidth == RenderLength.AUTO)
      {
        node.setMaximumBoxWidth(contentSize.getWidth());
      }
      else
      {
        node.setMaximumBoxWidth(requestedWidth.resolve(contentSize.getWidth()));
      }

      node.setMinimumChunkWidth(0);
      // replaced content cannot have any childs anymore, so it is safe to
      // set this flag to an unconditional true.
View Full Code Here

    final int rowNumber = currentTable.getRowNumber();
    rowInfoStructure.setRowNumber(rowNumber);
    final TableRow row = rowModel.getRow(rowNumber);

    final BoxDefinition boxDefinition = box.getBoxDefinition();
    final RenderLength preferredHeight = boxDefinition.getPreferredHeight();
    final ComputedLayoutProperties rowNlp = box.getComputedLayoutProperties();
    final RenderLength rowComputedWidth = rowNlp.getComputedWidth();
    row.clearSizes();
    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;
      }

      // 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());
      }

      final RenderLength definedHeight =
          box.getBoxDefinition().getPreferredHeight();
      row.updateDefinedSize(dataCell.getRowSpan(),
          definedHeight.resolve(computedWidth.resolve(0)));
    }

    currentTable.increaseRowNumber();
  }
View Full Code Here

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

      validationTrack = table.getChangeTracker();
      return;
    }

    final ComputedLayoutProperties nlp = table.getComputedLayoutProperties();
    final RenderLength blockContextWidth = nlp.getBlockContextWidth();
    final long bcw = blockContextWidth.resolve(0);

    final RenderLength borderSpacingLength = table.getBorderSpacing();
    borderSpacing = borderSpacingLength.resolve(bcw);

    final long totalBorderSpacing = (colCount - 1) * borderSpacing;
    minimumChunkSize = totalBorderSpacing;
    maxBoxSize = totalBorderSpacing;
    preferredSize = totalBorderSpacing;

    // first, find out how much space is already used.
    final long[] minChunkSizes = new long[colCount];
    final long[] maxBoxSizes = new long[colCount];
    final long[] preferredSizes = new long[colCount];

    // For each colspan distribute the content.
    // The 1-column size also gets the preferred size ...
    for (int colIdx = 0; colIdx < minChunkSizes.length; colIdx++)
    {
      final TableColumn column = columns[colIdx];
      final long minimumChunkSize = column.getMinimumChunkSize(1);
      final long maxBoxSize = column.getMaximumBoxWidth(1);
      final long resolvedColWidth = column.getDefinedWidth().resolve(bcw);
      final long preferredSize = Math.max
          (resolvedColWidth, column.getPreferredWidth(1));

      minChunkSizes[colIdx] = minimumChunkSize;
      maxBoxSizes[colIdx] = maxBoxSize;
      preferredSizes[colIdx] = preferredSize;
    }

    for (int colspan = 2; colspan <= maxColSpan; colspan += 1)
    {
      for (int colIdx = 0; colIdx < minChunkSizes.length; colIdx++)
      {
        final TableColumn column = columns[colIdx];
        final long minimumChunkSize = column.getMinimumChunkSize(colspan);
        final long maxBoxSize = column.getMaximumBoxWidth(colspan);
        final long preferredSize = column.getPreferredWidth(colspan);

        distribute(minimumChunkSize, minChunkSizes, colIdx, colspan);
        distribute(preferredSize, preferredSizes, colIdx, colspan);
        distribute(maxBoxSize, maxBoxSizes, colIdx, colspan);
      }
    }

    for (int i = 0; i < minChunkSizes.length; i++)
    {
      final TableColumn column = columns[i];

      final long cmin = minChunkSizes[i];
      final long cpref = preferredSizes[i];
      final long cmax = maxBoxSizes[i];
      final long width = Math.max(cmin, cpref);

      minimumChunkSize += cmin;
      preferredSize += width;
      maxBoxSize += cmax;

      if (column.isValidated())
      {
        continue;
      }

      column.setComputedPreferredSize(cpref);
      column.setComputedMinChunkSize(cmin);
      column.setComputedMaximumWidth(cmax);
      column.setEffectiveSize(width);
      column.setValidated(true);
    }

    // Table-AutoWidth means, the tables width is based on the content of the
    // cells. The minimum chunk size and the preferred sizes are the only
    // metrics used in that computation.
    //
    // If the table's width is fixed, then we have to shrink or expand the
    // columns to fit that additional requirement.
    final RenderLength tableCWidth = table.getComputedLayoutProperties().getComputedWidth();
    if (tableCWidth != RenderLength.AUTO)
    {
      final long tableSize = Math.max(tableCWidth.resolve(0), minimumChunkSize);
      // the space we are able to distribute .. (This can be negative, if we
      // have to remove space to get to the defined table size!)
      // The space that is available for the content from the cells. The
      // border-spacing eats some space as well (already in the pref-size-value)
      final long extraSpace = tableSize - preferredSize;
View Full Code Here

TOP

Related Classes of org.jfree.layouting.renderer.border.RenderLength

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.