Class CarLoads
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.jmrit.operations.rollingstock.RollingStockAttribute
-
- jmri.jmrit.operations.rollingstock.cars.CarLoads
-
- All Implemented Interfaces:
PropertyChangeFirer
,PropertyChangeProvider
,InstanceManagerAutoDefault
public class CarLoads extends RollingStockAttribute implements InstanceManagerAutoDefault
Represents the loads that cars can have.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
_emptyName
protected java.lang.String
_loadName
protected java.util.Hashtable<java.lang.String,java.util.List<CarLoad>>
listCarLoads
static java.lang.String
LOAD_CHANGED_PROPERTY
static java.lang.String
LOAD_COMMENT_CHANGED_PROPERTY
static java.lang.String
LOAD_HAZARDOUS_CHANGED_PROPERTY
static java.lang.String
LOAD_NAME_CHANGED_PROPERTY
static java.lang.String
LOAD_PRIORITY_CHANGED_PROPERTY
static java.lang.String
LOAD_TYPE_CHANGED_PROPERTY
(package private) int
maxCommentLength
static java.lang.String
NONE
-
Fields inherited from class jmri.jmrit.operations.rollingstock.RollingStockAttribute
list, maxName, maxNameLength, maxNameSubStringLength, MIN_NAME_LENGTH
-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description CarLoads()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addName(java.lang.String type, java.lang.String name)
Add a load name for the car type.void
addType(java.lang.String type)
Add a car type with specific loadsboolean
containsName(java.lang.String type, java.lang.String name)
Determines if a car type can have a specific load name.void
deleteName(java.lang.String type, java.lang.String name)
void
dispose()
javax.swing.JComboBox<java.lang.String>
getComboBox(java.lang.String type)
Gets the appropriate car loads for the car's type.java.lang.String
getDefaultEmptyName()
java.lang.String
getDefaultLoadName()
java.lang.String
getDropComment(java.lang.String type, java.lang.String name)
javax.swing.JComboBox<java.lang.String>
getHazardousComboBox()
java.util.Hashtable<java.lang.String,java.util.List<CarLoad>>
getList()
java.lang.String
getLoadType(java.lang.String type, java.lang.String name)
Get the load type, empty or load.javax.swing.JComboBox<java.lang.String>
getLoadTypesComboBox()
Gets a ComboBox with the available load types: empty and loadint
getMaxLoadCommentLength()
int
getMaxNameLength()
java.util.List<java.lang.String>
getNames(java.lang.String type)
Gets a sorted list of load names for a given car typejava.lang.String
getPickupComment(java.lang.String type, java.lang.String name)
java.lang.String
getPriority(java.lang.String type, java.lang.String name)
Get's a load's priority.javax.swing.JComboBox<java.lang.String>
getPriorityComboBox()
Gets a ComboBox with the available prioritiesjavax.swing.JComboBox<java.lang.String>
getSelectComboBox(java.lang.String type)
Gets the appropriate car loads for the car's type.boolean
isHazardous(java.lang.String type, java.lang.String name)
void
load(org.jdom2.Element e)
void
replaceName(java.lang.String type, java.lang.String oldName, java.lang.String newName)
void
replaceType(java.lang.String oldType, java.lang.String newType)
Replace a car type.void
setDefaultEmptyName(java.lang.String name)
void
setDefaultLoadName(java.lang.String name)
protected void
setDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
void
setDropComment(java.lang.String type, java.lang.String name, java.lang.String comment)
void
setHazardous(java.lang.String type, java.lang.String name, boolean isHazardous)
void
setLoadType(java.lang.String type, java.lang.String name, java.lang.String loadType)
Sets the load type, empty or load.void
setPickupComment(java.lang.String type, java.lang.String name, java.lang.String comment)
Sets the comment for a car type's loadvoid
setPriority(java.lang.String type, java.lang.String name, java.lang.String priority)
Sets a loads priority.void
store(org.jdom2.Element root)
Create an XML element to represent this Entry.void
updateComboBox(java.lang.String type, javax.swing.JComboBox<java.lang.String> box)
void
updateComboBox(javax.swing.JComboBox<java.lang.String> box)
Update a JComboBox with all load names for every type of car.void
updateRweComboBox(java.lang.String type, javax.swing.JComboBox<java.lang.String> box)
void
updateRwlComboBox(java.lang.String type, javax.swing.JComboBox<java.lang.String> box)
-
Methods inherited from class jmri.jmrit.operations.rollingstock.RollingStockAttribute
addName, containsName, deleteName, getComboBox, getDefaultNames, getMaxNameSubStringLength, getMinNameLength, getNames, load, setNames, setValues, sort, store
-
Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
listCarLoads
protected java.util.Hashtable<java.lang.String,java.util.List<CarLoad>> listCarLoads
-
_emptyName
protected java.lang.String _emptyName
-
_loadName
protected java.lang.String _loadName
-
NONE
public static final java.lang.String NONE
- See Also:
- Constant Field Values
-
LOAD_CHANGED_PROPERTY
public static final java.lang.String LOAD_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
LOAD_TYPE_CHANGED_PROPERTY
public static final java.lang.String LOAD_TYPE_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
LOAD_PRIORITY_CHANGED_PROPERTY
public static final java.lang.String LOAD_PRIORITY_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
LOAD_NAME_CHANGED_PROPERTY
public static final java.lang.String LOAD_NAME_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
LOAD_COMMENT_CHANGED_PROPERTY
public static final java.lang.String LOAD_COMMENT_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
LOAD_HAZARDOUS_CHANGED_PROPERTY
public static final java.lang.String LOAD_HAZARDOUS_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
maxCommentLength
int maxCommentLength
-
-
Constructor Detail
-
CarLoads
public CarLoads()
-
-
Method Detail
-
addType
public void addType(java.lang.String type)
Add a car type with specific loads- Parameters:
type
- car type
-
replaceType
public void replaceType(java.lang.String oldType, java.lang.String newType)
Replace a car type. Transfers load type, priority, isHardous, drop and load comments.- Parameters:
oldType
- old car typenewType
- new car type
-
getSelectComboBox
public javax.swing.JComboBox<java.lang.String> getSelectComboBox(java.lang.String type)
Gets the appropriate car loads for the car's type.- Parameters:
type
- Car type- Returns:
- JComboBox with car loads starting with empty string.
-
getComboBox
public javax.swing.JComboBox<java.lang.String> getComboBox(java.lang.String type)
Gets the appropriate car loads for the car's type.- Parameters:
type
- Car type- Returns:
- JComboBox with car loads.
-
getPriorityComboBox
public javax.swing.JComboBox<java.lang.String> getPriorityComboBox()
Gets a ComboBox with the available priorities- Returns:
- JComboBox with car priorities.
-
getHazardousComboBox
public javax.swing.JComboBox<java.lang.String> getHazardousComboBox()
-
getLoadTypesComboBox
public javax.swing.JComboBox<java.lang.String> getLoadTypesComboBox()
Gets a ComboBox with the available load types: empty and load- Returns:
- JComboBox with load types: LOAD_TYPE_EMPTY and LOAD_TYPE_LOAD
-
getNames
public java.util.List<java.lang.String> getNames(java.lang.String type)
Gets a sorted list of load names for a given car type- Parameters:
type
- car type- Returns:
- list of load names
-
addName
public void addName(java.lang.String type, java.lang.String name)
Add a load name for the car type.- Parameters:
type
- car type.name
- load name.
-
deleteName
public void deleteName(java.lang.String type, java.lang.String name)
-
containsName
public boolean containsName(java.lang.String type, java.lang.String name)
Determines if a car type can have a specific load name.- Parameters:
type
- car type.name
- load name.- Returns:
- true if car can have this load name.
-
updateComboBox
public void updateComboBox(java.lang.String type, javax.swing.JComboBox<java.lang.String> box)
-
updateComboBox
public void updateComboBox(javax.swing.JComboBox<java.lang.String> box)
Update a JComboBox with all load names for every type of car.- Overrides:
updateComboBox
in classRollingStockAttribute
- Parameters:
box
- the combo box to update
-
updateRweComboBox
public void updateRweComboBox(java.lang.String type, javax.swing.JComboBox<java.lang.String> box)
-
updateRwlComboBox
public void updateRwlComboBox(java.lang.String type, javax.swing.JComboBox<java.lang.String> box)
-
replaceName
public void replaceName(java.lang.String type, java.lang.String oldName, java.lang.String newName)
-
getDefaultLoadName
public java.lang.String getDefaultLoadName()
-
setDefaultLoadName
public void setDefaultLoadName(java.lang.String name)
-
getDefaultEmptyName
public java.lang.String getDefaultEmptyName()
-
setDefaultEmptyName
public void setDefaultEmptyName(java.lang.String name)
-
setLoadType
public void setLoadType(java.lang.String type, java.lang.String name, java.lang.String loadType)
Sets the load type, empty or load.- Parameters:
type
- car type.name
- load name.loadType
- load type: LOAD_TYPE_EMPTY or LOAD_TYPE_LOAD.
-
getLoadType
public java.lang.String getLoadType(java.lang.String type, java.lang.String name)
Get the load type, empty or load.- Parameters:
type
- car type.name
- load name.- Returns:
- load type, LOAD_TYPE_EMPTY or LOAD_TYPE_LOAD.
-
setPriority
public void setPriority(java.lang.String type, java.lang.String name, java.lang.String priority)
Sets a loads priority.- Parameters:
type
- car type.name
- load name.priority
- load priority, PRIORITY_LOW, PRIORITY_MEDIUM or PRIORITY_HIGH.
-
getPriority
public java.lang.String getPriority(java.lang.String type, java.lang.String name)
Get's a load's priority.- Parameters:
type
- car type.name
- load name.- Returns:
- load priority, PRIORITY_LOW, PRIORITY_MEDIUM or PRIORITY_HIGH.
-
setHazardous
public void setHazardous(java.lang.String type, java.lang.String name, boolean isHazardous)
-
isHazardous
public boolean isHazardous(java.lang.String type, java.lang.String name)
-
setPickupComment
public void setPickupComment(java.lang.String type, java.lang.String name, java.lang.String comment)
Sets the comment for a car type's load- Parameters:
type
- the car typename
- the load namecomment
- the comment
-
getPickupComment
public java.lang.String getPickupComment(java.lang.String type, java.lang.String name)
-
setDropComment
public void setDropComment(java.lang.String type, java.lang.String name, java.lang.String comment)
-
getDropComment
public java.lang.String getDropComment(java.lang.String type, java.lang.String name)
-
getMaxNameLength
public int getMaxNameLength()
- Overrides:
getMaxNameLength
in classRollingStockAttribute
-
getMaxLoadCommentLength
public int getMaxLoadCommentLength()
-
dispose
public void dispose()
- Overrides:
dispose
in classRollingStockAttribute
-
store
public void store(org.jdom2.Element root)
Create an XML element to represent this Entry. This member has to remain synchronized with the detailed DTD in operations-cars.dtd.- Parameters:
root
- The common Element for operations-cars.dtd.
-
load
public void load(org.jdom2.Element e)
-
setDirtyAndFirePropertyChange
protected void setDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
-
-