Package jmri.managers
Class DefaultRouteManager
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.beans.VetoableChangeSupport
-
- jmri.managers.AbstractManager<Route>
-
- jmri.managers.DefaultRouteManager
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener,java.beans.VetoableChangeListener,java.util.EventListener,PropertyChangeFirer,PropertyChangeProvider,SilenceablePropertyChangeProvider,VetoableChangeFirer,VetoableChangeProvider,Manager<Route>,ProvidingManager<Route>,RouteManager
public class DefaultRouteManager extends AbstractManager<Route> implements RouteManager
Basic Implementation of a RouteManager.Note that this does not enforce any particular system naming convention
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.Manager
Manager.ManagerDataEvent<E extends NamedBean>, Manager.ManagerDataListener<E extends NamedBean>, Manager.NameValidity
-
-
Field Summary
-
Fields inherited from class jmri.managers.AbstractManager
_beans, _tsys, _tuser, lastAutoNamedBeanRef, memo, paddedNumber, silenceableProperties, silencedProperties
-
Fields inherited from class jmri.beans.VetoableChangeSupport
vetoableChangeSupport
-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
Fields inherited from interface jmri.Manager
ANALOGIOS, AUDIO, BLOCKBOSS, BLOCKS, CONDITIONALS, CTCDATA, ENTRYEXIT, IDTAGS, LAYOUTBLOCKS, LIGHTS, LOGIXNG_ANALOG_ACTIONS, LOGIXNG_ANALOG_EXPRESSIONS, LOGIXNG_CONDITIONALNGS, LOGIXNG_DIGITAL_ACTIONS, LOGIXNG_DIGITAL_BOOLEAN_ACTIONS, LOGIXNG_DIGITAL_EXPRESSIONS, LOGIXNG_GLOBAL_VARIABLES, LOGIXNG_MODULES, LOGIXNG_STRING_ACTIONS, LOGIXNG_STRING_EXPRESSIONS, LOGIXNG_TABLES, LOGIXNGS, LOGIXS, MEMORIES, METERFRAMES, METERS, OBLOCKS, PANELFILES, PROPERTY_BEANS, PROPERTY_CAN_DELETE, PROPERTY_DISPLAY_LIST_NAME, PROPERTY_DO_DELETE, PROPERTY_DO_NOT_DELETE, PROPERTY_LENGTH, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, STRINGIOS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS
-
-
Constructor Summary
Constructors Constructor Description DefaultRouteManager(InternalSystemConnectionMemo memo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddListeners()voiddeleteRoute(Route r)Remove an existing route.voiddispose()Free resources when no longer used.java.lang.StringgetBeanTypeHandled(boolean plural)Get the user-readable name of the type of NamedBean handled by this manager.java.lang.Class<Route>getNamedBeanClass()Get the class of NamedBean supported by this Manager.RoutegetRoute(java.lang.String name)Method to get an existing Route.intgetXMLOrder()Determine the order that types should be written when storing panel files.RoutenewRoute(java.lang.String userName)Create a new Route if the route does not exist.Routeprovide(java.lang.String name)Provide Route by System Name.RouteprovideRoute(java.lang.String systemName, java.lang.String userName)Provides existing Route by UserName then SystemName if one exists.chartypeLetter()-
Methods inherited from class jmri.managers.AbstractManager
addDataListener, checkNumeric, createSystemName, deleteBean, deregister, fireDataListenersAdded, fireDataListenersRemoved, fireVetoableChange, getAutoSystemName, getBySystemName, getBySystemName, getByUserName, getKnownBeanProperties, getMemo, getNamedBean, getNamedBeanSet, getObjectCount, getOuterBean, getSystemPrefix, handleUserNameUniqueness, makeSystemName, propertyChange, register, registerSelf, registerUserName, removeDataListener, setDataListenerMute, setPropertyChangesSilenced, setRegisterSelf, updateAutoNumber, validSystemNameFormat, vetoableChange
-
Methods inherited from class jmri.beans.VetoableChangeSupport
addVetoableChangeListener, addVetoableChangeListener, fireVetoableChange, fireVetoableChange, fireVetoableChange, getVetoableChangeListeners, getVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.Manager
addDataListener, deleteBean, deregister, getBeanTypeHandled, getEntryToolTip, getKnownBeanProperties, getMemo, getNamedBean, getNamedBeanSet, getObjectCount, getSubSystemNamePrefix, getSystemNamePrefix, getSystemPrefix, isValidSystemNameFormat, makeSystemName, makeSystemName, makeSystemName, register, removeDataListener, setDataListenerMute, validateBadCharsInSystemNameFormat, validateIntegerSystemNameFormat, validateNmraAccessorySystemNameFormat, validateSystemNameFormat, validateSystemNameFormat, validateSystemNameFormatOnlyNumeric, validateSystemNamePrefix, validateTrimmedMin1NumberSystemNameFormat, validateTrimmedSystemNameFormat, validateUppercaseTrimmedSystemNameFormat, validSystemNameFormat
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from interface jmri.RouteManager
getBySystemName, getByUserName
-
Methods inherited from interface jmri.beans.SilenceablePropertyChangeProvider
setPropertyChangesSilenced
-
Methods inherited from interface jmri.beans.VetoableChangeProvider
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
-
-
-
Constructor Detail
-
DefaultRouteManager
public DefaultRouteManager(InternalSystemConnectionMemo memo)
-
-
Method Detail
-
addListeners
final void addListeners()
-
getXMLOrder
public int getXMLOrder()
Description copied from interface:ManagerDetermine the order that types should be written when storing panel files. Uses one of the constants defined in this class.Yes, that's an overly-centralized methodology, but it works for now.
- Specified by:
getXMLOrderin interfaceManager<Route>- Returns:
- write order for this Manager; larger is later.
-
typeLetter
public char typeLetter()
- Specified by:
typeLetterin interfaceManager<Route>- Returns:
- The type letter for a specific implementation
-
provideRoute
@Nonnull public Route provideRoute(@Nonnull java.lang.String systemName, @CheckForNull java.lang.String userName) throws java.lang.IllegalArgumentException
Provides existing Route by UserName then SystemName if one exists. Create a new Route if the route does not exist.- Specified by:
provideRoutein interfaceRouteManager- Parameters:
systemName- the system name for the routeuserName- the user name for the route- Returns:
- New or existing Route.
- Throws:
java.lang.IllegalArgumentException- if there is trouble creating a new Route
-
newRoute
@Nonnull public Route newRoute(@Nonnull java.lang.String userName) throws java.lang.IllegalArgumentException
Create a new Route if the route does not exist. Intended for use with User GUI, to allow the auto generation of systemNames, where the user can optionally supply a username.Calls
provideRoute(String, String)with the result ofAbstractManager.getAutoSystemName()as the system name.- Specified by:
newRoutein interfaceRouteManager- Parameters:
userName- user name for the new route- Returns:
- New Route.
- Throws:
java.lang.IllegalArgumentException- if there is trouble creating a new Route
-
deleteRoute
public void deleteRoute(@Nonnull Route r)
Remove an existing route. Route must have been deactivated before invoking this.- Specified by:
deleteRoutein interfaceRouteManager- Parameters:
r- the route to remove
-
getRoute
@CheckForNull public Route getRoute(@Nonnull java.lang.String name)
Method to get an existing Route. First looks up assuming that name is a User Name. If this fails looks up assuming that name is a System Name.- Specified by:
getRoutein interfaceRouteManager- Parameters:
name- User name or system name to match- Returns:
- If both fail, returns null.
-
getBeanTypeHandled
@Nonnull public java.lang.String getBeanTypeHandled(boolean plural)
Description copied from interface:ManagerGet the user-readable name of the type of NamedBean handled by this manager.For instance, in the code where we are dealing with just a bean and a message that needs to be passed to the user or in a log.
- Specified by:
getBeanTypeHandledin interfaceManager<Route>- Parameters:
plural- true to return plural form of the type; false to return singular form- Returns:
- a string of the bean type that the manager handles, eg Turnout, Sensor etc
-
getNamedBeanClass
public java.lang.Class<Route> getNamedBeanClass()
Get the class of NamedBean supported by this Manager. This should be the generic class used in the Manager's class declaration.- Specified by:
getNamedBeanClassin interfaceManager<Route>- Returns:
- the class supported by this Manager.
-
provide
@Nonnull public Route provide(@Nonnull java.lang.String name) throws java.lang.IllegalArgumentException
Provide Route by System Name.- Specified by:
providein interfaceProvidingManager<Route>- Parameters:
name- System Name f Route.- Returns:
- new or existing Route with corresponding System Name.
- Throws:
java.lang.IllegalArgumentException- if NamedBean doesn't already exist and the manager cannot create it due to an illegal name or name that can't be parsed.
-
dispose
public void dispose()
Description copied from class:AbstractManagerFree resources when no longer used. Specifically, remove all references to and from this object, so it can be garbage-collected.- Specified by:
disposein interfaceManager<Route>- Specified by:
disposein interfaceRouteManager- Overrides:
disposein classAbstractManager<Route>
-
-