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 class
CollapsedTableBorders.BorderComparator
A comparison function to compare twoBorder
instances.
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Comparator<Border>
borderComparator
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.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.private java.util.Map<java.lang.Integer,java.util.List<Border>>
verticalBorderComputationResult
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.-
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 TableBorders
applyBottomTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean reverse)
protected TableBorders
applyBottomTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean isEmpty, boolean force, boolean reverse)
protected TableBorders
applyCellIndents(Rectangle box, float topIndent, float rightIndent, float bottomIndent, float leftIndent, boolean reverse)
protected TableBorders
applyLeftAndRightTableBorder(Rectangle layoutBox, boolean reverse)
protected TableBorders
applyTopTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean reverse)
protected TableBorders
applyTopTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean isEmpty, boolean force, boolean reverse)
protected void
buildBordersArrays(CellRenderer cell, int row)
protected void
buildBordersArrays(CellRenderer cell, int row, int col)
protected boolean
checkAndReplaceBorderInArray(java.util.List<java.util.List<Border>> borderArray, int i, int j, Border borderToAdd, boolean hasPriority)
protected TableBorders
collapseTableWithFooter(TableBorders footerBordersHandler, boolean hasContent)
protected TableBorders
collapseTableWithHeader(TableBorders headerBordersHandler, boolean updateBordersHandler)
protected TableBorders
drawHorizontalBorder(PdfCanvas canvas, TableBorderDescriptor borderDescriptor)
protected TableBorders
drawVerticalBorder(PdfCanvas canvas, TableBorderDescriptor borderDescriptor)
protected TableBorders
fixHeaderOccupiedArea(Rectangle occupiedBox, Rectangle layoutBox)
java.util.List<Border>
getBottomBorderCollapseWith()
float[]
getCellBorderIndents(int row, int col, int rowspan, int colspan)
protected float
getCellVerticalAddition(float[] indents)
static Border
getCollapsedBorder(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 theBorder
instances, 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 float
getWidestBorderWidth(Border... borders)
Gets the width of the widest border in the specified list.private static boolean
isBorderWider(Border thisBorder, Border otherBorder)
Compares borders and defines whether this border is wider than the other.private static boolean
isBorderWider(Border thisBorder, Border otherBorder, boolean strict)
Compares borders and defines whether this border is wider than the other.CollapsedTableBorders
setBottomBorderCollapseWith(java.util.List<Border> bottomBorderCollapseWith, java.util.List<Border> verticalBordersCrossingBottomBorder)
CollapsedTableBorders
setTopBorderCollapseWith(java.util.List<Border> topBorderCollapseWith)
protected TableBorders
skipFooter(Border[] borders)
protected TableBorders
skipHeader(Border[] borders)
protected TableBorders
updateBordersOnNewPage(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:
getCellBorderIndents
in 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:
getVerticalBorder
in classTableBorders
-
getHorizontalBorder
public java.util.List<Border> getHorizontalBorder(int index)
- Specified by:
getHorizontalBorder
in 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:
buildBordersArrays
in 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:
drawHorizontalBorder
in classTableBorders
-
drawVerticalBorder
protected TableBorders drawVerticalBorder(PdfCanvas canvas, TableBorderDescriptor borderDescriptor)
- Specified by:
drawVerticalBorder
in 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:
applyLeftAndRightTableBorder
in classTableBorders
-
applyTopTableBorder
protected TableBorders applyTopTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean isEmpty, boolean force, boolean reverse)
- Specified by:
applyTopTableBorder
in classTableBorders
-
applyBottomTableBorder
protected TableBorders applyBottomTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean isEmpty, boolean force, boolean reverse)
- Specified by:
applyBottomTableBorder
in classTableBorders
-
applyTopTableBorder
protected TableBorders applyTopTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean reverse)
- Specified by:
applyTopTableBorder
in classTableBorders
-
applyBottomTableBorder
protected TableBorders applyBottomTableBorder(Rectangle occupiedBox, Rectangle layoutBox, boolean reverse)
- Specified by:
applyBottomTableBorder
in classTableBorders
-
applyCellIndents
protected TableBorders applyCellIndents(Rectangle box, float topIndent, float rightIndent, float bottomIndent, float leftIndent, boolean reverse)
- Specified by:
applyCellIndents
in classTableBorders
-
getCellVerticalAddition
protected float getCellVerticalAddition(float[] indents)
- Specified by:
getCellVerticalAddition
in classTableBorders
-
updateBordersOnNewPage
protected TableBorders updateBordersOnNewPage(boolean isOriginalNonSplitRenderer, boolean isFooterOrHeader, TableRenderer currentRenderer, TableRenderer headerRenderer, TableRenderer footerRenderer)
- Specified by:
updateBordersOnNewPage
in classTableBorders
-
skipFooter
protected TableBorders skipFooter(Border[] borders)
- Specified by:
skipFooter
in classTableBorders
-
skipHeader
protected TableBorders skipHeader(Border[] borders)
- Specified by:
skipHeader
in classTableBorders
-
collapseTableWithFooter
protected TableBorders collapseTableWithFooter(TableBorders footerBordersHandler, boolean hasContent)
- Specified by:
collapseTableWithFooter
in classTableBorders
-
collapseTableWithHeader
protected TableBorders collapseTableWithHeader(TableBorders headerBordersHandler, boolean updateBordersHandler)
- Specified by:
collapseTableWithHeader
in classTableBorders
-
fixHeaderOccupiedArea
protected TableBorders fixHeaderOccupiedArea(Rectangle occupiedBox, Rectangle layoutBox)
- Specified by:
fixHeaderOccupiedArea
in classTableBorders
-
getCrossingBorders
java.util.List<Border> getCrossingBorders(int horizontalIndex, int verticalIndex)
Returns theBorder
instances, 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
Border
instances, 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
-
-