Package org.opensourcephysics.tools
Class FunctionTool
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
org.opensourcephysics.tools.FunctionTool
- All Implemented Interfaces:
 ImageObserver,MenuContainer,PropertyChangeListener,Serializable,EventListener,Accessible,RootPaneContainer,WindowConstants
- Direct Known Subclasses:
 DataBuilder,FitBuilder,ModelBuilder,TrackDataBuilder
This tool allows users to create and manage editable Functions.
 
 OSP DataBuilder, DataToolTab.dataBuilder, FitBuilder
 
 Tracker ModelBuilder and TrackDataBuilder
- Author:
 - Douglas Brown
 - See Also:
 
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassCustom renderer to show name and icon in dropdown list itemsstatic classNested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialogNested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityTypeNested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.TypeNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy - 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Set<DatasetCurveFitter>protected JToolBarprotected Stringprotected Stringprotected intprotected ActionListenerprotected Stringprotected Stringstatic String[]static String[]static final Stringstatic final Stringstatic final Stringprotected booleanprotected FunctionPanelprotected Stringprotected Map<String,FunctionPanel> Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabledFields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPEFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE - 
Constructor Summary
ConstructorsConstructorDescriptionFunctionTool(Component comp) Constructs a tool for the specified component (may be null)FunctionTool(Component comp, boolean isFitBuilder, boolean lazyGUI) Constructor allowing for a fitBuilder flag and lazyGUI option - 
Method Summary
Modifier and TypeMethodDescriptionvoidaddForbiddenNames(String[] names) Adds names to the forbidden set.voidaddPanel(String name, FunctionPanel panel) Adds a FunctionPanel.static booleanarrayContains(String[] s, String name) voidcheckGUI()voidClears all FunctionPanels.protected voidCreates the GUI.voiddispose()protected voidfirePropertyChange(String name, Object oldObj, Object newObj) Fires a property change.voidintGets the font level.static XML.ObjectLoaderReturns an ObjectLoader to save and load data for this class.Returns the named FunctionPanel.Returns the set of all panel names.protected StringGets the selected dropdown item name.Returns the name of the selected FunctionPanel.Returns the selected FunctionPanel.Gets the toolbar.Gets the custom buttons or other components.protected StringgetUniqueName(String proposedName) Gets a unique name.booleanprotected booleanhaveGUI()protected voidinit()booleanisEmpty()Reports if this is empty.static booleanisReservedName(String name) Returns true if name is reserved by the OSP parser.booleanOverrides JDialog isVisible method.voidResponds to property change events from TrackerPanel.voidrefreshDropdown(String name) Refreshes the dropdown and selects a specified panel.protected voidRefreshes the GUI.removePanel(String name) Removes a named FunctionPanel.renamePanel(String prevName, String newName) Renames a FunctionPanel.voidsetButtonBar(Object[] btns) voidsetDefaultVariables(String[] vars) Sets the independent variables of all function panels.voidsetFontLevel(int level) Sets the font level.voidsetHelpAction(ActionListener action) Sets the help action.voidsetHelpPath(String path) Sets the path of the help file.voidsetSelectedPanel(String name) Selects a FunctionPanel by name.protected voidvoidsetToolbarComponents(Component[] toolbarItems) Sets the custom buttons or other components.voidsetVisible(boolean vis) Overrides JDialog setVisible method.Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateMethods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBackMethods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFrontMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle 
- 
Field Details
- 
PROPERTY_FUNCTIONTOOL_PANEL
- See Also:
 
 - 
PROPERTY_FUNCTIONTOOL_VISIBLE
- See Also:
 
 - 
PROPERTY_FUNCTIONTOOL_FUNCTION
- See Also:
 
 - 
parserNames
 - 
parserOperators
 - 
forbiddenNames
 - 
curveFitters
 - 
trackFunctionPanels
 - 
selectedPanel
 - 
helpPath
 - 
helpBase
 - 
helpAction
 - 
fontLevel
protected int fontLevel - 
refreshing
protected boolean refreshing - 
dropdownbar
 - 
dropdownTipText
 - 
titleText
 - 
dropdownLabelText
 
 - 
 - 
Constructor Details
- 
FunctionTool
Constructs a tool for the specified component (may be null)- Parameters:
 comp- Component used to get Frame owner of this Dialog
 - 
FunctionTool
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
Sets the custom buttons or other components.- Parameters:
 toolbarItems- an array of components (may be null)
 - 
getToolbarComponents
Gets the custom buttons or other components.- Returns:
 - an array of components (may be null)
 
 - 
getToolbar
Gets the toolbar.- Returns:
 - the toolbar
 
 - 
addPanel
Adds a FunctionPanel.- Parameters:
 name- a descriptive namepanel- the FunctionPanel
 - 
removePanel
Removes a named FunctionPanel.- Parameters:
 name- the name- Returns:
 - the removed panel, if any
 
 - 
renamePanel
Renames a FunctionPanel.- Parameters:
 prevName- the previous namenewName- the new name- Returns:
 - the renamed panel
 
 - 
setSelectedPanel
Selects a FunctionPanel by name.- Parameters:
 name- the name
 - 
getSelectedName
Returns the name of the selected FunctionPanel.- Returns:
 - the name
 
 - 
getSelectedPanel
Returns the selected FunctionPanel.- Returns:
 - the FunctionPanel
 
 - 
getPanel
Returns the named FunctionPanel.- Parameters:
 name- the name- Returns:
 - the FunctionPanel
 
 - 
getPanelNames
Returns the set of all panel names.- Returns:
 - a set of names
 
 - 
clearPanels
public void clearPanels()Clears all FunctionPanels. - 
propertyChange
Responds to property change events from TrackerPanel.- Specified by:
 propertyChangein interfacePropertyChangeListener- Parameters:
 e- the property change event
 - 
addForbiddenNames
Adds names to the forbidden set.- Parameters:
 names- the names to add
 - 
setVisible
public void setVisible(boolean vis) Overrides JDialog setVisible method.- Overrides:
 setVisiblein classDialog- Parameters:
 vis- true to show this tool
 - 
isVisible
public boolean isVisible()Overrides JDialog isVisible method. - 
setHelpPath
Sets the path of the help file.- Parameters:
 path- a filename or url
 - 
setHelpAction
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
Sets the independent variables of all function panels.- Parameters:
 vars- the independent variable names
 - 
firePropertyChange
Fires a property change. This makes this method visible to the tools package.- Overrides:
 firePropertyChangein classComponent
 - 
getSelectedDropdownName
Gets the selected dropdown item name.- Returns:
 - the selected name
 
 - 
refreshDropdown
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
Gets a unique name.- Parameters:
 proposedName- the proposed name- Returns:
 - the unique name
 
 - 
getLoader
Returns an ObjectLoader to save and load data for this class.- Returns:
 - the object loader
 
 - 
setButtonBar
 - 
hasButton
 - 
focusHelp
public void focusHelp() - 
dispose
public void dispose() - 
arrayContains
 - 
isReservedName
Returns true if name is reserved by the OSP parser.- Parameters:
 name- the proposed name- Returns:
 - true if reserved
 
 
 -