Class OBlockManager
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.beans.VetoableChangeSupport
-
- jmri.managers.AbstractManager<OBlock>
-
- jmri.jmrit.logix.OBlockManager
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.beans.VetoableChangeListener
,java.util.EventListener
,PropertyChangeFirer
,PropertyChangeProvider
,SilenceablePropertyChangeProvider
,VetoableChangeFirer
,VetoableChangeProvider
,InstanceManagerAutoDefault
,Manager<OBlock>
,ProvidingManager<OBlock>
public class OBlockManager extends AbstractManager<OBlock> implements ProvidingManager<OBlock>, InstanceManagerAutoDefault
Basic Implementation of an OBlockManager.Note that this does not enforce any particular system naming convention.
Note this is a concrete class, there are now 2 types of Blocks (LayoutBlocks use a Block member and inheritance). Perhaps now the proxyManager strategy of interface/implementation pairs like other Managers should be implemented.
-
-
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, 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 OBlockManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OBlock
createNewOBlock(java.lang.String userName)
Create a new OBlock using an automatically incrementing system name.OBlock
createNewOBlock(java.lang.String systemName, java.lang.String userName)
Create a new OBlock if it does not exist.java.lang.String
getBeanTypeHandled(boolean plural)
Get the user-readable name of the type of NamedBean handled by this manager.java.lang.Class<OBlock>
getNamedBeanClass()
Get the class of NamedBean supported by this Manager.OBlock
getOBlock(java.lang.String name)
Get an existing OBlock by a given name.int
getXMLOrder()
Determine the order that types should be written when storing panel files.OBlock
provide(java.lang.String name)
Get an existing instance via user name, then system name; if no matching instance is found, create a new NameBean from the system name.OBlock
provideOBlock(java.lang.String name)
char
typeLetter()
-
Methods 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, 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, getBySystemName, getByUserName, 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
-
OBlockManager
public OBlockManager()
-
-
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<OBlock>
- Returns:
- write order for this Manager; larger is later.
-
typeLetter
public char typeLetter()
- Specified by:
typeLetter
in interfaceManager<OBlock>
- Returns:
- The type letter for a specific implementation
-
createNewOBlock
@CheckForNull public OBlock createNewOBlock(@Nonnull java.lang.String systemName, @CheckForNull java.lang.String userName)
Create a new OBlock if it does not exist.- Parameters:
systemName
- System nameuserName
- User name- Returns:
- newly created OBlock, or null if an OBlock with the same systemName or userName already exists, or if there is trouble creating a new OBlock
-
createNewOBlock
@CheckForNull public OBlock createNewOBlock(@Nonnull java.lang.String userName)
Create a new OBlock using an automatically incrementing system name.- Parameters:
userName
- the user name for the new OBlock- Returns:
- null if an OBlock with the same systemName or userName already exists, or if there is trouble creating a new OBlock.
-
getOBlock
public OBlock getOBlock(@Nonnull java.lang.String name)
Get an existing OBlock by a given name. First looks up assuming that name is a User Name. If this fails looks up assuming that name is a System Name. If both fail, returns null.- Parameters:
name
- OBlock name- Returns:
- the OBlock, oe null if not found
-
provide
public OBlock provide(@Nonnull java.lang.String name)
Description copied from interface:ProvidingManager
Get an existing instance via user name, then system name; if no matching instance is found, create a new NameBean from the system name.If the name is a valid system name, it will be used for the new NamedBean. Otherwise, the
Manager.makeSystemName(java.lang.String)
method will attempt to turn it into a valid system name which the manager will attempt to use. If that fails, an exception is thrown.This is similar to the specific methods found in certain type-specific managers:
TurnoutManager.provideTurnout(java.lang.String)
,SensorManager.provideSensor(java.lang.String)
, et al. Those might be more mnemonic; this one is more generic. Neither is preferred nor deprecated; use your choice.- Specified by:
provide
in interfaceProvidingManager<OBlock>
- Parameters:
name
- User name, system name, or address which can be promoted to system name- Returns:
- Never null
-
provideOBlock
@Nonnull public OBlock provideOBlock(@Nonnull java.lang.String name)
-
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<OBlock>
- 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<OBlock> 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<OBlock>
- Returns:
- the class supported by this Manager.
-
-