Class VariablePanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class VariablePanel extends JPanel
Panel for displaying and keeping track of user global variables.

The application-wide instance of this component is available from the getInstance() method.

Since:
3 Jul 2025
Author:
Mark Taylor
See Also:
  • Constructor Details

    • VariablePanel

      protected VariablePanel()
      Constructor.
  • Method Details

    • addDoubleVariable

      public void addDoubleVariable(UserConstant<Double> konst)
      Adds a new floating point variable to the display.
      Parameters:
      konst - variable
    • addIntegerVariable

      public void addIntegerVariable(UserConstant<Integer> konst)
      Adds a new integer variable to the display.
      Parameters:
      konst - variable
    • removeVariable

      public void removeVariable(UserConstant<?> konst)
      Removes the given variable from the list managed by this window. No effect if the variable is not currently in the list.
      Parameters:
      konst - variable to remove
    • getVariables

      public Map<String, UserConstant<?>> getVariables()
      Returns a map of all the variables managed by this window, keyed by variable name. The returned object is always the same Map object, but its contents may change over time according to the state of this window.
      Returns:
      immutable (but not unchanging) name to value map
    • getSpecifier

      public <T> uk.ac.starlink.ttools.plot2.config.Specifier<T> getSpecifier(UserConstant<T> konst)
      Returns the specifier component used to control a given variable.
      Parameters:
      konst - variable
      Returns:
      specifier
    • addVariableValueListener

      public void addVariableValueListener(ActionListener l)
      Adds a listener that will be notified if any variable values change.
      Parameters:
      l - listener
    • removeVariableValueListener

      public void removeVariableValueListener(ActionListener l)
      Removes a listener previously added.
      Parameters:
      l - listener
    • getAddVariableAction

      public Action getAddVariableAction()
      Returns the action that adds a new variable to this panel.
      Returns:
      add variable action
    • getRemoveVariableAction

      public Action getRemoveVariableAction()
      Returns the action that removes the currently selected variable from this panel.
      Returns:
      remove variable action
    • getInstance

      public static VariablePanel getInstance()
      Returns the application-wide instance of this class.
      Returns:
      static instance