protected TableBorders applyBottomTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean reverse) { float bottomTableBorderWidth = (reverse ? -1 : 1) * getMaxBottomWidth(); layoutBox.decreaseHeight(bottomTableBorderWidth / 2); occupiedBox.moveDown(bottomTableBorderWidth / 2).increaseHeight(bottomTableBorderWidth / 2); return this; }
protected TableBorders applyTopTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean reverse) { float topIndent = (reverse ? -1 : 1) * getMaxTopWidth(); layoutBox.decreaseHeight(topIndent / 2); occupiedBox.moveDown(topIndent / 2).increaseHeight(topIndent / 2); return this; }
protected TableBorders fixHeaderOccupiedArea(Rectangle occupiedBox, Rectangle layoutBox) { float topBorderMaxWidth = getMaxTopWidth(); layoutBox.increaseHeight(topBorderMaxWidth); occupiedBox.moveUp(topBorderMaxWidth).decreaseHeight(topBorderMaxWidth); return this; } // endregion
@Override protected TableBorders applyTopTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean reverse) { float topIndent = (reverse ? -1 : 1) * getMaxTopWidth(); layoutBox.decreaseHeight(topIndent); occupiedBox.moveDown(topIndent).increaseHeight(topIndent); return this; }
protected TableBorders applyBottomTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean reverse) { float bottomTableBorderWidth = (reverse ? -1 : 1) * getMaxBottomWidth(); layoutBox.decreaseHeight(bottomTableBorderWidth / 2); occupiedBox.moveDown(bottomTableBorderWidth / 2).increaseHeight(bottomTableBorderWidth / 2); return this; }
protected TableBorders applyTopTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean reverse) { float topIndent = (reverse ? -1 : 1) * getMaxTopWidth(); layoutBox.decreaseHeight(topIndent / 2); occupiedBox.moveDown(topIndent / 2).increaseHeight(topIndent / 2); return this; }
@Override protected TableBorders applyBottomTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean reverse) { float bottomTableBorderWidth = (reverse ? -1 : 1) * getMaxBottomWidth(); layoutBox.decreaseHeight(bottomTableBorderWidth); occupiedBox.moveDown(bottomTableBorderWidth).increaseHeight(bottomTableBorderWidth); return this; }
@Override protected TableBorders applyTopTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean reverse) { float topIndent = (reverse ? -1 : 1) * getMaxTopWidth(); layoutBox.decreaseHeight(topIndent); occupiedBox.moveDown(topIndent).increaseHeight(topIndent); return this; }
@Override protected TableBorders applyBottomTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean reverse) { float bottomTableBorderWidth = (reverse ? -1 : 1) * getMaxBottomWidth(); layoutBox.decreaseHeight(bottomTableBorderWidth); occupiedBox.moveDown(bottomTableBorderWidth).increaseHeight(bottomTableBorderWidth); return this; }
protected TableBorders fixHeaderOccupiedArea(Rectangle occupiedBox, Rectangle layoutBox) { float topBorderMaxWidth = getMaxTopWidth(); layoutBox.increaseHeight(topBorderMaxWidth); occupiedBox.moveUp(topBorderMaxWidth).decreaseHeight(topBorderMaxWidth); return this; } // endregion
protected void extendLastRow(CellRenderer[] lastRow, Rectangle freeBox) { if (null != lastRow && 0 != heights.size()) { heights.set(heights.size() - 1, heights.get(heights.size() - 1) + freeBox.getHeight()); occupiedArea.getBBox().moveDown(freeBox.getHeight()).increaseHeight(freeBox.getHeight()); for (CellRenderer cell : lastRow) { if (null != cell) { cell.occupiedArea.getBBox().moveDown(freeBox.getHeight()).increaseHeight(freeBox.getHeight()); } } freeBox.moveUp(freeBox.getHeight()).setHeight(0); } }
protected void extendLastRow(CellRenderer[] lastRow, Rectangle freeBox) { if (null != lastRow && 0 != heights.size()) { heights.set(heights.size() - 1, heights.get(heights.size() - 1) + freeBox.getHeight()); occupiedArea.getBBox().moveDown(freeBox.getHeight()).increaseHeight(freeBox.getHeight()); for (CellRenderer cell : lastRow) { if (null != cell) { cell.occupiedArea.getBBox().moveDown(freeBox.getHeight()).increaseHeight(freeBox.getHeight()); } } freeBox.moveUp(freeBox.getHeight()).setHeight(0); } }
private void applySelfCollapsedKidMarginWithClearance(Rectangle layoutBox) { // Self-collapsed kid margin with clearance will not be applied to parent top margin // if parent is not self-collapsing. It's self-collapsing kid, thus we just can // add this area to occupied area of parent. float clearedKidMarginWithClearance = prevChildMarginInfo.getOwnCollapseAfter().getCollapsedMarginsSize(); renderer.getOccupiedArea().getBBox(). increaseHeight(clearedKidMarginWithClearance) .moveDown(clearedKidMarginWithClearance); layoutBox.decreaseHeight(clearedKidMarginWithClearance); }
private void applySelfCollapsedKidMarginWithClearance(Rectangle layoutBox) { // Self-collapsed kid margin with clearance will not be applied to parent top margin // if parent is not self-collapsing. It's self-collapsing kid, thus we just can // add this area to occupied area of parent. float clearedKidMarginWithClearance = prevChildMarginInfo.getOwnCollapseAfter().getCollapsedMarginsSize(); renderer.getOccupiedArea().getBBox(). increaseHeight(clearedKidMarginWithClearance) .moveDown(clearedKidMarginWithClearance); layoutBox.decreaseHeight(clearedKidMarginWithClearance); }
/** * If there is some space left, we will move the footer up, because initially the footer is at the very bottom of the area. * We also will adjust the occupied area by the footer's size if it is present. * * @param layoutBox the layout box which represents the area which is left free. */ private void adjustFooterAndFixOccupiedArea(Rectangle layoutBox, float verticalBorderSpacing) { if (footerRenderer != null) { footerRenderer.move(0, layoutBox.getHeight() + verticalBorderSpacing); float footerHeight = footerRenderer.getOccupiedArea().getBBox().getHeight() - verticalBorderSpacing; occupiedArea.getBBox().moveDown(footerHeight).increaseHeight(footerHeight); } }
/** * If there is some space left, we will move the footer up, because initially the footer is at the very bottom of the area. * We also will adjust the occupied area by the footer's size if it is present. * * @param layoutBox the layout box which represents the area which is left free. */ private void adjustFooterAndFixOccupiedArea(Rectangle layoutBox, float verticalBorderSpacing) { if (footerRenderer != null) { footerRenderer.move(0, layoutBox.getHeight() + verticalBorderSpacing); float footerHeight = footerRenderer.getOccupiedArea().getBBox().getHeight() - verticalBorderSpacing; occupiedArea.getBBox().moveDown(footerHeight).increaseHeight(footerHeight); } }
static LayoutArea adjustResultOccupiedAreaForFloatAndClear(IRenderer renderer, List<Rectangle> floatRendererAreas, Rectangle parentBBox, float clearHeightCorrection, boolean marginsCollapsingEnabled) { LayoutArea occupiedArea = renderer.getOccupiedArea(); LayoutArea editedArea = occupiedArea; if (isRendererFloating(renderer)) { editedArea = occupiedArea.clone(); if (occupiedArea.getBBox().getWidth() > 0) { floatRendererAreas.add(occupiedArea.getBBox()); } editedArea.getBBox().setY(parentBBox.getTop()); editedArea.getBBox().setHeight(0); } else if (clearHeightCorrection > 0 && !marginsCollapsingEnabled) { editedArea = occupiedArea.clone(); editedArea.getBBox().increaseHeight(clearHeightCorrection); } return editedArea; }
static LayoutArea adjustResultOccupiedAreaForFloatAndClear(IRenderer renderer, List<Rectangle> floatRendererAreas, Rectangle parentBBox, float clearHeightCorrection, boolean marginsCollapsingEnabled) { LayoutArea occupiedArea = renderer.getOccupiedArea(); LayoutArea editedArea = occupiedArea; if (isRendererFloating(renderer)) { editedArea = occupiedArea.clone(); if (occupiedArea.getBBox().getWidth() > 0) { floatRendererAreas.add(occupiedArea.getBBox()); } editedArea.getBBox().setY(parentBBox.getTop()); editedArea.getBBox().setHeight(0); } else if (clearHeightCorrection > 0 && !marginsCollapsingEnabled) { editedArea = occupiedArea.clone(); editedArea.getBBox().increaseHeight(clearHeightCorrection); } return editedArea; }
/** * If there is some space left, we will move the caption up, because initially the caption is at the very bottom of the area. * We also will adjust the occupied area by the caption's size if it is present. * * @param layoutBox the layout box which represents the area which is left free. */ private void adjustCaptionAndFixOccupiedArea(Rectangle layoutBox, float verticalBorderSpacing) { if (captionRenderer != null) { float captionHeight = captionRenderer.getOccupiedArea().getBBox().getHeight(); occupiedArea.getBBox().moveDown(captionHeight).increaseHeight(captionHeight); if (CaptionSide.BOTTOM.equals(captionRenderer.<CaptionSide>getProperty(Property.CAPTION_SIDE))) { captionRenderer.move(0, layoutBox.getHeight() + verticalBorderSpacing); } else { occupiedArea.getBBox().moveUp(captionHeight); } } }
/** * If there is some space left, we will move the caption up, because initially the caption is at the very bottom of the area. * We also will adjust the occupied area by the caption's size if it is present. * * @param layoutBox the layout box which represents the area which is left free. */ private void adjustCaptionAndFixOccupiedArea(Rectangle layoutBox, float verticalBorderSpacing) { if (captionRenderer != null) { float captionHeight = captionRenderer.getOccupiedArea().getBBox().getHeight(); occupiedArea.getBBox().moveDown(captionHeight).increaseHeight(captionHeight); if (CaptionSide.BOTTOM.equals(captionRenderer.<CaptionSide>getProperty(Property.CAPTION_SIDE))) { captionRenderer.move(0, layoutBox.getHeight() + verticalBorderSpacing); } else { occupiedArea.getBBox().moveUp(captionHeight); } } }