public abstract class SelfUpdatingTableModel extends DefaultTableModel
Modifier and Type | Field and Description |
---|---|
boolean |
isScrolling
When true this indicates that the user is currently scrolling in the
table and that the table should not update.
|
columnIdentifiers, dataVector
listenerList
Constructor and Description |
---|
SelfUpdatingTableModel() |
Modifier and Type | Method and Description |
---|---|
static void |
addScrollListeners(JTable table,
JScrollPane scrollPane,
JScrollBar scrollBar)
Add scroll bar and mouse wheel listeners.
|
static void |
addSortListener(JTable jTable,
ProgressDialogX progressDialog)
Convenience method adding a row sorter listener to the given JTable.
|
protected abstract void |
catchException(Exception e)
This method is called whenever an exception is encountered in a separate
thread.
|
protected void |
dataMissingAtRow(int row)
Calling this method indicates that data is missing at the given row.
|
int |
getRowNumber(int viewIndex)
Returns the row number of the given view index.
|
int |
getViewIndex(int row)
Returns the view index of the given row.
|
void |
initiateSorter()
Initiates the sorter to the current order of the table.
|
boolean |
isScrolling()
Indicates whether the table is currently being scrolled.
|
boolean |
isSelfUpdating()
Indicates whether the table is in self update mode.
|
protected abstract void |
loadDataForColumn(int column,
WaitingHandler waitingHandler)
Loads the data for a column.
|
protected abstract int |
loadDataForRows(ArrayList<Integer> indexes,
WaitingHandler waitingHandler)
Loads the data needed for objects at rows of the given view indexes.
|
boolean |
needsUpdate(int column,
String waitingContent)
Indicates whether the given column needs an update, i.e.
|
void |
resetSorting(ProgressDialogX aProgressDialog)
Sorts the table according to a given column using the built in sorter.
|
void |
setIsScrolling(boolean isScrolling)
Set if the user is currently scrolling or not.
|
void |
setSelfUpdating(boolean selfUpdating)
Sets whether the table is in self update mode.
|
void |
sort(int column,
ProgressDialogX aProgressDialog)
Sorts the table according to a given column using the built in sorter.
|
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getColumnName, getDataVector, getRowCount, getValueAt, insertRow, insertRow, isCellEditable, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount, setValueAt
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
public boolean isScrolling
protected abstract int loadDataForRows(ArrayList<Integer> indexes, WaitingHandler waitingHandler)
indexes
- the view indexes to load as a list. Shall not be empty or
null.waitingHandler
- the waiting handlerprotected abstract void loadDataForColumn(int column, WaitingHandler waitingHandler)
column
- the column numberwaitingHandler
- a waiting handler used to display progress to the
user or interrupt the processprotected abstract void catchException(Exception e)
e
- the exception encounteredprotected void dataMissingAtRow(int row) throws InterruptedException
row
- the row number (not the view index)InterruptedException
- if an InterruptedException occurspublic boolean isSelfUpdating()
public void setSelfUpdating(boolean selfUpdating)
selfUpdating
- if false the table will not automatically updatepublic boolean needsUpdate(int column, String waitingContent)
column
- index of the column of interestwaitingContent
- the waiting content of this tablepublic void initiateSorter()
public int getViewIndex(int row)
row
- the row of interestpublic int getRowNumber(int viewIndex)
viewIndex
- view index row of interestpublic void resetSorting(ProgressDialogX aProgressDialog)
aProgressDialog
- a progress dialog used to display the progress and
interrupt the processpublic void sort(int column, ProgressDialogX aProgressDialog)
column
- the column of interestaProgressDialog
- a progress dialog used to display the progress and
interrupt the processpublic static void addSortListener(JTable jTable, ProgressDialogX progressDialog)
jTable
- the table to add the resetSorting listener toprogressDialog
- progress dialog used to display progress or cancel
while sorting. Can be null.public boolean isScrolling()
public void setIsScrolling(boolean isScrolling)
isScrolling
- the isScrolling to setpublic static void addScrollListeners(JTable table, JScrollPane scrollPane, JScrollBar scrollBar)
table
- the tablescrollBar
- the scroll barscrollPane
- the scroll paneCopyright © 2016. All rights reserved.