Class LogixTableAction

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.io.Serializable, 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 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:
    Serialized Form
    • Constructor Detail

      • LogixTableAction

        public LogixTableAction​(java.lang.String s)
        Create a LogixManager instance.
        Parameters:
        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.

        Overrides:
        setMenuBar in class AbstractTableAction<Logix>
        Parameters:
        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.

        Since:
        4.7.3
      • loadEditorMode

        void 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

        void setEditorMode​(LogixTableAction.EditMode newMode)
        Save the view mode selection. Called by menu item change events.
        Parameters:
        newMode - The ViewMode enum constant
        Since:
        4.9.x
      • 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>
        Parameters:
        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.
        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

        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.

        Parameters:
        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.

        Parameters:
        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.
        Parameters:
        uName - the suggested name
        Returns:
        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.
        Returns:
        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.
        Parameters:
        sName - system name of Logix to be copied
        Returns:
        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.
        Parameters:
        e - The event heard
      • editPressed

        void editPressed​(java.lang.String sName)
        Respond to the Edit button pressed in Logix table.
        Parameters:
        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.
        Parameters:
        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.
        Parameters:
        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.
        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
      • checkConditionalSystemName

        boolean checkConditionalSystemName​(java.lang.String sName)
        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​(java.lang.String logixName)
        Check for conditional references.
        Parameters:
        logixName - The Logix under consideration
        Returns:
        true if no references
        Since:
        4.7.4
      • deleteSourceWhereUsed

        void deleteSourceWhereUsed()
        Remove target/source where used entries after a Logix delete.
        Since:
        4.7.4
      • 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.

        Parameters:
        newTargetNames - The conditional target names after updating
        refName - The system name for the referencing conditional
        Since:
        4.7.4
      • 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.
        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 java.lang.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
      • 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.

        Since:
        4.7.4
      • 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.
        Parameters:
        sName - The selected Logix system name
      • makeBrowserWindow

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

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

        javax.swing.JTextArea buildConditionalListing​(Logix logix)
        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