Package jmri.jmrit.operations.routes
Class RouteManager
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.jmrit.operations.routes.RouteManager
-
- All Implemented Interfaces:
PropertyChangeFirer
,PropertyChangeProvider
,InstanceManagerAutoDefault
,InstanceManagerAutoInitialize
public class RouteManager extends PropertyChangeSupport implements InstanceManagerAutoDefault, InstanceManagerAutoInitialize
Manages the routes
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Hashtable<java.lang.String,Route>
_routeHashTable
static java.lang.String
LISTLENGTH_CHANGED_PROPERTY
-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description RouteManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Route
copyRoute(Route route, java.lang.String routeName, boolean invert)
Copy route, returns a new route named routeName.void
deregister(Route route)
Forget a NamedBean Object created outside the manager.void
dispose()
javax.swing.JComboBox<Route>
getComboBox()
Route
getRouteById(java.lang.String id)
Route
getRouteByName(java.lang.String name)
java.util.List<Route>
getRoutesByIdList()
Sort by route number, number can alpha numericjava.util.List<Route>
getRoutesByNameList()
Sort by route namevoid
initialize()
Perform any initialization that occurs after this object has been constructed and made available by the InstanceManager.void
load(Element root)
Route
newRoute(java.lang.String name)
Finds an existing route or creates a new route if needed requires route's name creates a unique id for this routeint
numEntries()
void
register(Route route)
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(Element root)
void
updateComboBox(javax.swing.JComboBox<Route> 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
-
_routeHashTable
protected java.util.Hashtable<java.lang.String,Route> _routeHashTable
-
-
Constructor Detail
-
RouteManager
public RouteManager()
-
-
Method Detail
-
dispose
public void dispose()
-
getRouteByName
public Route getRouteByName(java.lang.String name)
- Parameters:
name
- The string name of the Route.- Returns:
- requested Route object or null if none exists
-
getRouteById
public Route getRouteById(java.lang.String id)
-
newRoute
public Route newRoute(java.lang.String name)
Finds an existing route or creates a new route if needed requires route's name creates a unique id for this route- Parameters:
name
- The string name of the new Route.- Returns:
- new route or existing route
-
register
public void register(Route route)
Remember a NamedBean Object created outside the manager.- Parameters:
route
- The Route to add.
-
deregister
public void deregister(Route route)
Forget a NamedBean Object created outside the manager.- Parameters:
route
- The Route to delete.
-
getRoutesByNameList
public java.util.List<Route> getRoutesByNameList()
Sort by route name- Returns:
- list of routes ordered by name
-
getRoutesByIdList
public java.util.List<Route> getRoutesByIdList()
Sort by route number, number can alpha numeric- Returns:
- list of routes ordered by id numbers
-
getComboBox
public javax.swing.JComboBox<Route> getComboBox()
-
updateComboBox
public void updateComboBox(javax.swing.JComboBox<Route> box)
-
copyRoute
public Route copyRoute(Route route, java.lang.String routeName, boolean invert)
Copy route, returns a new route named routeName. If invert is true the reverse of the route is returned.- Parameters:
route
- The route to be copiedrouteName
- The name of the new routeinvert
- If true, return the inversion of route- Returns:
- A copy of the route
-
numEntries
public int numEntries()
- Returns:
- Number of routes
-
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
-
-