Class FunctionTool

All Implemented Interfaces:
ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants
Direct Known Subclasses:
DataBuilder, FitBuilder, ModelBuilder, TrackDataBuilder

public class FunctionTool extends JDialog implements PropertyChangeListener
This tool allows users to create and manage editable Functions. OSP DataBuilder, DataToolTab.dataBuilder, FitBuilder Tracker ModelBuilder and TrackDataBuilder
Author:
Douglas Brown
See Also:
  • Field Details

    • PROPERTY_FUNCTIONTOOL_PANEL

      public static final String PROPERTY_FUNCTIONTOOL_PANEL
      See Also:
    • PROPERTY_FUNCTIONTOOL_VISIBLE

      public static final String PROPERTY_FUNCTIONTOOL_VISIBLE
      See Also:
    • PROPERTY_FUNCTIONTOOL_FUNCTION

      public static final String PROPERTY_FUNCTIONTOOL_FUNCTION
      See Also:
    • parserNames

      public static String[] parserNames
    • parserOperators

      public static String[] parserOperators
    • forbiddenNames

      protected HashSet<String> forbiddenNames
    • curveFitters

      protected Set<DatasetCurveFitter> curveFitters
    • trackFunctionPanels

      protected Map<String,FunctionPanel> trackFunctionPanels
    • selectedPanel

      protected FunctionPanel selectedPanel
    • helpPath

      protected String helpPath
    • helpBase

      protected String helpBase
    • helpAction

      protected ActionListener helpAction
    • fontLevel

      protected int fontLevel
    • refreshing

      protected boolean refreshing
    • titleText

      protected String titleText
  • Constructor Details

    • FunctionTool

      public FunctionTool(Component comp)
      Constructs a tool for the specified component (may be null)
      Parameters:
      comp - Component used to get Frame owner of this Dialog
    • FunctionTool

      public FunctionTool(Component comp, boolean isFitBuilder, boolean lazyGUI)
      Constructor allowing for a fitBuilder flag and lazyGUI option
      Parameters:
      comp -
      isFitBuilder -
      lazyGUI -
  • Method Details

    • checkGUI

      public void checkGUI()
    • init

      protected void init()
    • haveGUI

      protected boolean haveGUI()
    • createGUI

      protected void createGUI()
      Creates the GUI.
    • setTitles

      protected void setTitles()
    • refreshGUI

      protected void refreshGUI()
      Refreshes the GUI.
    • setToolbarComponents

      public void setToolbarComponents(Component[] toolbarItems)
      Sets the custom buttons or other components.
      Parameters:
      toolbarItems - an array of components (may be null)
    • getToolbarComponents

      public Component[] getToolbarComponents()
      Gets the custom buttons or other components.
      Returns:
      an array of components (may be null)
    • getToolbar

      public JToolBar getToolbar()
      Gets the toolbar.
      Returns:
      the toolbar
    • addPanel

      public void addPanel(String name, FunctionPanel panel)
      Adds a FunctionPanel.
      Parameters:
      name - a descriptive name
      panel - the FunctionPanel
    • removePanel

      public FunctionPanel removePanel(String name)
      Removes a named FunctionPanel.
      Parameters:
      name - the name
      Returns:
      the removed panel, if any
    • renamePanel

      public FunctionPanel renamePanel(String prevName, String newName)
      Renames a FunctionPanel.
      Parameters:
      prevName - the previous name
      newName - the new name
      Returns:
      the renamed panel
    • setSelectedPanel

      public void setSelectedPanel(String name)
      Selects a FunctionPanel by name.
      Parameters:
      name - the name
    • getSelectedName

      public String getSelectedName()
      Returns the name of the selected FunctionPanel.
      Returns:
      the name
    • getSelectedPanel

      public FunctionPanel getSelectedPanel()
      Returns the selected FunctionPanel.
      Returns:
      the FunctionPanel
    • getPanel

      public FunctionPanel getPanel(String name)
      Returns the named FunctionPanel.
      Parameters:
      name - the name
      Returns:
      the FunctionPanel
    • getPanelNames

      public Set<String> getPanelNames()
      Returns the set of all panel names.
      Returns:
      a set of names
    • clearPanels

      public void clearPanels()
      Clears all FunctionPanels.
    • propertyChange

      public void propertyChange(PropertyChangeEvent e)
      Responds to property change events from TrackerPanel.
      Specified by:
      propertyChange in interface PropertyChangeListener
      Parameters:
      e - the property change event
    • addForbiddenNames

      public void addForbiddenNames(String[] names)
      Adds names to the forbidden set.
      Parameters:
      names - the names to add
    • setVisible

      public void setVisible(boolean vis)
      Overrides JDialog setVisible method.
      Overrides:
      setVisible in class Dialog
      Parameters:
      vis - true to show this tool
    • isVisible

      public boolean isVisible()
      Overrides JDialog isVisible method.
      Overrides:
      isVisible in class Component
      Returns:
      true if visible
    • setHelpPath

      public void setHelpPath(String path)
      Sets the path of the help file.
      Parameters:
      path - a filename or url
    • setHelpAction

      public void setHelpAction(ActionListener action)
      Sets the help action. this will replace the current help action
      Parameters:
      action - a custom help action
    • isEmpty

      public boolean isEmpty()
      Reports if this is empty.
      Returns:
      true if empty
    • setFontLevel

      public void setFontLevel(int level)
      Sets the font level.
      Parameters:
      level - the level
    • getFontLevel

      public int getFontLevel()
      Gets the font level.
      Returns:
      the level
    • setDefaultVariables

      public void setDefaultVariables(String[] vars)
      Sets the independent variables of all function panels.
      Parameters:
      vars - the independent variable names
    • firePropertyChange

      protected void firePropertyChange(String name, Object oldObj, Object newObj)
      Fires a property change. This makes this method visible to the tools package.
      Overrides:
      firePropertyChange in class Component
    • getSelectedDropdownName

      protected String getSelectedDropdownName()
      Gets the selected dropdown item name.
      Returns:
      the selected name
    • refreshDropdown

      public void refreshDropdown(String name)
      Refreshes the dropdown and selects a specified panel. If name is null, the current selection is retained if possible.
      Parameters:
      name - the name of the panel to select
    • getUniqueName

      protected String getUniqueName(String proposedName)
      Gets a unique name.
      Parameters:
      proposedName - the proposed name
      Returns:
      the unique name
    • getLoader

      public static XML.ObjectLoader getLoader()
      Returns an ObjectLoader to save and load data for this class.
      Returns:
      the object loader
    • setButtonBar

      public void setButtonBar(Object[] btns)
    • hasButton

      public boolean hasButton(JButton btn)
    • focusHelp

      public void focusHelp()
    • dispose

      public void dispose()
      Overrides:
      dispose in class Window
    • arrayContains

      public static boolean arrayContains(String[] s, String name)
    • isReservedName

      public static boolean isReservedName(String name)
      Returns true if name is reserved by the OSP parser.
      Parameters:
      name - the proposed name
      Returns:
      true if reserved