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>_routeHashTablestatic java.lang.StringLISTLENGTH_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 RoutecopyRoute(Route route, java.lang.String routeName, boolean invert)Copy route, returns a new route named routeName.voidderegister(Route route)Forget a NamedBean Object created outside the manager.voiddispose()javax.swing.JComboBox<Route>getComboBox()RoutegetRouteById(java.lang.String id)RoutegetRouteByName(java.lang.String name)java.util.List<Route>getRoutesByIdList()Sort by route number, number can alpha numericjava.util.List<Route>getRoutesByNameList()Sort by route namevoidinitialize()Perform any initialization that occurs after this object has been constructed and made available by the InstanceManager.RouteisLocationInUse(Location loc)Used to determine if a location is part of any route.voidload(org.jdom2.Element root)RoutenewRoute(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 routeintnumEntries()voidregister(Route route)Remember a NamedBean Object created outside the manager.protected voidsetDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)voidstore(org.jdom2.Element root)voidupdateComboBox(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
-
isLocationInUse
public Route isLocationInUse(Location loc)
Used to determine if a location is part of any route.- Parameters:
loc- The location being checked.- Returns:
- null if location isn't used, otherwise a route using the location.
-
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
-
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:InstanceManagerAutoInitializePerform any initialization that occurs after this object has been constructed and made available by the InstanceManager.- Specified by:
initializein interfaceInstanceManagerAutoInitialize
-
-