Class DivisionManager
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.jmrit.operations.locations.divisions.DivisionManager
-
- All Implemented Interfaces:
PropertyChangeFirer
,PropertyChangeProvider
,InstanceManagerAutoDefault
,InstanceManagerAutoInitialize
public class DivisionManager extends PropertyChangeSupport implements InstanceManagerAutoDefault, InstanceManagerAutoInitialize
Manages divisions.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Hashtable<java.lang.String,Division>
_divisionHashTable
protected int
_maxDivisionNameLength
static java.lang.String
LISTLENGTH_CHANGED_PROPERTY
-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description DivisionManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deregister(Division division)
Forget a NamedBean Object created outside the manager.void
dispose()
javax.swing.JComboBox<Division>
getComboBox()
Division
getDivisionById(java.lang.String id)
Division
getDivisionByName(java.lang.String name)
java.util.List<Division>
getDivisionsByIdList()
Sort by Division idjava.util.List<Division>
getDivisionsByNameList()
Sort by Division namejava.util.List<Division>
getList()
Gets an unsorted list of all divisions.int
getMaxDivisionNameLength()
int
getNumberOfdivisions()
void
initialize()
Perform any initialization that occurs after this object has been constructed and made available by the InstanceManager.void
load(org.jdom2.Element root)
Division
newDivision(java.lang.String name)
Finds an existing Division or creates a new Division if needed requires Division's name creates a unique id for this Divisionvoid
register(Division division)
Remember a NamedBean Object created outside the manager.protected void
setDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
void
store(org.jdom2.Element root)
void
updateComboBox(javax.swing.JComboBox<Division> box)
-
Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
LISTLENGTH_CHANGED_PROPERTY
public static final java.lang.String LISTLENGTH_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
_divisionHashTable
protected java.util.Hashtable<java.lang.String,Division> _divisionHashTable
-
_maxDivisionNameLength
protected int _maxDivisionNameLength
-
-
Constructor Detail
-
DivisionManager
public DivisionManager()
-
-
Method Detail
-
dispose
public void dispose()
-
getNumberOfdivisions
public int getNumberOfdivisions()
- Returns:
- Number of divisions
-
getDivisionByName
public Division getDivisionByName(java.lang.String name)
- Parameters:
name
- The string name of the Division to get.- Returns:
- requested Division object or null if none exists
-
getDivisionById
public Division getDivisionById(java.lang.String id)
-
newDivision
public Division newDivision(java.lang.String name)
Finds an existing Division or creates a new Division if needed requires Division's name creates a unique id for this Division- Parameters:
name
- The string name for a new Division.- Returns:
- new Division or existing Division
-
register
public void register(Division division)
Remember a NamedBean Object created outside the manager.- Parameters:
division
- The Division to add.
-
deregister
public void deregister(Division division)
Forget a NamedBean Object created outside the manager.- Parameters:
division
- The Division to delete.
-
getDivisionsByNameList
public java.util.List<Division> getDivisionsByNameList()
Sort by Division name- Returns:
- list of divisions ordered by name
-
getDivisionsByIdList
public java.util.List<Division> getDivisionsByIdList()
Sort by Division id- Returns:
- list of divisions ordered by id numbers
-
getList
public java.util.List<Division> getList()
Gets an unsorted list of all divisions.- Returns:
- All divisions.
-
getComboBox
public javax.swing.JComboBox<Division> getComboBox()
- Returns:
- ComboBox with divisions for this railroad
-
updateComboBox
public void updateComboBox(javax.swing.JComboBox<Division> box)
-
getMaxDivisionNameLength
public int getMaxDivisionNameLength()
-
load
public void load(org.jdom2.Element root)
-
store
public void store(org.jdom2.Element root)
-
setDirtyAndFirePropertyChange
protected void setDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
-
initialize
public void initialize()
Description copied from interface:InstanceManagerAutoInitialize
Perform any initialization that occurs after this object has been constructed and made available by the InstanceManager.- Specified by:
initialize
in interfaceInstanceManagerAutoInitialize
-
-