Class AbstractLightManager
- All Implemented Interfaces:
PropertyChangeListener,VetoableChangeListener,EventListener,PropertyChangeFirer,PropertyChangeProvider,SilenceablePropertyChangeProvider,VetoableChangeFirer,VetoableChangeProvider,LightManager,Manager<Light>,NameIncrementingManager,ProvidingManager<Light>
- Direct Known Subclasses:
AcelaLightManager,BiDiBLightManager,CbusLightManager,DCCppLightManager,InternalLightManager,IpocsLightManager,JMRIClientLightManager,LnLightManager,MqttLightManager,NceLightManager,OlcbLightManager,SerialLightManager,SerialLightManager,SerialLightManager,SerialLightManager,SerialLightManager,SerialLightManager,UsbLightManager,XBeeLightManager,XNetLightManager
Based on AbstractSignalHeadManager.java and AbstractSensorManager.java
-
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, silencedPropertiesFields inherited from class jmri.beans.VetoableChangeSupport
vetoableChangeSupportFields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupportFields 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
ConstructorsConstructorDescriptionCreate a new LightManager instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidActivate the control mechanism for each Light controlled by this LightManager.convertSystemNameToAlternate(String systemName) Convert the system name to a normalized alternate name.protected abstract LightcreateNewLight(String systemName, String userName) Internal method to invoke the factory, after all the logic for returning an existing Light has been invoked.getBeanTypeHandled(boolean plural) Get bean type handled.Get a manager-specific tool tip for adding an entry to the manager.Get an existing Light or return null if it doesn't exist.Get the class of NamedBean supported by this Manager.intDetermine the order that types should be written when storing panel files.Lookup Light by UserName, then provide by SystemName.provideLight(String name) Get the Light with the user name, then system name if needed; if that fails, create a new Light.booleansupportsVariableLights(String systemName) Test if system in the given name can support a variable light.charMethods inherited from class jmri.managers.AbstractManager
addDataListener, checkNumeric, createSystemName, deleteBean, deregister, dispose, 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, vetoableChangeMethods inherited from class jmri.beans.VetoableChangeSupport
addVetoableChangeListener, addVetoableChangeListener, fireVetoableChange, fireVetoableChange, fireVetoableChange, getVetoableChangeListeners, getVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListenerMethods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jmri.LightManager
createSystemName, dispose, getBySystemName, getByUserName, provide, validSystemNameConfigMethods inherited from interface jmri.Manager
addDataListener, deleteBean, deregister, getBeanTypeHandled, 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, validSystemNameFormatMethods inherited from interface jmri.NameIncrementingManager
allowMultipleAdditions, getNextValidSystemNameMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from interface jmri.beans.SilenceablePropertyChangeProvider
setPropertyChangesSilencedMethods inherited from interface jmri.beans.VetoableChangeProvider
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
Constructor Details
-
AbstractLightManager
Create a new LightManager instance.- Parameters:
memo- the system connection
-
-
Method Details
-
getXMLOrder
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:
getXMLOrderin interfaceManager<Light>- Returns:
- write order for this Manager; larger is later.
-
typeLetter
- Specified by:
typeLetterin interfaceManager<Light>- Returns:
- The type letter for a specific implementation
-
provideLight
Get the Light with the user name, then system name if needed; if that fails, create a new Light. If the name is a valid system name, it will be used for the new Light. Otherwise, theManager.makeSystemName(java.lang.String)method will attempt to turn it into a valid system name.This provides the same function as
ProvidingManager.provide(java.lang.String)which has a more generic form.- Specified by:
provideLightin interfaceLightManager- Parameters:
name- User name, system name, or address which can be promoted to system name- Returns:
- Never null under normal circumstances
-
getLight
Get an existing Light or return null if it doesn't exist.Locates via user name, then system name if needed.
- Specified by:
getLightin interfaceLightManager- Parameters:
name- User name, system name, or address which can be promoted to system name- Returns:
- Light, or null if no existing Light.
-
newLight
@Nonnull public Light newLight(@Nonnull String systemName, @CheckForNull String userName) throws IllegalArgumentException Lookup Light by UserName, then provide by SystemName. Return a Light with the specified user or system name. Lookup Light by UserName, then Provide New Light by SystemName. Note that two calls with the same arguments will get the same instance; there is only one Light object representing a given physical Light and therefore only one with a specific system or user name.This will always return a valid object reference; a new object will be created if necessary. In that case:
- If a null reference is given for user name, no user name will be associated with the Light object created; a valid system name must be provided
- If both names are provided, the system name defines the hardware access of the desired sensor, and the user address is associated with it. The system name must be valid.
- Specified by:
newLightin interfaceLightManager- Parameters:
systemName- the desired system nameuserName- the desired user name- Returns:
- requested Light object (never null)
- Throws:
IllegalArgumentException- if cannot create the Light due to e.g. an illegal name or name that can't be parsed.
-
createNewLight
@Nonnull protected abstract Light createNewLight(@Nonnull String systemName, String userName) throws IllegalArgumentException Internal method to invoke the factory, after all the logic for returning an existing Light has been invoked.- Parameters:
systemName- the system name to use for this lightuserName- the user name to use for this light- Returns:
- the new light or null if unsuccessful
- Throws:
IllegalArgumentException- something failed in the names
-
activateAllLights
Activate the control mechanism for each Light controlled by this LightManager. Note that some Lights don't require any activation. The activateLight method in AbstractLight.java determines what needs to be done for each Light.- Specified by:
activateAllLightsin interfaceLightManager
-
convertSystemNameToAlternate
Convert the system name to a normalized alternate name.This routine is to allow testing to ensure that two Lights with alternate names that refer to the same output bit are not created.
This routine is implemented in AbstractLightManager to return "". If a system implementation has alternate names, the system specific Light Manager should override this routine and supply the alternate name.
- Specified by:
convertSystemNameToAlternatein interfaceLightManager- Parameters:
systemName- the system name to convert- Returns:
- an alternate name
-
supportsVariableLights
Test if system in the given name can support a variable light.- Specified by:
supportsVariableLightsin interfaceLightManager- Parameters:
systemName- the system name- Returns:
- true if variable lights are supported; false otherwise
-
getBeanTypeHandled
Get bean type handled.- Specified by:
getBeanTypeHandledin interfaceManager<Light>- Parameters:
plural- true to return plural form of the type; false to return singular form- Returns:
- a string for the type of object handled by this manager
-
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<Light>- Returns:
- the class supported by this Manager.
-
getEntryToolTip
Get a manager-specific tool tip for adding an entry to the manager.- Specified by:
getEntryToolTipin interfaceManager<Light>- Returns:
- the tool tip or null to disable the tool tip
-