java.lang.Object
org.refcodes.textual.ColumnWidthMetricsImpl
org.refcodes.textual.ColumnFormatMetricsImpl
- All Implemented Interfaces:
org.refcodes.mixin.ColumnWidthAccessor
,org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<ColumnWidthMetrics>
,org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator
,org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
,ColumnFormatMetrics
,ColumnWidthMetrics
,HorizAlignTextModeAccessor.HorizAlignTextModeBuilder<ColumnFormatMetrics>
,HorizAlignTextModeAccessor.HorizAlignTextModeMutator
,MoreTextModeAccessor.MoreTextModeBuilder<ColumnFormatMetrics>
,MoreTextModeAccessor.MoreTextModeMutator
,SplitTextModeAccessor.SplitTextModeBuilder<ColumnFormatMetrics>
,SplitTextModeAccessor.SplitTextModeMutator
,TextFormatModeAccessor.TextFormatModeBuilder<ColumnFormatMetrics>
,TextFormatModeAccessor.TextFormatModeMutator
- Direct Known Subclasses:
ColumnSetupMetricsImpl
Implementation of the
ColumnFormatMetrics
interface.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.mixin.ColumnWidthAccessor
org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<B extends org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<B>>, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator, org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
-
Constructor Summary
ConstructorDescriptionInstantiates a new column format metrics impl.ColumnFormatMetricsImpl
(int aWidth, ColumnWidthType aWidthType) Constructs a column's width, either in percent (%) or in number of chars. -
Method Summary
Modifier and TypeMethodDescriptionReturns the ANSI Escape-Code for the header.Gets the ANSI Escape-Code factory for the header.Gets the alignment mode for the header.Gets the alignment mode for the header.Returns theSplitTextMode
for the header.Returns theTextFormatMode
for the header.Returns the ANSI Escape-Code for the rows and returns thisColumnFormatMetrics
instance as of the Builder-Pattern.Gets the ANSI Escape-Code factory for the row.Gets the alignment mode for the row.Gets the alignment mode for the row.Returns theSplitTextMode
for the row.Returns theTextFormatMode
for the row.void
setEscapeCode
(String aEscapeCode) Sets an ANSI Escape-Code for the header and the rows.void
setHeaderEscapeCode
(String aEscapeCode) Sets an ANSI Escape-Code for the header.void
setHeaderEscapeCodeFactory
(EscapeCodeFactory aEscapeCodeFactory) Sets an ANSI Escape-Code factory for the header.void
setHeaderHorizAlignTextMode
(HorizAlignTextMode aHorizAlignTextMode) Sets an alignment mode for the header.void
setHeaderMoreTextMode
(MoreTextMode aMoreTextMode) Sets a more-text mode for the header.void
setHeaderSplitTextMode
(SplitTextMode aSplitTextMode) Sets theSplitTextMode
for the header.void
setHeaderTextFormatMode
(TextFormatMode aTextFormatMode) Sets theTextFormatMode
for the header.void
setMoreTextMode
(MoreTextMode aMoreTextMode) Sets the more-text mode for the more-text mode property.void
setRowEscapeCode
(String aEscapeCode) Sets an ANSI Escape-Code for the rows and returns thisColumnFormatMetrics
instance as of the Builder-Pattern.void
setRowEscapeCodeFactory
(EscapeCodeFactory aEscapeCodeFactory) Sets an ANSI Escape-Code factory for the row.void
setRowHorizAlignTextMode
(HorizAlignTextMode aHorizAlignTextMode) Sets an alignment mode for the row.void
setRowMoreTextMode
(MoreTextMode aMoreTextMode) Sets a more-text mode for the row.void
setRowSplitTextMode
(SplitTextMode aSplitTextMode) Sets theSplitTextMode
for the row.void
setRowTextFormatMode
(TextFormatMode aTextFormatMode) Sets theTextFormatMode
for the row.toHeaderEscapeCode
(Object aIdentifier) Determines the ANSI Escape-Code by evaluating the provided TID: If anEscapeCodeFactory
has been set viaColumnFormatMetrics.setEscapeCodeFactory(EscapeCodeFactory)
and the factory returns a value different to null, then this value is returned.toRowEscapeCode
(Object aIdentifier) Determines the ANSI Escape-Code by evaluating the provided TID: If anEscapeCodeFactory
has been set viaColumnFormatMetrics.setEscapeCodeFactory(EscapeCodeFactory)
and the factory returns a value different to null, then this value is returned.withColumnWidth
(int aColumnWidth) Methods inherited from class org.refcodes.textual.ColumnWidthMetricsImpl
getColumnWidth, getColumnWidthType, setColumnWidth, setColumnWidthType, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.refcodes.textual.ColumnFormatMetrics
fromColumnFormatMetrics, setEscapeCodeFactory, setHorizAlignTextMode, setSplitTextMode, setTextFormatMode, withColumnWidthType, withEscapeCode, withEscapeCodeFactory, withHeaderEscapeCode, withHeaderEscapeCodeFactory, withHeaderHorizAlignTextMode, withHeaderMoreTextMode, withHeaderSplitTextMode, withHeaderTextFormatMode, withHorizAlignTextMode, withMoreTextMode, withRowEscapeCode, withRowEscapeCodeFactory, withRowHorizAlignTextMode, withRowMoreTextMode, withRowSplitTextMode, withRowTextFormatMode, withSplitTextMode, withTextFormatMode
Methods inherited from interface org.refcodes.mixin.ColumnWidthAccessor
getColumnWidth
Methods inherited from interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthMutator
setColumnWidth
Methods inherited from interface org.refcodes.mixin.ColumnWidthAccessor.ColumnWidthProperty
letColumnWidth
Methods inherited from interface org.refcodes.textual.ColumnWidthMetrics
fromColumnWidthMetrics, getColumnWidthType, setColumnWidthType
-
Constructor Details
-
ColumnFormatMetricsImpl
public ColumnFormatMetricsImpl()Instantiates a new column format metrics impl. -
ColumnFormatMetricsImpl
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 providedColumnWidthType
.aWidthType
- The type of the width being provided, either percent (%) or number of chars.
-
-
Method Details
-
withColumnWidth
- Specified by:
withColumnWidth
in interfaceColumnFormatMetrics
- Specified by:
withColumnWidth
in interfaceorg.refcodes.mixin.ColumnWidthAccessor.ColumnWidthBuilder<ColumnWidthMetrics>
- Overrides:
withColumnWidth
in classColumnWidthMetricsImpl
-
setEscapeCode
Sets an ANSI Escape-Code for the header and the rows. In case an ANSI Escape-Code is set, then the ANSI Escape-Code is prepended and an ANSI Reset-Code is appended to the according text being printed.- Specified by:
setEscapeCode
in interfaceColumnFormatMetrics
- Parameters:
aEscapeCode
- TheString
to be used for ANSI escaping.
-
setHeaderEscapeCode
Sets an ANSI Escape-Code for the header. In case an ANSI Escape-Code is set, then the ANSI Escape-Code is prepended and an ANSI Reset-Code is appended to the according text being printed.- Specified by:
setHeaderEscapeCode
in interfaceColumnFormatMetrics
- Parameters:
aEscapeCode
- TheString
to be used for ANSI escaping.
-
getHeaderEscapeCode
Returns the ANSI Escape-Code for the header. In case an ANSI Escape-Code is set, then the ANSI Escape-Code is prepended and an ANSI Reset-Code is appended to the according text being printed.- Specified by:
getHeaderEscapeCode
in interfaceColumnFormatMetrics
- Returns:
- The
String
to be used for ANSI escaping.
-
setRowEscapeCode
Sets an ANSI Escape-Code for the rows and returns thisColumnFormatMetrics
instance as of the Builder-Pattern. The latest ANSI Escape-Code being set wins.- Specified by:
setRowEscapeCode
in interfaceColumnFormatMetrics
- Parameters:
aEscapeCode
- TheString
to be used for ANSI escaping.
-
getRowEscapeCode
Returns the ANSI Escape-Code for the rows and returns thisColumnFormatMetrics
instance as of the Builder-Pattern. The latest ANSI Escape-Code being set wins.- Specified by:
getRowEscapeCode
in interfaceColumnFormatMetrics
- Returns:
- The
String
to be used for ANSI escaping.
-
setMoreTextMode
Sets the more-text mode for the more-text mode property.- Specified by:
setMoreTextMode
in interfaceColumnFormatMetrics
- Specified by:
setMoreTextMode
in interfaceMoreTextModeAccessor.MoreTextModeMutator
- Parameters:
aMoreTextMode
- The more-text mode to be stored by the more-text mode property.
-
setHeaderHorizAlignTextMode
Sets an alignment mode for the header.- Specified by:
setHeaderHorizAlignTextMode
in interfaceColumnFormatMetrics
- Parameters:
aHorizAlignTextMode
- TheHorizAlignTextMode
to be used for aligning the text.
-
getHeaderHorizAlignTextMode
Gets the alignment mode for the header.- Specified by:
getHeaderHorizAlignTextMode
in interfaceColumnFormatMetrics
- Returns:
- The
HorizAlignTextMode
to be used for aligning the text.
-
setRowHorizAlignTextMode
Sets an alignment mode for the row.- Specified by:
setRowHorizAlignTextMode
in interfaceColumnFormatMetrics
- Parameters:
aHorizAlignTextMode
- TheHorizAlignTextMode
to be used for aligning the text.
-
getRowHorizAlignTextMode
Gets the alignment mode for the row.- Specified by:
getRowHorizAlignTextMode
in interfaceColumnFormatMetrics
- Returns:
- The
HorizAlignTextMode
to be used for aligning the text.
-
setHeaderMoreTextMode
Sets a more-text mode for the header.- Specified by:
setHeaderMoreTextMode
in interfaceColumnFormatMetrics
- Parameters:
aMoreTextMode
- TheMoreTextMode
to be used for truncating the text.
-
getHeaderMoreTextMode
Gets the alignment mode for the header.- Specified by:
getHeaderMoreTextMode
in interfaceColumnFormatMetrics
- Returns:
- The
MoreTextMode
to be used for truncating the text.
-
setRowMoreTextMode
Sets a more-text mode for the row.- Specified by:
setRowMoreTextMode
in interfaceColumnFormatMetrics
- Parameters:
aMoreTextMode
- TheMoreTextMode
to be used for truncating the text.
-
getRowMoreTextMode
Gets the alignment mode for the row.- Specified by:
getRowMoreTextMode
in interfaceColumnFormatMetrics
- Returns:
- The
MoreTextMode
to be used for truncating the text.
-
setHeaderTextFormatMode
Sets theTextFormatMode
for the header.- Specified by:
setHeaderTextFormatMode
in interfaceColumnFormatMetrics
- Parameters:
aTextFormatMode
- TheTextFormatMode
to be set for the header;
-
getHeaderTextFormatMode
Returns theTextFormatMode
for the header.- Specified by:
getHeaderTextFormatMode
in interfaceColumnFormatMetrics
- Returns:
- The
TextFormatMode
to be set for the header;
-
setRowTextFormatMode
Sets theTextFormatMode
for the row.- Specified by:
setRowTextFormatMode
in interfaceColumnFormatMetrics
- Parameters:
aTextFormatMode
- TheTextFormatMode
to be set for the row;
-
getRowTextFormatMode
Returns theTextFormatMode
for the row.- Specified by:
getRowTextFormatMode
in interfaceColumnFormatMetrics
- Returns:
- The
TextFormatMode
to be set for the row;
-
setHeaderSplitTextMode
Sets theSplitTextMode
for the header.- Specified by:
setHeaderSplitTextMode
in interfaceColumnFormatMetrics
- Parameters:
aSplitTextMode
- TheSplitTextMode
to be set for the header;
-
getHeaderSplitTextMode
Returns theSplitTextMode
for the header.- Specified by:
getHeaderSplitTextMode
in interfaceColumnFormatMetrics
- Returns:
- The
SplitTextMode
to be set for the header;
-
setRowSplitTextMode
Sets theSplitTextMode
for the row.- Specified by:
setRowSplitTextMode
in interfaceColumnFormatMetrics
- Parameters:
aSplitTextMode
- TheSplitTextMode
to be set for the row;
-
getRowSplitTextMode
Returns theSplitTextMode
for the row.- Specified by:
getRowSplitTextMode
in interfaceColumnFormatMetrics
- Returns:
- The
SplitTextMode
to be set for the row;
-
setHeaderEscapeCodeFactory
Sets an ANSI Escape-Code factory for the header. In case an ANSI Escape-Code is set, then the ANSI Escape-Code is prepended and an ANSI Reset-Code is appended to the according text being printed.- Specified by:
setHeaderEscapeCodeFactory
in interfaceColumnFormatMetrics
- Parameters:
aEscapeCodeFactory
- TheEscapeCodeFactory
to be used for determining ANSI escaping.
-
getHeaderEscapeCodeFactory
Gets the ANSI Escape-Code factory for the header. In case an ANSI Escape-Code is set, then the ANSI Escape-Code is prepended and an ANSI Reset-Code is appended to the according text being printed.- Specified by:
getHeaderEscapeCodeFactory
in interfaceColumnFormatMetrics
- Returns:
- The
EscapeCodeFactory
to be used for determining ANSI escaping.
-
toHeaderEscapeCode
Determines the ANSI Escape-Code by evaluating the provided TID: If anEscapeCodeFactory
has been set viaColumnFormatMetrics.setEscapeCodeFactory(EscapeCodeFactory)
and the factory returns a value different to null, then this value is returned. Else the value returned byColumnFormatMetrics.getHeaderEscapeCode()
is returned as fallback.- Specified by:
toHeaderEscapeCode
in interfaceColumnFormatMetrics
- Parameters:
aIdentifier
- The TID for which to lookup an Escape-Code.- Returns:
- The identified Escape-Code or null if none was identifiable.
-
setRowEscapeCodeFactory
Sets an ANSI Escape-Code factory for the row. In case an ANSI Escape-Code is set, then the ANSI Escape-Code is prepended and an ANSI Reset-Code is appended to the according text being printed.- Specified by:
setRowEscapeCodeFactory
in interfaceColumnFormatMetrics
- Parameters:
aEscapeCodeFactory
- TheEscapeCodeFactory
to be used for determining ANSI escaping. configuration.
-
getRowEscapeCodeFactory
Gets the ANSI Escape-Code factory for the row. In case an ANSI Escape-Code is set, then the ANSI Escape-Code is prepended and an ANSI Reset-Code is appended to the according text being printed.- Specified by:
getRowEscapeCodeFactory
in interfaceColumnFormatMetrics
- Returns:
- The
EscapeCodeFactory
to be used for determining ANSI escaping.
-
toRowEscapeCode
Determines the ANSI Escape-Code by evaluating the provided TID: If anEscapeCodeFactory
has been set viaColumnFormatMetrics.setEscapeCodeFactory(EscapeCodeFactory)
and the factory returns a value different to null, then this value is returned. Else the value returned byColumnFormatMetrics.getRowEscapeCode()
is returned as fallback.- Specified by:
toRowEscapeCode
in interfaceColumnFormatMetrics
- Parameters:
aIdentifier
- The TID for which to lookup an Escape-Code.- Returns:
- The identified Escape-Code or null if none was identifiable.
-