Class HorizAlignTextBuilder

    • Constructor Detail

      • HorizAlignTextBuilder

        public HorizAlignTextBuilder()
    • Method Detail

      • withColumnWidth

        public HorizAlignTextBuilder withColumnWidth​(int aColumnWidth)
        Specified by:
        withColumnWidth in interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<HorizAlignTextBuilder>
      • setColumnWidth

        public void setColumnWidth​(int aColumnWidth)
        Specified by:
        setColumnWidth in interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator
      • getColumnWidth

        public int getColumnWidth()
        Specified by:
        getColumnWidth in interface org.refcodes.mixin.ColumnWidthAccessor
      • getHorizAlignTextMode

        public HorizAlignTextMode getHorizAlignTextMode()
        Retrieves the horizontal align text mode from the horizontal align text mode property.
        Specified by:
        getHorizAlignTextMode in interface HorizAlignTextModeAccessor
        Returns:
        The horizontal align text mode stored by the horizontal align text mode property.
      • getFillChar

        public char getFillChar()
        Retrieves the fill char from the fill char property.
        Specified by:
        getFillChar in interface FillCharAccessor
        Returns:
        The fill char stored by the fill char property.
      • setFillChar

        public void setFillChar​(char aFillChar)
        Sets the fill char for the fill char property.
        Specified by:
        setFillChar in interface FillCharAccessor.FillCharMutator
        Parameters:
        aFillChar - The fill char to be stored by the fill char property.
      • asAligned

        public static String asAligned​(String aText,
                                       int aColumnWidth,
                                       HorizAlignTextMode aHorizAlignTextMode)
        Fills a text up as of the provided HorizAlignTextMode with a space " " till the given length is reached. It is assumed that the text does not contain any ANSI escape codes, else use the according method with the ANSI escape code flag.
        Parameters:
        aText - The text to be filled up or aligned.
        aColumnWidth - The length to be reached.
        aHorizAlignTextMode - the horiz align text mode
        Returns:
        A String filled up with the given char till the width is reached or the String untouched in case no HorizAlignTextMode parameter has been provided..
      • asAligned

        public static String asAligned​(String aText,
                                       int aColumnWidth,
                                       char aFillChar,
                                       HorizAlignTextMode aHorizAlignTextMode)
        Fills a text up as of the provided HorizAlignTextMode with the give fill character till the given length is reached. It is assumed that the text does not contain any ANSI escape codes, else use the according method with the ANSI escape code flag.
        Parameters:
        aText - The text to be filled up or aligned.
        aColumnWidth - The length to be reached.
        aFillChar - The char to be used for filling up
        aHorizAlignTextMode - the horiz align text mode
        Returns:
        A String filled up with the given char till the width is reached or the String untouched in case no HorizAlignTextMode parameter has been provided..
      • asAligned

        public static String[] asAligned​(String[] aText,
                                         int aColumnWidth,
                                         char aFillChar,
                                         HorizAlignTextMode aHorizAlignTextMode)
        Fills a text up as of the provided HorizAlignTextMode with the give fill character till the given length is reached. It is assumed that the text does not contain any ANSI escape codes, else use the according method with the ANSI escape code flag.
        Parameters:
        aText - The text array to be filled up or aligned.
        aColumnWidth - The length to be reached.
        aFillChar - The char to be used for filling up
        aHorizAlignTextMode - the horiz align text mode
        Returns:
        A String filled up with the given char till the width is reached or the String untouched in case no HorizAlignTextMode parameter has been provided..
      • asAligned

        public static String asAligned​(String aText,
                                       int aColumnWidth,
                                       HorizAlignTextMode aHorizAlignTextMode,
                                       boolean hasAnsiEscapeCodes)
        Fills a text up as of the provided HorizAlignTextMode with a space " " character till the given length is reached.
        Parameters:
        aText - The text to be filled up or aligned.
        aColumnWidth - The length to be reached.
        aHorizAlignTextMode - the horiz align text mode
        hasAnsiEscapeCodes - Whether to take any (non printable) ANSI escape codes into account which would, when not being considered, cause wrong results.
        Returns:
        A String filled up with the given char till the width is reached or the String untouched in case no HorizAlignTextMode parameter has been provided..
      • asAligned

        public static String asAligned​(String aText,
                                       int aColumnWidth,
                                       char aFillChar,
                                       HorizAlignTextMode aHorizAlignTextMode,
                                       boolean hasAnsiEscapeCodes)
        Fills a text up as of the provided HorizAlignTextMode with the give fill character till the given length is reached.
        Parameters:
        aText - The text to be filled up or aligned.
        aColumnWidth - The length to be reached.
        aFillChar - The char to be used for filling up
        aHorizAlignTextMode - the horiz align text mode
        hasAnsiEscapeCodes - Whether to take any (non printable) ANSI escape codes into account which would, when not being considered, cause wrong results.
        Returns:
        A String filled up with the given char till the width is reached or the String untouched in case no HorizAlignTextMode parameter has been provided..
      • asAligned

        public static String[] asAligned​(String[] aText,
                                         int aColumnWidth,
                                         char aFillChar,
                                         HorizAlignTextMode aHorizAlignTextMode,
                                         boolean hasAnsiEscapeCodes)
        Fills a text up as of the provided HorizAlignTextMode with the give fill character till the given length is reached.
        Parameters:
        aText - The text array to be filled up or aligned.
        aColumnWidth - The length to be reached.
        aFillChar - The char to be used for filling up
        aHorizAlignTextMode - the horiz align text mode
        hasAnsiEscapeCodes - Whether to take any (non printable) ANSI escape codes into account which would, when not being considered, cause wrong results.
        Returns:
        A String filled up with the given char till the width is reached or the String untouched in case no HorizAlignTextMode parameter has been provided..
      • 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