Class DoubleBorder


  • public class DoubleBorder
    extends Border
    Creates a double border around the element it's set to. The space between the two border lines has the same width as the two borders. If a background has been set on the element the color will show in between the two borders.
    • Constructor Detail

      • DoubleBorder

        public DoubleBorder​(float width)
        Creates a DoubleBorder with the specified width for both the two borders as the space in between them. The color is set to the default: black.
        Parameters:
        width - width of the borders and the space between them
      • DoubleBorder

        public DoubleBorder​(Color color,
                            float width)
        Creates a DoubleBorder with the specified width for both the two borders as the space in between them and the specified color for the two borders. The space in between the two borders is either colorless or will be filled with the background color of the element, if a color has been set.
        Parameters:
        color - The color of the borders
        width - The width of the borders and the space between them
      • DoubleBorder

        public DoubleBorder​(Color color,
                            float width,
                            float opacity)
        Creates a DoubleBorder with the specified width for both the two borders as the space in between them and the specified color for the two borders. The space in between the two borders is either colorless or will be filled with the background color of the element, if a color has been set.
        Parameters:
        color - The color of the borders
        width - The width of the borders and the space between them
        opacity - The opacity
    • Method Detail

      • getType

        public int getType()
        Returns the type of the border
        Specified by:
        getType in class Border
        Returns:
        the type of border.
      • draw

        public void draw​(PdfCanvas canvas,
                         float x1,
                         float y1,
                         float x2,
                         float y2,
                         Border.Side defaultSide,
                         float borderWidthBefore,
                         float borderWidthAfter)
        All borders are supposed to be drawn in such way, that inner content of the element is on the right from the drawing direction. Borders are drawn in this order: top, right, bottom, left.

        Given points specify the line which lies on the border of the content area, therefore the border itself should be drawn to the left from the drawing direction.

        borderWidthBefore and borderWidthAfter parameters are used to define the widths of the borders that are before and after the current border, e.g. for the bottom border, borderWidthBefore specifies width of the right border and borderWidthAfter - width of the left border. Those width are used to handle areas of border joins.

        Specified by:
        draw in class Border
        Parameters:
        canvas - PdfCanvas to be written to
        x1 - x coordinate of the beginning point of the element side, that should be bordered
        y1 - y coordinate of the beginning point of the element side, that should be bordered
        x2 - x coordinate of the ending point of the element side, that should be bordered
        y2 - y coordinate of the ending point of the element side, that should be bordered
        defaultSide - the Border.Side, that we will fallback to, if it cannot be determined by border coordinates
        borderWidthBefore - defines width of the border that is before the current one
        borderWidthAfter - defines width of the border that is after the current one
      • drawCellBorder

        public void drawCellBorder​(PdfCanvas canvas,
                                   float x1,
                                   float y1,
                                   float x2,
                                   float y2,
                                   Border.Side defaultSide)
        Draws the border of a cell.
        Specified by:
        drawCellBorder in class Border
        Parameters:
        canvas - PdfCanvas to be written to
        x1 - x coordinate of the beginning point of the element side, that should be bordered
        y1 - y coordinate of the beginning point of the element side, that should be bordered
        x2 - x coordinate of the ending point of the element side, that should be bordered
        y2 - y coordinate of the ending point of the element side, that should be bordered
        defaultSide - the Border.Side, that we will fallback to, if it cannot be determined by border coordinates