Class DefaultSectionManager
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.beans.VetoableChangeSupport
-
- jmri.managers.AbstractManager<Section>
-
- jmri.managers.DefaultSectionManager
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.beans.VetoableChangeListener
,java.util.EventListener
,PropertyChangeFirer
,PropertyChangeProvider
,SilenceablePropertyChangeProvider
,VetoableChangeFirer
,VetoableChangeProvider
,Manager<Section>
,SectionManager
public class DefaultSectionManager extends AbstractManager<Section> implements SectionManager
Basic Implementation of a SectionManager.This doesn't have a "new" interface, since Sections are independently implemented, instead of being system-specific.
Note that Section system names must begin with system prefix and type character, usually IY, and be followed by a string, usually, but not always, a number. This is enforced when a Section is created.
This file is part of JMRI.JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-
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 (package private) java.util.List<Block>
blockList
A list of blocks that will be used to create a block based section.-
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 DefaultSectionManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addListeners()
Section
createNewSection(java.lang.String userName)
Create a New Section with Auto System Name.Section
createNewSection(java.lang.String systemName, java.lang.String userName)
Create a new Section if the Section does not exist.void
deleteSection(Section y)
Remove an existing Section.void
dispose()
Free resources when no longer used.void
generateBlockSections()
Find stub end blocks.java.lang.String
getBeanTypeHandled(boolean plural)
Get the user-readable name of the type of NamedBean handled by this manager.java.lang.Class<Section>
getNamedBeanClass()
Get the class of NamedBean supported by this Manager.Section
getSection(java.lang.String name)
Get an existing Section.int
getXMLOrder()
Determine the order that types should be written when storing panel files.void
initializeBlockingSensors()
Initialize all blocking sensors that exist - set them to 'ACTIVE'.int
removeDirectionSensorsFromSSL()
Remove direction sensors from SSL for all signals.int
setupDirectionSensors()
Check direction sensors in SSL for signals.char
typeLetter()
int
validateAllSections()
Validate all Sections.-
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, 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
-
DefaultSectionManager
public DefaultSectionManager()
-
-
Method Detail
-
addListeners
final void addListeners()
-
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<Section>
- Returns:
- write order for this Manager; larger is later.
-
typeLetter
public char typeLetter()
- Specified by:
typeLetter
in interfaceManager<Section>
- Returns:
- The type letter for a specific implementation
-
getNamedBeanClass
public java.lang.Class<Section> getNamedBeanClass()
Description copied from interface:Manager
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<Section>
- Returns:
- the class supported by this Manager.
-
createNewSection
@Nonnull public Section createNewSection(@Nonnull java.lang.String systemName, java.lang.String userName) throws java.lang.IllegalArgumentException
Create a new Section if the Section does not exist.- Specified by:
createNewSection
in interfaceSectionManager
- Parameters:
systemName
- the desired system nameuserName
- the desired user name- Returns:
- a new Section or
- Throws:
java.lang.IllegalArgumentException
- if a Section with the same systemName or userName already exists, or if there is trouble creating a new Section.
-
createNewSection
@Nonnull public Section createNewSection(java.lang.String userName) throws java.lang.IllegalArgumentException
Create a New Section with Auto System Name.- Specified by:
createNewSection
in interfaceSectionManager
- Parameters:
userName
- UserName for new Section- Returns:
- new Section with Auto System Name.
- Throws:
java.lang.IllegalArgumentException
- if existing Section, or unable to create a new Section.
-
deleteSection
public void deleteSection(Section y)
Remove an existing Section.- Specified by:
deleteSection
in interfaceSectionManager
- Parameters:
y
- the section to remove
-
getSection
public Section getSection(java.lang.String name)
Get an existing Section. First look up assuming that name is a User Name. If this fails look up assuming that name is a System Name.- Specified by:
getSection
in interfaceSectionManager
- Parameters:
name
- the name to find; user names are searched for a match first, followed by system names- Returns:
- the found section of null if no matching Section found
-
validateAllSections
public int validateAllSections()
Validate all Sections.- Specified by:
validateAllSections
in interfaceSectionManager
- Returns:
- number or validation errors; -2 is returned if there are no sections
-
setupDirectionSensors
public int setupDirectionSensors()
Check direction sensors in SSL for signals.- Specified by:
setupDirectionSensors
in interfaceSectionManager
- Returns:
- the number or errors; 0 if no errors; -1 if the panel is null; -2 if there are no sections
-
removeDirectionSensorsFromSSL
public int removeDirectionSensorsFromSSL()
Remove direction sensors from SSL for all signals.- Specified by:
removeDirectionSensorsFromSSL
in interfaceSectionManager
- Returns:
- the number or errors; 0 if no errors; -1 if the panel is null; -2 if there are no sections
-
initializeBlockingSensors
public void initializeBlockingSensors()
Initialize all blocking sensors that exist - set them to 'ACTIVE'.- Specified by:
initializeBlockingSensors
in interfaceSectionManager
-
generateBlockSections
public void generateBlockSections()
Find stub end blocks.- Specified by:
generateBlockSections
in interfaceSectionManager
-
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<Section>
- 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
-
dispose
public void dispose()
Description copied from class:AbstractManager
Free resources when no longer used. Specifically, remove all references to and from this object, so it can be garbage-collected.
-
-