Class TextBorderBuilderImpl

    • Constructor Detail

      • TextBorderBuilderImpl

        public TextBorderBuilderImpl​()
    • Method Detail

      • 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.
        Specified by:
        getBorderChar in interface TextBorderBuilder
        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.
        Specified by:
        setBorderChar in interface TextBorderBuilder
        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.
        Specified by:
        getBorderWidth in interface TextBorderBuilder
        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.
        Specified by:
        setBorderWidth in interface TextBorderBuilder
        Parameters:
        aBorderWidth - The border width to be stored by the text align mode property.
      • toLeftBorder

        protected static java.lang.String[] toLeftBorder​(java.lang.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 java.lang.String[] toRightBorder​(java.lang.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 java.lang.String[] toTopBorder​(java.lang.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 java.lang.String[] toBottomBorder​(java.lang.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

        protected static java.lang.String[] toBorder​(java.lang.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 java.lang.String[] toBorder​(java.lang.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 java.lang.String[] toSingleBorder​(java.lang.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 java.lang.String[] toDoubleBorder​(java.lang.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 java.lang.String[] toAsciiBorder​(java.lang.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 java.lang.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 java.lang.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​(java.lang.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.
      • withText

        public B withText​(java.lang.String... aText)
        With text.
        Specified by:
        withText in interface Text<B extends Text<B>>
        Specified by:
        withText in interface TextAccessor.TextBuilder<B extends Text<B>>
        Parameters:
        aText - the text
        Returns:
        the b
      • withText

        public B withText​(java.util.Collection<java.lang.String> aText)
        With text.
        Specified by:
        withText in interface TextAccessor.TextBuilder<B extends Text<B>>
        Parameters:
        aText - the text
        Returns:
        the b
      • toString

        public java.lang.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 java.lang.Object
        Returns:
        The according resulting String