Package jmri.jmrit.operations.routes
Class RouteLocation
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.jmrit.operations.routes.RouteLocation
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener,java.util.EventListener,PropertyChangeFirer,PropertyChangeProvider
public class RouteLocation extends PropertyChangeSupport implements java.beans.PropertyChangeListener
Represents a location in a route, a location can appear more than once in a route.
-
-
Field Summary
Fields Modifier and Type Field Description protected int_blockingOrderprotected int_carMovesprotected java.lang.String_commentprotected java.awt.Color_commentColorprotected java.lang.String_departureTimeprotected boolean_dropsprotected double_gradeprotected java.lang.String_idprotected boolean_localMovesprotected Location_locationprotected java.lang.String_locationIdprotected int_maxCarMovesprotected int_maxTrainLengthprotected boolean_pickupsprotected java.lang.String_randomControlprotected int_sequenceNumprotected int_trainDirprotected int_trainIconXprotected int_trainIconYprotected int_trainLengthprotected int_trainWeightprotected int_waitstatic java.lang.StringDELETEDstatic java.lang.StringDEPARTURE_TIME_CHANGED_PROPERTYstatic java.lang.StringDISABLEDstatic java.lang.StringDISPOSEstatic java.lang.StringDROP_CHANGED_PROPERTYstatic intEASTstatic java.lang.StringEAST_DIRstatic java.lang.StringLOCAL_MOVES_CHANGED_PROPERTYstatic java.lang.StringMAX_LENGTH_CHANGED_PROPERTYstatic java.lang.StringMAX_MOVES_CHANGED_PROPERTYstatic java.lang.StringNONEstatic intNORTHstatic java.lang.StringNORTH_DIRstatic java.lang.StringPICKUP_CHANGED_PROPERTYstatic intSOUTHstatic java.lang.StringSOUTH_DIRstatic java.lang.StringTRAIN_DIRECTION_CHANGED_PROPERTYstatic intWESTstatic java.lang.StringWEST_DIR-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description RouteLocation(java.lang.String id, Location location)RouteLocation(org.jdom2.Element e)Construct this Entry from XML.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()intgetBlockingOrder()intgetCarMoves()java.lang.StringgetComment()java.awt.ColorgetCommentColor()java.lang.StringgetCommentTextColor()java.lang.StringgetCommentWithColor()java.lang.StringgetDepartureTime()java.lang.StringgetDepartureTimeHour()java.lang.StringgetDepartureTimeMinute()java.lang.StringgetFormatedDepartureTime()doublegetGrade()java.lang.StringgetId()LocationgetLocation()intgetMaxCarMoves()Get the maximum number of moves for this locationintgetMaxTrainLength()java.lang.StringgetName()java.lang.StringgetRandomControl()intgetSequenceNumber()java.lang.StringgetSplitName()intgetTrainDirection()Gets the binary representation of the train's direction at this locationjava.lang.StringgetTrainDirectionString()Gets the String representation of the train's direction at this locationjava.awt.PointgetTrainIconCoordinates()intgetTrainIconRangeX()Gets the X range for detecting the manual movement of a train icon.intgetTrainIconRangeY()Gets the Y range for detecting the manual movement of a train icon.intgetTrainIconX()intgetTrainIconY()intgetTrainLength()intgetTrainWeight()intgetWait()booleanisDropAllowed()booleanisLocalMovesAllowed()booleanisPickUpAllowed()voidpropertyChange(java.beans.PropertyChangeEvent e)voidsetBlockingOrder(int order)voidsetCarMoves(int moves)Set the number of moves completed when building a trainvoidsetComment(java.lang.String comment)voidsetCommentColor(java.awt.Color color)Sets the text color for the route commentvoidsetCommentTextColor(java.lang.String color)voidsetDepartureTime(java.lang.String time)Sets the formated departure time from this locationvoidsetDepartureTime(java.lang.String hour, java.lang.String minute)protected voidsetDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)voidsetDropAllowed(boolean drops)When true allow car drops at this locationvoidsetGrade(double grade)voidsetLocalMovesAllowed(boolean local)When true allow local car moves at this locationvoidsetMaxCarMoves(int moves)voidsetMaxTrainLength(int length)voidsetPickUpAllowed(boolean pickups)When true allow car pick ups at this locationvoidsetRandomControl(java.lang.String value)voidsetSequenceNumber(int sequence)voidsetTrainDirection(int direction)voidsetTrainIconCoordinates()Set the train icon panel coordinates to the location defaults.voidsetTrainIconX(int x)voidsetTrainIconY(int y)voidsetTrainLength(int length)Set the train length departing this location when building a trainvoidsetTrainWeight(int weight)Set the train weight departing this location when building a trainvoidsetWait(int time)org.jdom2.Elementstore()Create an XML element to represent this Entry.java.lang.StringtoString()-
Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
NONE
public static final java.lang.String NONE
- See Also:
- Constant Field Values
-
_id
protected java.lang.String _id
-
_locationId
protected java.lang.String _locationId
-
_trainDir
protected int _trainDir
-
_maxTrainLength
protected int _maxTrainLength
-
_maxCarMoves
protected int _maxCarMoves
-
_randomControl
protected java.lang.String _randomControl
-
_drops
protected boolean _drops
-
_pickups
protected boolean _pickups
-
_localMoves
protected boolean _localMoves
-
_sequenceNum
protected int _sequenceNum
-
_grade
protected double _grade
-
_wait
protected int _wait
-
_departureTime
protected java.lang.String _departureTime
-
_trainIconX
protected int _trainIconX
-
_trainIconY
protected int _trainIconY
-
_blockingOrder
protected int _blockingOrder
-
_comment
protected java.lang.String _comment
-
_commentColor
protected java.awt.Color _commentColor
-
_carMoves
protected int _carMoves
-
_trainWeight
protected int _trainWeight
-
_trainLength
protected int _trainLength
-
EAST
public static final int EAST
- See Also:
- Constant Field Values
-
WEST
public static final int WEST
- See Also:
- Constant Field Values
-
NORTH
public static final int NORTH
- See Also:
- Constant Field Values
-
SOUTH
public static final int SOUTH
- See Also:
- Constant Field Values
-
EAST_DIR
public static final java.lang.String EAST_DIR
-
WEST_DIR
public static final java.lang.String WEST_DIR
-
NORTH_DIR
public static final java.lang.String NORTH_DIR
-
SOUTH_DIR
public static final java.lang.String SOUTH_DIR
-
DISPOSE
public static final java.lang.String DISPOSE
- See Also:
- Constant Field Values
-
DELETED
public static final java.lang.String DELETED
-
DROP_CHANGED_PROPERTY
public static final java.lang.String DROP_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
PICKUP_CHANGED_PROPERTY
public static final java.lang.String PICKUP_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
LOCAL_MOVES_CHANGED_PROPERTY
public static final java.lang.String LOCAL_MOVES_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
MAX_MOVES_CHANGED_PROPERTY
public static final java.lang.String MAX_MOVES_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
TRAIN_DIRECTION_CHANGED_PROPERTY
public static final java.lang.String TRAIN_DIRECTION_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
DEPARTURE_TIME_CHANGED_PROPERTY
public static final java.lang.String DEPARTURE_TIME_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
MAX_LENGTH_CHANGED_PROPERTY
public static final java.lang.String MAX_LENGTH_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
DISABLED
public static final java.lang.String DISABLED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RouteLocation
public RouteLocation(java.lang.String id, Location location)
-
RouteLocation
public RouteLocation(org.jdom2.Element e)
Construct this Entry from XML. This member has to remain synchronized with the detailed DTD in operations-config.xml- Parameters:
e- Consist XML element
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getId
public java.lang.String getId()
-
getName
public java.lang.String getName()
-
getSplitName
public java.lang.String getSplitName()
-
getLocation
public Location getLocation()
-
getSequenceNumber
public int getSequenceNumber()
-
setSequenceNumber
public void setSequenceNumber(int sequence)
-
getBlockingOrder
public int getBlockingOrder()
-
setBlockingOrder
public void setBlockingOrder(int order)
-
setComment
public void setComment(java.lang.String comment)
-
getComment
public java.lang.String getComment()
-
setCommentColor
public void setCommentColor(java.awt.Color color)
Sets the text color for the route comment- Parameters:
color- The color of the text
-
getCommentColor
public java.awt.Color getCommentColor()
-
getCommentWithColor
public java.lang.String getCommentWithColor()
-
setCommentTextColor
public void setCommentTextColor(java.lang.String color)
-
getCommentTextColor
public java.lang.String getCommentTextColor()
-
setTrainDirection
public void setTrainDirection(int direction)
-
getTrainDirection
public int getTrainDirection()
Gets the binary representation of the train's direction at this location- Returns:
- int representing train direction EAST WEST NORTH SOUTH
-
getTrainDirectionString
public java.lang.String getTrainDirectionString()
Gets the String representation of the train's direction at this location- Returns:
- String representing train direction at this location
-
setMaxTrainLength
public void setMaxTrainLength(int length)
-
getMaxTrainLength
public int getMaxTrainLength()
-
setTrainLength
public void setTrainLength(int length)
Set the train length departing this location when building a train- Parameters:
length- The train's current length.
-
getTrainLength
public int getTrainLength()
-
setTrainWeight
public void setTrainWeight(int weight)
Set the train weight departing this location when building a train- Parameters:
weight- The train's current weight.
-
getTrainWeight
public int getTrainWeight()
-
setMaxCarMoves
public void setMaxCarMoves(int moves)
-
getMaxCarMoves
public int getMaxCarMoves()
Get the maximum number of moves for this location- Returns:
- maximum number of moves
-
setRandomControl
public void setRandomControl(java.lang.String value)
-
getRandomControl
public java.lang.String getRandomControl()
-
setDropAllowed
public void setDropAllowed(boolean drops)
When true allow car drops at this location- Parameters:
drops- when true drops allowed at this location
-
isDropAllowed
public boolean isDropAllowed()
-
setPickUpAllowed
public void setPickUpAllowed(boolean pickups)
When true allow car pick ups at this location- Parameters:
pickups- when true pick ups allowed at this location
-
isPickUpAllowed
public boolean isPickUpAllowed()
-
setLocalMovesAllowed
public void setLocalMovesAllowed(boolean local)
When true allow local car moves at this location- Parameters:
local- when true local moves allowed at this location
-
isLocalMovesAllowed
public boolean isLocalMovesAllowed()
-
setCarMoves
public void setCarMoves(int moves)
Set the number of moves completed when building a train- Parameters:
moves- An integer representing the amount of moves completed.
-
getCarMoves
public int getCarMoves()
-
setWait
public void setWait(int time)
-
getWait
public int getWait()
-
setDepartureTime
public void setDepartureTime(java.lang.String time)
Sets the formated departure time from this location- Parameters:
time- format hours:minutes
-
setDepartureTime
public void setDepartureTime(java.lang.String hour, java.lang.String minute)
-
getDepartureTime
public java.lang.String getDepartureTime()
-
getDepartureTimeHour
public java.lang.String getDepartureTimeHour()
-
getDepartureTimeMinute
public java.lang.String getDepartureTimeMinute()
-
getFormatedDepartureTime
public java.lang.String getFormatedDepartureTime()
-
setGrade
public void setGrade(double grade)
-
getGrade
public double getGrade()
-
setTrainIconX
public void setTrainIconX(int x)
-
getTrainIconX
public int getTrainIconX()
-
setTrainIconY
public void setTrainIconY(int y)
-
getTrainIconY
public int getTrainIconY()
-
getTrainIconRangeX
public int getTrainIconRangeX()
Gets the X range for detecting the manual movement of a train icon.- Returns:
- the range for detection
-
getTrainIconRangeY
public int getTrainIconRangeY()
Gets the Y range for detecting the manual movement of a train icon.- Returns:
- the range for detection
-
setTrainIconCoordinates
public void setTrainIconCoordinates()
Set the train icon panel coordinates to the location defaults. Coordinates are dependent on the train's departure direction.
-
getTrainIconCoordinates
public java.awt.Point getTrainIconCoordinates()
-
dispose
public void dispose()
-
store
public org.jdom2.Element store()
Create an XML element to represent this Entry. This member has to remain synchronized with the detailed DTD in operations-config.xml.- Returns:
- Contents in a JDOM Element
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener
-
setDirtyAndFirePropertyChange
protected void setDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
-
-