Package adams.gui.goe

Class VariableSupport


  • public class VariableSupport
    extends Object
    Helper class for managing variables in the GOE.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Field Detail

      • CAPTION_INDICATOR

        public static final String CAPTION_INDICATOR
        the indicator to be displayed in a JLabel when the option has a variable.
        See Also:
        Constant Field Values
      • HINT_INDICATOR

        public static final String HINT_INDICATOR
        the indicator to be displayed in a JLabel's tiptext when the option has a variable.
        See Also:
        Constant Field Values
      • BUTTON_HINT_PREFIX

        public static final String BUTTON_HINT_PREFIX
        the prefix for the buttons's tiptext when the option has a variable.
        See Also:
        Constant Field Values
    • Constructor Detail

      • VariableSupport

        public VariableSupport()
    • Method Detail

      • findParent

        public static PropertySheetPanel findParent​(Container c)
        Returns the PropertySheetPanel parent of this container.
        Parameters:
        c - the container to get the enclosing PropertySheetPanel for
        Returns:
        the parent sheet or null if none found
      • createPopup

        public static BasePopupMenu createPopup​(PropertySheetPanel parent,
                                                PropertyEditor editor)
        Creates a popup menu for variable management.
        Parameters:
        parent - the parent sheet panel of the editor
        editor - the property editor this menu is generated for
        Returns:
        the popup menu
      • getCallableActor

        protected static String getCallableActor​(TreePath path)
        Returns the callable actor associated with the path.
        Parameters:
        path - the path to get the callable actor for
        Returns:
        the name of the callable actor, null if not a callable actor
      • selectCallableActorFromNodes

        protected static String selectCallableActorFromNodes​(Container parent,
                                                             List<Node> nodes,
                                                             String current)
        Pops up a dialog with the provided callable actors for the user to select one.
        Parameters:
        parent - the swing parent
        nodes - the actors to choose from
        current - the current actor, null if not available
        Returns:
        the selected actor, null if none chosen or none available
      • selectCallableActorFromNames

        protected static String selectCallableActorFromNames​(Container parent,
                                                             List<String> actors,
                                                             String current)
        Pops up a dialog with the provided callable actors for the user to select one.
        Parameters:
        parent - the swing parent
        actors - the actors to choose from
        current - the current actor, null if not available
        Returns:
        the selected actor, null if none chosen
      • updatePopup

        public static BasePopupMenu updatePopup​(PropertySheetPanel parent,
                                                PropertyEditor editor,
                                                BasePopupMenu menu)
        Updates a popup menu and adds menu items for variable management.
        Parameters:
        parent - the parent sheet panel of the editor
        editor - the property editor this menu is generated for
        menu - the menu to update
        Returns:
        the updated popup menu
      • updateLabel

        public static void updateLabel​(JLabel label,
                                       String variable)
        Updates the label's caption and hint depending on whether the option has a variable or not.
        Parameters:
        label - the label to process
        variable - the variable name, null if none present
      • updateButton

        public static void updateButton​(BaseFlatButton button,
                                        String variable)
        Updates the icon of the variables button.
        Parameters:
        button - the button to change
        variable - the name of the attached variable, null if none attached