org.opensourcephysics.tools
Class DatasetTool

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Frame
                  extended byjavax.swing.JFrame
                      extended byorg.opensourcephysics.display.OSPFrame
                          extended byorg.opensourcephysics.tools.DatasetTool
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.rmi.Remote, javax.swing.RootPaneContainer, java.io.Serializable, Tool, javax.swing.WindowConstants

public class DatasetTool
extends OSPFrame
implements Tool

This provides a GUI for analyzing datasets.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  javax.swing.JMenu addMenu
           
protected static javax.swing.JFileChooser chooser
           
protected  javax.swing.JPanel contentPane
           
protected  XMLControl control
           
protected static java.awt.Dimension dim
           
protected  javax.swing.JMenu divideMenu
           
protected  JobManager jobManager
           
protected static OSPLog log
           
protected  javax.swing.JMenu multiplyMenu
           
protected  javax.swing.JMenu subtractMenu
           
protected  java.beans.PropertyChangeSupport support
           
protected  javax.swing.JTabbedPane tabbedPane
           
protected  boolean useChooser
           
 
Fields inherited from class org.opensourcephysics.display.OSPFrame
animated, applet, appletMode, authorMode, autoclear, buttonPanel, chooserDir, constructorThreadGroup, customButtons, DEFAULT_LOOK_AND_FEEL, defaultLocales, keepHidden, launcherMode, osp_icon_file, strategy
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DatasetTool()
          Constructs a blank DatasetTool.
DatasetTool(Dataset dataset)
          Constructs a DatasetTool and opens the specified dataset.
DatasetTool(java.lang.String fileName)
          Constructs a DatasetTool and opens the specified xml file.
DatasetTool(XMLControl control)
          Constructs a DatasetTool and opens datasets in the specified xml control.
 
Method Summary
protected  boolean addTab(Dataset dataset)
          Adds or selects a tab for the specified dataset.
protected  void createGUI()
          Creates the GUI.
 java.awt.Container getContentPane()
          Gets the content pane.
protected  Dataset getDataset(int i)
          Returns the dataset at the specified index.
 java.util.Collection getDatasets()
          Returns all open datasets.
 Dataset getSelectedDataset()
          Gets the dataset in the currently selected tab, if any.
protected  DatasetTab getSelectedTab()
          Gets the currently selected tab (DatasetTab), if any.
protected  int getTabIndex(Dataset data)
          Returns the index of the tab containing the specified Dataset.
static DatasetTool getTool()
          Gets the shared DatasetTool.
 boolean isUseChooser()
          Gets the useChooser flag.
 java.util.Collection loadDatasets(XMLControl control)
          Loads the datasets found in the specified xml control.
 java.util.Collection loadDatasets(XMLControl control, boolean useChooser)
          Loads the datasets found in the specified xml control.
static void main(java.lang.String[] args)
          Main entry point when used as application.
protected  java.lang.String open()
          Opens an xml file selected with a chooser.
 java.lang.String open(java.lang.String fileName)
          Opens an xml file specified by name.
protected  void refreshTabTitles()
           
protected  void removeAllButTab(int index)
          Removes all tabs except the specified index.
protected  void removeAllTabs()
          Removes all tabs.
protected  void removeTab(int index)
          Removes the specified tab.
 void send(Job job, Tool replyTo)
          Sends a job to this tool and specifies a tool to reply to.
 void setUseChooser(boolean useChooser)
          Sets the useChooser flag.
protected  void showAboutDialog()
          Shows the about dialog.
 void updateData(Dataset dataset)
           
 
Methods inherited from class org.opensourcephysics.display.OSPFrame
addButton, bufferStrategyShow, clearData, clearDataAndRepaint, createBufferStrategy, dispose, getChooser, getConstructorThreadGroup, getDefaultLocales, getMenu, invalidateImage, isAnimated, isAuthorMode, isAutoclear, isIconified, isKeepHidden, isLauncherMode, loadDisplayMenu, loadToolsMenu, parseXMLMenu, parseXMLMenu, print, refreshGUI, removeMenu, removeMenuItem, render, setAnimated, setAuthorMode, setAutoclear, setDefaultCloseOperation, setFontLevel, setKeepHidden, setLauncherMode, setSize, setTitle, setVisible, show, wishesToExit
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, toBack, toFront
 
Methods 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, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods 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, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, 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, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

chooser

protected static javax.swing.JFileChooser chooser

