jmri.jmrit.operations.routes
Class RouteManager

java.lang.Object
  extended by jmri.jmrit.operations.routes.RouteManager

public class RouteManager
extends Object

Manages the routes

Author:
Bob Jacobsen Copyright (C) 2003, Daniel Boudreau Copyright (C) 2008, 2009, 2010

Field Summary
protected  Hashtable<String,Route> _routeHashTable
           
static String LISTLENGTH_CHANGED_PROPERTY
           
 
Constructor Summary
RouteManager()
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
           
 Route copyRoute(Route route, 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()
           
protected  void firePropertyChange(String p, Object old, Object n)
           
 JComboBox getComboBox()
           
 Route getRouteById(String id)
           
 Route getRouteByName(String name)
           
 List<String> getRoutesByIdList()
          Sort by route number, number can alpha numeric
 List<String> getRoutesByNameList()
          Sort by route name
static RouteManager instance()
           
 Route newRoute(String name)
          Finds an existing route or creates a new route if needed requires route's name creates a unique id for this route
 int numEntries()
           
 void register(Route route)
          Remember a NamedBean Object created outside the manager.
 void removePropertyChangeListener(PropertyChangeListener l)
           
 void updateComboBox(JComboBox box)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LISTLENGTH_CHANGED_PROPERTY

public static final String LISTLENGTH_CHANGED_PROPERTY
See Also:
Constant Field Values

_routeHashTable

protected Hashtable<String,Route> _routeHashTable
Constructor Detail

RouteManager

public RouteManager()
Method Detail

instance

public static RouteManager instance()

dispose

public void dispose()

getRouteByName

public Route getRouteByName(String name)
Returns:
requested Route object or null if none exists

getRouteById

public Route getRouteById(String id)

newRoute

public Route newRoute(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 -
Returns:
new route or existing route

register

public void register(Route route)
Remember a NamedBean Object created outside the manager.


deregister

public void deregister(Route route)
Forget a NamedBean Object created outside the manager.


getRoutesByNameList

public List<String> getRoutesByNameList()
Sort by route name

Returns:
list of route ids ordered by name

getRoutesByIdList

public List<String> getRoutesByIdList()
Sort by route number, number can alpha numeric

Returns:
list of route ids ordered by number

getComboBox

public JComboBox getComboBox()

updateComboBox

public void updateComboBox(JComboBox box)

copyRoute

public Route copyRoute(Route route,
                       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 copied
routeName - The name of the new route
invert - If true, return the inversion of route
Returns:
A copy of the route

numEntries

public int numEntries()
Returns:
Number of routes

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)

firePropertyChange

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


Copyright © 1997 - 2011 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