Package jmri.jmrit.operations.trains
Class TrainCommon
- java.lang.Object
-
- jmri.jmrit.operations.trains.TrainCommon
-
- Direct Known Subclasses:
HtmlTrainCommon
,JsonManifest
,Router
,TrainBuilderBase
,TrainCsvCommon
,TrainManifest
,TrainSwitchLists
public class TrainCommon extends java.lang.Object
Common routines for trains
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
_dropCars
protected boolean
_pickupCars
(package private) boolean
_printLocalMoveHeader
(package private) boolean
_printPickupHeader
(package private) boolean
_printSetoutHeader
protected static java.lang.String
BLANK_LINE
protected static java.lang.String
BUILD_REPORT_CHAR
(package private) CarManager
carManager
(package private) java.util.List<Car>
doneCars
protected static boolean
ENGINE
(package private) EngineManager
engineManager
protected static java.lang.String
HORIZONTAL_LINE_CHAR
static java.lang.String
HYPHEN
(package private) int
index
protected static boolean
IS_MANIFEST
static boolean
IS_TWO_COLUMN_TRACK
static boolean
LOCAL
(package private) LocationManager
locationManager
protected static java.lang.String
NEW_LINE
protected static java.awt.Dimension
PAPER_MARGINS
protected static boolean
PICKUP
static java.lang.String
SPACE
protected static java.lang.String
TAB
protected static java.lang.String
TEXT_COLOR_DONE
protected static java.lang.String
TEXT_COLOR_END
protected static java.lang.String
TEXT_COLOR_START
(package private) java.util.List<java.lang.String>
utilityCarTypes
protected static java.lang.String
VERTICAL_LINE_CHAR
-
Constructor Summary
Constructors Constructor Description TrainCommon()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addCarsLocationUnknown(java.io.PrintWriter file, boolean isManifest)
protected void
addLine(java.io.PrintWriter file, java.lang.String string)
Writes string to file.protected static void
addLine(java.io.PrintWriter file, java.lang.String level, java.lang.String string)
Writes a line to the build report fileprotected void
blockCarsByTrack(java.io.PrintWriter file, Train train, java.util.List<Car> carList, RouteLocation rl, boolean printHeader, boolean isManifest)
Block cars by track, then pick up and set out for each location in a train's route.protected void
blockCarsByTrackNameTwoColumn(java.io.PrintWriter file, Train train, java.util.List<Car> carList, RouteLocation rl, boolean printHeader, boolean isManifest)
Produces a two column format for car pick ups and set outs.protected void
blockCarsTwoColumn(java.io.PrintWriter file, Train train, java.util.List<Car> carList, RouteLocation rl, boolean printHeader, boolean isManifest)
Produces a two column format for car pick ups and set outs.protected void
blockLocosTwoColumn(java.io.PrintWriter file, java.util.List<Engine> engineList, RouteLocation rl, boolean isManifest)
Used to generate "Two Column" format for engines.void
clearUtilityCarTypes()
static java.util.Date
convertStringToDate(java.lang.String date)
int
countPickupUtilityCars(java.util.List<Car> carList, Car car, boolean isManifest)
int
countSetoutUtilityCars(java.util.List<Car> carList, Car car, boolean isLocal, boolean isManifest)
protected int
countUtilityCars(java.lang.String[] format, java.util.List<Car> carList, Car car, boolean isPickup)
Scans the car list for utility cars that have the same attributes as the car provided.static java.lang.String
createTabIfNeeded(int tabSize)
Creates a String of spaces to create a tab for text.protected void
dropCar(java.io.PrintWriter file, Car car, boolean isManifest)
Adds the car's set out string to the output file using the manifest or switch list formatjava.lang.String
dropCar(Car car, boolean isManifest, boolean isTwoColumnTrack)
Returns the drop car string.java.lang.String
dropEngine(Engine engine)
Returns the drop string for a loco.protected void
dropEngines(java.io.PrintWriter file, java.util.List<Engine> engineList, RouteLocation rl, boolean isManifest)
Adds a list of locomotive drops for the route location to the output file.static java.lang.String
formatColorString(java.lang.String text, java.awt.Color color)
Adds HTML like color text control characters around a string.static java.lang.String
formatStringToCommaSeparated(java.lang.String[] array)
Produces a string using commas and spaces between the strings provided in the array.static java.lang.String
getDate(boolean isModelYear)
static java.lang.String
getDate(java.util.Date date)
java.lang.String
getDropCarHeader(boolean isManifest, boolean isTwoColumnTrack)
java.lang.String
getDropEngineHeader()
static java.lang.String
getISO8601Date(boolean isModelYear)
static int
getLineLength(boolean isManifest)
Returns the line length for manifest or switch list printout.java.lang.String
getLocalMoveHeader(boolean isManifest)
static int
getManifestHeaderLineLength()
protected static java.awt.Dimension
getPageSize(java.lang.String orientation)
java.lang.String
getPickupCarHeader(boolean isManifest, boolean isTwoColumnTrack)
java.lang.String
getPickupEngineHeader()
static java.awt.Color
getTextColor(java.lang.String string)
static java.lang.String
getTextColorName(java.lang.String string)
static java.lang.String
getTextColorString(java.lang.String string)
Removes the color text control characters around the desired stringstatic boolean
isNextCar(Car car, RouteLocation rl, RouteLocation rld)
Used to determine if car is the next to be processed when producing Manifests or Switch Lists.static boolean
isNextCar(Car car, RouteLocation rl, RouteLocation rld, boolean isIgnoreTrack)
protected boolean
isThereWorkAtLocation(java.util.List<Car> carList, java.util.List<Engine> engList, RouteLocation rl)
static boolean
isThereWorkAtLocation(Train train, Location location)
returns true if the train has work at the locationjava.lang.String
localMoveCar(Car car, boolean isManifest)
Returns the move car string.protected void
newLine(java.io.PrintWriter file)
Adds a blank line to the file.protected void
newLine(java.io.PrintWriter file, java.lang.String string, boolean isManifest)
Writes a string to a file.static java.lang.String
padAndTruncate(java.lang.String s, int fieldSize)
static java.lang.String
padAndTruncateIfNeeded(java.lang.String s, int fieldSize)
Pads out a string by adding spaces to the end of the string, and will remove characters from the end of the string if the string exceeds the field size.static java.lang.String
padString(java.lang.String s, int fieldSize)
Adjusts string to be a certain number of characters by adding spaces to the end of the string.java.lang.String
pickupCar(Car car, boolean isManifest, boolean isTwoColumnTrack)
Returns the pick up car string.protected void
pickUpCar(java.io.PrintWriter file, Car car, boolean isManifest)
Adds the car's pick up string to the output file using the manifest or switch list formatprotected void
pickUpCarTruncated(java.io.PrintWriter file, Car car, boolean isManifest)
Adds the car's pick up string to the output file using the truncated manifest formatjava.lang.String
pickupEngine(Engine engine)
Returns the pick up string for a loco.protected void
pickupEngines(java.io.PrintWriter file, java.util.List<Engine> engineList, RouteLocation rl, boolean isManifest)
Adds a list of locomotive pick ups for the route location to the output file.protected void
pickupUtilityCars(java.io.PrintWriter file, java.util.List<Car> carList, Car car, boolean isTruncate, boolean isManifest)
Add a list of utility cars scheduled for pick up from the route location to the output file.java.lang.String
pickupUtilityCars(java.util.List<Car> carList, Car car, boolean isManifest, boolean isTwoColumnTrack)
void
printCarHeader(java.io.PrintWriter file, boolean isManifest, boolean isTwoColumnTrack)
Prints the two column header for cars.void
printDropCarHeader(java.io.PrintWriter file, boolean isManifest, boolean isTwoColumnTrack)
void
printDropEngineHeader(java.io.PrintWriter file, boolean isManifest)
void
printEngineHeader(java.io.PrintWriter file, boolean isManifest)
Two column header format.void
printHorizontalLine(java.io.PrintWriter file, boolean isManifest)
Prints a line across the entire page.void
printHorizontalLine(java.io.PrintWriter file, int start, int end)
void
printLocalCarMoveHeader(java.io.PrintWriter file, boolean isManifest)
void
printPickupCarHeader(java.io.PrintWriter file, boolean isManifest, boolean isTwoColumnTrack)
void
printPickupEngineHeader(java.io.PrintWriter file, boolean isManifest)
protected void
printTrackComments(java.io.PrintWriter file, RouteLocation rl, java.util.List<Car> carList, boolean isManifest)
protected void
printTrackNameHeader(java.io.PrintWriter file, java.lang.String trackName, boolean isManifest)
protected void
setoutUtilityCars(java.io.PrintWriter file, java.util.List<Car> carList, Car car, boolean isTruncate, boolean isManifest)
Add a list of utility cars scheduled for drop at the route location to the output file.java.lang.String
setoutUtilityCars(java.util.List<Car> carList, Car car, boolean isLocal, boolean isManifest)
For the Conductor and Yardmaster windows.protected java.lang.String
setoutUtilityCars(java.util.List<Car> carList, Car car, boolean isLocal, boolean isManifest, boolean isTwoColumnTrack)
static java.lang.String
splitString(java.lang.String name)
Splits a string (example-number) as long as the second part of the string is an integer or if the first character after the hyphen is a left parenthesis "(".protected static java.lang.String
tabString(java.lang.String s, int tabSize)
protected void
truncatedDropCar(java.io.PrintWriter file, Car car, boolean isManifest)
Adds the car's set out string to the output file using the truncated manifest format.
-
-
-
Field Detail
-
TAB
protected static final java.lang.String TAB
- See Also:
- Constant Field Values
-
NEW_LINE
protected static final java.lang.String NEW_LINE
- See Also:
- Constant Field Values
-
SPACE
public static final java.lang.String SPACE
- See Also:
- Constant Field Values
-
BLANK_LINE
protected static final java.lang.String BLANK_LINE
- See Also:
- Constant Field Values
-
HORIZONTAL_LINE_CHAR
protected static final java.lang.String HORIZONTAL_LINE_CHAR
- See Also:
- Constant Field Values
-
BUILD_REPORT_CHAR
protected static final java.lang.String BUILD_REPORT_CHAR
- See Also:
- Constant Field Values
-
HYPHEN
public static final java.lang.String HYPHEN
- See Also:
- Constant Field Values
-
VERTICAL_LINE_CHAR
protected static final java.lang.String VERTICAL_LINE_CHAR
- See Also:
- Constant Field Values
-
TEXT_COLOR_START
protected static final java.lang.String TEXT_COLOR_START
- See Also:
- Constant Field Values
-
TEXT_COLOR_DONE
protected static final java.lang.String TEXT_COLOR_DONE
- See Also:
- Constant Field Values
-
TEXT_COLOR_END
protected static final java.lang.String TEXT_COLOR_END
- See Also:
- Constant Field Values
-
PICKUP
protected static final boolean PICKUP
- See Also:
- Constant Field Values
-
IS_MANIFEST
protected static final boolean IS_MANIFEST
- See Also:
- Constant Field Values
-
LOCAL
public static final boolean LOCAL
- See Also:
- Constant Field Values
-
ENGINE
protected static final boolean ENGINE
- See Also:
- Constant Field Values
-
IS_TWO_COLUMN_TRACK
public static final boolean IS_TWO_COLUMN_TRACK
- See Also:
- Constant Field Values
-
carManager
CarManager carManager
-
engineManager
EngineManager engineManager
-
locationManager
LocationManager locationManager
-
_pickupCars
protected boolean _pickupCars
-
_dropCars
protected boolean _dropCars
-
_printPickupHeader
boolean _printPickupHeader
-
_printSetoutHeader
boolean _printSetoutHeader
-
_printLocalMoveHeader
boolean _printLocalMoveHeader
-
index
int index
-
utilityCarTypes
java.util.List<java.lang.String> utilityCarTypes
-
PAPER_MARGINS
protected static final java.awt.Dimension PAPER_MARGINS
-
-
Constructor Detail
-
TrainCommon
public TrainCommon()
-
-
Method Detail
-
blockLocosTwoColumn
protected void blockLocosTwoColumn(java.io.PrintWriter file, java.util.List<Engine> engineList, RouteLocation rl, boolean isManifest)
Used to generate "Two Column" format for engines.- Parameters:
file
- Manifest or Switch List FileengineList
- List of engines for this train.rl
- The RouteLocation being printed.isManifest
- True if manifest, false if switch list.
-
pickupEngines
protected void pickupEngines(java.io.PrintWriter file, java.util.List<Engine> engineList, RouteLocation rl, boolean isManifest)
Adds a list of locomotive pick ups for the route location to the output file. Used to generate "Standard" format.- Parameters:
file
- Manifest or Switch List FileengineList
- List of engines for this train.rl
- The RouteLocation being printed.isManifest
- True if manifest, false if switch list
-
dropEngines
protected void dropEngines(java.io.PrintWriter file, java.util.List<Engine> engineList, RouteLocation rl, boolean isManifest)
Adds a list of locomotive drops for the route location to the output file. Used to generate "Standard" format.- Parameters:
file
- Manifest or Switch List FileengineList
- List of engines for this train.rl
- The RouteLocation being printed.isManifest
- True if manifest, false if switch list
-
pickupEngine
public java.lang.String pickupEngine(Engine engine)
Returns the pick up string for a loco. Useful for frames like the train conductor and yardmaster.- Parameters:
engine
- The Engine.- Returns:
- engine pick up string
-
dropEngine
public java.lang.String dropEngine(Engine engine)
Returns the drop string for a loco. Useful for frames like the train conductor and yardmaster.- Parameters:
engine
- The Engine.- Returns:
- engine drop string
-
blockCarsByTrack
protected void blockCarsByTrack(java.io.PrintWriter file, Train train, java.util.List<Car> carList, RouteLocation rl, boolean printHeader, boolean isManifest)
Block cars by track, then pick up and set out for each location in a train's route. This routine is used for the "Standard" format.- Parameters:
file
- Manifest or switch list Filetrain
- The train being printed.carList
- List of cars for this trainrl
- The RouteLocation being printedprintHeader
- True if new location.isManifest
- True if manifest, false if switch list.
-
isNextCar
public static boolean isNextCar(Car car, RouteLocation rl, RouteLocation rld)
Used to determine if car is the next to be processed when producing Manifests or Switch Lists. Caboose or FRED is placed at end of the train. Passenger cars are already blocked in the car list. Passenger cars with negative block numbers are placed at the front of the train, positive numbers at the end of the train. Note that a car in train doesn't have a track assignment.- Parameters:
car
- the car being testedrl
- when in train's route the car is being pulledrld
- the destination being tested- Returns:
- true if this car is the next one to be processed
-
isNextCar
public static boolean isNextCar(Car car, RouteLocation rl, RouteLocation rld, boolean isIgnoreTrack)
-
blockCarsTwoColumn
protected void blockCarsTwoColumn(java.io.PrintWriter file, Train train, java.util.List<Car> carList, RouteLocation rl, boolean printHeader, boolean isManifest)
Produces a two column format for car pick ups and set outs. Sorted by track and then by blocking order. This routine is used for the "Two Column" format.- Parameters:
file
- Manifest or switch list Filetrain
- The traincarList
- List of cars for this trainrl
- The RouteLocation being printedprintHeader
- True if new location.isManifest
- True if manifest, false if switch list.
-
blockCarsByTrackNameTwoColumn
protected void blockCarsByTrackNameTwoColumn(java.io.PrintWriter file, Train train, java.util.List<Car> carList, RouteLocation rl, boolean printHeader, boolean isManifest)
Produces a two column format for car pick ups and set outs. Sorted by track and then by destination. Track name in header format, track name removed from format. This routine is used to generate the "Two Column by Track" format.- Parameters:
file
- Manifest or switch list Filetrain
- The traincarList
- List of cars for this trainrl
- The RouteLocation being printedprintHeader
- True if new location.isManifest
- True if manifest, false if switch list.
-
printTrackComments
protected void printTrackComments(java.io.PrintWriter file, RouteLocation rl, java.util.List<Car> carList, boolean isManifest)
-
pickUpCarTruncated
protected void pickUpCarTruncated(java.io.PrintWriter file, Car car, boolean isManifest)
Adds the car's pick up string to the output file using the truncated manifest format- Parameters:
file
- Manifest or switch list Filecar
- The car being printed.isManifest
- True if manifest, false if switch list.
-
pickUpCar
protected void pickUpCar(java.io.PrintWriter file, Car car, boolean isManifest)
Adds the car's pick up string to the output file using the manifest or switch list format- Parameters:
file
- Manifest or switch list Filecar
- The car being printed.isManifest
- True if manifest, false if switch list.
-
pickupCar
public java.lang.String pickupCar(Car car, boolean isManifest, boolean isTwoColumnTrack)
Returns the pick up car string. Useful for frames like train conductor and yardmaster.- Parameters:
car
- The car being printed.isManifest
- when true use manifest format, when false use switch list formatisTwoColumnTrack
- True if printing using two column format sorted by track name.- Returns:
- pick up car string
-
truncatedDropCar
protected void truncatedDropCar(java.io.PrintWriter file, Car car, boolean isManifest)
Adds the car's set out string to the output file using the truncated manifest format. Does not print out local moves. Local moves are only shown on the switch list for that location.- Parameters:
file
- Manifest or switch list Filecar
- The car being printed.isManifest
- True if manifest, false if switch list.
-
dropCar
protected void dropCar(java.io.PrintWriter file, Car car, boolean isManifest)
Adds the car's set out string to the output file using the manifest or switch list format- Parameters:
file
- Manifest or switch list Filecar
- The car being printed.isManifest
- True if manifest, false if switch list.
-
dropCar
public java.lang.String dropCar(Car car, boolean isManifest, boolean isTwoColumnTrack)
Returns the drop car string. Useful for frames like train conductor and yardmaster.- Parameters:
car
- The car being printed.isManifest
- when true use manifest format, when false use switch list formatisTwoColumnTrack
- True if printing using two column format.- Returns:
- drop car string
-
localMoveCar
public java.lang.String localMoveCar(Car car, boolean isManifest)
Returns the move car string. Useful for frames like train conductor and yardmaster.- Parameters:
car
- The car being printed.isManifest
- when true use manifest format, when false use switch list format- Returns:
- move car string
-
pickupUtilityCars
protected void pickupUtilityCars(java.io.PrintWriter file, java.util.List<Car> carList, Car car, boolean isTruncate, boolean isManifest)
Add a list of utility cars scheduled for pick up from the route location to the output file. The cars are blocked by destination.- Parameters:
file
- Manifest or Switch List File.carList
- List of cars for this train.car
- The utility car.isTruncate
- True if manifest is to be truncatedisManifest
- True if manifest, false if switch list.
-
setoutUtilityCars
protected void setoutUtilityCars(java.io.PrintWriter file, java.util.List<Car> carList, Car car, boolean isTruncate, boolean isManifest)
Add a list of utility cars scheduled for drop at the route location to the output file.- Parameters:
file
- Manifest or Switch List File.carList
- List of cars for this train.car
- The utility car.isTruncate
- True if manifest is to be truncatedisManifest
- True if manifest, false if switch list.
-
pickupUtilityCars
public java.lang.String pickupUtilityCars(java.util.List<Car> carList, Car car, boolean isManifest, boolean isTwoColumnTrack)
-
countPickupUtilityCars
public int countPickupUtilityCars(java.util.List<Car> carList, Car car, boolean isManifest)
-
setoutUtilityCars
public java.lang.String setoutUtilityCars(java.util.List<Car> carList, Car car, boolean isLocal, boolean isManifest)
For the Conductor and Yardmaster windows.- Parameters:
carList
- List of cars for this train.car
- The utility car.isLocal
- True if local move.isManifest
- True if manifest, false if switch list.- Returns:
- A string representing the work of identical utility cars.
-
setoutUtilityCars
protected java.lang.String setoutUtilityCars(java.util.List<Car> carList, Car car, boolean isLocal, boolean isManifest, boolean isTwoColumnTrack)
-
countSetoutUtilityCars
public int countSetoutUtilityCars(java.util.List<Car> carList, Car car, boolean isLocal, boolean isManifest)
-
countUtilityCars
protected int countUtilityCars(java.lang.String[] format, java.util.List<Car> carList, Car car, boolean isPickup)
Scans the car list for utility cars that have the same attributes as the car provided. Returns 0 if this car type has already been processed, otherwise the number of cars with the same attribute.- Parameters:
format
- Message format.carList
- List of cars for this traincar
- The utility car.isPickup
- True if pick up, false if set out.- Returns:
- 0 if the car type has already been processed
-
clearUtilityCarTypes
public void clearUtilityCarTypes()
-
addLine
protected static void addLine(java.io.PrintWriter file, java.lang.String level, java.lang.String string)
Writes a line to the build report file- Parameters:
file
- build report filelevel
- print levelstring
- string to write
-
addLine
protected void addLine(java.io.PrintWriter file, java.lang.String string)
Writes string to file. No line length wrap or protection.- Parameters:
file
- The File to write to.string
- The string to write.
-
newLine
protected void newLine(java.io.PrintWriter file, java.lang.String string, boolean isManifest)
Writes a string to a file. Checks for string length, and will automatically wrap lines.- Parameters:
file
- The File to write to.string
- The string to write.isManifest
- set true for manifest page orientation, false for switch list orientation
-
newLine
protected void newLine(java.io.PrintWriter file)
Adds a blank line to the file.- Parameters:
file
- The File to write to.
-
splitString
public static java.lang.String splitString(java.lang.String name)
Splits a string (example-number) as long as the second part of the string is an integer or if the first character after the hyphen is a left parenthesis "(".- Parameters:
name
- The string to split if necessary.- Returns:
- First half of the string.
-
isThereWorkAtLocation
protected boolean isThereWorkAtLocation(java.util.List<Car> carList, java.util.List<Engine> engList, RouteLocation rl)
-
isThereWorkAtLocation
public static boolean isThereWorkAtLocation(Train train, Location location)
returns true if the train has work at the location- Parameters:
train
- The Train.location
- The Location.- Returns:
- true if the train has work at the location
-
addCarsLocationUnknown
protected void addCarsLocationUnknown(java.io.PrintWriter file, boolean isManifest)
-
printEngineHeader
public void printEngineHeader(java.io.PrintWriter file, boolean isManifest)
Two column header format. Left side pick ups, right side set outs- Parameters:
file
- Manifest or switch list File.isManifest
- True if manifest, false if switch list.
-
printPickupEngineHeader
public void printPickupEngineHeader(java.io.PrintWriter file, boolean isManifest)
-
printDropEngineHeader
public void printDropEngineHeader(java.io.PrintWriter file, boolean isManifest)
-
printCarHeader
public void printCarHeader(java.io.PrintWriter file, boolean isManifest, boolean isTwoColumnTrack)
Prints the two column header for cars. Left side pick ups, right side set outs.- Parameters:
file
- Manifest or Switch List FileisManifest
- True if manifest, false if switch list.isTwoColumnTrack
- True if two column format using track names.
-
printPickupCarHeader
public void printPickupCarHeader(java.io.PrintWriter file, boolean isManifest, boolean isTwoColumnTrack)
-
printDropCarHeader
public void printDropCarHeader(java.io.PrintWriter file, boolean isManifest, boolean isTwoColumnTrack)
-
printLocalCarMoveHeader
public void printLocalCarMoveHeader(java.io.PrintWriter file, boolean isManifest)
-
getPickupEngineHeader
public java.lang.String getPickupEngineHeader()
-
getDropEngineHeader
public java.lang.String getDropEngineHeader()
-
getPickupCarHeader
public java.lang.String getPickupCarHeader(boolean isManifest, boolean isTwoColumnTrack)
-
getDropCarHeader
public java.lang.String getDropCarHeader(boolean isManifest, boolean isTwoColumnTrack)
-
getLocalMoveHeader
public java.lang.String getLocalMoveHeader(boolean isManifest)
-
printTrackNameHeader
protected void printTrackNameHeader(java.io.PrintWriter file, java.lang.String trackName, boolean isManifest)
-
printHorizontalLine
public void printHorizontalLine(java.io.PrintWriter file, boolean isManifest)
Prints a line across the entire page.- Parameters:
file
- The File to print to.isManifest
- True if manifest, false if switch list.
-
printHorizontalLine
public void printHorizontalLine(java.io.PrintWriter file, int start, int end)
-
getISO8601Date
public static java.lang.String getISO8601Date(boolean isModelYear)
-
getDate
public static java.lang.String getDate(java.util.Date date)
-
getDate
public static java.lang.String getDate(boolean isModelYear)
-
convertStringToDate
public static java.util.Date convertStringToDate(java.lang.String date)
-
padAndTruncateIfNeeded
public static java.lang.String padAndTruncateIfNeeded(java.lang.String s, int fieldSize)
Pads out a string by adding spaces to the end of the string, and will remove characters from the end of the string if the string exceeds the field size.- Parameters:
s
- The string to pad.fieldSize
- The maximum length of the string.- Returns:
- A String the specified length
-
padAndTruncate
public static java.lang.String padAndTruncate(java.lang.String s, int fieldSize)
-
padString
public static java.lang.String padString(java.lang.String s, int fieldSize)
Adjusts string to be a certain number of characters by adding spaces to the end of the string.- Parameters:
s
- The string to padfieldSize
- The fixed length of the string.- Returns:
- A String the specified length
-
createTabIfNeeded
public static java.lang.String createTabIfNeeded(int tabSize)
Creates a String of spaces to create a tab for text. Tabs must be enabled. Setup.isTabEnabled()- Parameters:
tabSize
- the length of tab- Returns:
- tab
-
tabString
protected static java.lang.String tabString(java.lang.String s, int tabSize)
-
getLineLength
public static int getLineLength(boolean isManifest)
Returns the line length for manifest or switch list printout. Always an even number.- Parameters:
isManifest
- True if manifest.- Returns:
- line length for manifest or switch list.
-
getManifestHeaderLineLength
public static int getManifestHeaderLineLength()
-
getPageSize
protected static java.awt.Dimension getPageSize(java.lang.String orientation)
-
formatStringToCommaSeparated
public static java.lang.String formatStringToCommaSeparated(java.lang.String[] array)
Produces a string using commas and spaces between the strings provided in the array. Does not check for embedded commas in the string array.- Parameters:
array
- The string array to be formated.- Returns:
- formated string using commas and spaces
-
formatColorString
public static java.lang.String formatColorString(java.lang.String text, java.awt.Color color)
Adds HTML like color text control characters around a string. Note that black is the standard text color, and if black is requested no control characters are added.- Parameters:
text
- the text to be modifiedcolor
- the color the text is to be printed- Returns:
- formated text with color modifiers
-
getTextColorString
public static java.lang.String getTextColorString(java.lang.String string)
Removes the color text control characters around the desired string- Parameters:
string
- the string with control characters- Returns:
- pure text
-
getTextColor
public static java.awt.Color getTextColor(java.lang.String string)
-
getTextColorName
public static java.lang.String getTextColorName(java.lang.String string)
-
-