Class TextStyle


  • public final class TextStyle
    extends java.lang.Object
    The definition for styling recommendations blocks of text. Most common usage is to style columns in a table, but may also be used to specify default styling for a HelpAppendable. HelpWriters are free to ignore the TextStyle recommendations particularly where they are not supported or contradict common usage.
    Since:
    1.10.0
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  TextStyle.Alignment
      The alignment possibilities.
      static class  TextStyle.Builder
      The builder for the TextStyle.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static TextStyle DEFAULT
      The default style as generated by the default Builder.
      static int UNSET_MAX_WIDTH
      The unset value for maxWidth: 2147483647.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static TextStyle.Builder builder()
      Creates a new builder.
      TextStyle.Alignment getAlignment()
      Gets the alignment.
      int getIndent()
      Gets the indent value.
      int getLeftPad()
      Gets the left padding.
      int getMaxWidth()
      gets the maximum width.
      int getMinWidth()
      gets the minimum width.
      boolean isScalable()
      Specifies if the column can be made wider or to narrower width to fit constraints of the HelpAppendable and formatting.
      java.lang.CharSequence pad​(boolean addIndent, java.lang.CharSequence text)
      Pads a string to the maximum width or optionally to the maximum width - indent.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getIndent

        public int getIndent()
        Gets the indent value.
        Returns:
        the indent value.
      • getLeftPad

        public int getLeftPad()
        Gets the left padding.
        Returns:
        the left padding.
      • getMaxWidth

        public int getMaxWidth()
        gets the maximum width.
        Returns:
        The maximum width.
      • getMinWidth

        public int getMinWidth()
        gets the minimum width.
        Returns:
        The minimum width.
      • isScalable

        public boolean isScalable()
        Specifies if the column can be made wider or to narrower width to fit constraints of the HelpAppendable and formatting.
        Returns:
        the scaling value.
      • pad

        public java.lang.CharSequence pad​(boolean addIndent,
                                          java.lang.CharSequence text)
        Pads a string to the maximum width or optionally to the maximum width - indent.
        • Returns the string unchanged if it is longer than the specified length.
        • Will add the padding based on the alignment.
        Parameters:
        addIndent - if true account for the indent when padding the string.
        text - the text to pad.
        Returns:
        the padded string.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object