log

protected static OSPLog log

dim

protected static java.awt.Dimension dim

tabbedPane

protected javax.swing.JTabbedPane tabbedPane

useChooser

protected boolean useChooser

contentPane

protected javax.swing.JPanel contentPane

support

protected java.beans.PropertyChangeSupport support

control

protected XMLControl control

jobManager

protected JobManager jobManager

addMenu

protected javax.swing.JMenu addMenu

subtractMenu

protected javax.swing.JMenu subtractMenu

multiplyMenu

protected javax.swing.JMenu multiplyMenu

divideMenu

protected javax.swing.JMenu divideMenu
Constructor Detail

DatasetTool

public DatasetTool()
Constructs a blank DatasetTool.


DatasetTool

public DatasetTool(java.lang.String fileName)
Constructs a DatasetTool and opens the specified xml file.

Parameters:
fileName - the name of the xml file

DatasetTool

public DatasetTool(Dataset dataset)
Constructs a DatasetTool and opens the specified dataset.

Parameters:
dataset - the dataset

DatasetTool

public DatasetTool(XMLControl control)
Constructs a DatasetTool and opens datasets in the specified xml control.

Parameters:
control - the xml control
Method Detail

getTool

public static DatasetTool getTool()
Gets the shared DatasetTool.

Returns:
the shared DatasetTool

open

public java.lang.String open(java.lang.String fileName)
Opens an xml file specified by name.

Parameters:
fileName - the file name
Returns:
the file name, if successfully opened (datasets loaded)

send

public void send(Job job,
                 Tool replyTo)
          throws java.rmi.RemoteException
Sends a job to this tool and specifies a tool to reply to.

Specified by:
send in interface Tool
Parameters:
job - the Job
replyTo - the tool to notify when the job is complete (may be null)
Throws:
java.rmi.RemoteException

setUseChooser

public void setUseChooser(boolean useChooser)
Sets the useChooser flag.

Parameters:
useChooser - true to load datasets with a chooser

isUseChooser

public boolean isUseChooser()
Gets the useChooser flag.

Returns:
true if loading datasets with a chooser

loadDatasets

public java.util.Collection loadDatasets(XMLControl control)
Loads the datasets found in the specified xml control.

Parameters:
control - the xml control
Returns:
true if any datasets are loaded

loadDatasets

public java.util.Collection loadDatasets(XMLControl control,
                                         boolean useChooser)
Loads the datasets found in the specified xml control.

Parameters:
control - the xml control
useChooser - true to present choices to user
Returns:
a collection of newly loaded datasets

getDatasets

public java.util.Collection getDatasets()
Returns all open datasets.

Returns:
a collection of all open datasets

getContentPane

public java.awt.Container getContentPane()
Gets the content pane.

Specified by:
getContentPane in interface javax.swing.RootPaneContainer
Returns:
the content pane

getSelectedDataset

public Dataset getSelectedDataset()
Gets the dataset in the currently selected tab, if any.

Returns:
the selected dataset

addTab

protected boolean addTab(Dataset dataset)
Adds or selects a tab for the specified dataset.

Parameters:
dataset - the dataset
Returns:
true if a new tab was added

getSelectedTab

protected DatasetTab getSelectedTab()
Gets the currently selected tab (DatasetTab), if any.

Returns:
the selected tab

open

protected java.lang.String open()
Opens an xml file selected with a chooser.

Returns:
the name of the opened file

getTabIndex

protected int getTabIndex(Dataset data)
Returns the index of the tab containing the specified Dataset.

Parameters:
data - the Dataset
Returns:
the name of the opened file

getDataset

protected Dataset getDataset(int i)
Returns the dataset at the specified index.

Parameters:
i - the tab index
Returns:
the dataset, or null if none

updateData

public void updateData(Dataset dataset)

removeTab

protected void removeTab(int index)
Removes the specified tab.

Parameters:
index - the tab number

removeAllButTab

protected void removeAllButTab(int index)
Removes all tabs except the specified index.

Parameters:
index - the tab number

removeAllTabs

protected void removeAllTabs()
Removes all tabs.


refreshTabTitles

protected void refreshTabTitles()

createGUI

protected void createGUI()
Creates the GUI.


showAboutDialog

protected void showAboutDialog()
Shows the about dialog.


main

public static void main(java.lang.String[] args)
Main entry point when used as application.

Parameters:
args - ignored