Class SignalGroupTableAction

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

    public class SignalGroupTableAction
    extends AbstractTableAction<SignalGroup>
    implements java.beans.PropertyChangeListener
    Swing action to create and register a Signal Group Table.

    Based in part on RouteTableAction.java by Bob Jacobsen

    See Also:
    Serialized Form
    • Constructor Detail

      • SignalGroupTableAction

        public SignalGroupTableAction​(java.lang.String s)
        Create an action with a specific title.

        Note that the argument is the Action title, not the title of the resulting frame. Perhaps this should be changed?

        Parameters:
        s - title of the action
    • Method Detail

      • propertyChange

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

        int signalStateFromBox​(javax.swing.JComboBox<java.lang.String> box)
        Read Appearance for a Signal Group Signal Head from the state comboBox.

        Called from SignalGroupSubTableAction.

        Parameters:
        box - comboBox to read from
        Returns:
        index representing selected set to appearance for head
      • setSignalStateBox

        void setSignalStateBox​(int mode,
                               javax.swing.JComboBox<java.lang.String> box)
        Set Appearance in a Signal Group Signal Head state comboBox. Called from SignalGroupSubTableAction
        Parameters:
        mode - Value to be set
        box - in which to enter mode
      • addPressed

        protected void addPressed​(java.awt.event.ActionEvent e)
        Respond to click on Add... button below Signal Group Table.

        Create JPanel with options for configuration.

        Specified by:
        addPressed in class AbstractTableAction<SignalGroup>
        Parameters:
        e - Event from origin; null when called from Edit button in Signal Group Table row
      • setColumnToHoldButton

        void setColumnToHoldButton​(javax.swing.JTable table,
                                   int column,
                                   javax.swing.JButton sample)
      • initializeIncludedList

        void initializeIncludedList()
        Initialize list of included signal head appearances for when "Included" is selected.
      • createPressed

        void createPressed​(java.awt.event.ActionEvent e)
        Respond to the Create button.
        Parameters:
        e - the action event
      • checkNewNamesOK

        boolean checkNewNamesOK()
        Check name for a new SignalGroup object using the _systemName field on the addFrame pane. Not used when autoSystemName is checked.
        Returns:
        whether name entered is allowed
      • checkValidSignalMast

        boolean checkValidSignalMast()
        Check selection in Main Mast comboBox and store object as mMast for further calculations.
        Returns:
        The new/updated SignalGroup object
      • checkNamesOK

        SignalGroup checkNamesOK()
        Check name and return a new or existing SignalGroup object with the name as entered in the _systemName field on the addFrame pane.
        Returns:
        The new/updated SignalGroup object
      • setHeadInformation

        int setHeadInformation​(SignalGroup g)
        Check all available Single Output Signal Heads against the list of signal head items registered with the group. Updates the list, which is stored in the field _includedSignalHeadsList.
        Parameters:
        g - Signal Group object
        Returns:
        The number of Signal Heads included in the group
      • setMastAspectInformation

        void setMastAspectInformation​(SignalGroup g)
        Store included Aspects for the selected main Signal Mast in the Signal Group
        Parameters:
        g - Signal Group object
      • setValidSignalMastAspects

        void setValidSignalMastAspects()
        Look up the list of valid Aspects for the selected main Signal Mast in the comboBox and store them in a table on the addFrame using _AspectModel
      • cancelPressed

        void cancelPressed​(java.awt.event.ActionEvent e)
        When user clicks Cancel during editing a Signal Group, close the Add/Edit pane and reset default entries.
        Parameters:
        e - Event from origin
      • editPressed

        void editPressed​(java.awt.event.ActionEvent e)
        Respond to the Edit button in the Signal Group Table after creating the Add/Edit pane with AddPressed supplying _SystemName. Hides the editable _systemName field on the Add Group pane and displays the value as a label instead.
        Parameters:
        e - Event from origin, null if invoked by clicking the Edit button in a Signal Group Table row
      • deletePressed

        void deletePressed​(java.awt.event.ActionEvent e)
        Respond to the Delete button in the Add/Edit pane.
        Parameters:
        e - the event heard
      • updatePressed

        void updatePressed​(java.awt.event.ActionEvent e,
                           boolean newSignalGroup,
                           boolean close)
        Respond to the Update button on the Edit Signal Group pane - store new properties in the Signal Group.
        Parameters:
        e - Event from origin, null if invoked by clicking the Edit button in a Signal Group Table row
        newSignalGroup - False when called as Update, True after editing Signal Head details
        close - True if the pane is closing, False if it stays open
      • finishUpdate

        void finishUpdate()
        Clean up the Edit Signal Group pane.
      • signalHeadEditPressed

        void signalHeadEditPressed​(int row)
        Open an editor to set the details of a Signal Head as part of a Signal Group when user clicks the Edit button in the Signal Head table in the lower half of the Edit Signal Group pane. (renamed from signalEditPressed in 4.7.1 to explain what's in here)
        Parameters:
        row - Index of line clicked in the displayed Signal Head table
        See Also:
        SignalGroupSubTableAction.editHead