Package org.opensourcephysics.tools
Class DataTool
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
org.opensourcephysics.display.OSPFrame
org.opensourcephysics.tools.DataTool
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,PropertyChangeListener
,Serializable
,EventListener
,Accessible
,RootPaneContainer
,WindowConstants
,AppFrame
,Hidable
,Tool
This provides a GUI for analyzing OSP Data objects.
- Version:
- 1.0
- Author:
- Douglas Brown
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
A dialog to edit table data using delimited text.static class
A class to find an exponential moving average (weighting for previous values fall off by factor exp(-alpha)).class
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.Type
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JMenuItem
protected Data
protected static boolean
protected static int
protected JMenuItem
protected JMenuItem
protected JPanel
protected XMLControlElement
protected boolean
protected JMenuItem
protected JMenu
protected JMenuItem
protected JMenuItem
protected JMenu
protected JMenuItem
protected DataBuilder
protected static final int
protected JMenuItem
protected static String[]
protected static Dimension
protected JMenu
protected JMenu
protected JMenu
protected JMenuItem
protected JMenu
protected JMenuBar
protected JMenuItem
protected JMenuItem
protected JMenuItem
protected JMenuItem
protected JMenuItem
protected boolean
protected JMenuItem
protected JMenu
protected FitBuilder
protected ButtonGroup
protected JMenu
protected static String
protected static TextFrame
protected JMenuItem
protected JMenu
protected static String
protected JMenuItem
protected boolean
protected JMenuItem[]
protected JMenu
static boolean
protected JButton
protected static boolean
protected JMenuItem
protected JMenuBar
protected int
protected int
static String
protected JMenuItem
protected JMenuItem
protected JMenuItem
protected JMenu
protected JMenuItem
protected JMenuItem
protected JMenuItem
protected JMenuItem
protected boolean
protected JButton
protected JMenuItem
protected JMenu
protected boolean
protected static final String
protected PropertyChangeSupport
protected JTabbedPane
protected JMenuItem
protected boolean
Fields inherited from class org.opensourcephysics.display.OSPFrame
action, animated, autoclear, buttonPanel, childFrames, constructorThreadGroup, customButtons, keepHidden, myFontLevel, strategy
Fields inherited from class javax.swing.JFrame
accessibleContext, 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.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionDataTool()
Constructs a blank DataTool.Constructs a DataTool and opens the specified xml file.protected
Constructs a DataTool with title and name.DataTool
(XMLControl control) Constructs a DataTool and loads data from an xml control.Constructs a DataTool and loads the specified data object. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
add columns, possibly asynchronouslyvoid
addTab
(DataToolTab tab) Adds a tab.void
addTabs
(XMLControl control, Consumer<ArrayList<DataToolTab>> whenDone) Adds tabs loaded with data from an xml control.void
Clears data by removing all tabs.protected void
cloneTab
(int index, boolean editable) protected static boolean
containsDuplicateValues
(double[] values) Determines if an array contains any duplicate or Double.NaN values.static Dataset
copyDataset
(Dataset source, Dataset target, boolean includeDataAndID) Copies a dataset.protected void
copyTab()
protected static JButton
createButton
(String text) Creates a button with a specified text.protected static JButton
createButton
(String text, boolean allowBorder) static Dataset
createDatasetFromYPoints
(Dataset xColumn, Dataset yColumn) Constructs a dataset from independent xColumn and yColumn datasets.protected void
Creates the GUI.protected DataToolTab
Creates a tab for the specified Data object.createTabs
(Data source) Creates a tab for each Data object returned by DataTool.getDataList(source).void
dispose()
Disposes all resources.void
finalize()
protected static ArrayList<DataColumn>
getAllDataColumns
(Data source) Gets a list of all DataColumns from any Data object.getAllDatasets
(Data source) Gets a list of all Datasets from any Data object.protected FunctionTool
Gets the data builder for defining custom data functions.protected static ArrayList<DataColumn>
getDataColumns
(Data source) Gets a list of DataColumns from a self-contained Data object.getDatasets
(Data source) Gets a list of Datasets from a self-contained source Data object.Gets the fit builder.protected static int
getIndex
(double value, double[] array, int ignoreIndex) Gets the first array index at which the specified value is found.Gets the main OSPFrame when DataTool is a stand alone application.int[]
Gets the DataTool frame size.protected static double[]
getRowArray
(int rowCount) Returns an array of row numbers.Gets the currently selected DataToolTab, if any.getSelfContainedData
(Data container) Gets a list of self-contained Data objects.getTab
(int index) Returns the tab at the specified index.Returns the tab associated with the specified Data object.int
Returns the tab count.protected int
getTabIndex
(Data data) Returns the index of the tab containing the specified Data object.protected int
getTabIndex
(DataToolTab tab) Returns the index of a specified tab.getTabs()
Returns a list of all open tabs.static DataTool
getTool()
static DataTool
getTool
(boolean forceNew) Gets the shared DataTool.protected String
getUniqueTabName
(String proposed) Gets a unique name.protected boolean
Determines if the clipboard has columns that are pastable into a specified tab.protected boolean
Determines if the clipboard has pastable data.protected static double[]
insert
(double input, double[] array, int trend) Inserts a specified value into an array.boolean
Gets the useChooser flag.Loads a Data object into existing tabs and/or newly created tabs as needed.Loads multiple Data objects into a single existing or newly created tab.void
loadDataset
(String content, String title) Loads content into DataDataTool.void
loadDatasetURI
(String relpath) Replace any open tabs with a single tab loaded with the given path.void
loadDatasetURL
(String path) Replace any open tabs with a single tab loaded with the given path.static void
Main entry point when used as application.protected void
open()
Opens an xml or data file selected with a chooser.void
Opens an xml or data file specified by name.static DatasetManager[]
Parses character-delimited data from a string.protected static double[]
parseDoubles
(String[] strings, String delimiter) Parses a String array into doubles.protected static double[]
parseDoubles
(String text, String delimiter) Parses a String into doubles separated by a specified delimiter.protected static double[][]
parseDoubles
(String text, String rowDelimiter, String colDelimiter) Parses a String into doubles separated by specified row and column delimiters.protected static String[]
parseStrings
(String text, String delimiter) Parses a String into tokens separated by a specified delimiter.protected static String[][]
parseStrings
(String text, String rowDelimiter, String colDelimiter) Parses a String into tokens separated by specified row and column delimiters.protected void
pasteAction
(String dataString, Object source) protected void
void
Listens for property changes "function"protected String
readFirstLine
(Reader in) protected void
Refreshes the data builder.void
Refreshes decimal separators in all tabs.protected void
Refreshes the GUI.protected void
protected void
protected boolean
removeAllButTab
(int index) Removes all tabs except the specified index.protected boolean
Removes all tabs.removeTab
(int index, boolean saveChanges) Removes the tab at the specified index.removeTab
(DataToolTab tab) Removes a specified tab.protected String
Saves the current tab to the specified file.protected String
save
(DataToolTab tab, String fileName) Saves a tab to the specified file.protected String
saveAs()
Saves the current tab to a file selected with a chooser.protected boolean
saveChangesAt
(int i) Offers to save changes to the tab at the specified index.void
Sends a job to this tool and specifies a tool to reply to.void
setDefaultCloseOperation
(int operation) Overrides OSPFrame method.void
setFontLevel
(int level) Sets the font level.protected void
setMultipleTabPolicy
(String dataString) void
setSaveChangesOnClose
(boolean save) Sets the saveChangesOnClose flag.void
Selects a DataToolTab.protected void
setupDelimiterMenu
(JMenu menu) void
setUseChooser
(boolean useChooser) Sets the useChooser flag.void
setVisible
(boolean vis) Shows or hides this component depending on the value of parameterb
and thekeepHidden
flag.protected void
Shows the about dialog.protected static void
showHelp()
Shows the DataTool help.protected static void
Writes text to a Writer.protected static String
Writes text to a file with the specified name.Methods inherited from class org.opensourcephysics.display.OSPFrame
addButton, addChildFrame, bufferStrategyShow, clearChildFrames, clearDataAndRepaint, createBufferStrategy, getChildFrames, getChooser, getConstructorThreadGroup, getMenu, invalidateImage, isAnimated, isAutoclear, isIconified, isKeepHidden, loadDisplayMenu, loadToolsMenu, parseXMLMenu, parseXMLMenu, removeMenu, removeMenuItem, render, setAnimated, setAutoclear, setKeepHidden, setResizeAction, setSize, setTitle, show, wishesToExit
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setUndecorated
Methods 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, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setType, 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, 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, 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, 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, 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, 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
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opensourcephysics.display.AppFrame
getDefaultCloseOperation
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
-
Field Details
-
loadClass
public static boolean loadClass -
dim
-
defaultButtonHeight
protected static final int defaultButtonHeight- See Also:
-
buttonHeight
protected static int buttonHeight -
SPACE
- See Also:
-
delimiters
-
helpFrame
-
helpName
-
helpBase
-
loadMultipleTracksInSingleTab
protected static boolean loadMultipleTracksInSingleTab -
askToLoadMultipleTracksInSingleTab
protected static boolean askToLoadMultipleTracksInSingleTab -
tabbedPane
-
useChooser
protected boolean useChooser -
contentPane
-
support
-
control
-
addableData
-
controlContainsData
protected boolean controlContainsData -
emptyMenubar
-
emptyFileMenu
-
emptyNewTabItem
-
emptyOpenItem
-
emptyExitItem
-
emptyEditMenu
-
emptyPasteMenu
-
emptyPasteTabItem
-
fileMenu
-
newTabItem
-
openItem
-
importItem
-
exportItem
-
saveItem
-
saveAsItem
-
closeItem
-
closeAllItem
-
printItem
-
exitItem
-
editMenu
-
undoItem
-
redoItem
-
copyMenu
-
copyImageItem
-
copyTabItem
-
copyDataMenu
-
setDelimiterMenu
-
copyDataAsFormattedItem
-
copyDataRawItem
-
pasteMenu
-
pasteTabItem
-
pasteColumnsItem
-
displayMenu
-
languageMenu
-
languageItems
-
fontSizeMenu
-
defaultFontSizeItem
-
fontSizeGroup
-
helpMenu
-
helpItem
-
logItem
-
aboutItem
-
dataBuilder
-
exitOnClose
protected boolean exitOnClose -
saveChangesOnClose
protected boolean saveChangesOnClose -
fitBuilder
-
isLoading
protected boolean isLoading -
loadDataFunctionsButton
-
saveDataFunctionsButton
-
slopeExtended
protected boolean slopeExtended -
myPopupFontLevel
protected int myPopupFontLevel -
myCopyMenuFontLevel
protected int myCopyMenuFontLevel -
NEW_LINE
-
-
Constructor Details
-
DataTool
public DataTool()Constructs a blank DataTool. -
DataTool
Constructs a DataTool and opens the specified xml file.- Parameters:
fileName
- the name of the xml file
-
DataTool
Constructs a DataTool and loads data from an xml control.- Parameters:
control
- the xml control
-
DataTool
Constructs a DataTool and loads the specified data object.- Parameters:
data
- the data
-
DataTool
Constructs a DataTool with title and name.- Parameters:
title
-name
-
-
-
Method Details
-
getTool
-
getTool
Gets the shared DataTool.- Returns:
- the shared DataTool
-
main
Main entry point when used as application.- Parameters:
args
- args[0] may be a data or xml file name
-
loadDatasetURL
Replace any open tabs with a single tab loaded with the given path. JavaScript only?- Parameters:
path
-
-
loadDatasetURI
Replace any open tabs with a single tab loaded with the given path. JavaScript only?- Parameters:
relpath
-
-
getMainFrame
Gets the main OSPFrame when DataTool is a stand alone application.- Returns:
- OSPFrame
-
getMainFrameSize
public int[] getMainFrameSize()Gets the DataTool frame size. -
setSaveChangesOnClose
public void setSaveChangesOnClose(boolean save) Sets the saveChangesOnClose flag.- Parameters:
save
- true to save changes when exiting
-
addTabs
Adds tabs loaded with data from an xml control.- Parameters:
control
- the xml controlwhenDone
-
-
createTabs
Creates a tab for each Data object returned by DataTool.getDataList(source). The tab names will be those of the Data objects in the list if they define a getName() method.- Parameters:
source
- the source Data- Returns:
- a list of new tabs
-
createTab
Creates a tab for the specified Data object. The tab name will be that of the Data object if it defines a getName() method.- Parameters:
data
- the Data- Returns:
- the new tab
-
removeTab
Removes the tab at the specified index.- Parameters:
index
- the tab numbersaveChanges
-- Returns:
- the removed tab, or null if none removed
-
removeTab
Removes a specified tab.- Parameters:
tab
- the tab- Returns:
- the removed tab, or null if none removed
-
loadData
Loads a Data object into existing tabs and/or newly created tabs as needed.- Parameters:
data
- the Data- Returns:
- a list of the loaded tabs
-
loadData
Loads multiple Data objects into a single existing or newly created tab.- Parameters:
data
- one or more Data objects- Returns:
- the loaded tab
-
getTab
Returns the tab associated with the specified Data object. May return null.- Parameters:
data
- the Data- Returns:
- the tab
-
getTab
Returns the tab at the specified index. May return null.- Parameters:
index
- the tab index- Returns:
- the tab
-
getTabCount
public int getTabCount()Returns the tab count.- Returns:
- the number of tabs
-
getTabs
Returns a list of all open tabs.- Returns:
- a list of DataToolTabs
-
open
Opens an xml or data file specified by name.- Parameters:
fileName
- the file name
-
loadDataset
Loads content into DataDataTool.- Parameters:
content
- the xml or CVS dataset
-
send
Sends a job to this tool and specifies a tool to reply to. -
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
-
propertyChange
Listens for property changes "function"- Specified by:
propertyChange
in interfacePropertyChangeListener
- Parameters:
e
- the event
-
containsDuplicateValues
protected static boolean containsDuplicateValues(double[] values) Determines if an array contains any duplicate or Double.NaN values.- Parameters:
values
- the array- Returns:
- true if at least one duplicate is found
-
getIndex
protected static int getIndex(double value, double[] array, int ignoreIndex) Gets the first array index at which the specified value is found.- Parameters:
value
- the value to findarray
- the array to searchignoreIndex
- an array index to ignore- Returns:
- the index, or -1 if not found
-
getRowArray
protected static double[] getRowArray(int rowCount) Returns an array of row numbers.- Parameters:
rowCount
- length of the array- Returns:
- the array
-
parseStrings
Parses a String into tokens separated by a specified delimiter. A token may be "".- Parameters:
text
- the text to parsedelimiter
- the delimiter- Returns:
- an array of String tokens
-
parseDoubles
Parses a String into doubles separated by a specified delimiter. Unparsable strings are set to Double.NaN.- Parameters:
text
- the text to parsedelimiter
- the delimiter- Returns:
- an array of doubles
-
parseDoubles
Parses a String array into doubles. Unparsable strings are set to Double.NaN.- Parameters:
strings
- the String array to parsedelimiter
- the delimiter that was used to parse the strings- Returns:
- an array of doubles
-
parseStrings
Parses a String into tokens separated by specified row and column delimiters. NOTE: This method WILL check for European comma decimal point- Parameters:
text
- the text to parserowDelimiter
- the column delimitercolDelimiter
- the column delimiter- Returns:
- a 2D array of String tokens
-
parseDoubles
Parses a String into doubles separated by specified row and column delimiters. NOTE: This method is not set to parse European comma decimal points (but could be)- Parameters:
text
- the text to parserowDelimiter
- the column delimitercolDelimiter
- the column delimiter- Returns:
- a 2D array of doubles
-
parseData
Parses character-delimited data from a string. This attempts to extract the following information from the string: 1. A title to be used for the tab name 2. One or more columns of double data values 3. Column names for the data columns- Parameters:
dataString
- the data stringfileName
- name of file containing the data string (may be null)- Returns:
- DatasetManager[] with parsed data, or null if none found
-
readFirstLine
-
setupDelimiterMenu
-
getUniqueTabName
Gets a unique name.- Parameters:
proposed
- the proposed name- Returns:
- the unique name
-
createDatasetFromYPoints
Constructs a dataset from independent xColumn and yColumn datasets.- Parameters:
xColumn
- the dataset containing data for the x columnyColumn
- the dataset containing data for the y column- Returns:
- the x-y dataset
-
getDatasets
Gets a list of Datasets from a self-contained source Data object.- Parameters:
source
- the self-contained Data- Returns:
- a list of Datasets
-
getAllDatasets
Gets a list of all Datasets from any Data object.- Parameters:
source
- a self-contained or container Data object- Returns:
- a list of all Datasets
-
getSelfContainedData
Gets a list of self-contained Data objects.- Parameters:
container
- the container Data- Returns:
- a list of self-contained Data objects
-
getDataColumns
Gets a list of DataColumns from a self-contained Data object.- Parameters:
source
- a self-contained Data object- Returns:
- a list of DataColumns
-
getAllDataColumns
Gets a list of all DataColumns from any Data object.- Parameters:
source
- a self-contained or container Data object- Returns:
- a list of all DataColumns
-
copyDataset
Copies a dataset. If includeDataAndID is false, only the name and display properties are copied.- Parameters:
source
- the source datasettarget
- the target dataset (may be null)includeDataAndID
- true to copy data and ID- Returns:
- the copy
-
insert
protected static double[] insert(double input, double[] array, int trend) Inserts a specified value into an array.- Parameters:
input
- the value to insertarray
- the array into which the value is insertedtrend
- positive if array is ascending, negative if descending, 0 if neither- Returns:
- an array containing the inserted value
-
addTab
Adds a tab. The tab should be named before calling this method.- Parameters:
tab
- a DataToolTab
-
saveChangesAt
protected boolean saveChangesAt(int i) Offers to save changes to the tab at the specified index.- Parameters:
i
- the tab index- Returns:
- true unless canceled by the user
-
getSelectedTab
Gets the currently selected DataToolTab, if any.- Returns:
- the selected tab
-
setSelectedTab
Selects a DataToolTab.- Parameters:
tab
- the tab to select
-
clearData
public void clearData()Clears data by removing all tabs. -
setFontLevel
public void setFontLevel(int level) Sets the font level.- Overrides:
setFontLevel
in classOSPFrame
- Parameters:
level
- the level
-
setVisible
public void setVisible(boolean vis) Description copied from class:OSPFrame
Shows or hides this component depending on the value of parameterb
and thekeepHidden
flag. OSP Applets often keep windows hidden.- Overrides:
setVisible
in classOSPFrame
-
getFitBuilder
Gets the fit builder.- Returns:
- the fit builder
-
write
Writes text to a file with the specified name.- Parameters:
text
- the textfileName
- the file name- Returns:
- the path of the saved document or null if failed
-
write
Writes text to a Writer.- Parameters:
text
- the textout
- the Writer
-
open
protected void open()Opens an xml or data file selected with a chooser. -
save
Saves the current tab to the specified file.- Parameters:
fileName
- the file name- Returns:
- the name of the saved file, or null if not saved
-
save
Saves a tab to the specified file.- Parameters:
tab
- the tabfileName
- the file name- Returns:
- the name of the saved file, or null if not saved
-
saveAs
Saves the current tab to a file selected with a chooser.- Returns:
- the name of the saved file, or null if not saved
-
getTabIndex
Returns the index of the tab containing the specified Data object.- Parameters:
data
- the Data- Returns:
- the index, or -1 if not found
-
getTabIndex
Returns the index of a specified tab.- Parameters:
tab
- the tab- Returns:
- the index, or -1 if not found
-
removeAllButTab
protected boolean removeAllButTab(int index) Removes all tabs except the specified index.- Parameters:
index
- the tab number- Returns:
- true if tabs removed
-
removeAllTabs
protected boolean removeAllTabs()Removes all tabs.- Returns:
- true if all tabs removed
-
refreshTabTitles
protected void refreshTabTitles() -
refreshMenubar
protected void refreshMenubar() -
getDataBuilder
Gets the data builder for defining custom data functions.- Returns:
- the data builder
-
refreshDataBuilder
protected void refreshDataBuilder()Refreshes the data builder. -
showHelp
protected static void showHelp()Shows the DataTool help. -
setDefaultCloseOperation
public void setDefaultCloseOperation(int operation) Overrides OSPFrame method. This converts EXIT_ON_CLOSE to DO_NOTHING_ON_CLOSE and sets the exitOnClose flag.- Specified by:
setDefaultCloseOperation
in interfaceAppFrame
- Overrides:
setDefaultCloseOperation
in classOSPFrame
- Parameters:
operation
- the operation- See Also:
-
dispose
public void dispose()Description copied from class:OSPFrame
Disposes all resources. -
finalize
-
createGUI
protected void createGUI()Creates the GUI. -
pasteTab
-
copyTab
protected void copyTab() -
cloneTab
protected void cloneTab(int index, boolean editable) -
pasteAction
-
addColumnsFromPaste
protected void addColumnsFromPaste()add columns, possibly asynchronously -
refreshGUI
protected void refreshGUI()Refreshes the GUI.- Overrides:
refreshGUI
in classOSPFrame
-
refreshDecimalSeparators
public void refreshDecimalSeparators()Refreshes decimal separators in all tabs. -
hasPastableData
protected boolean hasPastableData()Determines if the clipboard has pastable data.- Returns:
- true if data is pastable
-
hasPastableColumns
Determines if the clipboard has columns that are pastable into a specified tab.- Parameters:
tab
- the tab- Returns:
- true if clipboard has pastable columns
-
showAboutDialog
protected void showAboutDialog()Shows the about dialog. -
setMultipleTabPolicy
-
createButton
Creates a button with a specified text.- Parameters:
text
- the button text- Returns:
- the button
-
createButton
-