Package jmri.util.davidflanagan
Class HardcopyWriter.Column
java.lang.Object
jmri.util.davidflanagan.HardcopyWriter.Column
- Enclosing class:
- HardcopyWriter
Class to represent a column in the output. This has a start position,
width and alignment. This allows left, center or right alignment, with or
without wrapping.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) HardcopyWriter.Align(package private) boolean(package private) int(package private) int -
Constructor Summary
ConstructorsConstructorDescriptionColumn(int position, int width) Create a Column with specified position and width with LEFT alignmentColumn(int position, int width, HardcopyWriter.Align alignment) Create a Column with specified position, width and alignmentColumn(int position, HardcopyWriter.Align alignment) Create a Column with specified position and alignment. -
Method Summary
Modifier and TypeMethodDescriptionGets the alignment of the columnintGets the starting position of the column in pointsintgetStartPos(double strlen) Gets the starting position of text of length strlen (in points)intgetWidth()Gets the width of the column in pointsbooleanisWrap()Gets whether the column is a wrap columnvoidsetWidth(int width) Sets the width of the column in pointsstatic ArrayList<HardcopyWriter.Column>stretchColumns(Collection<HardcopyWriter.Column> columns, int width, int gap) Stretch the columns to fit the specified width.toString()
-
Field Details
-
Constructor Details
-
Column
Create a Column with specified position, width and alignment- Parameters:
position- The position of the column in pointswidth- The width of the column in pointsalignment- The alignment of the column
-
Column
Create a Column with specified position and alignment. The width will be calculated up to the next column.- Parameters:
position- The position of the column in pointsalignment- The alignment of the column
-
Column
Create a Column with specified position and width with LEFT alignment- Parameters:
position- The position of the column in pointswidth- The width of the column in points
-
-
Method Details
-
setWidth
Sets the width of the column in points- Parameters:
width- The new width of the column in points
-
getWidth
Gets the width of the column in points- Returns:
- The width of the column in points
-
getStartPos
Gets the starting position of text of length strlen (in points)- Parameters:
strlen- The length of the text in points- Returns:
- The starting position of the text in points
-
getPosition
Gets the starting position of the column in points- Returns:
- The starting position of the column in points
-
getAlignment
Gets the alignment of the column- Returns:
- The alignment of the column
-
isWrap
Gets whether the column is a wrap column- Returns:
- true if the column is a wrap column
-
toString
-
stretchColumns
public static ArrayList<HardcopyWriter.Column> stretchColumns(Collection<HardcopyWriter.Column> columns, int width, int gap) Stretch the columns to fit the specified width. The columns are assumed to be sorted by position. The input widths are treated as ratios. There is a gap between the columns.- Parameters:
columns- The columns to stretchwidth- The width to stretch to in pointsgap- The gap between the columns in points- Returns:
- The stretched columns
-