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 voidadd(DataTable.OSPTableModel tableModel) Method to add an instance of OSPTableModel, including ComplexDataSet, DataSet, DataSetManager, Histogram, or TextColumnTableModel.protected voidaddColumnSelectionInterval(int coli, int colj) voidclear()Method clearprotected org.opensourcephysics.display.DataTable.DataTableElementfind(int icol) Find the dataTableElement associated with this column.protected org.opensourcephysics.display.DataTable.DataTableElementfindElementContaining(TableModel tableModel) returns the DataTableElement that contains the specified TableModelClass<?>getColumnClass(int columnIndex) Method getColumnClassintMethod getColumnCountgetColumnName(int columnIndex) Method getColumnNameprotected ObjectgetElementValue(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 intgetModelRow(int row) Converts a table row index to the corresponding model row number (i.e., displayed in the "row" column).intMethod getRowCountprotected int[]intGets the sorted column.protected intgetSortedRow(int j) getValueAt(int rowIndex, int columnIndex) Method getValueAtbooleanisCellEditable(int rowIndex, int columnIndex) Method isCellEditableprotected booleanisElementEditable(int row, int col) booleanbooleanMethod isRowNumberVisibleprotected voidrefresh(int mask) protected voidvoidremove(TableModel tableModel) Method removeprotected voidvoidprotected voidsetColumnVisible(TableModel model, int columnIndex, boolean b) Method setColumnVisibleprotected voidsetElementValue(Object value, int rowIndex, int columnIndex) voidsetRowNumberVisible(boolean b) Method setRowNumberVisiblevoidprotected voidThe TableModelListener will clue us invoidsetValueAt(Object value, int rowIndex, int columnIndex) Method setValueAt modified by Doug Brown 12/19/2013protected voidsort(int col) Sorts the table rows using the given column.voidThis 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:
setValueAtin interfaceTableModel- Overrides:
setValueAtin classAbstractTableModel- Parameters:
value-rowIndex-columnIndex-
-
setElementValue
-
isRowNumberVisible
public boolean isRowNumberVisible()Method isRowNumberVisible- Returns:
-
getColumnName
Method getColumnName- Specified by:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein classAbstractTableModel- Parameters:
columnIndex-- Returns:
- the name
-
getRowCount
public int getRowCount()Method getRowCount- Specified by:
getRowCountin interfaceTableModel- Returns:
-
getColumnCount
public int getColumnCount()Method getColumnCount- Specified by:
getColumnCountin interfaceTableModel- Returns:
- the number of VISIBLE columns
-
getValueAt
Method getValueAt- Specified by:
getValueAtin 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:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin classAbstractTableModel- Parameters:
columnIndex-- Returns:
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex) Method isCellEditable- Specified by:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein 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:
tableChangedin interfaceTableModelListener
-
isFoundOrdered
public boolean isFoundOrdered() -
refresh
protected void refresh(int mask) -
getSelectedModelRows
protected int[] getSelectedModelRows()
-