Package jmri.managers
Class DefaultSignalGroupManager
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.beans.VetoableChangeSupport
-
- jmri.managers.AbstractManager<SignalGroup>
-
- jmri.managers.DefaultSignalGroupManager
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.beans.VetoableChangeListener
,java.util.EventListener
,PropertyChangeFirer
,PropertyChangeProvider
,SilenceablePropertyChangeProvider
,VetoableChangeFirer
,VetoableChangeProvider
,Manager<SignalGroup>
,SignalGroupManager
public class DefaultSignalGroupManager extends AbstractManager<SignalGroup> implements SignalGroupManager
Default implementation of a SignalGroupManager.This loads automatically the first time used.
-
-
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, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, STRINGIOS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS
-
-
Constructor Summary
Constructors Constructor Description DefaultSignalGroupManager(InternalSystemConnectionMemo memo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteSignalGroup(SignalGroup s)
Delete Group by removing it from the manager.java.lang.String
getBeanTypeHandled(boolean plural)
Get the user-readable name of the type of NamedBean handled by this manager.SignalGroup
getBySystemName(java.lang.String key)
Locate an existing instance based on a system name.SignalGroup
getByUserName(java.lang.String key)
Locate an existing instance based on a user name.(package private) java.util.List<java.lang.String>
getListOfNames()
java.lang.Class<SignalGroup>
getNamedBeanClass()
Get the class of NamedBean supported by this Manager.SignalGroup
getSignalGroup(java.lang.String name)
Locate via user name, then system name if needed.int
getXMLOrder()
Determine the order that types should be written when storing panel files.SignalGroup
newSignalGroupWithUserName(java.lang.String userName)
Create a new Signal group if the group does not exist.SignalGroup
provideSignalGroup(java.lang.String systemName, java.lang.String userName)
Create a new SignalGroup if the group does not exist.char
typeLetter()
-
Methods inherited from class jmri.managers.AbstractManager
addDataListener, checkNumeric, createSystemName, deleteBean, deregister, dispose, fireDataListenersAdded, fireDataListenersRemoved, fireVetoableChange, getAutoSystemName, getBySystemName, 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, dispose, 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.beans.SilenceablePropertyChangeProvider
setPropertyChangesSilenced
-
Methods inherited from interface jmri.beans.VetoableChangeProvider
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
-
-
-
Constructor Detail
-
DefaultSignalGroupManager
public DefaultSignalGroupManager(InternalSystemConnectionMemo memo)
-
-
Method Detail
-
getXMLOrder
public int getXMLOrder()
Description copied from interface:Manager
Determine 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:
getXMLOrder
in interfaceManager<SignalGroup>
- Returns:
- write order for this Manager; larger is later.
-
typeLetter
public char typeLetter()
- Specified by:
typeLetter
in interfaceManager<SignalGroup>
- Returns:
- The type letter for a specific implementation
-
getSignalGroup
@CheckForNull public SignalGroup getSignalGroup(@Nonnull java.lang.String name)
Locate via user name, then system name if needed.Does not create a new one if nothing found
- Specified by:
getSignalGroup
in interfaceSignalGroupManager
- Parameters:
name
- User Name or System Name to match- Returns:
- null if no match found
-
getBySystemName
@CheckForNull public SignalGroup getBySystemName(@Nonnull java.lang.String key)
Locate an existing instance based on a system name.- Specified by:
getBySystemName
in interfaceManager<SignalGroup>
- Specified by:
getBySystemName
in interfaceSignalGroupManager
- Overrides:
getBySystemName
in classAbstractManager<SignalGroup>
- Parameters:
key
- System Name of the required NamedBean- Returns:
- requested NamedBean object or null if none exists
-
getByUserName
@CheckForNull public SignalGroup getByUserName(@Nonnull java.lang.String key)
Locate an existing instance based on a user name.- Specified by:
getByUserName
in interfaceManager<SignalGroup>
- Specified by:
getByUserName
in interfaceSignalGroupManager
- Overrides:
getByUserName
in classAbstractManager<SignalGroup>
- Parameters:
key
- System Name of the required NamedBean- Returns:
- requested NamedBean object or null if none exists
-
provideSignalGroup
@Nonnull public SignalGroup provideSignalGroup(@Nonnull java.lang.String systemName, java.lang.String userName) throws java.lang.IllegalArgumentException
Create a new SignalGroup if the group does not exist. Keep autostring in line withnewSignalGroupWithUserName(String)
,AbstractManager.getSystemPrefix()
andtypeLetter()
- Specified by:
provideSignalGroup
in interfaceSignalGroupManager
- Parameters:
systemName
- the system name for the groupuserName
- the user name for the group- Returns:
- a Signal Group with the same systemName or userName if already exists or
- Throws:
java.lang.IllegalArgumentException
- if there is trouble creating a new Group.
-
newSignalGroupWithUserName
@Nonnull public SignalGroup newSignalGroupWithUserName(@Nonnull java.lang.String userName)
Create a new Signal group if the group does not exist.Intended for use with User GUI, to allow the auto generation of systemNames, where the user can optionally supply a username. Keep autostring in line with
provideSignalGroup(String, String)
,AbstractManager.getSystemPrefix()
andtypeLetter()
- Specified by:
newSignalGroupWithUserName
in interfaceSignalGroupManager
- Parameters:
userName
- User name for the new group- Returns:
- a Signal Group with the same userName if already exists
-
getListOfNames
java.util.List<java.lang.String> getListOfNames()
-
deleteSignalGroup
public void deleteSignalGroup(SignalGroup s)
Description copied from interface:SignalGroupManager
Delete Group by removing it from the manager. The Group must first be deactivated so it stops processing.- Specified by:
deleteSignalGroup
in interfaceSignalGroupManager
- Parameters:
s
- the group to remove
-
getBeanTypeHandled
@Nonnull public java.lang.String getBeanTypeHandled(boolean plural)
Description copied from interface:Manager
Get 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:
getBeanTypeHandled
in interfaceManager<SignalGroup>
- 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<SignalGroup> 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:
getNamedBeanClass
in interfaceManager<SignalGroup>
- Returns:
- the class supported by this Manager.
-
-