jmri.jmrit.operations.rollingstock.cars
Class CarLoads

Show UML class diagram
java.lang.Object
  extended by jmri.jmrit.operations.rollingstock.cars.CarLoads

public class CarLoads
extends Object

Represents the loads that cars can have.


Field Summary
protected  String _emptyName
           
protected  String _loadName
           
protected  Hashtable<String,List<CarLoad>> list
           
static String LOAD_CHANGED_PROPERTY
           
static String LOAD_NAME_CHANGED_PROPERTY
           
(package private) static org.slf4j.Logger log
           
(package private)  PropertyChangeSupport pcs
           
 
Constructor Summary
CarLoads()
           
 
Method Summary
 void addName(String type, String name)
          Add a load name for the car type.
 void addPropertyChangeListener(PropertyChangeListener l)
           
 void addType(String type)
          Add a car type with specific loads
 boolean containsName(String type, String name)
          Determines if a car type can have a specific load name.
 void deleteName(String type, String name)
           
 void dispose()
           
protected  void firePropertyChange(String p, Object old, Object n)
           
 JComboBox getComboBox(String type)
          Gets the appropriate car loads for the car's type.
 int getCurMaxNameLength()
           
 String getDefaultEmptyName()
           
 String getDefaultLoadName()
           
 String getDropComment(String type, String name)
           
 Hashtable<String,List<CarLoad>> getList()
           
 String getLoadType(String type, String name)
          Get's the load type, empty or load.
 JComboBox getLoadTypesComboBox()
          Gets a combobox with the available load types
 List<String> getNames(String type)
          Gets the load names for a given car type
 String getPickupComment(String type, String name)
           
 String getPriority(String type, String name)
          Get's a load's priority.
 JComboBox getPriorityComboBox()
          Gets a combobox with the available priorities
 JComboBox getSelectComboBox(String type)
          Gets the appropriate car loads for the car's type.
static CarLoads instance()
           
 void load(org.jdom.Element e)
           
 void removePropertyChangeListener(PropertyChangeListener l)
           
 void replaceName(String type, String oldName, String newName)
           
 void replaceType(String oldType, String newType)
          Replace a car type.
 void setDefaultEmptyName(String name)
           
 void setDefaultLoadName(String name)
           
 void setDropComment(String type, String name, String comment)
           
 void setLoadType(String type, String name, String loadType)
          Sets the load type, empty or load.
 void setPickupComment(String type, String name, String comment)
           
 void setPriority(String type, String name, String priority)
          Sets a loads priority.
 void store(org.jdom.Element root)
          Create an XML element to represent this Entry.
 void updateComboBox(String type, JComboBox box)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

protected Hashtable<String,List<CarLoad>> list

_emptyName

protected String _emptyName

_loadName

protected String _loadName

LOAD_CHANGED_PROPERTY

public static final String LOAD_CHANGED_PROPERTY
See Also:
Constant Field Values

LOAD_NAME_CHANGED_PROPERTY

public static final String LOAD_NAME_CHANGED_PROPERTY
See Also:
Constant Field Values

pcs

PropertyChangeSupport pcs

log

static org.slf4j.Logger log
Constructor Detail

CarLoads

public CarLoads()
Method Detail

instance

public static CarLoads instance()

dispose

public void dispose()

addType

public void addType(String type)
Add a car type with specific loads

Parameters:
type - car type

replaceType

public void replaceType(String oldType,
                        String newType)
Replace a car type. Transfers load priority, drop and load comments.

Parameters:
oldType - old car type
newType - new car type

getSelectComboBox

public JComboBox getSelectComboBox(String type)
Gets the appropriate car loads for the car's type.

Parameters:
type -
Returns:
JComboBox with car loads starting with empty string.

getComboBox

public JComboBox getComboBox(String type)
Gets the appropriate car loads for the car's type.

Parameters:
type -
Returns:
JComboBox with car loads.

getPriorityComboBox

public JComboBox getPriorityComboBox()
Gets a combobox with the available priorities

Returns:
JComboBox with car priorities.

getLoadTypesComboBox

public JComboBox getLoadTypesComboBox()
Gets a combobox with the available load types

Returns:
JComboBox with load types.

getNames

public List<String> getNames(String type)
Gets the load names for a given car type

Parameters:
type - car type
Returns:
list of load names

addName

public void addName(String type,
                    String name)
Add a load name for the car type.

Parameters:
type - car type.
name - load name.

deleteName

public void deleteName(String type,
                       String name)

containsName

public boolean containsName(String type,
                            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(String type,
                           JComboBox box)

replaceName

public void replaceName(String type,
                        String oldName,
                        String newName)

getDefaultLoadName

public String getDefaultLoadName()

setDefaultLoadName

public void setDefaultLoadName(String name)

getDefaultEmptyName

public String getDefaultEmptyName()

setDefaultEmptyName

public void setDefaultEmptyName(String name)

setLoadType

public void setLoadType(String type,
                        String name,
                        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 String getLoadType(String type,
                          String name)
Get's 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(String type,
                        String name,
                        String priority)
Sets a loads priority.

Parameters:
type - car type.
name - load name.
priority - load priority, PRIORITY_LOW or PRIORITY_HIGH.

getPriority

public String getPriority(String type,
                          String name)
Get's a load's priority.

Parameters:
type - car type.
name - load name.
Returns:
load priority, PRIORITY_LOW or PRIORITY_HIGH.

setPickupComment

public void setPickupComment(String type,
                             String name,
                             String comment)

getPickupComment

public String getPickupComment(String type,
                               String name)

setDropComment

public void setDropComment(String type,
                           String name,
                           String comment)

getDropComment

public String getDropComment(String type,
                             String name)

getCurMaxNameLength

public int getCurMaxNameLength()

getList

public Hashtable<String,List<CarLoad>> getList()

store

public void store(org.jdom.Element root)
Create an XML element to represent this Entry. This member has to remain synchronized with the detailed DTD in operations-cars.dtd.


load

public void load(org.jdom.Element e)

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)

firePropertyChange

protected void firePropertyChange(String p,
                                  Object old,
                                  Object n)


Copyright © 1997-2013 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads