Class LogixTableAction

All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action

Swing action to create and register a Logix Table.

Also contains the panes to create, edit, and delete a Logix. Conditional editing has been moved to ConditionalListView or CondtionalTreeView.

Most of the text used in this GUI is in BeanTableBundle.properties, accessed via Bundle.getMessage(). 201803 Moved all keys from LogixTableBundle.properties to BeanTableBundle.properties to simplify i18n.

Conditionals now have two policies to trigger execution of their action lists:

  1. the previous policy - Trigger on change of state only
  2. the new default - Trigger on any enabled state calculation
Jan 15, 2011 - Pete Cressman

Two additional action and variable name selection methods have been added:

  1. Single Pick List
  2. Combo Box Selection
The traditional tabbed Pick List with text entry is the default method. The Options menu has been expanded to list the 3 methods. Mar 27, 2017 - Dave Sand

Add a Browse Option to the Logix Select Menu This will display a window that creates a formatted list of the contents of the selected Logix with each Conditional, Variable and Action. The code is courtesy of Chuck Catania and is used with his permission. Apr 2, 2017 - Dave Sand

See Also:
  • Constructor Details

    • LogixTableAction

      Create a LogixManager instance.
      Parameters:
      s - the Action title, not the title of the resulting frame. Perhaps this should be changed?
    • LogixTableAction

      Create a LogixManager instance with default title.
  • Method Details

    • createModel

      protected void createModel()
      Create the JTable DataModel, along with the changes (overrides of BeanTableDataModel) for the specific case of a Logix table.
      Specified by:
      createModel in class AbstractTableAction<Logix>
    • setTitle

      protected void setTitle()
      Set title of Logix table.
      Specified by:
      setTitle in class AbstractTableAction<Logix>
    • setMenuBar

      public void setMenuBar(BeanTableFrame<Logix> f)
      Insert 2 table specific menus.

      Accounts for the Window and Help menus, which are already added to the menu bar as part of the creation of the JFrame, by adding the new menus 2 places earlier unless the table is part of the ListedTableFrame, which adds the Help menu later on.

      Overrides:
      setMenuBar in class AbstractTableAction<Logix>
      Parameters:
      f - the JFrame of this table
    • loadSelectionMode

      Get the saved mode selection, default to the tranditional tabbed pick list.

      During the menu build process, the corresponding menu item is set to selected.

      Since:
      4.7.3
    • setSelectionMode

      Save the mode selection. Called by menu item change events.
      Parameters:
      newMode - The SelectionMode enum constant
      Since:
      4.7.3
    • loadEditorMode

      Get the saved mode selection, default to the traditional conditional list editor.

      During the menu build process, the corresponding menu item is set to selected.

      Since:
      4.9.x
    • setEditorMode

      Save the view mode selection. Called by menu item change events.
      Parameters:
      newMode - The ViewMode enum constant
      Since:
      4.9.x
    • openPickListTable

      Open a new Pick List to drag Actions from to form Logix Conditionals.
    • findEmptyPressed

      Find empty Conditional entries, called from menu.
      Parameters:
      e - the event heard
      See Also:
    • findOrphansPressed

      Find orphaned entries, called from menu.
      Parameters:
      e - the event heard
      See Also:
    • enableAll

      void enableAll(boolean enable)
    • helpTarget

      protected String helpTarget()
      Description copied from class: AbstractTableAction
      Specify the JavaHelp target for this specific panel.
      Overrides:
      helpTarget in class AbstractTableAction<Logix>
      Returns:
      a fixed default string "index" pointing to to highest level in JMRI Help
    • addPressed

      protected void addPressed(ActionEvent e)
      Respond to the Add button in Logix table Creates and/or initialize the Add Logix pane.
      Specified by:
      addPressed in class AbstractTableAction<Logix>
      Parameters:
      e - The event heard
    • makeAddLogixFrame

      JPanel makeAddLogixFrame(String titleId, String messageId, String helpFile)
      Create or copy Logix frame.
      Parameters:
      titleId - property key to fetch as title of the frame (using Bundle)
      messageId - part 1 of property key to fetch as user instruction on pane, either 1 or 2 is added to form the whole key
      helpFile - help file name
      Returns:
      the button JPanel
    • autoSystemName

      Enable/disable fields for data entry when user selects to have system name automatically generated.
    • cancelAddPressed

      Respond to the Cancel button in Add Logix window.

      Note: Also get there if the user closes the Add Logix window.

      Parameters:
      e - The event heard
    • copyPressed

      void copyPressed(String sName)
      Respond to the Copy Logix button in Add Logix window.

      Provides a pane to set new properties of the copy.

      Parameters:
      sName - system name of Logix to be copied
    • checkLogixUserName

      boolean checkLogixUserName(String uName)
      Check and warn if a string is already in use as the user name of a Logix.
      Parameters:
      uName - the suggested name
      Returns:
      true if not in use
    • checkLogixSysName

      Check for a valid Logix system name. A valid name starts with the Logix prefix consisting of the Internal system prefix (normally I) + X, and at least 1 additional character. The prefix will be added if necessary. Any makeSystemName errors are logged to the system console and a dialog is displayed.
      Returns:
      true if the name is now valid.
    • checkFlags

      boolean checkFlags(String sName)
      Check if another Logix editing session is currently open or no system name is provided.
      Parameters:
      sName - system name of Logix to be copied
      Returns:
      true if a new session may be started
    • createPressed

      Respond to the Create Logix button in Add Logix window.
      Parameters:
      e - The event heard
    • handleCreateException

    • editPressed

      void editPressed(String sName)
      Respond to the Edit button pressed in Logix table.
      Parameters:
      sName - system name of Logix to be edited
    • showSaveReminder

      Display reminder to save.
    • setMessagePreferencesDetails

      Overrides:
      setMessagePreferencesDetails in class AbstractTableAction<Logix>
    • deletePressed

      void deletePressed(String sName)
      Respond to the Delete combo selection Logix window or conditional view delete request.
      Parameters:
      sName - system name of bean to be deleted
    • exportToLogixNGPressed

      Respond to the Export to LogixNG combo selection Logix window request.
      Parameters:
      sName - system name of bean to export
    • loadReferenceNames

      Build a tree set from conditional references.
      Parameters:
      varList - The ConditionalVariable list that might contain conditional references
      treeSet - A tree set to be built from the varList data
      Since:
      4.7.4
    • checkConditionalUserName

      boolean checkConditionalUserName(String uName, Logix logix)
    • checkConditionalSystemName

      Check form of Conditional systemName.
      Parameters:
      sName - system name of bean to be checked
      Returns:
      false if sName is empty string or null
    • checkConditionalReferences

      boolean checkConditionalReferences(String logixName)
      Check for conditional references.
      Parameters:
      logixName - The Logix under consideration
      Returns:
      true if no references
      Since:
      4.7.4
    • deleteSourceWhereUsed

      Remove target/source where used entries after a Logix delete.
      Since:
      4.7.4
    • updateWhereUsed

      void updateWhereUsed(TreeSet<String> newTargetNames, String refName)
      Update the conditional reference where used.

      The difference between the saved target names and new target names is used to add/remove where used references.

      Parameters:
      newTargetNames - The conditional target names after updating
      refName - The system name for the referencing conditional
      Since:
      4.7.4
    • makeEditPanel

      Create Variable and Action editing pane center part.
      Parameters:
      comp - Field or comboBox to include on sub pane
      label - property key for label
      hint - property key for tooltip for this sub pane
      Returns:
      JPanel containing interface
    • formatTime

      public static String formatTime(int hour, int minute)
      Format time to hh:mm given integer hour and minute.
      Parameters:
      hour - value for time hours
      minute - value for time minutes
      Returns:
      Formatted time string
    • getClassDescription

      Overrides:
      getClassDescription in class AbstractTableAction<Logix>
    • getClassName

      protected String getClassName()
      Specified by:
      getClassName in class AbstractTableAction<Logix>
    • makeWhereUsedWindow

      Builds the conditional references window when the Conditional Variable References menu item is selected.

      This is a stand-alone window that can be closed at any time.

      Since:
      4.7.4
    • buildWhereUsedListing

      Creates a component containing the conditional reference where used list. The source is ConditionalManager.getWhereUsedMap()
      Returns:
      a TextArea, empty if reference is not used
      Since:
      4.7.4
    • getWhereUsedName

    • browserPressed

      void browserPressed(String sName)
      Respond to the Browse button pressed in Logix table.
      Parameters:
      sName - The selected Logix system name
    • makeBrowserWindow

      void makeBrowserWindow(String lgxName)
      Create and initialize the conditionals browser window.
      Parameters:
      lgxName - Logix system name
    • saveBrowserPressed

      void saveBrowserPressed(String lgxName)
      Save the Logix browser window content to a text file.
      Parameters:
      lgxName - Logix system name
    • buildConditionalListing

      Builds a Component representing the current conditionals for the selected Logix statement.
      Parameters:
      logix - browsing Logix
      Returns:
      a TextArea listing existing conditionals; will be empty if there are none