Class AbstractBaseManager<E extends NamedBean>
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.beans.VetoableChangeSupport
-
- jmri.managers.AbstractManager<E>
-
- jmri.jmrit.logixng.implementation.AbstractBaseManager<E>
-
- Type Parameters:
E
- the type of NamedBean supported by this manager
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.beans.VetoableChangeListener
,java.util.EventListener
,PropertyChangeFirer
,PropertyChangeProvider
,SilenceablePropertyChangeProvider
,VetoableChangeFirer
,VetoableChangeProvider
,BaseManager<E>
,Manager<E>
- Direct Known Subclasses:
DefaultAnalogActionManager
,DefaultAnalogExpressionManager
,DefaultDigitalActionManager
,DefaultDigitalBooleanActionManager
,DefaultDigitalExpressionManager
,DefaultStringActionManager
,DefaultStringExpressionManager
public abstract class AbstractBaseManager<E extends NamedBean> extends AbstractManager<E> implements BaseManager<E>
Abstract partial implementation for the LogixNG action and expression managers.
-
-
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 Modifier and Type Field Description protected java.util.List<MaleSocketFactory<E>>
_maleSocketFactories
-
Fields inherited from class jmri.managers.AbstractManager
_beans, _tsys, _tuser, memo, 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 AbstractBaseManager()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract E
castBean(MaleSocket maleSocket)
Cast the maleSocket to E This method is needed since SpotBugs @SuppressWarnings("unchecked") does not work for the cast: (E)socket.void
deleteBean(E n, java.lang.String property)
Method for a UI to delete a bean.void
deleteBean(MaleSocket socket, java.lang.String property)
Method for a UI to delete a bean.void
deregister(E s)
Forget a NamedBean Object created outside the manager.void
fireVetoableChange(java.lang.String p, java.lang.Object old)
Inform all registered listeners of a vetoable change.If the propertyName is "CanDelete" ALL listeners with an interest in the bean will throw an exception, which is recorded returned back to the invoking method, so that it can be presented back to the user.However if a listener decides that the bean can not be deleted then it should throw an exception with a property name of "DoNotDelete", this is thrown back up to the user and the delete process should be aborted.protected E
getOuterBean(E bean)
Get the outer bean of an encapsulated bean.void
register(E s)
Remember a NamedBean Object created outside the manager.E
registerBean(E s)
Remember a NamedBean Object created outside the manager.void
registerMaleSocketFactory(MaleSocketFactory<E> factory)
Register a male socket factory.Manager.NameValidity
validSystemNameFormat(java.lang.String systemName)
Test if parameter is a properly formatted system name.-
Methods inherited from class jmri.managers.AbstractManager
addDataListener, checkNumeric, createSystemName, dispose, fireDataListenersAdded, fireDataListenersRemoved, fireVetoableChange, getAutoSystemName, getBySystemName, getBySystemName, getByUserName, getKnownBeanProperties, getMemo, getNamedBean, getNamedBeanSet, getObjectCount, getSystemPrefix, handleUserNameUniqueness, makeSystemName, propertyChange, registerSelf, registerUserName, removeDataListener, setDataListenerMute, setPropertyChangesSilenced, updateAutoNumber, 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.jmrit.logixng.BaseManager
getLastRegisteredMaleSocket, getMaleSocketClass
-
Methods inherited from interface jmri.Manager
addDataListener, dispose, getBeanTypeHandled, getBeanTypeHandled, getBySystemName, getByUserName, getEntryToolTip, getKnownBeanProperties, getMemo, getNamedBean, getNamedBeanClass, getNamedBeanSet, getObjectCount, getSubSystemNamePrefix, getSystemNamePrefix, getSystemPrefix, getXMLOrder, isValidSystemNameFormat, makeSystemName, makeSystemName, makeSystemName, removeDataListener, setDataListenerMute, typeLetter, validateBadCharsInSystemNameFormat, validateIntegerSystemNameFormat, validateNmraAccessorySystemNameFormat, validateSystemNameFormat, validateSystemNameFormat, validateSystemNameFormatOnlyNumeric, validateSystemNamePrefix, validateTrimmedMin1NumberSystemNameFormat, validateTrimmedSystemNameFormat, validateUppercaseTrimmedSystemNameFormat
-
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
-
-
-
-
Field Detail
-
_maleSocketFactories
protected java.util.List<MaleSocketFactory<E extends NamedBean>> _maleSocketFactories
-
-
Constructor Detail
-
AbstractBaseManager
public AbstractBaseManager()
-
-
Method Detail
-
fireVetoableChange
@OverridingMethodsMustInvokeSuper public void fireVetoableChange(java.lang.String p, java.lang.Object old) throws java.beans.PropertyVetoException
Inform all registered listeners of a vetoable change.If the propertyName is "CanDelete" ALL listeners with an interest in the bean will throw an exception, which is recorded returned back to the invoking method, so that it can be presented back to the user.However if a listener decides that the bean can not be deleted then it should throw an exception with a property name of "DoNotDelete", this is thrown back up to the user and the delete process should be aborted.- Parameters:
p
- The programmatic name of the property that is to be changed. "CanDelete" will inquire with all listeners if the item can be deleted. "DoDelete" tells the listener to delete the item.old
- The old value of the property.- Throws:
java.beans.PropertyVetoException
- If the recipients wishes the delete to be aborted (see above)
-
castBean
protected abstract E castBean(MaleSocket maleSocket)
Cast the maleSocket to E This method is needed since SpotBugs @SuppressWarnings("unchecked") does not work for the cast: (E)socket.- Parameters:
maleSocket
- the maleSocket to cast- Returns:
- the maleSocket as E
-
deleteBean
public final void deleteBean(@Nonnull E n, @Nonnull java.lang.String property) throws java.beans.PropertyVetoException
Method for a UI to delete a bean.The UI should first request a "CanDelete", this will return a list of locations (and descriptions) where the bean is in use via throwing a VetoException, then if that comes back clear, or the user agrees with the actions, then a "DoDelete" can be called which inform the listeners to delete the bean, then it will be deregistered and disposed of.
If a property name of "DoNotDelete" is thrown back in the VetoException then the delete process should be aborted.
- Specified by:
deleteBean
in interfaceManager<E extends NamedBean>
- Overrides:
deleteBean
in classAbstractManager<E extends NamedBean>
- Parameters:
n
- The NamedBean to be deletedproperty
- The programmatic name of the request. "CanDelete" will enquire with all listeners if the item can be deleted. "DoDelete" tells the listener to delete the item- Throws:
java.beans.PropertyVetoException
- If the recipients wishes the delete to be aborted (see above)
-
deleteBean
@OverridingMethodsMustInvokeSuper public void deleteBean(@Nonnull MaleSocket socket, @Nonnull java.lang.String property) throws java.beans.PropertyVetoException
Method for a UI to delete a bean.The UI should first request a "CanDelete", this will return a list of locations (and descriptions) where the bean is in use via throwing a VetoException, then if that comes back clear, or the user agrees with the actions, then a "DoDelete" can be called which inform the listeners to delete the bean, then it will be deregistered and disposed of.
If a property name of "DoNotDelete" is thrown back in the VetoException then the delete process should be aborted.
- Specified by:
deleteBean
in interfaceBaseManager<E extends NamedBean>
- Parameters:
socket
- The MaleSocket to be deletedproperty
- The programmatic name of the request. "CanDelete" will enquire with all listeners if the item can be deleted. "DoDelete" tells the listener to delete the item- Throws:
java.beans.PropertyVetoException
- If the recipients wishes the delete to be aborted (see above)
-
deregister
@OverridingMethodsMustInvokeSuper public void deregister(@Nonnull E s)
Forget a NamedBean Object created outside the manager.The non-system-specific RouteManager uses this method.
- Specified by:
deregister
in interfaceManager<E extends NamedBean>
- Overrides:
deregister
in classAbstractManager<E extends NamedBean>
- Parameters:
s
- the bean
-
validSystemNameFormat
public final Manager.NameValidity validSystemNameFormat(java.lang.String systemName)
Test if parameter is a properly formatted system name.- Specified by:
validSystemNameFormat
in interfaceManager<E extends NamedBean>
- Overrides:
validSystemNameFormat
in classAbstractManager<E extends NamedBean>
- Parameters:
systemName
- the system name- Returns:
- enum indicating current validity, which might be just as a prefix
-
register
public void register(@Nonnull E s)
Description copied from class:AbstractManager
Remember a NamedBean Object created outside the manager.The non-system-specific SignalHeadManagers use this method extensively.
-
registerBean
public E registerBean(@Nonnull E s)
Description copied from interface:BaseManager
Remember a NamedBean Object created outside the manager.The non-system-specific SignalHeadManagers use this method extensively.
- Specified by:
registerBean
in interfaceBaseManager<E extends NamedBean>
- Parameters:
s
- the bean- Returns:
- the registered bean with attached male sockets
-
registerMaleSocketFactory
public void registerMaleSocketFactory(MaleSocketFactory<E> factory)
Description copied from interface:BaseManager
Register a male socket factory.- Specified by:
registerMaleSocketFactory
in interfaceBaseManager<E extends NamedBean>
- Parameters:
factory
- the factory
-
getOuterBean
protected E getOuterBean(E bean)
Get the outer bean of an encapsulated bean. Some managers encapsulates the beans and those managers needs to override this method.- Overrides:
getOuterBean
in classAbstractManager<E extends NamedBean>
- Parameters:
bean
- the bean- Returns:
- the most outer bean or the bean itself if there is no outer bean
-
-