Class LocationManager

java.lang.Object
jmri.beans.PropertyChangeSupport
jmri.jmrit.operations.locations.LocationManager
All Implemented Interfaces:
PropertyChangeListener, EventListener, PropertyChangeFirer, PropertyChangeProvider, InstanceManagerAutoDefault, InstanceManagerAutoInitialize

Manages locations.
  • Field Details

  • Constructor Details

  • Method Details

    • dispose

      public void dispose()
    • getNumberOfLocations

      public int 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

      public boolean hasDivisions()
      Used to determine if a division name has been assigned to a location
      Returns:
      true if a location has a division name
    • hasWork

      public boolean hasWork()
    • hasReporters

      public boolean hasReporters()
      Used to determine if a reporter has been assigned to a location
      Returns:
      true if a location has a RFID reporter
    • setShowIdEnabled

      public void setShowIdEnabled(boolean showId)
    • isShowIdEnabled

      public boolean 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

      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 - The string name for a new Location.
      Returns:
      new location or existing location
    • register

      public void register(Location location)
      Remember a NamedBean Object created outside the manager.
      Parameters:
      location - The Location to add.
    • deregister

      public void deregister(Location location)
      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

      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

      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

      public void resetMoves()
      Sets move count to 0 for all tracks
    • getComboBox

      Returns a JComboBox with locations sorted alphabetically.
      Returns:
      locations for this railroad
    • updateComboBox

      public void updateComboBox(JComboBox<Location> box)
      Updates JComboBox alphabetically with a list of locations.
      Parameters:
      box - The JComboBox to update.
    • replaceLoad

      public void replaceLoad(String type, String oldLoadName, String newLoadName)
      Replace all track car load names for a given type of car
      Parameters:
      type - type of car
      oldLoadName - load name to replace
      newLoadName - new load name
    • resetNameLengths

      public void resetNameLengths()
    • getMaxLocationNameLength

    • getMaxTrackNameLength

      public int getMaxTrackNameLength()
    • getMaxLocationAndTrackNameLength

    • load

      public void load(org.jdom2.Element root)
      Load the locations from a xml file.
      Parameters:
      root - xml file
    • store

      public void store(org.jdom2.Element root)
    • propertyChange

      There aren't any current property changes being monitored.
      Specified by:
      propertyChange in interface PropertyChangeListener
    • setDirtyAndFirePropertyChange

      protected void setDirtyAndFirePropertyChange(String p, Object old, Object n)
    • initialize

      public void initialize()
      Description copied from interface: InstanceManagerAutoInitialize
      Perform any initialization that occurs after this object has been constructed and made available by the InstanceManager.
      Specified by:
      initialize in interface InstanceManagerAutoInitialize