public class TextMetricsUtility extends Object
Modifier and Type | Method and Description |
---|---|
static int |
getMaxStringLength(Object[] aCollection)
Returns the length of the longest
String (maximum length). |
static int[] |
toColumnWidths(int aTotalWidth,
ColumnWidth... aColumnWidths)
Calculates the columns widths in "number of chars" according to the
provided
ColumnWidthImpl instances in relation to the provided
total (available) width; the provided column widths can be a mix of
"number of char" widths (WidthType.ABSOLUTE ) and percent (%)
widths (WidthType.RELATIVE ). |
public static int[] toColumnWidths(int aTotalWidth, ColumnWidth... aColumnWidths)
ColumnWidthImpl
instances in relation to the provided
total (available) width; the provided column widths can be a mix of
"number of char" widths (WidthType.ABSOLUTE
) and percent (%)
widths (WidthType.RELATIVE
). When the width is being relative,
then the total sum of all of relative widths represents 100%. The
resulting column widths add up to the total width.
The column widths for the ColumnWidthImpl
instances being
specified in percent (WidthType.RELATIVE
) are calculated from the
remainder width after all "number of char" ColumnWidthImpl
instances ( WidthType.ABSOLUTE
) have been subtracted from the
provided total width. *aTotalWidth
- The total available width in number of chars.aColumnWidths
- The ColumnWidthImpl
instances providing
width specifications either in percent (%) or in
"number of chars".ColumnWidthImpl
instances in the order them
ColumnWidthImpl
instances have been passed; the array
species the actual column widths in "number of chars", adding up
to the total width.public static int getMaxStringLength(Object[] aCollection)
String
(maximum length).aCollection
- The array containing the Object
instances or
String
instances (in any case, Object.toString()
is being invoked to get the String
in question.String
length.Copyright © 2015. All rights reserved.