Class ColumnFormatMetrics

java.lang.Object
org.refcodes.textual.ColumnWidthMetrics
org.refcodes.textual.ColumnFormatMetrics
All Implemented Interfaces:
ColumnWidthAccessor, ColumnWidthAccessor.ColumnWidthBuilder<ColumnWidthMetrics>, ColumnWidthAccessor.ColumnWidthMutator, ColumnWidthAccessor.ColumnWidthProperty, HorizAlignTextModeAccessor.HorizAlignTextModeBuilder<ColumnFormatMetrics>, HorizAlignTextModeAccessor.HorizAlignTextModeMutator, MoreTextModeAccessor.MoreTextModeBuilder<ColumnFormatMetrics>, MoreTextModeAccessor.MoreTextModeMutator, SplitTextModeAccessor.SplitTextModeBuilder<ColumnFormatMetrics>, SplitTextModeAccessor.SplitTextModeMutator, TextFormatModeAccessor.TextFormatModeBuilder<ColumnFormatMetrics>, TextFormatModeAccessor.TextFormatModeMutator
Direct Known Subclasses:
ColumnSetupMetrics

  • Constructor Details

    • ColumnFormatMetrics

      public ColumnFormatMetrics()
      Instantiates a new column format metrics.
    • ColumnFormatMetrics

      public ColumnFormatMetrics(int aWidth, ColumnWidthType aWidthType)
      Constructs a column's width, either in percent (%) or in number of chars.
      Parameters:
      aWidth - The width for the column, either in percent (%) or in number of chars, depending on the provided ColumnWidthType.
      aWidthType - The type of the width being provided.
  • Method Details

    • withHeaderEscapeCodeFactory

      public ColumnFormatMetrics withHeaderEscapeCodeFactory(EscapeCodeFactory aEscapeCodeFactory)
      Sets an ANSI Escape-Code factory for the header and the rows and returns this ColumnFormatMetrics instance as of the Builder-Pattern. In case an ANSI Escape-Code has been determined by the EscapeCodeFactory, then the ANSI Escape-Code is prepended and an ANSI Reset-Code is appended to the according text being printed.
      Parameters:
      aEscapeCodeFactory - The EscapeCodeFactory to be used for determining ANSI escaping.
      Returns:
      the column format metrics
    • withRowEscapeCodeFactory

      public ColumnFormatMetrics withRowEscapeCodeFactory(EscapeCodeFactory aEscapeCodeFactory)
      Sets an ANSI Escape-Code factory for the row and the rows and returns this ColumnFormatMetrics instance as of the Builder-Pattern. In case an ANSI Escape-Code has been determined by the EscapeCodeFactory, then the ANSI Escape-Code is prepended and an ANSI Reset-Code is appended to the according text being printed.
      Parameters:
      aEscapeCodeFactory - The EscapeCodeFactory to be used for determining ANSI escaping.
      Returns:
      the column format metrics
    • withColumnWidth

      public ColumnFormatMetrics withColumnWidth(int aColumnWidth)
      Sets the column width and returns this instance as of the Builder-Pattern.
      Specified by:
      withColumnWidth in interface ColumnWidthAccessor.ColumnWidthBuilder<ColumnWidthMetrics>
      Overrides:
      withColumnWidth in class ColumnWidthMetrics
      Parameters:
      aColumnWidth - The column width to be set.
      Returns:
      This instance to continue configuration.
    • withColumnWidthType

      public ColumnFormatMetrics withColumnWidthType(ColumnWidthType aColumnWidthType)
      Sets the column width type and returns this instance as of the Builder-Pattern.
      Overrides:
      withColumnWidthType in class ColumnWidthMetrics
      Parameters:
      aColumnWidthType - The column width type.
      Returns:
      This instance to continue configuration.
    • withEscapeCode

      public ColumnFormatMetrics withEscapeCode(String aEscapeCode)
      Sets an ANSI Escape-Code for the header and the rows and returns this instance as of the Builder-Pattern.
      Parameters:
      aEscapeCode - The String to be used for ANSI escaping.
      Returns:
      This instance to continue configuration.
    • setEscapeCode

      public void setEscapeCode(String aEscapeCode)
      Sets an ANSI Escape-Code for the header and the rows.
      Parameters:
      aEscapeCode - The String to be used for ANSI escaping.
    • withEscapeCodeFactory

      public ColumnFormatMetrics withEscapeCodeFactory(EscapeCodeFactory aEscapeCodeFactory)
      Sets an ANSI Escape-Code factory for the header and the rows and returns this instance as of the Builder-Pattern.
      Parameters:
      aEscapeCodeFactory - The EscapeCodeFactory to be used.
      Returns:
      This instance to continue configuration.
    • setEscapeCodeFactory

      public void setEscapeCodeFactory(EscapeCodeFactory aEscapeCodeFactory)
      Sets an ANSI Escape-Code factory for the header and the rows.
      Parameters:
      aEscapeCodeFactory - The EscapeCodeFactory to be used.
    • withHeaderEscapeCode

      public ColumnFormatMetrics withHeaderEscapeCode(String aEscapeCode)
      Sets an ANSI Escape-Code for the header and returns this instance as of the Builder-Pattern.
      Parameters:
      aEscapeCode - The String to be used for ANSI escaping.
      Returns:
      This instance to continue configuration.
    • setHeaderEscapeCode

      public void setHeaderEscapeCode(String aEscapeCode)
      Sets an ANSI Escape-Code for the header.
      Parameters:
      aEscapeCode - The String to be used for ANSI escaping.
    • getHeaderEscapeCode

      public String getHeaderEscapeCode()
      Returns the ANSI Escape-Code for the header.
      Returns:
      The String to be used for ANSI escaping.
    • withRowEscapeCode

      public ColumnFormatMetrics withRowEscapeCode(String aEscapeCode)
      Sets an ANSI Escape-Code for the rows and returns this instance as of the Builder-Pattern.
      Parameters:
      aEscapeCode - The String to be used for ANSI escaping.
      Returns:
      This instance to continue configuration.
    • setRowEscapeCode

      public void setRowEscapeCode(String aEscapeCode)
      Sets an ANSI Escape-Code for the rows.
      Parameters:
      aEscapeCode - The String to be used for ANSI escaping.
    • getRowEscapeCode

      public String getRowEscapeCode()
      Returns the ANSI Escape-Code for the rows.
      Returns:
      The String to be used for ANSI escaping.
    • setHeaderEscapeCodeFactory

      public void setHeaderEscapeCodeFactory(EscapeCodeFactory aEscapeCodeFactory)
      Sets an ANSI Escape-Code factory for the header.
      Parameters:
      aEscapeCodeFactory - The EscapeCodeFactory to be used.
    • getHeaderEscapeCodeFactory

      public EscapeCodeFactory getHeaderEscapeCodeFactory()
      Gets the ANSI Escape-Code factory for the header.
      Returns:
      The EscapeCodeFactory.
    • toHeaderEscapeCode

      public String toHeaderEscapeCode(Object aIdentifier)
      Determines the ANSI Escape-Code for the header by evaluating the provided identifier.
      Parameters:
      aIdentifier - The identifier for which to lookup an Escape-Code.
      Returns:
      The identified Escape-Code or null.
    • setRowEscapeCodeFactory

      public void setRowEscapeCodeFactory(EscapeCodeFactory aEscapeCodeFactory)
      Sets an ANSI Escape-Code factory for the row.
      Parameters:
      aEscapeCodeFactory - The EscapeCodeFactory to be used.
    • getRowEscapeCodeFactory

      public EscapeCodeFactory getRowEscapeCodeFactory()
      Gets the ANSI Escape-Code factory for the row.
      Returns:
      The EscapeCodeFactory.
    • toRowEscapeCode

      public String toRowEscapeCode(Object aIdentifier)
      Determines the ANSI Escape-Code for the row by evaluating the provided identifier.
      Parameters:
      aIdentifier - The identifier for which to lookup an Escape-Code.
      Returns:
      The identified Escape-Code or null.
    • withHorizAlignTextMode

      public ColumnFormatMetrics withHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
      Sets the horizontal align text mode for the horizontal align text mode property.
      Specified by:
      withHorizAlignTextMode in interface HorizAlignTextModeAccessor.HorizAlignTextModeBuilder<ColumnFormatMetrics>
      Parameters:
      aHorizAlignTextMode - The horizontal align text mode to be stored by the font style property.
      Returns:
      The builder for applying multiple build operations.
    • setHorizAlignTextMode

      public void setHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
      Sets the horizontal align text mode for the horizontal align text mode property.
      Specified by:
      setHorizAlignTextMode in interface HorizAlignTextModeAccessor.HorizAlignTextModeMutator
      Parameters:
      aHorizAlignTextMode - The horizontal align text mode to be stored by the font style property.
    • withHeaderHorizAlignTextMode

      public ColumnFormatMetrics withHeaderHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
      Sets an alignment mode for the header and returns this instance as of the Builder-Pattern.
      Parameters:
      aHorizAlignTextMode - The HorizAlignTextMode to be used for aligning the text.
      Returns:
      This instance to continue configuration.
    • setHeaderHorizAlignTextMode

      public void setHeaderHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
      Sets an alignment mode for the header.
      Parameters:
      aHorizAlignTextMode - The HorizAlignTextMode to be used for aligning the text.
    • getHeaderHorizAlignTextMode

      public HorizAlignTextMode getHeaderHorizAlignTextMode()
      Gets the alignment mode for the header.
      Returns:
      The HorizAlignTextMode.
    • withRowHorizAlignTextMode

      public ColumnFormatMetrics withRowHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
      Sets an alignment mode for the row and returns this instance as of the Builder-Pattern.
      Parameters:
      aHorizAlignTextMode - The HorizAlignTextMode to be used for aligning the text.
      Returns:
      This instance to continue configuration.
    • setRowHorizAlignTextMode

      public void setRowHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
      Sets an alignment mode for the row.
      Parameters:
      aHorizAlignTextMode - The HorizAlignTextMode to be used for aligning the text.
    • getRowHorizAlignTextMode

      public HorizAlignTextMode getRowHorizAlignTextMode()
      Gets the alignment mode for the row.
      Returns:
      The HorizAlignTextMode.
    • withMoreTextMode

      public ColumnFormatMetrics withMoreTextMode(MoreTextMode aMoreTextMode)
      Sets the more-text mode for the more-text mode property.
      Specified by:
      withMoreTextMode in interface MoreTextModeAccessor.MoreTextModeBuilder<ColumnFormatMetrics>
      Parameters:
      aMoreTextMode - The more-text mode to be stored by the more-text mode property.
      Returns:
      The builder for applying multiple build operations.
    • setMoreTextMode

      public void setMoreTextMode(MoreTextMode aMoreTextMode)
      Sets the more-text mode for the more-text mode property.
      Specified by:
      setMoreTextMode in interface MoreTextModeAccessor.MoreTextModeMutator
      Parameters:
      aMoreTextMode - The more-text mode to be stored by the more-text mode property.
    • withHeaderMoreTextMode

      public ColumnFormatMetrics withHeaderMoreTextMode(MoreTextMode aMoreTextMode)
      Sets a more-text mode for the header and returns this instance as of the Builder-Pattern.
      Parameters:
      aMoreTextMode - The MoreTextMode to be used for truncating the text.
      Returns:
      This instance to continue configuration.
    • setHeaderMoreTextMode

      public void setHeaderMoreTextMode(MoreTextMode aMoreTextMode)
      Sets a more-text mode for the header.
      Parameters:
      aMoreTextMode - The MoreTextMode to be used for truncating the text.
    • getHeaderMoreTextMode

      public MoreTextMode getHeaderMoreTextMode()
      Gets the more-text mode for the header.
      Returns:
      The MoreTextMode.
    • withRowMoreTextMode

      public ColumnFormatMetrics withRowMoreTextMode(MoreTextMode aMoreTextMode)
      Sets a more-text mode for the row and returns this instance as of the Builder-Pattern.
      Parameters:
      aMoreTextMode - The MoreTextMode to be used for truncating the text.
      Returns:
      This instance to continue configuration.
    • setRowMoreTextMode

      public void setRowMoreTextMode(MoreTextMode aMoreTextMode)
      Sets a more-text mode for the row.
      Parameters:
      aMoreTextMode - The MoreTextMode to be used for truncating the text.
    • getRowMoreTextMode

      public MoreTextMode getRowMoreTextMode()
      Gets the more-text mode for the row.
      Returns:
      The MoreTextMode.
    • withTextFormatMode

      public ColumnFormatMetrics withTextFormatMode(TextFormatMode aTextFormatMode)
      Sets the text-format mode for the text-format mode property.
      Specified by:
      withTextFormatMode in interface TextFormatModeAccessor.TextFormatModeBuilder<ColumnFormatMetrics>
      Parameters:
      aTextFormatMode - The text-format mode to be stored by the text-format mode property.
      Returns:
      The builder for applying multiple build operations.
    • setTextFormatMode

      public void setTextFormatMode(TextFormatMode aTextFormatMode)
      Sets the text-format mode for the text-format mode property.
      Specified by:
      setTextFormatMode in interface TextFormatModeAccessor.TextFormatModeMutator
      Parameters:
      aTextFormatMode - The text-format mode to be stored by the text-format mode property.
    • withHeaderTextFormatMode

      public ColumnFormatMetrics withHeaderTextFormatMode(TextFormatMode aTextFormatMode)
      Sets the TextFormatMode for the header and returns this instance as of the Builder-Pattern.
      Parameters:
      aTextFormatMode - The TextFormatMode to be set for the header.
      Returns:
      This instance to continue configuration.
    • setHeaderTextFormatMode

      public void setHeaderTextFormatMode(TextFormatMode aTextFormatMode)
      Sets the TextFormatMode for the header.
      Parameters:
      aTextFormatMode - The TextFormatMode to be set for the header.
    • getHeaderTextFormatMode

      public TextFormatMode getHeaderTextFormatMode()
      Returns the TextFormatMode for the header.
      Returns:
      The TextFormatMode.
    • withRowTextFormatMode

      public ColumnFormatMetrics withRowTextFormatMode(TextFormatMode aTextFormatMode)
      Sets the TextFormatMode for the row and returns this instance as of the Builder-Pattern.
      Parameters:
      aTextFormatMode - The TextFormatMode to be set for the row.
      Returns:
      This instance to continue configuration.
    • setRowTextFormatMode

      public void setRowTextFormatMode(TextFormatMode aTextFormatMode)
      Sets the TextFormatMode for the row.
      Parameters:
      aTextFormatMode - The TextFormatMode to be set for the row.
    • getRowTextFormatMode

      public TextFormatMode getRowTextFormatMode()
      Returns the TextFormatMode for the row.
      Returns:
      The TextFormatMode.
    • withSplitTextMode

      public ColumnFormatMetrics withSplitTextMode(SplitTextMode aSplitTextMode)
      Sets the split-text mode for the split-text mode property.
      Specified by:
      withSplitTextMode in interface SplitTextModeAccessor.SplitTextModeBuilder<ColumnFormatMetrics>
      Parameters:
      aSplitTextMode - The split-text mode to be stored by the split-text mode property.
      Returns:
      The builder for applying multiple build operations.
    • setSplitTextMode

      public void setSplitTextMode(SplitTextMode aSplitTextMode)
      Sets the split-text mode for the split-text mode property.
      Specified by:
      setSplitTextMode in interface SplitTextModeAccessor.SplitTextModeMutator
      Parameters:
      aSplitTextMode - The split-text mode to be stored by the split-text mode property.
    • withHeaderSplitTextMode

      public ColumnFormatMetrics withHeaderSplitTextMode(SplitTextMode aSplitTextMode)
      Sets the SplitTextMode for the header and returns this instance as of the Builder-Pattern.
      Parameters:
      aSplitTextMode - The SplitTextMode to be set for the header.
      Returns:
      This instance to continue configuration.
    • setHeaderSplitTextMode

      public void setHeaderSplitTextMode(SplitTextMode aSplitTextMode)
      Sets the SplitTextMode for the header.
      Parameters:
      aSplitTextMode - The SplitTextMode to be set for the header.
    • getHeaderSplitTextMode

      public SplitTextMode getHeaderSplitTextMode()
      Returns the SplitTextMode for the header.
      Returns:
      The SplitTextMode.
    • withRowSplitTextMode

      public ColumnFormatMetrics withRowSplitTextMode(SplitTextMode aSplitTextMode)
      Sets the SplitTextMode for the row and returns this instance as of the Builder-Pattern.
      Parameters:
      aSplitTextMode - The SplitTextMode to be set for the row.
      Returns:
      This instance to continue configuration.
    • setRowSplitTextMode

      public void setRowSplitTextMode(SplitTextMode aSplitTextMode)
      Sets the SplitTextMode for the row.
      Parameters:
      aSplitTextMode - The SplitTextMode to be set for the row.
    • getRowSplitTextMode

      public SplitTextMode getRowSplitTextMode()
      Returns the SplitTextMode for the row.
      Returns:
      The SplitTextMode.
    • fromColumnFormatMetrics

      public void fromColumnFormatMetrics(ColumnFormatMetrics aColumnFormatMetrics)
      Copies all column format metrics from the provided instance.
      Parameters:
      aColumnFormatMetrics - The source metrics.