|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JTable org.opensourcephysics.display.DataTable org.opensourcephysics.tools.DataToolTable
public class DataToolTable
This is a DataTable that displays DataColumns and constructs HighlightableDatasets for a plot.
Nested Class Summary | |
---|---|
protected static class |
DataToolTable.DataToolTableModel
A table model for this table. |
protected class |
DataToolTable.TableEdit
A class to undo/redo edits. |
Nested classes/interfaces inherited from class org.opensourcephysics.display.DataTable |
---|
DataTable.DefaultDataTableModel, DataTable.NumberFormatDialog, DataTable.RowNumberRenderer |
Nested classes/interfaces inherited from class javax.swing.JTable |
---|
javax.swing.JTable.AccessibleJTable, javax.swing.JTable.DropLocation, javax.swing.JTable.PrintMode |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected static int |
DELETE_CELLS_EDIT
|
protected static int |
DELETE_COLUMN_EDIT
|
protected static int |
DELETE_ROWS_EDIT
|
protected static java.lang.String[] |
editTypes
|
protected static int |
INSERT_CELLS_EDIT
|
protected static int |
INSERT_COLUMN_EDIT
|
protected static int |
INSERT_ROWS_EDIT
|
protected static int |
RENAME_COLUMN_EDIT
|
protected static int |
REPLACE_CELLS_EDIT
|
protected static java.awt.Color |
xAxisColor
|
protected static java.awt.Color |
yAxisColor
|
Fields inherited from class org.opensourcephysics.display.DataTable |
---|
decorator, formatDialog, labelColumnWidth, renderersByColumnName, rowName, rowNumberRenderer |
Fields inherited from class javax.swing.JTable |
---|
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
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 |
Constructor Summary | |
---|---|
DataToolTable(DataToolTab tab)
Constructs a DataToolTable for the specified DataTooltab. |
Method Summary | |
---|---|
void |
clearSelection()
Deselects all selected columns and rows. |
protected void |
clearSelectionIfEmptyEndRow()
Clears the selection if it consists of only an empty end row. |
protected void |
clearWorkingData()
Clears the working data. |
protected java.util.HashMap<java.lang.String,double[]> |
deleteCells(int[] rows,
java.util.HashMap<java.lang.String,double[]> values)
Deletes cells in a column. |
protected Dataset |
deleteColumn(java.lang.String colName)
Deletes a column. |
protected double[] |
deletePoints(Dataset dataset,
int[] rows)
Deletes points from a dataset. |
protected java.util.HashMap<java.lang.String,double[]> |
deleteRows(int[] rows)
Deletes rows. |
protected void |
deleteSelectedColumns()
|
javax.swing.table.TableCellEditor |
getCellEditor(int row,
int col)
Returns the editor for a cell specified by row and column. |
javax.swing.table.TableCellRenderer |
getCellRenderer(int row,
int col)
Overrides DataTable getCellRenderer() method. |
protected Dataset |
getDataset(java.lang.String colName)
Gets the source dataset associated with table column name. |
java.lang.String[] |
getHiddenMarkers()
Gets the names of columns with visible markers. |
int[] |
getModelColumnOrder()
Gets the model column order. |
protected int |
getModelRow(int row)
Converts a table row index to the corresponding model row number (i.e., displayed in the "row" column). |
protected java.util.Collection<java.lang.String> |
getPatternColumns()
|
protected java.util.ArrayList<java.lang.String> |
getSelectedColumnNames()
Gets the selected column names. |
protected HighlightableDataset |
getSelectedData()
Gets the selected data. |
protected int[] |
getSelectedModelRows()
Gets the selected model rows in ascending order. |
protected int |
getViewRow(int row)
Converts a model row index (i.e., displayed in the "row" column) to the corresponding table row number. |
protected org.opensourcephysics.tools.DataToolTable.WorkingDataset |
getWorkingData()
Gets the working data: first two data columns in x-y order |
protected org.opensourcephysics.tools.DataToolTable.WorkingDataset |
getWorkingData(java.lang.String colName)
Gets the working data for a specified column name. |
protected int |
getXColumn()
Gets the x-axis view column. |
protected int |
getYColumn()
Gets the y-axis view column. |
void |
hideMarkers(java.lang.String[] hiddenColumns)
Hides markers of named columns. |
protected java.util.HashMap<java.lang.String,double[]> |
insertCells(int[] rows,
java.util.HashMap<java.lang.String,double[]> values)
Inserts cells with values specified by column name. |
protected void |
insertColumn(Dataset data,
int col)
Inserts a column dataset. |
protected double[] |
insertPoints(Dataset dataset,
int[] rows,
double[] vals)
Inserts points into a dataset. |
protected java.util.HashMap<java.lang.String,double[]> |
insertRows(int[] rows,
java.util.HashMap<java.lang.String,double[]> values)
Inserts rows with values specified by column name. |
protected boolean |
isEmptyCells(int row,
java.util.ArrayList<java.lang.String> columnNames)
Determines if a row is empty. |
protected boolean |
isEmptyRow(int row)
Determines if a row is empty. |
void |
refreshDataFunctions()
Refreshes the data functions. |
void |
refreshTable()
Refreshes the data in the table. |
protected void |
refreshUndoItems()
Refreshes the undo and redo menu items. |
protected void |
removeWorkingData(java.lang.String colName)
Removes the working data for a specified column name. |
protected void |
renameColumn(java.lang.String oldName,
java.lang.String newName)
Renames a column. |
protected java.util.HashMap<java.lang.String,double[]> |
replaceCells(int[] rows,
java.util.HashMap<java.lang.String,double[]> values)
Replaces cells. |
protected double[] |
replacePoints(Dataset dataset,
int[] rows,
double[] vals)
Replaces points in a dataset. |
void |
setFont(java.awt.Font font)
|
protected void |
setLabelColumnWidth(int w)
Sets the label column width |
void |
setModelColumnOrder(int[] modelColumns)
Sets the model column order. |
protected void |
setSelectedColumnNames(java.util.Collection<java.lang.String> names)
Sets the selected column names. |
protected void |
setSelectedModelRows(int[] rows)
Sets the selected model rows. |
void |
setWorkingColumns(java.lang.String xColName,
java.lang.String yColName)
Sets the working columns by name. |
protected void |
showDataBuilder()
Displays the data builder. |
protected void |
trimEmptyRows(int minSize)
Trims empty rows from bottom of table up to a specified minimum. |
Methods inherited from class org.opensourcephysics.display.DataTable |
---|
actionPerformed, add, clear, getFormatDialog, getFormatPattern, getMaximumFractionDigits, isRowNumberVisible, remove, setColumnVisible, setFormatPattern, setMaximumFractionDigits, setMaximumFractionDigits, setModel, setRefreshDelay, setRowNumberVisible, setStride, sort |
Methods inherited from class javax.swing.JTable |
---|
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellRect, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditingRow, getEditorComponent, getFillsViewportHeight, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getUpdateSelectionOnSort, getValueAt, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, print, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setRowSorter, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sizeColumnsToFit, sorterChanged, tableChanged, unconfigureEnclosingScrollPane, updateUI, valueChanged |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final int RENAME_COLUMN_EDIT
protected static final int INSERT_COLUMN_EDIT
protected static final int DELETE_COLUMN_EDIT
protected static final int INSERT_CELLS_EDIT
protected static final int DELETE_CELLS_EDIT
protected static final int REPLACE_CELLS_EDIT
protected static final int INSERT_ROWS_EDIT
protected static final int DELETE_ROWS_EDIT
protected static java.lang.String[] editTypes
protected static java.awt.Color xAxisColor
protected static java.awt.Color yAxisColor
Constructor Detail |
---|
public DataToolTable(DataToolTab tab)
tab
- Method Detail |
---|
protected org.opensourcephysics.tools.DataToolTable.WorkingDataset getWorkingData(java.lang.String colName)
colName
- the name of the data column
protected org.opensourcephysics.tools.DataToolTable.WorkingDataset getWorkingData()
protected void removeWorkingData(java.lang.String colName)
colName
- the name of the data columnprotected void deleteSelectedColumns()
protected void clearWorkingData()
protected Dataset getDataset(java.lang.String colName)
protected HighlightableDataset getSelectedData()
protected int getModelRow(int row)
row
- the table row
protected int getViewRow(int row)
row
- the table row
protected int[] getSelectedModelRows()
protected void setSelectedModelRows(int[] rows)
rows
- the model rows to selectprotected java.util.ArrayList<java.lang.String> getSelectedColumnNames()
protected void setSelectedColumnNames(java.util.Collection<java.lang.String> names)
names
- Collection of column names to selectprotected void insertColumn(Dataset data, int col)
data
- the dataset to insertcol
- the insertion view column numberprotected Dataset deleteColumn(java.lang.String colName)
colName
- the column name to delete
protected java.util.HashMap<java.lang.String,double[]> insertCells(int[] rows, java.util.HashMap<java.lang.String,double[]> values)
rows
- the model rows to insertvalues
- HashMap of column name to double[] values
protected java.util.HashMap<java.lang.String,double[]> deleteCells(int[] rows, java.util.HashMap<java.lang.String,double[]> values)
rows
- the model rows to deletevalues
- HashMap of column name to (ignored) double[] values
protected java.util.HashMap<java.lang.String,double[]> replaceCells(int[] rows, java.util.HashMap<java.lang.String,double[]> values)
rows
- the model rows to replace in ascending ordervalues
- HashMap of column name to double[] new values
protected java.util.HashMap<java.lang.String,double[]> insertRows(int[] rows, java.util.HashMap<java.lang.String,double[]> values)
rows
- the model rows to insertvalues
- HashMap of column name to double[] values
protected java.util.HashMap<java.lang.String,double[]> deleteRows(int[] rows)
rows
- the model rows to delete
protected boolean isEmptyRow(int row)
row
- the model row number
protected boolean isEmptyCells(int row, java.util.ArrayList<java.lang.String> columnNames)
row
- the model row number
protected int getXColumn()
protected int getYColumn()
protected double[] replacePoints(Dataset dataset, int[] rows, double[] vals)
dataset
- the datasetrows
- the rows to replace in ascending ordervals
- array of new y-values
protected double[] insertPoints(Dataset dataset, int[] rows, double[] vals)
dataset
- the datasetrows
- the rows to insert in ascending ordervals
- the corresponding y-values to insert
protected double[] deletePoints(Dataset dataset, int[] rows)
dataset
- the datasetrows
- the rows to remove in ascending order
protected void trimEmptyRows(int minSize)
minSize
- the minimum row count to keepprotected void clearSelectionIfEmptyEndRow()
protected void showDataBuilder()
protected void renameColumn(java.lang.String oldName, java.lang.String newName)
oldName
- the old namenewName
- the new nameprotected void refreshUndoItems()
public void refreshDataFunctions()
public void clearSelection()
clearSelection
in class javax.swing.JTable
public void refreshTable()
refreshTable
in class DataTable
public int[] getModelColumnOrder()
public void setModelColumnOrder(int[] modelColumns)
modelColumns
- array of model column numbers in view column orderpublic java.lang.String[] getHiddenMarkers()
public void hideMarkers(java.lang.String[] hiddenColumns)
hiddenColumns
- names of columns with hidden markerspublic void setWorkingColumns(java.lang.String xColName, java.lang.String yColName)
xColName
- the name of the horizontal axis variableyColName
- the name of the vertical axis variablepublic void setFont(java.awt.Font font)
setFont
in class javax.swing.JComponent
protected void setLabelColumnWidth(int w)
protected java.util.Collection<java.lang.String> getPatternColumns()
public javax.swing.table.TableCellRenderer getCellRenderer(int row, int col)
getCellRenderer
in class DataTable
row
- the row numbercol
- the column number
public javax.swing.table.TableCellEditor getCellEditor(int row, int col)
getCellEditor
in class javax.swing.JTable
row
- the row numbercol
- the column number
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |