Package org.opensourcephysics.display
Class DataTable.OSPDataTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
org.opensourcephysics.display.DataTable.OSPDataTableModel
- All Implemented Interfaces:
Serializable
,EventListener
,TableModelListener
,TableModel
- Direct Known Subclasses:
DataToolTable.DataToolTableModel
- Enclosing class:
- DataTable
protected class DataTable.OSPDataTableModel
extends AbstractTableModel
implements TableModelListener
- See Also:
-
Field Summary
FieldsFields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
add
(DataTable.OSPTableModel tableModel) Method to add an instance of OSPTableModel, including ComplexDataSet, DataSet, DataSetManager, Histogram, or TextColumnTableModel.protected void
addColumnSelectionInterval
(int coli, int colj) void
clear()
Method clearprotected org.opensourcephysics.display.DataTable.DataTableElement
find
(int icol) Find the dataTableElement associated with this column.protected org.opensourcephysics.display.DataTable.DataTableElement
findElementContaining
(TableModel tableModel) returns the DataTableElement that contains the specified TableModelClass<?>
getColumnClass
(int columnIndex) Method getColumnClassint
Method getColumnCountgetColumnName
(int columnIndex) Method getColumnNameprotected Object
getElementValue
(int rowIndex, int columnIndex) protected Object[]
getElementValues
(org.opensourcephysics.display.DataTable.DataTableElement dte, int columnIndex, Object[] objects) Get an array of column values ready for sorting.protected int
getModelRow
(int row) Converts a table row index to the corresponding model row number (i.e., displayed in the "row" column).int
Method getRowCountprotected int[]
int
Gets the sorted column.protected int
getSortedRow
(int j) getValueAt
(int rowIndex, int columnIndex) Method getValueAtboolean
isCellEditable
(int rowIndex, int columnIndex) Method isCellEditableprotected boolean
isElementEditable
(int row, int col) boolean
boolean
Method isRowNumberVisibleprotected void
refresh
(int mask) protected void
void
remove
(TableModel tableModel) Method removeprotected void
void
protected void
setColumnVisible
(TableModel model, int columnIndex, boolean b) Method setColumnVisibleprotected void
setElementValue
(Object value, int rowIndex, int columnIndex) void
setRowNumberVisible
(boolean b) Method setRowNumberVisiblevoid
protected void
The TableModelListener will clue us invoid
setValueAt
(Object value, int rowIndex, int columnIndex) Method setValueAt modified by Doug Brown 12/19/2013protected void
sort
(int col) Sorts the table rows using the given column.void
This will be from the DataSet sub-TableModels, specifically for APPEND for now.Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
Field Details
-
lastModelEvent
-
columnCount
protected int columnCount -
haveColumnClasses
protected boolean haveColumnClasses
-
-
Constructor Details
-
OSPDataTableModel
protected OSPDataTableModel()
-
-
Method Details
-
setTainted
protected void setTainted()The TableModelListener will clue us in -
setColumnSelectionFromJTable
public void setColumnSelectionFromJTable() -
setSelectedRowsFromJTable
public void setSelectedRowsFromJTable() -
getModelRow
protected int getModelRow(int row) Converts a table row index to the corresponding model row number (i.e., displayed in the "row" column).- Parameters:
row
- the table row- Returns:
- the model row
-
addColumnSelectionInterval
protected void addColumnSelectionInterval(int coli, int colj) -
find
protected org.opensourcephysics.display.DataTable.DataTableElement find(int icol) Find the dataTableElement associated with this column.- Parameters:
rowNumberVisible
-dataTableElements
-icol
-- Returns:
-
sort
protected void sort(int col) Sorts the table rows using the given column.- Parameters:
col
- int
-
getSortedColumn
public int getSortedColumn()Gets the sorted column. Added by D Brown 2010-10-24.- Returns:
- the
-
resetSort
protected void resetSort() -
getSortedRow
protected int getSortedRow(int j) -
setColumnVisible
Method setColumnVisible- Parameters:
model
-columnIndex
-b
-
-
refreshColumnModel
protected void refreshColumnModel() -
setRowNumberVisible
public void setRowNumberVisible(boolean b) Method setRowNumberVisible- Parameters:
b
-
-
setValueAt
Method setValueAt modified by Doug Brown 12/19/2013- Specified by:
setValueAt
in interfaceTableModel
- Overrides:
setValueAt
in classAbstractTableModel
- Parameters:
value
-rowIndex
-columnIndex
-
-
setElementValue
-
isRowNumberVisible
public boolean isRowNumberVisible()Method isRowNumberVisible- Returns:
-
getColumnName
Method getColumnName- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classAbstractTableModel
- Parameters:
columnIndex
-- Returns:
- the name
-
getRowCount
public int getRowCount()Method getRowCount- Specified by:
getRowCount
in interfaceTableModel
- Returns:
-
getColumnCount
public int getColumnCount()Method getColumnCount- Specified by:
getColumnCount
in interfaceTableModel
- Returns:
- the number of VISIBLE columns
-
getValueAt
Method getValueAt- Specified by:
getValueAt
in interfaceTableModel
- Parameters:
rowIndex
-columnIndex
-- Returns:
-
getElementValue
-
getElementValues
protected Object[] getElementValues(org.opensourcephysics.display.DataTable.DataTableElement dte, int columnIndex, Object[] objects) Get an array of column values ready for sorting.- Parameters:
columnIndex
-objects
-- Returns:
-
getColumnClass
Method getColumnClass- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
- Parameters:
columnIndex
-- Returns:
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex) Method isCellEditable- Specified by:
isCellEditable
in interfaceTableModel
- Overrides:
isCellEditable
in classAbstractTableModel
- Parameters:
rowIndex
-columnIndex
-- Returns:
- true if editable
-
isElementEditable
protected boolean isElementEditable(int row, int col) -
remove
Method remove- Parameters:
tableModel
-
-
clear
public void clear()Method clear -
add
Method to add an instance of OSPTableModel, including ComplexDataSet, DataSet, DataSetManager, Histogram, or TextColumnTableModel.- Parameters:
tableModel
-
-
findElementContaining
protected org.opensourcephysics.display.DataTable.DataTableElement findElementContaining(TableModel tableModel) returns the DataTableElement that contains the specified TableModel- Parameters:
tableModel
-- Returns:
- Description of the Returned Value
-
tableChanged
This will be from the DataSet sub-TableModels, specifically for APPEND for now.- Specified by:
tableChanged
in interfaceTableModelListener
-
isFoundOrdered
public boolean isFoundOrdered() -
refresh
protected void refresh(int mask) -
getSelectedModelRows
protected int[] getSelectedModelRows()
-