Package com.itextpdf.layout.renderer
Class CollapsedTableBorders
- java.lang.Object
-
- com.itextpdf.layout.renderer.TableBorders
-
- com.itextpdf.layout.renderer.CollapsedTableBorders
-
class CollapsedTableBorders extends TableBorders
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classCollapsedTableBorders.BorderComparatorA comparison function to compare twoBorderinstances.
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Comparator<Border>borderComparatorprivate java.util.List<Border>bottomBorderCollapseWithHorizontal borders to be collapsed with the last-on-the-area row's cell bottom borders of this TableRenderer instance.private java.util.List<Border>topBorderCollapseWithHorizontal borders to be collapsed with the first-on-the-area row's cell top borders of this TableRenderer instance.private java.util.Map<java.lang.Integer,java.util.List<Border>>verticalBorderComputationResultprivate java.util.List<Border>verticalBottomBorderCollapseWithVertical borders to be collapsed with the last-on-the-area row's cell bottom borders of this TableRenderer instance.-
Fields inherited from class com.itextpdf.layout.renderer.TableBorders
finishRow, horizontalBorders, largeTableIndexOffset, leftBorderMaxWidth, numberOfColumns, rightBorderMaxWidth, rows, startRow, tableBoundingBorders, verticalBorders
-
-
Constructor Summary
Constructors Constructor Description CollapsedTableBorders(java.util.List<CellRenderer[]> rows, int numberOfColumns, Border[] tableBoundingBorders)CollapsedTableBorders(java.util.List<CellRenderer[]> rows, int numberOfColumns, Border[] tableBoundingBorders, int largeTableIndexOffset)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TableBordersapplyBottomTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean reverse)protected TableBordersapplyBottomTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean isEmpty, boolean force, boolean reverse)protected TableBordersapplyCellIndents(Rectangle box, float topIndent, float rightIndent, float bottomIndent, float leftIndent, boolean reverse)protected TableBordersapplyLeftAndRightTableBorder(Rectangle layoutBox, boolean reverse)protected TableBordersapplyTopTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean reverse)protected TableBordersapplyTopTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean isEmpty, boolean force, boolean reverse)protected voidbuildBordersArrays(CellRenderer cell, int row)protected voidbuildBordersArrays(CellRenderer cell, int row, int col)protected booleancheckAndReplaceBorderInArray(java.util.List<java.util.List<Border>> borderArray, int i, int j, Border borderToAdd, boolean hasPriority)protected TableBorderscollapseTableWithFooter(TableBorders footerBordersHandler, boolean hasContent)protected TableBorderscollapseTableWithHeader(TableBorders headerBordersHandler, boolean updateBordersHandler)protected TableBordersdrawHorizontalBorder(PdfCanvas canvas, TableBorderDescriptor borderDescriptor)protected TableBordersdrawVerticalBorder(PdfCanvas canvas, TableBorderDescriptor borderDescriptor)protected TableBordersfixHeaderOccupiedArea(Rectangle occupiedBox, Rectangle layoutBox)java.util.List<Border>getBottomBorderCollapseWith()float[]getCellBorderIndents(int row, int col, int rowspan, int colspan)protected floatgetCellVerticalAddition(float[] indents)static BordergetCollapsedBorder(Border cellBorder, Border tableBorder)Returns the collapsed border.static java.util.List<Border>getCollapsedList(java.util.List<Border> innerList, java.util.List<Border> outerList)(package private) java.util.List<Border>getCrossingBorders(int horizontalIndex, int verticalIndex)Returns theBorderinstances, which intersect in the specified point.java.util.List<Border>getHorizontalBorder(int index)java.util.List<Border>getTopBorderCollapseWith()java.util.List<Border>getVerticalBorder(int index)java.util.List<Border>getVerticalBordersCrossingTopHorizontalBorder()Gets vertical borders which cross the top horizontal border.private floatgetWidestBorderWidth(Border... borders)Gets the width of the widest border in the specified list.private static booleanisBorderWider(Border thisBorder, Border otherBorder)Compares borders and defines whether this border is wider than the other.private static booleanisBorderWider(Border thisBorder, Border otherBorder, boolean strict)Compares borders and defines whether this border is wider than the other.CollapsedTableBorderssetBottomBorderCollapseWith(java.util.List<Border> bottomBorderCollapseWith, java.util.List<Border> verticalBordersCrossingBottomBorder)CollapsedTableBorderssetTopBorderCollapseWith(java.util.List<Border> topBorderCollapseWith)protected TableBordersskipFooter(Border[] borders)protected TableBordersskipHeader(Border[] borders)protected TableBordersupdateBordersOnNewPage(boolean isOriginalNonSplitRenderer, boolean isFooterOrHeader, TableRenderer currentRenderer, TableRenderer headerRenderer, TableRenderer footerRenderer)-
Methods inherited from class com.itextpdf.layout.renderer.TableBorders
getFinishRow, getFirstHorizontalBorder, getFirstVerticalBorder, getLastHorizontalBorder, getLastVerticalBorder, getLeftBorderMaxWidth, getMaxBottomWidth, getMaxLeftWidth, getMaxRightWidth, getMaxTopWidth, getNumberOfColumns, getRightBorderMaxWidth, getStartRow, getTableBoundingBorders, getWidestHorizontalBorder, getWidestHorizontalBorder, getWidestVerticalBorder, getWidestVerticalBorder, initializeBorders, processAllBordersAndEmptyRows, setFinishRow, setRowRange, setStartRow, setTableBoundingBorders
-
-
-
-
Field Detail
-
topBorderCollapseWith
private java.util.List<Border> topBorderCollapseWith
Horizontal borders to be collapsed with the first-on-the-area row's cell top borders of this TableRenderer instance.
-
bottomBorderCollapseWith
private java.util.List<Border> bottomBorderCollapseWith
Horizontal borders to be collapsed with the last-on-the-area row's cell bottom borders of this TableRenderer instance.
-
verticalBottomBorderCollapseWith
private java.util.List<Border> verticalBottomBorderCollapseWith
Vertical borders to be collapsed with the last-on-the-area row's cell bottom borders of this TableRenderer instance.
-
borderComparator
private static java.util.Comparator<Border> borderComparator
-
verticalBorderComputationResult
private final java.util.Map<java.lang.Integer,java.util.List<Border>> verticalBorderComputationResult
-
-
Constructor Detail
-
CollapsedTableBorders
public CollapsedTableBorders(java.util.List<CellRenderer[]> rows, int numberOfColumns, Border[] tableBoundingBorders)
-
CollapsedTableBorders
public CollapsedTableBorders(java.util.List<CellRenderer[]> rows, int numberOfColumns, Border[] tableBoundingBorders, int largeTableIndexOffset)
-
-
Method Detail
-
getTopBorderCollapseWith
public java.util.List<Border> getTopBorderCollapseWith()
-
getBottomBorderCollapseWith
public java.util.List<Border> getBottomBorderCollapseWith()
-
getCellBorderIndents
public float[] getCellBorderIndents(int row, int col, int rowspan, int colspan)- Overrides:
getCellBorderIndentsin classTableBorders
-
getVerticalBordersCrossingTopHorizontalBorder
public java.util.List<Border> getVerticalBordersCrossingTopHorizontalBorder()
Gets vertical borders which cross the top horizontal border.- Returns:
- vertical borders which cross the top horizontal border
-
getVerticalBorder
public java.util.List<Border> getVerticalBorder(int index)
- Specified by:
getVerticalBorderin classTableBorders
-
getHorizontalBorder
public java.util.List<Border> getHorizontalBorder(int index)
- Specified by:
getHorizontalBorderin classTableBorders
-
setTopBorderCollapseWith
public CollapsedTableBorders setTopBorderCollapseWith(java.util.List<Border> topBorderCollapseWith)
-
setBottomBorderCollapseWith
public CollapsedTableBorders setBottomBorderCollapseWith(java.util.List<Border> bottomBorderCollapseWith, java.util.List<Border> verticalBordersCrossingBottomBorder)
-
buildBordersArrays
protected void buildBordersArrays(CellRenderer cell, int row, int col)
- Specified by:
buildBordersArraysin classTableBorders
-
buildBordersArrays
protected void buildBordersArrays(CellRenderer cell, int row)
-
checkAndReplaceBorderInArray
protected boolean checkAndReplaceBorderInArray(java.util.List<java.util.List<Border>> borderArray, int i, int j, Border borderToAdd, boolean hasPriority)
-
drawHorizontalBorder
protected TableBorders drawHorizontalBorder(PdfCanvas canvas, TableBorderDescriptor borderDescriptor)
- Specified by:
drawHorizontalBorderin classTableBorders
-
drawVerticalBorder
protected TableBorders drawVerticalBorder(PdfCanvas canvas, TableBorderDescriptor borderDescriptor)
- Specified by:
drawVerticalBorderin classTableBorders
-
getCollapsedBorder
public static Border getCollapsedBorder(Border cellBorder, Border tableBorder)
Returns the collapsed border. We process collapse if the table border width is strictly greater than cell border width.- Parameters:
cellBorder- cell bordertableBorder- table border- Returns:
- the collapsed border
-
getCollapsedList
public static java.util.List<Border> getCollapsedList(java.util.List<Border> innerList, java.util.List<Border> outerList)
-
applyLeftAndRightTableBorder
protected TableBorders applyLeftAndRightTableBorder(Rectangle layoutBox, boolean reverse)
- Specified by:
applyLeftAndRightTableBorderin classTableBorders
-
applyTopTableBorder
protected TableBorders applyTopTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean isEmpty, boolean force, boolean reverse)
- Specified by:
applyTopTableBorderin classTableBorders
-
applyBottomTableBorder
protected TableBorders applyBottomTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean isEmpty, boolean force, boolean reverse)
- Specified by:
applyBottomTableBorderin classTableBorders
-
applyTopTableBorder
protected TableBorders applyTopTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean reverse)
- Specified by:
applyTopTableBorderin classTableBorders
-
applyBottomTableBorder
protected TableBorders applyBottomTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean reverse)
- Specified by:
applyBottomTableBorderin classTableBorders
-
applyCellIndents
protected TableBorders applyCellIndents(Rectangle box, float topIndent, float rightIndent, float bottomIndent, float leftIndent, boolean reverse)
- Specified by:
applyCellIndentsin classTableBorders
-
getCellVerticalAddition
protected float getCellVerticalAddition(float[] indents)
- Specified by:
getCellVerticalAdditionin classTableBorders
-
updateBordersOnNewPage
protected TableBorders updateBordersOnNewPage(boolean isOriginalNonSplitRenderer, boolean isFooterOrHeader, TableRenderer currentRenderer, TableRenderer headerRenderer, TableRenderer footerRenderer)
- Specified by:
updateBordersOnNewPagein classTableBorders
-
skipFooter
protected TableBorders skipFooter(Border[] borders)
- Specified by:
skipFooterin classTableBorders
-
skipHeader
protected TableBorders skipHeader(Border[] borders)
- Specified by:
skipHeaderin classTableBorders
-
collapseTableWithFooter
protected TableBorders collapseTableWithFooter(TableBorders footerBordersHandler, boolean hasContent)
- Specified by:
collapseTableWithFooterin classTableBorders
-
collapseTableWithHeader
protected TableBorders collapseTableWithHeader(TableBorders headerBordersHandler, boolean updateBordersHandler)
- Specified by:
collapseTableWithHeaderin classTableBorders
-
fixHeaderOccupiedArea
protected TableBorders fixHeaderOccupiedArea(Rectangle occupiedBox, Rectangle layoutBox)
- Specified by:
fixHeaderOccupiedAreain classTableBorders
-
getCrossingBorders
java.util.List<Border> getCrossingBorders(int horizontalIndex, int verticalIndex)
Returns theBorderinstances, which intersect in the specified point.The order of the borders: first the left one, then the top, the right and the bottom ones.
- Parameters:
horizontalIndex- index of horizontal borderverticalIndex- index of vertical border- Returns:
- a list of
Borderinstances, which intersect in the specified point
-
getWidestBorderWidth
private float getWidestBorderWidth(Border... borders)
Gets the width of the widest border in the specified list.- Parameters:
borders- the borders which widths should be considered- Returns:
- the width of the widest border in the specified list
-
isBorderWider
private static boolean isBorderWider(Border thisBorder, Border otherBorder)
Compares borders and defines whether this border is wider than the other.Note that by default the comparison will be strict, e.g. if this border is of the same width as the other border, then false will be returned.
- Parameters:
thisBorder- this borderotherBorder- the other border to be compared with- Returns:
- whether this border is wider than the other
-
isBorderWider
private static boolean isBorderWider(Border thisBorder, Border otherBorder, boolean strict)
Compares borders and defines whether this border is wider than the other.- Parameters:
thisBorder- this borderotherBorder- the other border to be compared withstrict- if true, then in case this border is of the same width as the other border, true will be returned. If false, it will be checked whether the width of this border is strictly greater than the other border's width- Returns:
- whether this border is wider than the other
-
-