Class HorizAlignTextBuilderImpl

    • Constructor Detail

      • HorizAlignTextBuilderImpl

        public HorizAlignTextBuilderImpl()
    • 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 HorizAlignTextBuilder
        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 HorizAlignTextBuilder
        Parameters:
        aFillChar - The fill char to be stored by the align text mode property.
      • toStrings

        public java.lang.String[] toStrings()
        The Strings being build by the builder upon the settings of the attributes.
        Specified by:
        toStrings in interface TextAccessor.TextProvider
        Returns:
        The according resulting String array
      • toAlign

        protected static java.lang.String toAlign​(java.lang.String aText,
                                                  int aLength,
                                                  char aFillChar,
                                                  HorizAlignTextMode aHorizAlignTextMode)
        Fills a text up on by appending the given char to the left and the right till the given length is reached.
        Parameters:
        aText - The text to be filled up or aligned.
        aLength - 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..
      • toAlignLeft

        protected static java.lang.String toAlignLeft​(java.lang.String aText,
                                                      int aLength,
                                                      char aFillChar)
        Fills a text up on by appending the given char to the right till the given length is reached (align left).
        Parameters:
        aText - The text to be filled up.
        aLength - The length to be reached.
        aFillChar - The char to be used for filling up
        Returns:
        A String filled up on the right hand side with the given char.
      • toAlignRight

        protected static java.lang.String toAlignRight​(java.lang.String aText,
                                                       int aLength,
                                                       char aFillChar)
        Fills a text up by prepending the given char to the left till the given length is reached (align right).
        Parameters:
        aText - The text to be filled up.
        aLength - The length to be reached.
        aFillChar - The char to be used for filling up
        Returns:
        A String filled up on the left hand side with the given char.
      • toAlignCenter

        protected static java.lang.String toAlignCenter​(java.lang.String aText,
                                                        int aLength,
                                                        char aFillChar)
        Fills a text up on by appending the given char to the left and the right till the given length is reached (align center).
        Parameters:
        aText - The text to be filled up.
        aLength - The length to be reached.
        aFillChar - The char to be used for filling up
        Returns:
        A String filled up on the left and right hand side with the given char.
      • toAlignBlock

        protected static java.lang.String toAlignBlock​(java.lang.String aText,
                                                       int aLength,
                                                       char aFillChar)
        Fills a text up on by adding the given char to occurrences of the given char round robin till given length is reached (block mode).
        Parameters:
        aText - The text to be filled up.
        aLength - The length to be reached.
        aFillChar - The char to be used for filling up
        Returns:
        A String filled up in block mode with the given char.
      • toAlign

        protected static java.lang.String[] toAlign​(java.lang.String[] aText,
                                                    int aLength,
                                                    char aFillChar,
                                                    HorizAlignTextMode aHorizAlignTextMode)
        To align.
        Parameters:
        aText - the text
        aLength - the length
        aFillChar - the fill char
        aHorizAlignTextMode - the horiz align text mode
        Returns:
        the string[]
        See Also:
        except applied to arrays.
      • 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