Package jmri.jmrit.operations.locations
Class LocationManager
java.lang.Object
jmri.beans.PropertyChangeSupport
jmri.jmrit.operations.locations.LocationManager
- All Implemented Interfaces:
PropertyChangeListener,EventListener,PropertyChangeFirer,PropertyChangeProvider,InstanceManagerAutoDefault,InstanceManagerAutoInitialize
public class LocationManager
extends PropertyChangeSupport
implements InstanceManagerAutoDefault, InstanceManagerAutoInitialize, PropertyChangeListener
Manages locations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected intprotected booleanstatic final StringFields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidderegister(Location location) Forget a NamedBean Object created outside the manager.voiddispose()Returns a JComboBox with locations sorted alphabetically.getList()Gets an unsorted list of all locations.getLocationByName(String name) Request a location associated with a given reporter.Sort by location number, number can alpha numericSort by location nameintintintintRequest a track associated with a given reporter.Returns all tracks of typegetTracksByMoves(String type) Returns all tracks of type sorted by use.Get unique locations list by location name.booleanUsed to determine if a division name has been assigned to a locationbooleanUsed to determine if a reporter has been assigned to a locationbooleanhasWork()voidPerform any initialization that occurs after this object has been constructed and made available by the InstanceManager.booleanvoidload(org.jdom2.Element root) Load the locations from a xml file.newLocation(String name) Finds an existing location or creates a new location if needed requires location's name creates a unique id for this locationvoidThere aren't any current property changes being monitored.voidRemember a NamedBean Object created outside the manager.voidreplaceLoad(String type, String oldLoadName, String newLoadName) Replace all track car load names for a given type of carvoidSets move count to 0 for all tracksvoidprotected voidsetDirtyAndFirePropertyChange(String p, Object old, Object n) voidsetShowIdEnabled(boolean showId) voidstore(org.jdom2.Element root) voidupdateComboBox(JComboBox<Location> box) Updates JComboBox alphabetically with a list of locations.Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
LISTLENGTH_CHANGED_PROPERTY
- See Also:
-
_showId
-
_locationHashTable
-
_maxLocationNameLength
-
_maxTrackNameLength
-
_maxLocationAndTrackNameLength
-
-
Constructor Details
-
LocationManager
public LocationManager()
-
-
Method Details
-
dispose
-
getNumberOfLocations
- Returns:
- Number of locations
-
getLocationByName
- Parameters:
name- The string name of the Location to get.- Returns:
- requested Location object or null if none exists
-
getLocationById
-
hasDivisions
Used to determine if a division name has been assigned to a location- Returns:
- true if a location has a division name
-
hasWork
-
hasReporters
Used to determine if a reporter has been assigned to a location- Returns:
- true if a location has a RFID reporter
-
setShowIdEnabled
-
isShowIdEnabled
-
getLocationByReporter
Request a location associated with a given reporter.- Parameters:
r- Reporter object associated with desired location.- Returns:
- requested Location object or null if none exists
-
getTrackByReporter
Request a track associated with a given reporter.- Parameters:
r- Reporter object associated with desired location.- Returns:
- requested Location object or null if none exists
-
newLocation
Finds an existing location or creates a new location if needed requires location's name creates a unique id for this location- Parameters:
name- The string name for a new Location.- Returns:
- new location or existing location
-
register
Remember a NamedBean Object created outside the manager.- Parameters:
location- The Location to add.
-
deregister
Forget a NamedBean Object created outside the manager.- Parameters:
location- The Location to delete.
-
getLocationsByNameList
Sort by location name- Returns:
- list of locations ordered by name
-
getUniqueLocationsByNameList
Get unique locations list by location name.- Returns:
- list of locations ordered by name. Locations with "similar" names to the primary location are not returned. Also checks and updates the primary location for any changes to the other "similar" locations.
-
getLocationsByIdList
Sort by location number, number can alpha numeric- Returns:
- list of locations ordered by id numbers
-
getList
Gets an unsorted list of all locations.- Returns:
- All locations.
-
getTracks
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
Returns all tracks of type sorted by use. Alternate tracks are not included.- 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
Sets move count to 0 for all tracks -
getComboBox
Returns a JComboBox with locations sorted alphabetically.- Returns:
- locations for this railroad
-
updateComboBox
Updates JComboBox alphabetically with a list of locations.- Parameters:
box- The JComboBox to update.
-
replaceLoad
Replace all track car load names for a given type of car- Parameters:
type- type of caroldLoadName- load name to replacenewLoadName- new load name
-
resetNameLengths
-
getMaxLocationNameLength
-
getMaxTrackNameLength
-
getMaxLocationAndTrackNameLength
-
load
Load the locations from a xml file.- Parameters:
root- xml file
-
store
-
propertyChange
There aren't any current property changes being monitored.- Specified by:
propertyChangein interfacePropertyChangeListener
-
setDirtyAndFirePropertyChange
-
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
-