Package org.opensourcephysics.display
Class DataTable
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTable
org.opensourcephysics.display.DataTable
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,CellEditorListener
,ListSelectionListener
,RowSorterListener
,TableColumnModelListener
,TableModelListener
,Scrollable
- Direct Known Subclasses:
DataToolTable
DataTable displays multiple TableModels in a table. The first TableModel
usually contains the independent variable for the other TableModel so that
the visibility of column[0] can be set to false for subsequent TableModels.
- Version:
- 1.0
- Author:
- Joshua Gould, Wolfgang Christian
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
class
protected static class
A default double renderer for the tableclass
A header cell renderer that identifies sorted columns.class
protected class
static class
A marker type for TableModels that are associated with DataTable.protected static class
A settable precision double renderer for the tableprotected static class
protected static class
A cell renderer that adds units to displayed values.Nested classes/interfaces inherited from class javax.swing.JTable
JTable.AccessibleJTable, JTable.DropLocation, JTable.PrintMode
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
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 int
protected DataTable.OSPDataTableModel
aka JTable.dataModelprotected static final DataTable.DoubleRenderer
protected DataTable.NumberFormatDialog
boolean
protected int
protected int
protected int
protected int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
protected static final String
static final String
static final String
protected DataTable.RowNumberRenderer
static final char
boolean
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
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
accessibleContext, 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(TableModel tableModel) Add a TableModel object to the table model list.void
void
addColumnSelectionInterval
(int index0, int index1) void
clear()
Remove all TableModels from the table model list.int
convertColumnIndexToModel
(int viewIndex) void
Copies data from this table to the system clipboard.void
Deprecated.protected DataTable.OSPDataTableModel
Overridden in DataToolTable in order to use its own implementation of OSPDataTableModelvoid
dispose()
Clear the table and stop refreshing.protected int
subclass should return the modelIndex of the first column name (comma-quoted key) not found in names and, if that exists, add that key to name in case this needs to be run more than once.getCellRenderer
(int row, int column) Returns an appropriate renderer for the cell specified by this row and column.getData
(boolean asFormatted) Gets the data selected by the user in this datatable.getFormatDialog
(String[] names, String[] selected) Gets the format setter dialog.getFormatPattern
(String columnName) Gets the formatting pattern for a named columnString[]
Gets the names of formatted columns Added by D Brown 24 Apr 2011getFormattedValueAt
(int row, int col) Gets the formatted value at a given row and column.int
Gets the maximum number of digits in the table.int
Returns the minimum table width.int[]
Gets the model column order.protected int
getModelRow
(int i) getPrecisionRenderer
(String columnName) Gets the precision renderer, if any, for a given columnn name.int
protected int[]
Gets the selected model rows in ascending order.int
getSortedRow
(int i) protected int
getViewRow
(int modelRow) Converts a model row index (i.e., displayed in the "row" column) to the corresponding table row number.protected boolean
protected void
init()
boolean
Gets the display row number flag.void
Reset bsColVis for all elements.void
void
refreshTable
(int mode) Refresh the data in the DataTable, as well as other changes to the table, such as row number visibility.protected void
refreshTable
(int mode, boolean resortAndReselect) protected void
refreshTableNow
(int mode) Performs the action for the refresh timer and refreshTable() method by refreshing the data in the DataTable.void
remove
(TableModel tableModel) Remove a TableModel object from the table model list.void
void
void
scrollColumnToVisible
(int col) void
scrollRowToVisible
(int row) void
selectModelRows
(int[] modelRows) Sets the selected model rows.void
selectModelRowsBS
(BitSet rows) void
selectTableColsBS
(BitSet cols) A standard method using BitSet blocks; reduces the number of calls to addColumnSelectionInterval.void
selectTableRowsBS
(BitSet rows, int nRows) A standard method using BitSet blocks; reduces the number of calls to addRowSelectionInterval.void
setColumnVisible
(TableModel model, int columnIndex, boolean b) Sets the visibility of a column of a TableModel in the DataTable.void
setFormatPattern
(String columnName, String pattern) Sets the formatting pattern for a named columnvoid
setLabelColumnWidth
(int w) Sets the label column widthvoid
setMaximumFractionDigits
(int maximumFractionDigits) Sets the maximum number of fraction digits to display for cells that have type Doublevoid
setMaximumFractionDigits
(String columnName, int maximumFractionDigits) Sets the maximum number of fraction digits to display in a named columnvoid
setModel
(TableModel dataModel) Called by JTable's default constructor to install the default table model, which we coerce to be an OSPDataTableModel.void
setModelColumnOrder
(int[] modelColumns) from DataToolTable Sets the model column order -- for DataToolTab Loader onlyvoid
setRefreshDelay
(int delay) Deprecated.void
setRowNumberVisible
(boolean b) Sets the display row number flag.void
void
setSelectedModelRowsBS
(BitSet rows) void
Sets the units and tooltip for a named column.void
sort
(int col) static String
unshiftName
(String name) Trim "'" from namevoid
protected void
updateRowSelection
(int firstIndex, boolean isAdjusting) Overridden in DataToolTableMethods inherited from class javax.swing.JTable
addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createDefaultColumnModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditingRow, getEditorComponent, getFillsViewportHeight, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, 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, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, setFont, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
PROPERTY_DATATABLE_FORMAT
- See Also:
-
MODE_CREATE
public static final int MODE_CREATE- See Also:
-
MODE_CLEAR
public static final int MODE_CLEAR- See Also:
-
MODE_MODEL
public static final int MODE_MODEL- See Also:
-
MODE_TAB
public static final int MODE_TAB- See Also:
-
MODE_TRACK_REFRESH
public static final int MODE_TRACK_REFRESH- See Also:
-
MODE_TRACK_STATE
public static final int MODE_TRACK_STATE- See Also:
-
MODE_TRACK_STEP
public static final int MODE_TRACK_STEP- See Also:
-
MODE_TRACK_SELECTEDPOINT
public static final int MODE_TRACK_SELECTEDPOINT- See Also:
-
MODE_TRACK_STEPS
public static final int MODE_TRACK_STEPS- See Also:
-
MODE_TRACK_LOADED
public static final int MODE_TRACK_LOADED- See Also:
-
MODE_COL_SETVISIBLE
public static final int MODE_COL_SETVISIBLE- See Also:
-
MODE_TRACK_LOADER
public static final int MODE_TRACK_LOADER- See Also:
-
MODE_TRACK_CHOOSE
public static final int MODE_TRACK_CHOOSE- See Also:
-
MODE_TRACK_SELECT
public static final int MODE_TRACK_SELECT- See Also:
-
MODE_TRACK_TRANSFORM
public static final int MODE_TRACK_TRANSFORM- See Also:
-
MODE_TRACK_DATA
public static final int MODE_TRACK_DATA- See Also:
-
MODE_TRACK_FUNCTION
public static final int MODE_TRACK_FUNCTION- See Also:
-
MODE_TRACK_NEW
public static final int MODE_TRACK_NEW- See Also:
-
MODE_APPEND_ROW
public static final int MODE_APPEND_ROW- See Also:
-
MODE_INSERT_ROW
public static final int MODE_INSERT_ROW- See Also:
-
MODE_DELETE_ROW
public static final int MODE_DELETE_ROW- See Also:
-
MODE_UPDATE_ROWS
public static final int MODE_UPDATE_ROWS- See Also:
-
MODE_COLUMN
public static final int MODE_COLUMN- See Also:
-
MODE_CELLS
public static final int MODE_CELLS- See Also:
-
MODE_VALUES
public static final int MODE_VALUES- See Also:
-
MODE_PATTERN
public static final int MODE_PATTERN- See Also:
-
MODE_FUNCTION
public static final int MODE_FUNCTION- See Also:
-
MODE_FORMAT
public static final int MODE_FORMAT- See Also:
-
MODE_HIGHLIGHT
public static final int MODE_HIGHLIGHT- See Also:
-
MODE_SELECT
public static final int MODE_SELECT- See Also:
-
MODE_HEADER
public static final int MODE_HEADER- See Also:
-
MODE_SHOW
public static final int MODE_SHOW- See Also:
-
MODE_REFRESH
public static final int MODE_REFRESH- See Also:
-
MODE_SET_TAINTED
public static final int MODE_SET_TAINTED- See Also:
-
MODE_CANCEL
public static final int MODE_CANCEL- See Also:
-
MODE_UNKNOWN
public static final int MODE_UNKNOWN- See Also:
-
NO_PATTERN
-
rowName
-
defaultDoubleRenderer
-
dataTableModel
aka JTable.dataModel -
rowNumberRenderer
-
maximumFractionDigits
protected int maximumFractionDigits -
labelColumnWidth
protected int labelColumnWidth -
minimumDataColumnWidth
protected int minimumDataColumnWidth -
formatDialog
-
clickCountToSort
protected int clickCountToSort -
mode
protected int mode -
tainted
public boolean tainted -
includeHeadersInCopiedData
public boolean includeHeadersInCopiedData -
SHIFTED
public static final char SHIFTED- See Also:
-
-
Constructor Details
-
DataTable
public DataTable()Constructs a DataTable with a default data model
-
-
Method Details
-
unshiftName
Trim "'" from name- Parameters:
name
-- Returns:
-
setModel
Called by JTable's default constructor to install the default table model, which we coerce to be an OSPDataTableModel. -
createTableModel
Overridden in DataToolTable in order to use its own implementation of OSPDataTableModel- Returns:
-
addColumnSelectionInterval
public void addColumnSelectionInterval(int index0, int index1) - Overrides:
addColumnSelectionInterval
in classJTable
-
init
protected void init() -
updateRowSelection
protected void updateRowSelection(int firstIndex, boolean isAdjusting) Overridden in DataToolTable- Parameters:
firstIndex
-isAdjusting
-
-
addColumn
-
convertColumnIndexToModel
public int convertColumnIndexToModel(int viewIndex) - Overrides:
convertColumnIndexToModel
in classJTable
-
setMaximumFractionDigits
Sets the maximum number of fraction digits to display in a named column- Parameters:
maximumFractionDigits
- maximum number of fraction digits to displaycolumnName
- name of the column
-
setFormatPattern
Sets the formatting pattern for a named column- Parameters:
pattern
- the patterncolumnName
- name of the column
-
setUnits
Sets the units and tooltip for a named column.- Parameters:
columnName
- name of the columnunits
- the units string (may be null)tootip
- the tooltip (may be null)
-
getFormatPattern
Gets the formatting pattern for a named column- Parameters:
columnName
- name of the column- Returns:
- the pattern
-
getFormattedColumnNames
Gets the names of formatted columns Added by D Brown 24 Apr 2011- Returns:
- array of names of columns with non-null formats
-
getFormattedValueAt
Gets the formatted value at a given row and column. Added by D Brown 6 Oct 2010- Parameters:
row
- the row numbercol
- the column number- Returns:
- the value formatted as displayed in the table
-
getFormatDialog
Gets the format setter dialog.- Parameters:
names
- the column name choicesselected
- the initially selected names- Returns:
- the format setter dialog
-
setMaximumFractionDigits
public void setMaximumFractionDigits(int maximumFractionDigits) Sets the maximum number of fraction digits to display for cells that have type Double- Parameters:
maximumFractionDigits
- - maximum number of fraction digits to display
-
getMaximumFractionDigits
public int getMaximumFractionDigits()Gets the maximum number of digits in the table.- Returns:
- int
-
getMinimumTableWidth
public int getMinimumTableWidth()Returns the minimum table width.- Returns:
- minimum table width.
-
setLabelColumnWidth
public void setLabelColumnWidth(int w) Sets the label column width- Parameters:
w
- the width
-
resizeAndRepaint
public void resizeAndRepaint()- Overrides:
resizeAndRepaint
in classJTable
-
setRowNumberVisible
public void setRowNumberVisible(boolean b) Sets the display row number flag. Table displays row number.- Parameters:
b
-true<\code> if table display row number
-
setColumnVisible
Sets the visibility of a column of a TableModel in the DataTable.- Parameters:
model
- an OSPTableModel, actuallycolumnIndex
-b
-
-
refreshColumnModel
public void refreshColumnModel()Reset bsColVis for all elements. -
isRowNumberVisible
public boolean isRowNumberVisible()Gets the display row number flag.- Returns:
- The rowNumberVisible value
-
getCellRenderer
Returns an appropriate renderer for the cell specified by this row and column. If theTableColumn
for this column has a non-null renderer, returns that. If theTableColumn
for this column has the same name as a name specified in the setMaximumFractionDigits method, returns the appropriate renderer. If not, finds the class of the data in this column (usinggetColumnClass
) and returns the default renderer for this type of data.- Overrides:
getCellRenderer
in classJTable
- Parameters:
row
- Description of Parametercolumn
- Description of Parameter- Returns:
- The cellRenderer value
-
getPrecisionRenderer
Gets the precision renderer, if any, for a given columnn name. Added by D Brown Dec 2010- Parameters:
columnName
- the name- Returns:
- the PrecisionRenderer, or null if none
-
setRefreshDelay
public void setRefreshDelay(int delay) Deprecated.Sets the delay time for table refresh timer. Only called by TableTrackView dispose- Parameters:
delay
- the delay in millisecond
-
dispose
public void dispose()Clear the table and stop refreshing. Only called by TableTrackView dispose.- Parameters:
delay
- the delay in millisecond
-
refreshTable
public void refreshTable() -
refreshTable
public void refreshTable(int mode) Refresh the data in the DataTable, as well as other changes to the table, such as row number visibility. Changes to the TableModels displayed in the table will not be visible until this method is called. -
refreshTableNow
protected void refreshTableNow(int mode) Performs the action for the refresh timer and refreshTable() method by refreshing the data in the DataTable.- Parameters:
cause
- allows more nuanced refresh
-
add
Add a TableModel object to the table model list.- Parameters:
tableModel
-
-
remove
Remove a TableModel object from the table model list.- Parameters:
tableModel
-
-
clear
public void clear()Remove all TableModels from the table model list. -
sort
public void sort(int col) -
setModelColumnOrder
public void setModelColumnOrder(int[] modelColumns) from DataToolTable Sets the model column order -- for DataToolTab Loader only- Parameters:
modelColumns
- array of model column numbers in view column order
-
getModelColumnOrder
public int[] getModelColumnOrder()Gets the model column order. -- for DataToolTab Loader- Returns:
- array of model column numbers in view column order
-
createDefaultColumnsFromModel
Deprecated.This method, called by Jtable.tableChanged(TableModelEvent), is never called, because we have set autoCreateColumnsFromModel false. All updating is handled exclusively by DataTableColumnModel.updateColumnModel().- Overrides:
createDefaultColumnsFromModel
in classJTable
-
getSortedRow
public int getSortedRow(int i) -
resetSort
public void resetSort() -
getRowCount
public int getRowCount()- Overrides:
getRowCount
in classJTable
-
refreshTable
protected void refreshTable(int mode, boolean resortAndReselect) -
selectTableRowsBS
A standard method using BitSet blocks; reduces the number of calls to addRowSelectionInterval.- Parameters:
rows
-nRows
-
-
selectTableColsBS
A standard method using BitSet blocks; reduces the number of calls to addColumnSelectionInterval.- Parameters:
cols
-
-
setSelectedColumnsFromModelBS
public void setSelectedColumnsFromModelBS() -
updateColumnModel
public void updateColumnModel() -
getSelectedModelRows
protected int[] getSelectedModelRows()Gets the selected model rows in ascending order.- Returns:
- the selected rows
-
getViewRow
protected int getViewRow(int modelRow) Converts a model row index (i.e., displayed in the "row" column) to the corresponding table row number.- Parameters:
modelRow
- the table row- Returns:
- the model row
-
selectModelRows
public void selectModelRows(int[] modelRows) Sets the selected model rows.- Parameters:
modelRows
- the model rows to select
-
selectModelRowsBS
-
haveSelectedRows
protected boolean haveSelectedRows() -
getSelectedModelRowsBS
-
setSelectedModelRowsBS
-
getModelRow
protected int getModelRow(int i) -
scrollRowToVisible
public void scrollRowToVisible(int row) -
scrollColumnToVisible
public void scrollColumnToVisible(int col) -
getData
Gets the data selected by the user in this datatable. This method is modified from the org.opensourcephysics.display.DataTableFrame getSelectedData method.- Parameters:
asFormatted
- true to retain table formatting- Returns:
- a StringBuffer containing the data.
-
copyTable
Copies data from this table to the system clipboard.- Parameters:
asFormatted
- true to retain table formattingheader
- the table header
-
findLastAddedModelIndex
subclass should return the modelIndex of the first column name (comma-quoted key) not found in names and, if that exists, add that key to name in case this needs to be run more than once.- Parameters:
names
- a simple comma-quoted listing of known column names- Returns:
- the modelIndex and append to names the new comma-quoted name found
-