Class EntryExitPairs
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.beans.VetoableChangeSupport
-
- jmri.jmrit.entryexit.EntryExitPairs
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.util.EventListener
,PropertyChangeFirer
,PropertyChangeProvider
,SilenceablePropertyChangeProvider
,VetoableChangeFirer
,VetoableChangeProvider
,InstanceManagerAutoDefault
,Manager<DestinationPoints>
public class EntryExitPairs extends VetoableChangeSupport implements Manager<DestinationPoints>, InstanceManagerAutoDefault, java.beans.PropertyChangeListener
Implements an Entry Exit based method of setting turnouts, setting up signal logic and allocating blocks through a path based on the Layout Editor.The route is based upon having a sensor assigned at a known location on the panel (set at the boundary of two different blocks) through to a sensor at a remote location on the same panel. Using the layout block routing, a path can then be set between the two sensors so long as one exists and no section of track is set occupied. If available an alternative route will be used when the direct path is occupied (blocked).
Initial implementation only handles the setting up of turnouts on a path.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
EntryExitPairs.DeletePair
Class to store NX pair components.(package private) static class
EntryExitPairs.SourceToDest
Class to store NX sets consisting of a source point, a destination point, a direction and a reference.(package private) static class
EntryExitPairs.StackDetails
Class to collect (stack) routes when they are requested but blocked.-
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) boolean
absSignalMode
(package private) boolean
allocateToDispatcher
static int
AUTOCANCEL
static int
AUTOCLEAR
static int
AUTOSTACK
static int
CANCELROUTE
(package private) javax.swing.Timer
checkTimer
static int
CLEARROUTE
(package private) int
currentDealing
(package private) java.util.List<EntryExitPairs.DeletePair>
deletePairList
List of NX pairs that are scheduled for deletion.(package private) java.util.List<java.lang.Object>
destinationList
static int
EXITROUTE
static int
FULLINTERLOCK
Constant value to represent that the entryExit will do full interlocking.(package private) static javax.swing.JPanel
glassPane
(package private) int
interlockTypeToUseWhenStable
(package private) java.util.List<Manager.ManagerDataListener<DestinationPoints>>
listeners
(package private) int
memoryClearDelay
(package private) java.lang.String
memoryOption
static int
NXBUTTONACTIVE
static int
NXBUTTONINACTIVE
static int
NXBUTTONSELECTED
(package private) java.util.HashMap<PointDetails,Source>
nxpair
static int
OVERLAP_CANCEL
static int
OVERLAP_STACK
(package private) static java.util.List<PointDetails>
pointDetails
static int
PROMPTUSER
protected java.beans.PropertyChangeListener
propertyBlockManagerListener
protected java.beans.PropertyChangeListener
propertyDestinationListener
(package private) int
refCounter
(package private) int
routeClearOption
(package private) int
routeOverlapOption
(package private) java.util.List<EntryExitPairs.SourceToDest>
routesToSet
List holding SourceToDest sets of routes between two points.LayoutBlockConnectivityTools.Metric
routingMethod
(package private) boolean
runWhenStabilised
static int
SETUPSIGNALMASTLOGIC
Constant value to represent that the entryExit will set up the turnouts between two different points and configure the Signal Mast Logic to use the correct blocks.static int
SETUPTURNOUTSONLY
Constant value to represent that the entryExit will only set up the turnouts between two different points.(package private) SignalMastLogicManager
smlm
(package private) javax.swing.JDialog
stackDialog
(package private) java.util.List<EntryExitPairs.StackDetails>
stackList
(package private) StackNXPanel
stackPanel
static int
STACKROUTE
(package private) LayoutEditor
toUseWhenStable
int
turnoutSetDelay
Delay between issuing Turnout commands-
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 EntryExitPairs()
Constructor for creating an EntryExitPairs object and create a transparent JPanel for it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDataListener(Manager.ManagerDataListener<DestinationPoints> e)
Register aManager.ManagerDataListener
to hear about adding or removing items from the list of NamedBeans.void
addNXDestination(NamedBean source, NamedBean destination, LayoutEditor panel)
void
addNXDestination(NamedBean source, NamedBean destination, LayoutEditor panel, java.lang.String id)
void
addNXSourcePoint(LayoutBlock facing, java.util.List<LayoutBlock> protecting, NamedBean loc, LayoutEditor panel)
void
addNXSourcePoint(NamedBean source)
void
addNXSourcePoint(NamedBean source, LayoutEditor panel)
void
automaticallyDiscoverEntryExitPairs(LayoutEditor editor, int interlockType)
Discover all possible valid source and destination Signal Mast Logic pairs on all Layout Editor panels.boolean
canBeBiDirectional(java.lang.Object source, LayoutEditor panel, java.lang.Object dest)
void
cancelInterlock(java.lang.Object source, LayoutEditor panel, java.lang.Object dest)
void
cancelStackedRoute(DestinationPoints dp, boolean reverse)
Remove a stacked route from stackList.(package private) void
checkRoute()
Step through stackList and activate the first stacked route in line if it is no longer blocked.(package private) void
createDeletePairList(NamedBean sensor)
Rebuild the delete pair list based on the supplied sensor.void
deleteBean(DestinationPoints bean, java.lang.String property)
Method for a UI to delete a bean.boolean
deleteNxPair(NamedBean sensor)
Entry point to delete all of the NX pairs for a specific sensor. 1) Build a list of affected NX pairs. 2) Check for Conditional references. 3) If no references, do the delete process with user approval.boolean
deleteNxPair(NamedBean entrySensor, NamedBean exitSensor, LayoutEditor panel)
Entry point to delete a specific NX pair.void
deregister(DestinationPoints n)
Forget a NamedBean Object created outside the manager.void
dispose()
Free resources when no longer used.java.lang.String
getBeanTypeHandled(boolean plural)
Get the user-readable name of the type of NamedBean handled by this manager.DestinationPoints
getBySystemName(java.lang.String systemName)
Locate an existing instance based on a system name.DestinationPoints
getByUserName(java.lang.String userName)
Locate an existing instance based on a user name.int
getClearDownOption()
java.util.List<java.lang.Object>
getDestinationList(java.lang.Object obj, LayoutEditor panel)
boolean
getDispatcherIntegration()
java.lang.Object
getEndPointLocation(NamedBean source, LayoutEditor panel)
java.util.List<java.lang.String>
getEntryExitList()
int
getEntryExitType(java.lang.Object source, LayoutEditor panel, java.lang.Object dest)
javax.swing.JPanel
getGlassPane()
Get the transparent JPanel for this EntryExitPairs.SystemConnectionMemo
getMemo()
Get the system connection for this manager.int
getMemoryClearDelay()
java.lang.String
getMemoryOption()
DestinationPoints
getNamedBean(java.lang.String name)
Locate an existing instance based on a name.java.lang.Class<DestinationPoints>
getNamedBeanClass()
Get the class of NamedBean supported by this Manager.java.util.SortedSet<DestinationPoints>
getNamedBeanSet()
Implemented to support the Conditional combo box name listjava.util.List<java.lang.Object>
getNxDestination()
int
getNxPairNumbers(LayoutEditor panel)
java.util.List<java.lang.Object>
getNxSource(LayoutEditor panel)
int
getObjectCount()
Get the count of managed objects.int
getOverlapOption()
java.lang.String
getPointAsString(NamedBean obj, LayoutEditor panel)
Get the name of a destinationPoint on a LE Panel.PointDetails
getPointDetails(java.lang.Object obj, LayoutEditor panel)
Return a point from a given LE Panel.(package private) PointDetails
getPointDetails(LayoutBlock source, java.util.List<LayoutBlock> destination, LayoutEditor panel)
Return either an existing point stored in pointDetails, or create a new one as required.java.awt.Color
getSettingRouteColor()
int
getSettingTimer()
Source
getSourceForPoint(PointDetails pd)
java.util.List<java.lang.Object>
getSourceList(LayoutEditor panel)
Return a list of all source (origin) points on a given Layout Editor panel.java.util.List<LayoutEditor>
getSourcePanelList()
java.util.List<DestinationPoints>
getStackedInterlocks()
Get a list of all stacked routes from stackList.java.lang.String
getSystemPrefix()
Provide access to the system prefix string.java.lang.String
getUniqueId(java.lang.Object source, LayoutEditor panel, java.lang.Object dest)
int
getXMLOrder()
Determine the order that types should be written when storing panel files.boolean
isAbsSignalMode()
boolean
isDestinationValid(java.lang.Object source, java.lang.Object dest, LayoutEditor panel)
boolean
isEnabled(java.lang.Object source, LayoutEditor panel, java.lang.Object dest)
boolean
isPathActive(java.lang.Object sourceObj, java.lang.Object destObj, LayoutEditor panel)
boolean
isRouteStacked(DestinationPoints dp, boolean reverse)
Query if a stacked route is in stackList.boolean
isUniDirection(java.lang.Object source, LayoutEditor panel, java.lang.Object dest)
java.util.List<java.lang.String>
layoutBlockSensors(LayoutBlock layoutBlock)
Create a list of sensors that have the layout block as either facing or protecting.java.lang.String
makeSystemName(java.lang.String s)
Create a SystemName by prepending the system name prefix to the name if not already present.(package private) void
processRoutesToSet()
Activate each SourceToDest set in routesToSetvoid
propertyChange(java.beans.PropertyChangeEvent evt)
PointDetails
providePoint(NamedBean source, LayoutEditor panel)
Generate the point details, given a known source and a Layout Editor panel.void
register(DestinationPoints n)
Remember a NamedBean Object created outside the manager.void
removeDataListener(Manager.ManagerDataListener<DestinationPoints> e)
Unregister a previously-addedManager.ManagerDataListener
.void
removeNXSensor(Sensor sensor)
void
removePropertyChangeListener(java.beans.PropertyChangeListener list, NamedBean obj, LayoutEditor panel)
(package private) void
removeRemainingRoute()
Remove remaining SourceToDest sets in routesToSetvoid
setAbsSignalMode(boolean absMode)
void
setClearDownOption(int i)
void
setDispatcherIntegration(boolean boo)
void
setEnabled(java.lang.Object source, LayoutEditor panel, java.lang.Object dest, boolean set)
void
setEntryExitType(java.lang.Object source, LayoutEditor panel, java.lang.Object dest, int set)
void
setMemoryClearDelay(int secs)
void
setMemoryOption(java.lang.String memoryName)
void
setMultiPointRoute(PointDetails requestpd, LayoutEditor panel)
void
setOverlapOption(int i)
void
setPropertyChangesSilenced(java.lang.String propertyName, boolean silenced)
Suppress sendingPropertyChangeEvent
s for the named property.void
setReversedRoute(java.lang.String nxPair)
Set a reversed route between two points.void
setSettingRouteColor(java.awt.Color col)
void
setSettingTimer(int i)
void
setSingleSegmentRoute(java.lang.String nxPair)
Set the route between the two points represented by the Destination Point name.void
setUniDirection(java.lang.Object source, LayoutEditor panel, java.lang.Object dest, boolean set)
void
stackNXRoute(DestinationPoints dp, boolean reverse)
If a route is requested but is currently blocked, ask user if it should be added to stackList.char
typeLetter()
boolean
useDifferentColorWhenSetting()
void
vetoableChange(java.beans.PropertyChangeEvent evt)
-
Methods inherited from class jmri.beans.VetoableChangeSupport
addVetoableChangeListener, addVetoableChangeListener, fireVetoableChange, 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
getBeanTypeHandled, getEntryToolTip, getKnownBeanProperties, getSubSystemNamePrefix, getSystemNamePrefix, isValidSystemNameFormat, makeSystemName, makeSystemName, 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.VetoableChangeProvider
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
-
-
-
Field Detail
-
routingMethod
public LayoutBlockConnectivityTools.Metric routingMethod
-
NXBUTTONSELECTED
public static final int NXBUTTONSELECTED
- See Also:
- Constant Field Values
-
NXBUTTONACTIVE
public static final int NXBUTTONACTIVE
- See Also:
- Constant Field Values
-
NXBUTTONINACTIVE
public static final int NXBUTTONINACTIVE
- See Also:
- Constant Field Values
-
SETUPTURNOUTSONLY
public static final int SETUPTURNOUTSONLY
Constant value to represent that the entryExit will only set up the turnouts between two different points.- See Also:
- Constant Field Values
-
SETUPSIGNALMASTLOGIC
public static final int SETUPSIGNALMASTLOGIC
Constant value to represent that the entryExit will set up the turnouts between two different points and configure the Signal Mast Logic to use the correct blocks.- See Also:
- Constant Field Values
-
FULLINTERLOCK
public static final int FULLINTERLOCK
Constant value to represent that the entryExit will do full interlocking. It will set the turnouts and "reserve" the blocks.- See Also:
- Constant Field Values
-
allocateToDispatcher
boolean allocateToDispatcher
-
absSignalMode
boolean absSignalMode
-
PROMPTUSER
public static final int PROMPTUSER
- See Also:
- Constant Field Values
-
AUTOCLEAR
public static final int AUTOCLEAR
- See Also:
- Constant Field Values
-
AUTOCANCEL
public static final int AUTOCANCEL
- See Also:
- Constant Field Values
-
AUTOSTACK
public static final int AUTOSTACK
- See Also:
- Constant Field Values
-
OVERLAP_CANCEL
public static final int OVERLAP_CANCEL
- See Also:
- Constant Field Values
-
OVERLAP_STACK
public static final int OVERLAP_STACK
- See Also:
- Constant Field Values
-
routeClearOption
int routeClearOption
-
routeOverlapOption
int routeOverlapOption
-
memoryOption
java.lang.String memoryOption
-
memoryClearDelay
int memoryClearDelay
-
glassPane
static javax.swing.JPanel glassPane
-
turnoutSetDelay
public int turnoutSetDelay
Delay between issuing Turnout commands
-
nxpair
java.util.HashMap<PointDetails,Source> nxpair
-
refCounter
int refCounter
-
routesToSet
java.util.List<EntryExitPairs.SourceToDest> routesToSet
List holding SourceToDest sets of routes between two points.
-
currentDealing
int currentDealing
-
propertyDestinationListener
protected java.beans.PropertyChangeListener propertyDestinationListener
-
destinationList
java.util.List<java.lang.Object> destinationList
-
deletePairList
java.util.List<EntryExitPairs.DeletePair> deletePairList
List of NX pairs that are scheduled for deletion.- Since:
- 4.11.2
-
CANCELROUTE
public static final int CANCELROUTE
- See Also:
- Constant Field Values
-
CLEARROUTE
public static final int CLEARROUTE
- See Also:
- Constant Field Values
-
EXITROUTE
public static final int EXITROUTE
- See Also:
- Constant Field Values
-
STACKROUTE
public static final int STACKROUTE
- See Also:
- Constant Field Values
-
pointDetails
static java.util.List<PointDetails> pointDetails
-
stackList
java.util.List<EntryExitPairs.StackDetails> stackList
-
stackPanel
StackNXPanel stackPanel
-
stackDialog
javax.swing.JDialog stackDialog
-
checkTimer
javax.swing.Timer checkTimer
-
runWhenStabilised
boolean runWhenStabilised
-
toUseWhenStable
LayoutEditor toUseWhenStable
-
interlockTypeToUseWhenStable
int interlockTypeToUseWhenStable
-
propertyBlockManagerListener
protected java.beans.PropertyChangeListener propertyBlockManagerListener
-
listeners
final java.util.List<Manager.ManagerDataListener<DestinationPoints>> listeners
-
-
Constructor Detail
-
EntryExitPairs
public EntryExitPairs()
Constructor for creating an EntryExitPairs object and create a transparent JPanel for it.
-
-
Method Detail
-
getSettingTimer
public int getSettingTimer()
-
setSettingTimer
public void setSettingTimer(int i)
-
useDifferentColorWhenSetting
public boolean useDifferentColorWhenSetting()
-
getSettingRouteColor
public java.awt.Color getSettingRouteColor()
-
setSettingRouteColor
public void setSettingRouteColor(java.awt.Color col)
-
setDispatcherIntegration
public void setDispatcherIntegration(boolean boo)
-
getDispatcherIntegration
public boolean getDispatcherIntegration()
-
setAbsSignalMode
public void setAbsSignalMode(boolean absMode)
-
isAbsSignalMode
public boolean isAbsSignalMode()
-
getGlassPane
public javax.swing.JPanel getGlassPane()
Get the transparent JPanel for this EntryExitPairs.- Returns:
- JPanel overlay
-
addNXSourcePoint
public void addNXSourcePoint(LayoutBlock facing, java.util.List<LayoutBlock> protecting, NamedBean loc, LayoutEditor panel)
-
addNXSourcePoint
public void addNXSourcePoint(NamedBean source)
-
addNXSourcePoint
public void addNXSourcePoint(NamedBean source, LayoutEditor panel)
-
getEndPointLocation
public java.lang.Object getEndPointLocation(NamedBean source, LayoutEditor panel)
-
getXMLOrder
public int 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:
getXMLOrder
in interfaceManager<DestinationPoints>
- Returns:
- write order for this Manager; larger is later.
-
getBySystemName
public DestinationPoints getBySystemName(java.lang.String systemName)
Locate an existing instance based on a system name.- Specified by:
getBySystemName
in interfaceManager<DestinationPoints>
- Parameters:
systemName
- System Name of the required NamedBean- Returns:
- requested NamedBean object or null if none exists
-
getByUserName
public DestinationPoints getByUserName(@Nonnull java.lang.String userName)
Locate an existing instance based on a user name.- Specified by:
getByUserName
in interfaceManager<DestinationPoints>
- Parameters:
userName
- System Name of the required NamedBean- Returns:
- requested NamedBean object or null if none exists
-
getNamedBean
public DestinationPoints getNamedBean(@Nonnull java.lang.String name)
Locate an existing instance based on a name.- Specified by:
getNamedBean
in interfaceManager<DestinationPoints>
- Parameters:
name
- User Name or System Name of the required NamedBean- Returns:
- requested NamedBean object or null if none exists
-
getMemo
@Nonnull public SystemConnectionMemo getMemo()
Get the system connection for this manager.- Specified by:
getMemo
in interfaceManager<DestinationPoints>
- Returns:
- the system connection for this manager
-
getSystemPrefix
@Nonnull public java.lang.String getSystemPrefix()
Provide access to the system prefix string. This was previously called the "System letter"- Specified by:
getSystemPrefix
in interfaceManager<DestinationPoints>
- Returns:
- the system prefix
-
typeLetter
public char typeLetter()
- Specified by:
typeLetter
in interfaceManager<DestinationPoints>
- Returns:
- The type letter for a specific implementation
-
makeSystemName
@Nonnull public java.lang.String makeSystemName(@Nonnull java.lang.String s)
Create a SystemName by prepending the system name prefix to the name if not already present.Note: implementations must call
Manager.validateSystemNameFormat(java.lang.String, java.util.Locale)
to ensure the returned name is valid.- Specified by:
makeSystemName
in interfaceManager<DestinationPoints>
- Parameters:
s
- the item to make the system name for- Returns:
- A system name from a user input, typically a number.
-
getObjectCount
@CheckReturnValue public int getObjectCount()
Get the count of managed objects.- Specified by:
getObjectCount
in interfaceManager<DestinationPoints>
- Returns:
- the number of managed objects
-
getNamedBeanSet
@Nonnull public java.util.SortedSet<DestinationPoints> getNamedBeanSet()
Implemented to support the Conditional combo box name list- Specified by:
getNamedBeanSet
in interfaceManager<DestinationPoints>
- Returns:
- a list of Destination Point beans
- Since:
- 4.9.3
-
register
public void register(@Nonnull DestinationPoints n)
Remember a NamedBean Object created outside the manager.The non-system-specific SignalHeadManagers use this method extensively.
- Specified by:
register
in interfaceManager<DestinationPoints>
- Parameters:
n
- the bean
-
deregister
public void deregister(@Nonnull DestinationPoints n)
Forget a NamedBean Object created outside the manager.The non-system-specific RouteManager uses this method.
- Specified by:
deregister
in interfaceManager<DestinationPoints>
- Parameters:
n
- the bean
-
setClearDownOption
public void setClearDownOption(int i)
-
getClearDownOption
public int getClearDownOption()
-
setOverlapOption
public void setOverlapOption(int i)
-
getOverlapOption
public int getOverlapOption()
-
setMemoryOption
public void setMemoryOption(java.lang.String memoryName)
-
getMemoryOption
public java.lang.String getMemoryOption()
-
setMemoryClearDelay
public void setMemoryClearDelay(int secs)
-
getMemoryClearDelay
public int getMemoryClearDelay()
-
dispose
public void dispose()
Free resources when no longer used. Specifically, remove all references to and from this object, so it can be garbage-collected.- Specified by:
dispose
in interfaceManager<DestinationPoints>
-
providePoint
public PointDetails providePoint(NamedBean source, LayoutEditor panel)
Generate the point details, given a known source and a Layout Editor panel.- Parameters:
source
- Origin of movementpanel
- A Layout Editor panel- Returns:
- A PointDetails object
-
getSourceList
public java.util.List<java.lang.Object> getSourceList(LayoutEditor panel)
Return a list of all source (origin) points on a given Layout Editor panel.- Parameters:
panel
- A Layout Editor panel- Returns:
- A list of source objects
-
getSourceForPoint
public Source getSourceForPoint(PointDetails pd)
-
getNxPairNumbers
public int getNxPairNumbers(LayoutEditor panel)
-
setReversedRoute
public void setReversedRoute(java.lang.String nxPair)
Set a reversed route between two points. Special case to support a LogixNG action.- Parameters:
nxPair
- The system or user name of the destination point.- Since:
- 5.5.7
-
setSingleSegmentRoute
public void setSingleSegmentRoute(java.lang.String nxPair)
Set the route between the two points represented by the Destination Point name.- Parameters:
nxPair
- The system or user name of the destination point.- Since:
- 4.11.1
-
setMultiPointRoute
public void setMultiPointRoute(PointDetails requestpd, LayoutEditor panel)
-
processRoutesToSet
void processRoutesToSet()
Activate each SourceToDest set in routesToSet
-
removeRemainingRoute
void removeRemainingRoute()
Remove remaining SourceToDest sets in routesToSet
-
getNxSource
public java.util.List<java.lang.Object> getNxSource(LayoutEditor panel)
-
getNxDestination
public java.util.List<java.lang.Object> getNxDestination()
-
getSourcePanelList
public java.util.List<LayoutEditor> getSourcePanelList()
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
- Since:
- 4.17.4
-
addNXDestination
public void addNXDestination(NamedBean source, NamedBean destination, LayoutEditor panel)
-
addNXDestination
public void addNXDestination(NamedBean source, NamedBean destination, LayoutEditor panel, java.lang.String id)
- Parameters:
source
- the source bean.destination
- the destination bean.panel
- the layout editor panel.id
- the points details id.- Since:
- 4.17.4 Register in Property Change Listener.
-
getDestinationList
public java.util.List<java.lang.Object> getDestinationList(java.lang.Object obj, LayoutEditor panel)
-
removeNXSensor
public void removeNXSensor(Sensor sensor)
-
deleteNxPair
public boolean deleteNxPair(NamedBean sensor)
Entry point to delete all of the NX pairs for a specific sensor. 1) Build a list of affected NX pairs. 2) Check for Conditional references. 3) If no references, do the delete process with user approval.- Parameters:
sensor
- The sensor whose pairs should be deleted.- Returns:
- true if the delete was successful. False if prevented by Conditional/LogixNG references or user choice.
- Since:
- 4.11.2
-
deleteNxPair
public boolean deleteNxPair(NamedBean entrySensor, NamedBean exitSensor, LayoutEditor panel)
Entry point to delete a specific NX pair.- Parameters:
entrySensor
- The sensor that acts as the entry point.exitSensor
- The sensor that acts as the exit point.panel
- The layout editor panel that contains the entry sensor.- Returns:
- true if the delete was successful. False if there are Conditional/LogixNG references.
- Since:
- 4.11.2
-
createDeletePairList
void createDeletePairList(NamedBean sensor)
Rebuild the delete pair list based on the supplied sensor. Find all of the NX pairs that use this sensor as either a source or destination. They will be candidates for deletion.- Parameters:
sensor
- The sensor being deleted,- Since:
- 4.11.2
-
layoutBlockSensors
public java.util.List<java.lang.String> layoutBlockSensors(@Nonnull LayoutBlock layoutBlock)
Create a list of sensors that have the layout block as either facing or protecting. Called byLayoutTrackEditor.hasNxSensorPairs(jmri.jmrit.display.layoutEditor.LayoutBlock)
.- Parameters:
layoutBlock
- The layout block to be checked.- Returns:
- the a list of sensors affected by the layout block or an empty list.
- Since:
- 4.11.2
-
isDestinationValid
public boolean isDestinationValid(java.lang.Object source, java.lang.Object dest, LayoutEditor panel)
-
isUniDirection
public boolean isUniDirection(java.lang.Object source, LayoutEditor panel, java.lang.Object dest)
-
setUniDirection
public void setUniDirection(java.lang.Object source, LayoutEditor panel, java.lang.Object dest, boolean set)
-
canBeBiDirectional
public boolean canBeBiDirectional(java.lang.Object source, LayoutEditor panel, java.lang.Object dest)
-
isEnabled
public boolean isEnabled(java.lang.Object source, LayoutEditor panel, java.lang.Object dest)
-
setEnabled
public void setEnabled(java.lang.Object source, LayoutEditor panel, java.lang.Object dest, boolean set)
-
setEntryExitType
public void setEntryExitType(java.lang.Object source, LayoutEditor panel, java.lang.Object dest, int set)
-
getEntryExitType
public int getEntryExitType(java.lang.Object source, LayoutEditor panel, java.lang.Object dest)
-
getUniqueId
public java.lang.String getUniqueId(java.lang.Object source, LayoutEditor panel, java.lang.Object dest)
-
getEntryExitList
public java.util.List<java.lang.String> getEntryExitList()
-
isPathActive
public boolean isPathActive(java.lang.Object sourceObj, java.lang.Object destObj, LayoutEditor panel)
-
cancelInterlock
public void cancelInterlock(java.lang.Object source, LayoutEditor panel, java.lang.Object dest)
-
getPointDetails
public PointDetails getPointDetails(java.lang.Object obj, LayoutEditor panel)
Return a point from a given LE Panel.- Parameters:
obj
- The point objectpanel
- The Layout Editor panel on which the point was placed- Returns:
- the point object, null if the point is not found
-
getPointDetails
PointDetails getPointDetails(LayoutBlock source, java.util.List<LayoutBlock> destination, LayoutEditor panel)
Return either an existing point stored in pointDetails, or create a new one as required.- Parameters:
source
- The Layout Block functioning as the source (origin)destination
- A (list of) Layout Blocks functioning as destinationspanel
- The Layout Editor panel on which the point is to be placed- Returns:
- the point object
-
getPointAsString
public java.lang.String getPointAsString(NamedBean obj, LayoutEditor panel)
Get the name of a destinationPoint on a LE Panel.- Parameters:
obj
- the point objectpanel
- The Layout Editor panel on which it is expected to be placed- Returns:
- the name of the point
-
stackNXRoute
public void stackNXRoute(DestinationPoints dp, boolean reverse)
If a route is requested but is currently blocked, ask user if it should be added to stackList.- Parameters:
dp
- DestinationPoints objectreverse
- true for a reversed running direction, mostly false
-
getStackedInterlocks
public java.util.List<DestinationPoints> getStackedInterlocks()
Get a list of all stacked routes from stackList.- Returns:
- an List containing destinationPoint elements
-
isRouteStacked
public boolean isRouteStacked(DestinationPoints dp, boolean reverse)
Query if a stacked route is in stackList.- Parameters:
dp
- DestinationPoints objectreverse
- true for a reversed running direction, mostly false- Returns:
- true if dp is in stackList
-
cancelStackedRoute
public void cancelStackedRoute(DestinationPoints dp, boolean reverse)
Remove a stacked route from stackList.- Parameters:
dp
- DestinationPoints objectreverse
- true for a reversed running direction, mostly false
-
checkRoute
void checkRoute()
Step through stackList and activate the first stacked route in line if it is no longer blocked.
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener list, NamedBean obj, LayoutEditor panel)
-
automaticallyDiscoverEntryExitPairs
public void automaticallyDiscoverEntryExitPairs(LayoutEditor editor, int interlockType) throws JmriException
Discover all possible valid source and destination Signal Mast Logic pairs on all Layout Editor panels.- Parameters:
editor
- The Layout Editor panelinterlockType
- Integer value representing the type of interlocking, one of SETUPTURNOUTSONLY, SETUPSIGNALMASTLOGIC or FULLINTERLOCK- Throws:
JmriException
- when an error occurs during discovery
-
vetoableChange
public void vetoableChange(java.beans.PropertyChangeEvent evt) throws java.beans.PropertyVetoException
- Throws:
java.beans.PropertyVetoException
-
deleteBean
public void deleteBean(@Nonnull DestinationPoints bean, @Nonnull java.lang.String property) throws java.beans.PropertyVetoException
Description copied from interface:Manager
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<DestinationPoints>
- Parameters:
bean
- 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)
-
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<DestinationPoints>
- 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<DestinationPoints> 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<DestinationPoints>
- Returns:
- the class supported by this Manager.
-
setPropertyChangesSilenced
@OverridingMethodsMustInvokeSuper public void setPropertyChangesSilenced(@Nonnull java.lang.String propertyName, boolean silenced)
Suppress sendingPropertyChangeEvent
s for the named property.Stopping the suppression of sending change events may send a PropertyChangeEvent if the property changed while silenced, but otherwise should not fire a PropertyChangeEvent.
- Specified by:
setPropertyChangesSilenced
in interfaceSilenceablePropertyChangeProvider
- Parameters:
propertyName
- the name of the property to mutesilenced
- true if events are to be suppressed; false otherwise
-
addDataListener
public void addDataListener(Manager.ManagerDataListener<DestinationPoints> e)
Register aManager.ManagerDataListener
to hear about adding or removing items from the list of NamedBeans.- Specified by:
addDataListener
in interfaceManager<DestinationPoints>
- Parameters:
e
- the data listener to add
-
removeDataListener
public void removeDataListener(Manager.ManagerDataListener<DestinationPoints> e)
Unregister a previously-addedManager.ManagerDataListener
.- Specified by:
removeDataListener
in interfaceManager<DestinationPoints>
- Parameters:
e
- the data listener to remove- See Also:
Manager.addDataListener(ManagerDataListener)
-
-