Class 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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected TrackerTableAction.TableFrame _frame  
      protected static int STRUT_SIZE  
      • Fields inherited from class javax.swing.AbstractAction

        changeSupport, enabled
      • Fields inherited from interface javax.swing.Action

        ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
    • Method Detail

      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
      • 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 Tracker
        name - name of the Tracker
        marker - LocoIcon dropped on the block (optional)
        Returns:
        true if successfully created.
      • 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 stopped
        b - 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
      • 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
      • propertyChange

        public void propertyChange​(java.beans.PropertyChangeEvent evt)
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener