Class VertAlignTextBuilder

    • Constructor Detail

      • VertAlignTextBuilder

        public VertAlignTextBuilder()
    • Method Detail

      • build

        public VertAlignTextBuilder build()
        This is a convenience method for easily instantiating the according builder.
        Returns:
        an instance (using a default implementation) of this builder
      • getFillChar

        public char getFillChar()
        Retrieves the fill char from the fill char property.
        Returns:
        The fill char stored by the fill char property.
      • getRowHeight

        public int getRowHeight()
        Specified by:
        getRowHeight in interface org.refcodes.mixin.RowHeightAccessor
      • getVertAlignTextMode

        public VertAlignTextMode getVertAlignTextMode()
        Retrieves the vertical align text mode from the vertical align text mode property.
        Specified by:
        getVertAlignTextMode in interface VertAlignTextModeAccessor
        Returns:
        The vertical align text mode stored by the vertical align text mode property.
      • isEscapeCodesEnabled

        public boolean isEscapeCodesEnabled()
        Specified by:
        isEscapeCodesEnabled in interface org.refcodes.mixin.EscapeCodesStatusAccessor
      • setEscapeCodesEnabled

        public void setEscapeCodesEnabled​(boolean isEscCodesEnabled)
        Specified by:
        setEscapeCodesEnabled in interface org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusMutator
      • setFillChar

        public void setFillChar​(char aFillChar)
        Sets the fill char for the fill char property.
        Parameters:
        aFillChar - The fill char to be stored by the align text mode property.
      • setRowHeight

        public void setRowHeight​(int aRowHeight)
        Specified by:
        setRowHeight in interface org.refcodes.mixin.RowHeightAccessor.RowHeightMutator
      • withEscapeCodesEnabled

        public VertAlignTextBuilder withEscapeCodesEnabled​(boolean isEscCodesEnabled)
        Specified by:
        withEscapeCodesEnabled in interface org.refcodes.mixin.EscapeCodesStatusAccessor.EscapeCodeStatusBuilder<VertAlignTextBuilder>
      • withFillChar

        public VertAlignTextBuilder withFillChar​(char aFillChar)
        Sets the fill char for the fill char property.
        Parameters:
        aFillChar - The fill char to be stored by the align text mode property.
        Returns:
        The builder for applying multiple build operations.
      • asAligned

        public static String[] asAligned​(String[] aTextBlock,
                                         int aHeight,
                                         char aFillChar,
                                         VertAlignTextMode aVertAlignTextMode)
        Fills up or truncates a given text block to the provided height; filling up or truncating depends on the VertAlignTextMode specified, . When filling up, the provided fill char is used.
        Parameters:
        aTextBlock - The text block to be filled up / truncated.
        aHeight - The height of the resulting text block.
        aFillChar - the fill char to use when filling up.
        aVertAlignTextMode - The mode on how to fill up the text block. The mode can be VertAlignTextMode.BOTTOM, VertAlignTextMode.MIDDLE or VertAlignTextMode.TOP
        Returns:
        The text block filled up / truncated to the required height.
      • asAligned

        public static String[] asAligned​(String[] aTextBlock,
                                         int aHeight,
                                         VertAlignTextMode aVertAlignTextMode)
        Fills up or truncates a given text block to the provided height; filling up or truncating depends on the VertAlignTextMode specified. When filling up, a space (" ") character as fill char is used.
        Parameters:
        aTextBlock - The text block to be filled up / truncated.
        aHeight - The height of the resulting text block.
        aVertAlignTextMode - The mode on how to fill up the text block. The mode can be VertAlignTextMode.BOTTOM, VertAlignTextMode.MIDDLE or VertAlignTextMode.TOP
        Returns:
        The text block filled up / truncated to the required height.
      • asAligned

        public static String[] asAligned​(String[] aTextBlock,
                                         int aHeight,
                                         VertAlignTextMode aVertAlignTextMode,
                                         boolean isEscCodesEnabled)
        Fills up or truncates a given text block to the provided height; filling up or truncating depends on the VertAlignTextMode specified. When filling up, a space (" ") character as fill char is used.
        Parameters:
        aTextBlock - The text block to be filled up / truncated.
        aHeight - The height of the resulting text block.
        aVertAlignTextMode - The mode on how to fill up the text block. The mode can be VertAlignTextMode.BOTTOM, VertAlignTextMode.MIDDLE or VertAlignTextMode.TOP
        isEscCodesEnabled - True in case ANSI escape codes are to be regarded when calculating text lengths (they do not count).
        Returns:
        The text block filled up / truncated to the required height.
      • asAligned

        public static String[] asAligned​(String[] aTextBlock,
                                         int aHeight,
                                         char aFillChar,
                                         VertAlignTextMode aVertAlignTextMode,
                                         boolean isEscCodesEnabled)
        Fills up or truncates a given text block to the provided height; filling up or truncating depends on the VertAlignTextMode specified, . When filling up, the provided fill char is used.
        Parameters:
        aTextBlock - The text block to be filled up / truncated.
        aHeight - The height of the resulting text block.
        aFillChar - the fill char to use when filling up.
        aVertAlignTextMode - The mode on how to fill up the text block. The mode can be VertAlignTextMode.BOTTOM, VertAlignTextMode.MIDDLE or VertAlignTextMode.TOP
        isEscCodesEnabled - True in case ANSI escape codes are to be regarded when calculating text lengths (they do not count).
        Returns:
        The text block filled up / truncated to the required height.
      • 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