Class CollapsedTableBorders

    • 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
    • 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 class TableBorders
      • 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
      • setBottomBorderCollapseWith

        public CollapsedTableBorders setBottomBorderCollapseWith​(java.util.List<Border> bottomBorderCollapseWith,
                                                                 java.util.List<Border> verticalBordersCrossingBottomBorder)
      • buildBordersArrays

        protected void buildBordersArrays​(CellRenderer cell,
                                          int row,
                                          boolean isNeighbourCell)
      • checkAndReplaceBorderInArray

        protected boolean checkAndReplaceBorderInArray​(java.util.List<java.util.List<Border>> borderArray,
                                                       int i,
                                                       int j,
                                                       Border borderToAdd,
                                                       boolean hasPriority)
      • 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 border
        tableBorder - table border
        Returns:
        the collapsed border
      • getCollapsedList

        public static java.util.List<Border> getCollapsedList​(java.util.List<Border> innerList,
                                                              java.util.List<Border> outerList)
      • getCrossingBorders

        java.util.List<Border> getCrossingBorders​(int horizontalIndex,
                                                  int verticalIndex)
        Returns the Border 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 border
        verticalIndex - 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 border
        otherBorder - 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 border
        otherBorder - the other border to be compared with
        strict - 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