コード例 #1
0
  protected void finishTableRowLevelBox(final RenderBox box) {
    try {
      box.setCachedX(nodeContext.getX());
      box.setContentAreaX1(nodeContext.getX1());
      box.setContentAreaX2(nodeContext.getX2());

      if (box.getNodeType() != LayoutNodeTypes.TYPE_BOX_TABLE_CELL) {
        // break-marker boxes etc.
        box.setCachedWidth(resolveTableWidthOnFinish(box));
        nodeContext.updateParentX2(box.getCachedX2());
      } else {
        box.setCachedWidth(
            MinorAxisLayoutStepUtil.resolveNodeWidthOnFinish(
                box, nodeContext, isStrictLegacyMode()));

        final TableCellRenderBox cell = (TableCellRenderBox) box;
        final MinorAxisTableContext tableContext = getTableContext();
        final TableRenderBox table = tableContext.getTable();
        if (tableContext.isStructureValidated() == false) {
          table
              .getColumnModel()
              .updateCellSize(
                  cell.getColumnIndex(), cell.getColSpan(), box.getCachedWidth() - box.getInsets());
        }
        nodeContext.updateParentX2(box.getCachedX2());
      }
    } finally {
      nodeContext = nodeContext.pop();
    }
  }
コード例 #2
0
  protected boolean startTableCellBox(final TableCellRenderBox box) {
    if (currentTable == null) {
      return false;
    }
    if (currentTable.getSectionRenderBox() == null) {
      return false;
    }
    final int rowSpan = box.getRowSpan();
    final int colSpan = box.getColSpan();

    final int startPos = currentTable.increaseCellPosition(colSpan, rowSpan);
    while (currentTable.columnModel.getColumnCount() <= startPos) {
      currentTable.columnModel.addAutoColumn();
    }

    box.setColumnIndex(startPos);
    box.setBodySection(currentTable.isBodySection());

    final BoxDefinition boxDefinition = box.getBoxDefinition();
    final long preferredHeight = boxDefinition.getPreferredHeight().resolve(0);
    final long minHeight = boxDefinition.getMinimumHeight().resolve(0);
    final long maxHeight = boxDefinition.getMaximumHeight().resolve(0, MAX_AUTO);

    final long preferredSize = ProcessUtility.computeLength(minHeight, maxHeight, preferredHeight);
    currentTable.updateDefinedSize(rowSpan, preferredSize);
    return true;
  }