jmri.jmrit.operations.locations
Class LocationManager

Show UML class diagram
java.lang.Object
  extended by jmri.jmrit.operations.locations.LocationManager
All Implemented Interfaces:
PropertyChangeListener, EventListener

public class LocationManager
extends Object
implements PropertyChangeListener

Manages locations.


Field Summary
protected  Hashtable<String,Location> _locationHashTable
           
protected  int _maxLocationAndTrackNameLength
           
protected  int _maxLocationNameLength
           
protected  int _maxTrackNameLength
           
static String LISTLENGTH_CHANGED_PROPERTY
           
(package private) static org.slf4j.Logger log
           
static String NONE
           
(package private)  PropertyChangeSupport pcs
           
 
Constructor Summary
LocationManager()
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
           
 void deregister(Location location)
          Forget a NamedBean Object created outside the manager.
 void dispose()
           
protected  void firePropertyChange(String p, Object old, Object n)
           
 JComboBox getComboBox()
           
 List<Location> getList()
          Gets an unsorted list of all locations.
 Location getLocationById(String id)
           
 Location getLocationByName(String name)
           
 List<Location> getLocationsByIdList()
          Sort by location number, number can alpha numeric
 List<Location> getLocationsByNameList()
          Sort by location name
 int getMaxLocationAndTrackNameLength()
           
 int getMaxLocationNameLength()
           
 int getMaxTrackNameLength()
           
 int getNumberOfLocations()
           
 List<Track> getTracks(String type)
          Returns all tracks of type
 List<Track> getTracksByMoves(String type)
          Returns all tracks of type sorted by use
static LocationManager instance()
           
 void load(org.jdom.Element root)
           
 Location newLocation(String name)
          Finds an existing location or creates a new location if needed requires location's name creates a unique id for this location
 void propertyChange(PropertyChangeEvent e)
          There aren't any current property changes being monitored
 void register(Location location)
          Remember a NamedBean Object created outside the manager.
 void removePropertyChangeListener(PropertyChangeListener l)
           
 void replaceLoad(String type, String oldLoadName, String newLoadName)
           
 void resetMoves()
           
 void store(org.jdom.Element root)
           
 void updateComboBox(JComboBox box)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final String NONE
See Also:
Constant Field Values

LISTLENGTH_CHANGED_PROPERTY

public static final String LISTLENGTH_CHANGED_PROPERTY
See Also:
Constant Field Values

_locationHashTable

protected Hashtable<String,Location> _locationHashTable

_maxLocationNameLength

protected int _maxLocationNameLength

_maxTrackNameLength

protected int _maxTrackNameLength

_maxLocationAndTrackNameLength

protected int _maxLocationAndTrackNameLength

pcs

PropertyChangeSupport pcs

log

static org.slf4j.Logger log
Constructor Detail

LocationManager

public LocationManager()
Method Detail

instance

public static LocationManager instance()

dispose

public void dispose()

getNumberOfLocations

public int getNumberOfLocations()
Returns:
Number of locations

getLocationByName

public Location getLocationByName(String name)
Returns:
requested Location object or null if none exists

getLocationById

public Location getLocationById(String id)

newLocation

public Location newLocation(String name)
Finds an existing location or creates a new location if needed requires location's name creates a unique id for this location

Parameters:
name -
Returns:
new location or existing location

register

public void register(Location location)
Remember a NamedBean Object created outside the manager.


deregister

public void deregister(Location location)
Forget a NamedBean Object created outside the manager.


getLocationsByNameList

public List<Location> getLocationsByNameList()
Sort by location name

Returns:
list of locations ordered by name

getLocationsByIdList

public List<Location> getLocationsByIdList()
Sort by location number, number can alpha numeric

Returns:
list of locations ordered by id numbers

getList

public List<Location> getList()
Gets an unsorted list of all locations.

Returns:
All locations.

getTracks

public List<Track> getTracks(String type)
Returns all tracks of type

Parameters:
type - Spur (Track.SPUR), Yard (Track.YARD), Interchange (Track.INTERCHANGE), Staging (Track.STAGING), or null (returns all track types)
Returns:
List of tracks

getTracksByMoves

public List<Track> getTracksByMoves(String type)
Returns all tracks of type sorted by use

Parameters:
type - Spur (Track.SPUR), Yard (Track.YARD), Interchange (Track.INTERCHANGE), Staging (Track.STAGING), or null (returns all track types)
Returns:
List of tracks ordered by use

resetMoves

public void resetMoves()

getComboBox

public JComboBox getComboBox()

updateComboBox

public void updateComboBox(JComboBox box)

replaceLoad

public void replaceLoad(String type,
                        String oldLoadName,
                        String newLoadName)

getMaxLocationNameLength

public int getMaxLocationNameLength()

getMaxTrackNameLength

public int getMaxTrackNameLength()

getMaxLocationAndTrackNameLength

public int getMaxLocationAndTrackNameLength()

load

public void load(org.jdom.Element root)

store

public void store(org.jdom.Element root)

propertyChange

public void propertyChange(PropertyChangeEvent e)
There aren't any current property changes being monitored

Specified by:
propertyChange in interface PropertyChangeListener

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)

firePropertyChange

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


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