Package jmri.jmrit.logix
Class TrackerTableAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- jmri.jmrit.logix.TrackerTableAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.beans.PropertyChangeListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
public class TrackerTableAction extends javax.swing.AbstractAction implements java.beans.PropertyChangeListener
This class displays a table of the occupancy detection trackers. It does the listening of block sensors for all the Trackers and chooses the tracker most likely to have entered a block becoming active or leaving a block when it becomes inactive.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
TrackerTableAction.ChooseTracker
static class
TrackerTableAction.Initializer
(package private) class
TrackerTableAction.TableFrame
Holds a table of Trackers that follow adjacent occupancy.
-
Field Summary
Fields Modifier and Type Field Description protected TrackerTableAction.TableFrame
_frame
protected static int
STRUT_SIZE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
protected void
addBlockListeners(Tracker tracker)
Adds listeners to all blocks in the range of a Tracker.protected void
addTracker(Tracker t)
protected boolean
checkBlock(OBlock b)
Tracker
findTrackerIn(OBlock b)
See if any Trackers are occupying a given block.boolean
markNewTracker(OBlock block, java.lang.String name, LocoIcon marker)
Create and register a new Tracker.boolean
mouseClickedOnBlock(OBlock block)
(package private) boolean
nameInuse(java.lang.String name)
void
propertyChange(java.beans.PropertyChangeEvent evt)
protected void
removeBlockListeners(Tracker tracker)
protected void
setStatus(java.lang.String msg)
void
stopTracker(Tracker t, OBlock b)
Stop a Tracker from tracking and remove from listvoid
updateStatus()
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
STRUT_SIZE
protected static final int STRUT_SIZE
- See Also:
- Constant Field Values
-
_frame
protected TrackerTableAction.TableFrame _frame
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
-
mouseClickedOnBlock
public boolean mouseClickedOnBlock(OBlock block)
-
markNewTracker
public boolean markNewTracker(OBlock block, java.lang.String name, LocoIcon marker)
Create and register a new Tracker.- Parameters:
block
- starting head block of the Trackername
- name of the Trackermarker
- LocoIcon dropped on the block (optional)- Returns:
- true if successfully created.
-
addTracker
protected void addTracker(Tracker t)
-
checkBlock
protected boolean checkBlock(OBlock b)
-
nameInuse
boolean nameInuse(java.lang.String name)
-
stopTracker
public void stopTracker(Tracker t, OBlock b)
Stop a Tracker from tracking and remove from list- Parameters:
t
- Tracker to be stoppedb
- Block Tracker of its last move. Optional, for display purpose only.
-
setStatus
protected void setStatus(java.lang.String msg)
-
findTrackerIn
public Tracker findTrackerIn(OBlock b)
See if any Trackers are occupying a given block.- Parameters:
b
- Block being queried- Returns:
- Tracker if found
-
updateStatus
public void updateStatus()
-
addBlockListeners
protected void addBlockListeners(Tracker tracker)
Adds listeners to all blocks in the range of a Tracker. Called when a new tracker is created.- Parameters:
tracker
- Tracker that is about to start
-
removeBlockListeners
protected void removeBlockListeners(Tracker tracker)
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
-