Class TextBorderBuilder

    • Constructor Detail

      • TextBorderBuilder

        public TextBorderBuilder()
    • Method Detail

      • withBorderChar

        public TextBorderBuilder withBorderChar​(char aBorderChar)
        Sets the border char for the border char property.
        Parameters:
        aBorderChar - The border char to be stored by the text align mode property.
        Returns:
        The builder for applying multiple build operations.
      • withBorderWidth

        public TextBorderBuilder withBorderWidth​(int aBorderWidth)
        Sets the border width for the border width property.
        Parameters:
        aBorderWidth - The border width to be stored by the text align mode property.
        Returns:
        The builder for applying multiple build operations.
      • getBoxBorderMode

        public org.refcodes.graphical.BoxBorderMode getBoxBorderMode()
        Specified by:
        getBoxBorderMode in interface org.refcodes.graphical.BoxBorderModeAccessor
      • setBoxBorderMode

        public void setBoxBorderMode​(org.refcodes.graphical.BoxBorderMode aBoxBorderMode)
        Specified by:
        setBoxBorderMode in interface org.refcodes.graphical.BoxBorderModeAccessor.BoxBorderModeMutator
      • withBoxBorderMode

        public TextBorderBuilder withBoxBorderMode​(org.refcodes.graphical.BoxBorderMode aBoxBorderMode)
        Specified by:
        withBoxBorderMode in interface org.refcodes.graphical.BoxBorderModeAccessor.BoxBorderModeBuilder<TextBorderBuilder>
      • getBorderChar

        public char getBorderChar()
        Retrieves the border char from the border char property.
        Returns:
        The border char stored by the border char property.
      • setBorderChar

        public void setBorderChar​(char aBorderChar)
        Sets the border char for the border char property.
        Parameters:
        aBorderChar - The border char to be stored by the text align mode property.
      • getBorderWidth

        public int getBorderWidth()
        Retrieves the border width from the border width property.
        Returns:
        The border width stored by the border width property.
      • setBorderWidth

        public void setBorderWidth​(int aBorderWidth)
        Sets the border width for the border width property.
        Parameters:
        aBorderWidth - The border width to be stored by the text align mode property.
      • toLeftBorder

        protected static String[] toLeftBorder​(String[] aText,
                                               int aBorderWidth,
                                               char aBorderChar)
        Adds the according border with the given char and the provided witdh to the provided text.
        Parameters:
        aText - The text to which the border is to be applied.
        aBorderWidth - The width of the border to be drawn.
        aBorderChar - The character of the border to be drawn.
        Returns:
        The text with the according border being applied.
      • toRightBorder

        protected static String[] toRightBorder​(String[] aText,
                                                int aBorderWidth,
                                                char aBorderChar)
        Adds the according border with the given char and the provided width to the provided text.
        Parameters:
        aText - The text to which the border is to be applied.
        aBorderWidth - The width of the border to be drawn.
        aBorderChar - The character of the border to be drawn.
        Returns:
        The text with the according border being applied.
      • toTopBorder

        protected static String[] toTopBorder​(String[] aText,
                                              int aBorderWidth,
                                              char aBorderChar)
        Adds the according border with the given char and the provided width to the provided text.
        Parameters:
        aText - The text to which the border is to be applied.
        aBorderWidth - The width of the border to be drawn.
        aBorderChar - The character of the border to be drawn.
        Returns:
        The text with the according border being applied.
      • toBottomBorder

        protected static String[] toBottomBorder​(String[] aText,
                                                 int aBorderWidth,
                                                 char aBorderChar)
        Adds the according border with the given char and the provided width to the provided text.
        Parameters:
        aText - The text to which the border is to be applied.
        aBorderWidth - The width of the border to be drawn.
        aBorderChar - The character of the border to be drawn.
        Returns:
        The text with the according border being applied.
      • toBorder

        public static String[] toBorder​(String[] aText,
                                        int aBorderWidth,
                                        char aBorderChar,
                                        org.refcodes.graphical.BoxBorderMode aBoxBorderMode)
        Adds the according border with the given char and the provided width to the provided text.
        Parameters:
        aText - The text to which the border is to be applied.
        aBorderWidth - The width of the border to be drawn.
        aBorderChar - The character of the border to be drawn.
        aBoxBorderMode - the box border mode
        Returns:
        The text with the according border being applied.
      • toBorder

        protected static String[] toBorder​(String[] aText,
                                           char aTopLeftBorderChar,
                                           char aTopRightBorderChar,
                                           char aBottomLeftBorderChar,
                                           char aBottomRightBorderChar,
                                           char aTopBorderChar,
                                           char aRightBorderChar,
                                           char aBottomBorderChar,
                                           char aLeftBorderChar,
                                           org.refcodes.graphical.BoxBorderMode aBoxBorderMode)
        Adds a predefined border according border to the provided text.
        Parameters:
        aText - The text to which the border is to be applied.
        aTopLeftBorderChar - The top left border's character.
        aTopRightBorderChar - The top right border's character.
        aBottomLeftBorderChar - The bottom left border's character.
        aBottomRightBorderChar - The bottom right border's character.
        aTopBorderChar - the top border char
        aRightBorderChar - the right border char
        aBottomBorderChar - the bottom border char
        aLeftBorderChar - the left border char
        aBoxBorderMode - the box border mode
        Returns:
        The text with the according border being applied.
      • toSingleBorder

        protected static String[] toSingleBorder​(String[] aText)
        Adds a predefined "single-line" border to the provided text.
        Parameters:
        aText - The text to which the border is to be applied.
        Returns:
        The text with the according border being applied.
      • toDoubleBorder

        protected static String[] toDoubleBorder​(String[] aText)
        Adds a predefined "double-line" border to the provided text.
        Parameters:
        aText - The text to which the border is to be applied.
        Returns:
        The text with the according border being applied.
      • toAsciiBorder

        protected static String[] toAsciiBorder​(String[] aText)
        Adds a predefined "single-line" border to the provided text.
        Parameters:
        aText - The text to which the border is to be applied.
        Returns:
        The text with the according border being applied.
      • toLine

        protected static String toLine​(int aLength,
                                       char aFillChar)
        Returns a String with the given length and containing only the provided fill character.
        Parameters:
        aLength - The length to be reached.
        aFillChar - The char to be used for filling up
        Returns:
        The String filled with the fill character till the provided length.
      • getText

        public String[] getText()
        Retrieves the text from the text property.
        Specified by:
        getText in interface TextAccessor
        Returns:
        The text stored by the text property.
      • setText

        public void setText​(String... aText)
        Sets the text for the text property.
        Specified by:
        setText in interface TextAccessor.TextMutator
        Parameters:
        aText - The text to be stored by the text property.
      • toString

        public String toString()
        The String being build by the builder upon the settings of the attributes. In case more then one line has been set as input and the functionality of the builder is applied to each line in separate, then this method returns all of them lines concatenated with a line break between each of them (implementation depended).
        Specified by:
        toString in interface TextAccessor.TextProvider
        Overrides:
        toString in class Object
        Returns:
        The according resulting String