Class LogixTableAction

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

    public class LogixTableAction
    extends AbstractTableAction<Logix>
    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, accessed via Bundle.getMessage(). 201803 Moved all keys from to 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:
    Serialized Form
    • Constructor Detail

      • LogixTableAction

        public LogixTableAction​(java.lang.String s)
        Create a LogixManager instance.
        s - the Action title, not the title of the resulting frame. Perhaps this should be changed?
      • LogixTableAction

        public LogixTableAction()
        Create a LogixManager instance with default title.
    • Method Detail

      • 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>
      • 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.

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

        void 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.

      • loadEditorMode

        void loadEditorMode()
        Get the saved mode selection, default to the tranditional conditional list editor.

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

      • setEditorMode

        void setEditorMode​(LogixTableAction.EditMode newMode)
        Save the view mode selection. Called by menu item change events.
        newMode - The ViewMode enum constant
      • openPickListTable

        void openPickListTable()
        Open a new Pick List to drag Actions from to form Logix Conditionals.
      • enableAll

        void enableAll​(boolean enable)
      • addPressed

        protected void addPressed​(java.awt.event.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>
        e - The event heard
      • makeAddLogixFrame

        javax.swing.JPanel makeAddLogixFrame​(java.lang.String titleId,
                                             java.lang.String messageId,
                                             java.lang.String helpFile)
        Create or copy Logix frame.
        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
        the button JPanel
      • autoSystemName

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

        void cancelAddPressed​(java.awt.event.ActionEvent e)
        Respond to the Cancel button in Add Logix window.

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

        e - The event heard
      • copyPressed

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

        Provides a pane to set new properties of the copy.

        sName - system name of Logix to be copied
      • checkLogixUserName

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

        boolean 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.
        true if the name is now valid.
      • checkFlags

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

        void createPressed​(java.awt.event.ActionEvent e)
        Respond to the Create Logix button in Add Logix window.
        e - The event heard
      • editPressed

        void editPressed​(java.lang.String sName)
        Respond to the Edit button pressed in Logix table.
        sName - system name of Logix to be edited
      • deletePressed

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

        void exportToLogixNGPressed​(java.lang.String sName)
        Respond to the Export to LogixNG combo selection Logix window request.
        sName - system name of bean to export
      • loadReferenceNames

        void loadReferenceNames​(java.util.List<ConditionalVariable> varList,
                                java.util.TreeSet<java.lang.String> treeSet)
        Build a tree set from conditional references.
        varList - The ConditionalVariable list that might contain conditional references
        treeSet - A tree set to be built from the varList data
      • checkConditionalSystemName

        boolean checkConditionalSystemName​(java.lang.String sName)
        Check form of Conditional systemName.
        sName - system name of bean to be checked
        false if sName is empty string or null
      • checkConditionalReferences

        boolean checkConditionalReferences​(java.lang.String logixName)
        Check for conditional references.
        logixName - The Logix under consideration
        true if no references
      • deleteSourceWhereUsed

        void deleteSourceWhereUsed()
        Remove target/source where used entries after a Logix delete.
      • updateWhereUsed

        void updateWhereUsed​(java.util.TreeSet<java.lang.String> newTargetNames,
                             java.lang.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.

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

        javax.swing.JPanel makeEditPanel​(javax.swing.JComponent comp,
                                         java.lang.String label,
                                         java.lang.String hint)
        Create Variable and Action editing pane center part.
        comp - Field or comboBox to include on sub pane
        label - property key for label
        hint - property key for tooltip for this sub pane
        JPanel containing interface
      • formatTime

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

        void 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.

      • getWhereUsedName

        java.lang.String getWhereUsedName​(java.lang.String cName)
      • browserPressed

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

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

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

        javax.swing.JTextArea buildConditionalListing​(Logix logix)
        Builds a Component representing the current conditionals for the selected Logix statement.
        logix - browsing Logix
        a TextArea listing existing conditionals; will be empty if there are none