Class ConditionalEditBase

    • Constructor Detail

      • ConditionalEditBase

        public ConditionalEditBase​(java.lang.String sName)
        Set the Logix and Conditional managers and set the selection mode.
        Parameters:
        sName - the Logix system name being edited
    • Method Detail

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

        void fireLogixEvent()
        Notify the listeners to check for new data.
      • makeAntecedent

        java.lang.String makeAntecedent​(java.util.List<ConditionalVariable> variableList)
        Create an antecedent string based on the current variables

        The antecedent consists of all of the variables "in order" combined with the current operator.

        Parameters:
        variableList - The current variable list
        Returns:
        the resulting antecedent string
        Since:
        4.11.5
      • appendToAntecedent

        java.lang.String appendToAntecedent​(Conditional.AntecedentOperator logicType,
                                            int varListSize,
                                            java.lang.String antecedent)
        Add a variable R# entry to the antecedent string. If not the first one, include and or or depending on the logic type
        Parameters:
        logicType - The current logic type.
        varListSize - The current size of the variable list.
        antecedent - The current antecedent
        Returns:
        an extended antecedent
        Since:
        4.11.5
      • validateAntecedent

        boolean validateAntecedent​(Conditional.AntecedentOperator logicType,
                                   java.lang.String antecedentText,
                                   java.util.List<ConditionalVariable> variableList,
                                   Conditional curConditional)
        Check the antecedent and logic type.

        The antecedent text is translated and verified. A new one is created if necessary.

        Parameters:
        logicType - The current logic type. Types other than Mixed are ignored.
        antecedentText - The proposed antecedent string using the local language.
        variableList - The current variable list.
        curConditional - The current conditional.
        Returns:
        false if antecedent can't be validated
        Since:
        4.11.5
      • translateAntecedent

        public static java.lang.String translateAntecedent​(java.lang.String antecedent,
                                                           boolean isLocal)
        Translate an antecedent string between English and the current language as determined by the Bundle classes.

        The property files have Logic??? keys for translating to the target language.

        Parameters:
        antecedent - The antecedent string which can either local or English
        isLocal - True if the antecedent string has local words.
        Returns:
        the translated antecedent string.
        Since:
        4.11.5
      • checkConditionalUserName

        boolean checkConditionalUserName​(java.lang.String uName,
                                         Logix logix)
        Verify that the user name is not a duplicate for the selected Logix.
        Parameters:
        uName - is the user name to be checked
        logix - is the Logix that is being updated
        Returns:
        true if the name is unique
      • createNameBox

        NamedBeanComboBox<?> createNameBox​(Conditional.ItemType itemType)
        Create a combo name box for Variable and Action name selection.
        Parameters:
        itemType - The selected variable or action type
        Returns:
        nameBox A combo box based on the item type
      • createSinglePanelPickList

        void createSinglePanelPickList​(Conditional.ItemType itemType,
                                       ConditionalEditBase.PickSingleListener listener,
                                       boolean actionType)
        Create a single panel picklist JFrame for choosing action and variable names.
        Parameters:
        itemType - The selected variable or action type
        listener - The listener to be assigned to the picklist
        actionType - True if Action, false if Variable.
        Since:
        4.7.3
      • closeSinglePanelPickList

        void closeSinglePanelPickList()
        Close a single panel picklist JFrame and related items.
        Since:
        4.7.3
      • openPickListTable

        void openPickListTable()
        Open a new drag-n-drop Pick List to drag Variable and Action names from to form Logix Conditionals.
      • hidePickListTable

        void hidePickListTable()
        Hide the drag-n-drop Pick List if the last detail edit is closing.
      • setPickListTab

        void setPickListTab​(Conditional.ItemType curType,
                            boolean actionType)
        Set the pick list tab based on the variable or action type. If there is not a corresponding tab, hide the picklist.
        Parameters:
        curType - is the current type
        actionType - True if Action, false if Variable.
      • findPickListTabPane

        void findPickListTabPane​(java.awt.Component[] compList,
                                 int level)
        Recursive search for the tab panel.
        Parameters:
        compList - The components for the current Level
        level - The current level in the structure
      • 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
      • 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
      • updateWhereUsed

        void updateWhereUsed​(java.util.TreeSet<java.lang.String> oldTargetNames,
                             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:
        oldTargetNames - The conditional target names before updating
        newTargetNames - The conditional target names after updating
        refName - The system name for the referencing conditional
        Since:
        4.7.4
      • validateIntensityReference

        boolean validateIntensityReference​(Conditional.Action actionType,
                                           java.lang.String intReference)
        Check if String is an integer or references an integer.
        Parameters:
        actionType - Conditional action to check for, i.e. ACTION_SET_LIGHT_INTENSITY
        intReference - string referencing a decimal for light intensity or the name of a memory
        Returns:
        true if either correct decimal format or a memory with the given name is present
      • validateIntensity

        boolean validateIntensity​(int time)
        Check if text represents an integer is suitable for percentage w/o NumberFormatException.
        Parameters:
        time - value to use as light intensity percentage
        Returns:
        true if time is an integer in range 0 - 100
      • validateTimeReference

        boolean validateTimeReference​(Conditional.Action actionType,
                                      java.lang.String ref)
        Check if a string is decimal or references a decimal.
        Parameters:
        actionType - enum representing the Conditional action type being checked, i.e. ACTION_DELAYED_TURNOUT
        ref - entry to check
        Returns:
        true if ref is itself a decimal or user will provide one from a Memory at run time
      • validateTime

        boolean validateTime​(Conditional.Action actionType,
                             float time)
        Range check time entry (assumes seconds).
        Parameters:
        actionType - integer representing the Conditional action type being checked, i.e. ACTION_DELAYED_TURNOUT
        time - value to be checked
        Returns:
        false if time > 3600 (seconds) or too small
      • displayBadNumberReference

        void displayBadNumberReference​(Conditional.Action actionType)
        Display an error message to user when an invalid number is provided in Conditional setup.
        Parameters:
        actionType - integer representing the Conditional action type being checked, i.e. ACTION_DELAYED_TURNOUT
      • validateMemoryReference

        java.lang.String validateMemoryReference​(java.lang.String name)
        Check Memory reference of text.

        Show a message if not found.

        Parameters:
        name - the name to look for
        Returns:
        the system or user name of the corresponding Memory, null if not found
      • confirmIndirectMemory

        boolean confirmIndirectMemory​(java.lang.String memName)
        Check if user will provide a valid item name in a Memory variable.
        Parameters:
        memName - Memory location to provide item name at run time
        Returns:
        false if user replies No
      • confirmActionAsVariable

        boolean confirmActionAsVariable​(java.lang.String actionName,
                                        java.lang.String variableName)
        Check if user OK's the use of an item as both an action and a state variable.
        Parameters:
        actionName - name of ConditionalAction
        variableName - name of ConditionalVariable
        Returns:
        false if user replies No
      • validateTurnoutReference

        java.lang.String validateTurnoutReference​(java.lang.String name)
        Check Turnout reference of text.

        Show a message if not found.

        Parameters:
        name - the name to look for
        Returns:
        the system or user name of the corresponding Turnout, null if not found
      • validateSignalHeadReference

        java.lang.String validateSignalHeadReference​(java.lang.String name)
        Check SignalHead reference of text.

        Show a message if not found.

        Parameters:
        name - the name to look for
        Returns:
        the system or user name of the corresponding SignalHead, null if not found
      • validateSignalMastReference

        java.lang.String validateSignalMastReference​(java.lang.String name)
        Check SignalMast reference of text.

        Show a message if not found.

        Parameters:
        name - the name to look for
        Returns:
        the system or user name of the corresponding Signal Mast, null if not found
      • validateWarrantReference

        java.lang.String validateWarrantReference​(java.lang.String name)
        Check Warrant reference of text.

        Show a message if not found.

        Parameters:
        name - the name to look for
        Returns:
        the system or user name of the corresponding Warrant, null if not found
      • validateOBlockReference

        java.lang.String validateOBlockReference​(java.lang.String name)
        Check OBlock reference of text.

        Show a message if not found.

        Parameters:
        name - the name to look for
        Returns:
        the system or user name of the corresponding OBlock, null if not found
      • validateSensorReference

        java.lang.String validateSensorReference​(java.lang.String name)
        Check Sensor reference of text.

        Show a message if not found.

        Parameters:
        name - the name to look for
        Returns:
        the system or user name of the corresponding Sensor, null if not found
      • validateLightReference

        java.lang.String validateLightReference​(java.lang.String name)
        Check Light reference of text.

        Show a message if not found.

        Parameters:
        name - the name to look for
        Returns:
        the system or user name of the corresponding Light, null if not found
      • validateConditionalReference

        java.lang.String validateConditionalReference​(java.lang.String name)
        Check Conditional reference of text.

        Show a message if not found.

        Parameters:
        name - the name to look for
        Returns:
        the system or user name of the corresponding Conditional, null if not found
      • validateLogixReference

        java.lang.String validateLogixReference​(java.lang.String name)
        Check Logix reference of text.

        Show a message if not found.

        Parameters:
        name - the name to look for
        Returns:
        the system or user name of the corresponding Logix, null if not found
      • validateRouteReference

        java.lang.String validateRouteReference​(java.lang.String name)
        Check Route reference of text.

        Show a message if not found.

        Parameters:
        name - the name to look for
        Returns:
        the system or user name of the corresponding Route, null if not found
      • validateAudioReference

        java.lang.String validateAudioReference​(java.lang.String name)
        Check an Audio reference of text.

        Show a message if not found.

        Parameters:
        name - the name to look for
        Returns:
        the system or user name of the corresponding AudioManager, null if not found
      • validateEntryExitReference

        java.lang.String validateEntryExitReference​(java.lang.String name)
        Check an EntryExit reference of text.

        Show a message if not found.

        Parameters:
        name - the name to look for
        Returns:
        the system name of the corresponding EntryExit pair, null if not found
      • getLight

        Light getLight​(java.lang.String name)
        Get Light instance.

        Show a message if not found.

        Parameters:
        name - user or system name of an existing light
        Returns:
        the Light object
      • parseTime

        int parseTime​(java.lang.String s)
      • 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
      • messageInvalidSignalHeadAppearance

        void messageInvalidSignalHeadAppearance​(java.lang.String name,
                                                java.lang.String appearance)
        Send an Invalid Conditional SignalHead state message for Edit Logix pane.
        Parameters:
        name - proposed appearance description
        appearance - to compare to
      • messageInvalidActionItemName

        void messageInvalidActionItemName​(java.lang.String name,
                                          java.lang.String itemType)
        Send an Invalid Conditional Action name message for Edit Logix pane.
        Parameters:
        name - user or system name to look up
        itemType - type of Bean to look for
      • messageDuplicateConditionalUserName

        void messageDuplicateConditionalUserName​(java.lang.String svName)
        Send a duplicate Conditional user name message for Edit Logix pane.
        Parameters:
        svName - proposed name that duplicates an existing name
      • locateAt

        public void locateAt​(java.awt.Component c)