|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
weka.gui.SortedTableModel
public class SortedTableModel
Represents a TableModel with sorting functionality.
| Nested Class Summary | |
|---|---|
static class |
SortedTableModel.SortContainer
Helper class for sorting the columns. |
| Constructor Summary | |
|---|---|
SortedTableModel()
initializes with no model |
|
SortedTableModel(javax.swing.table.TableModel model)
initializes with the given model |
|
| Method Summary | |
|---|---|
void |
addMouseListenerToHeader(javax.swing.JTable table)
Adds a mouselistener to the header: left-click on the header sorts in ascending manner, using shift-left-click in descending manner. |
int |
getActualRow(int visibleRow)
Returns the actual underlying row the given visible one represents. |
java.lang.Class |
getColumnClass(int columnIndex)
Returns the most specific superclass for all the cell values in the column. |
int |
getColumnCount()
Returns the number of columns in the model |
java.lang.String |
getColumnName(int columnIndex)
Returns the name of the column at columnIndex |
javax.swing.table.TableModel |
getModel()
returns the current model, can be null |
int |
getRowCount()
Returns the number of rows in the model. |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value for the cell at columnIndex and rowIndex. |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns true if the cell at rowIndex and columnIndex is editable. |
boolean |
isSorted()
returns whether the table was sorted |
void |
setModel(javax.swing.table.TableModel value)
sets the model to use |
void |
setValueAt(java.lang.Object aValue,
int rowIndex,
int columnIndex)
Sets the value in the cell at columnIndex and rowIndex to aValue. |
void |
sort(int columnIndex)
sorts the table over the given column (ascending) |
void |
sort(int columnIndex,
boolean ascending)
sorts the table over the given column, either ascending or descending |
void |
tableChanged(javax.swing.event.TableModelEvent e)
This fine grain notification tells listeners the exact range of cells, rows, or columns that changed. |
| Methods inherited from class javax.swing.table.AbstractTableModel |
|---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SortedTableModel()
public SortedTableModel(javax.swing.table.TableModel model)
model - the model to initialize the sorted model with| Method Detail |
|---|
public void setModel(javax.swing.table.TableModel value)
value - the model to usepublic javax.swing.table.TableModel getModel()
public boolean isSorted()
public int getActualRow(int visibleRow)
visibleRow - the displayed row to retrieve the original row for
public java.lang.Class getColumnClass(int columnIndex)
getColumnClass in interface javax.swing.table.TableModelgetColumnClass in class javax.swing.table.AbstractTableModelcolumnIndex - the index of the column
public int getColumnCount()
getColumnCount in interface javax.swing.table.TableModelpublic java.lang.String getColumnName(int columnIndex)
getColumnName in interface javax.swing.table.TableModelgetColumnName in class javax.swing.table.AbstractTableModelcolumnIndex - the column to retrieve the name for
public int getRowCount()
getRowCount in interface javax.swing.table.TableModel
public java.lang.Object getValueAt(int rowIndex,
int columnIndex)
getValueAt in interface javax.swing.table.TableModelrowIndex - the rowcolumnIndex - the column
public boolean isCellEditable(int rowIndex,
int columnIndex)
isCellEditable in interface javax.swing.table.TableModelisCellEditable in class javax.swing.table.AbstractTableModelrowIndex - the rowcolumnIndex - the column
public void setValueAt(java.lang.Object aValue,
int rowIndex,
int columnIndex)
setValueAt in interface javax.swing.table.TableModelsetValueAt in class javax.swing.table.AbstractTableModelaValue - the new value of the cellrowIndex - the rowcolumnIndex - the columnpublic void sort(int columnIndex)
columnIndex - the column to sort over
public void sort(int columnIndex,
boolean ascending)
columnIndex - the column to sort overascending - ascending if true, otherwise descendingpublic void tableChanged(javax.swing.event.TableModelEvent e)
tableChanged in interface javax.swing.event.TableModelListenere - the eventpublic void addMouseListenerToHeader(javax.swing.JTable table)
table - the table to add the listener to
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||