jmri.jmrit.operations.locations
Class LocationManager

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

public class LocationManager
extends Object
implements PropertyChangeListener

Manages locations.

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

Field Summary
protected  Dimension _editFrameDimension
           
protected  Point _editFramePosition
           
protected  LocationEditFrame _locationEditFrame
           
protected  Hashtable<String,Location> _locationHashTable
           
static String LISTLENGTH_CHANGED_PROPERTY
           
 
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()
           
 Location getLocationById(String id)
           
 Location getLocationByName(String name)
           
 List<String> getLocationsByIdList()
          Sort by location number, number can alpha numeric
 List<String> getLocationsByNameList()
          Sort by location name
 List<Track> getTracks(String type)
          Returns all tracks of type
static LocationManager instance()
           
 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
 int numEntries()
           
 void propertyChange(PropertyChangeEvent e)
          Check for car type and road name replacements.
 void register(Location location)
          Remember a NamedBean Object created outside the manager.
 void removePropertyChangeListener(PropertyChangeListener l)
           
 void replaceLoad(String oldLoadName, String newLoadName)
           
 void replaceRoad(String oldRoad, String newRoad)
           
 void replaceType(String oldType, String newType)
           
 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

_locationEditFrame

protected LocationEditFrame _locationEditFrame

_editFrameDimension

protected Dimension _editFrameDimension

_editFramePosition

protected Point _editFramePosition

_locationHashTable

protected Hashtable<String,Location> _locationHashTable
Constructor Detail

LocationManager

public LocationManager()
Method Detail

instance

public static LocationManager instance()

dispose

public void dispose()

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<String> getLocationsByNameList()
Sort by location name

Returns:
list of location ids ordered by name

getLocationsByIdList

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

Returns:
list of location ids ordered by number

getTracks

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

Parameters:
type - Siding, Yard, Interchange, or Staging
Returns:
List of tracks ordered by use

getComboBox

public JComboBox getComboBox()

updateComboBox

public void updateComboBox(JComboBox box)

replaceType

public void replaceType(String oldType,
                        String newType)

replaceRoad

public void replaceRoad(String oldRoad,
                        String newRoad)

replaceLoad

public void replaceLoad(String oldLoadName,
                        String newLoadName)

propertyChange

public void propertyChange(PropertyChangeEvent e)
Check for car type and road name replacements. Also check for engine type replacement.

Specified by:
propertyChange in interface PropertyChangeListener

numEntries

public int numEntries()
Returns:
Number of locations

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