|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
com.quadrique.jbuildingblocks.gui.TableSorterModel
public abstract class TableSorterModel
This class implements a generic table model that also supports sorting by clicking on a column header
| Constructor Summary | |
|---|---|
TableSorterModel(String[] zColumnNames)
constructor |
|
| Method Summary | |
|---|---|
abstract int |
compare(Object zObject1,
Object zObject2)
Comparison mtheod that is used to sort the rows, has to be implemented in each derived class |
boolean |
equals(Object zObj)
|
int |
getColumnCount()
|
String |
getColumnName(int zColumn)
|
ArrayList<? extends Object> |
getData()
|
int |
getRowCount()
|
int |
getSortingColumn()
|
abstract Object |
getValueAt(int zRow,
int zColumn)
To retrieve each individual cell, has to be implemented in each derived class |
boolean |
isAcendingSort()
|
void |
setData(ArrayList<? extends Object> zData)
Set the data model |
void |
setSortingParameters(int zSortColumn,
boolean zIsAcendingSort)
To set the current sorting paramters |
| Methods inherited from class javax.swing.table.AbstractTableModel |
|---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt |
| Methods inherited from class java.lang.Object |
|---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TableSorterModel(String[] zColumnNames)
zColumnNames - an array that contains the name of the columns| Method Detail |
|---|
public int getRowCount()
getRowCount in interface TableModelpublic int getColumnCount()
getColumnCount in interface TableModelpublic String getColumnName(int zColumn)
getColumnName in interface TableModelgetColumnName in class AbstractTableModelzColumn - the column index
public abstract Object getValueAt(int zRow,
int zColumn)
getValueAt in interface TableModelzRow - the row indexzColumn - the column index
public int getSortingColumn()
public boolean isAcendingSort()
public void setSortingParameters(int zSortColumn,
boolean zIsAcendingSort)
zSortColumn - the index of the column that is used to sortzIsAcendingSort - true if the ascending order is to be used, false otherwise
public abstract int compare(Object zObject1,
Object zObject2)
compare in interface Comparator<Object>zObject1 - the first objectzObject2 - the second object
public boolean equals(Object zObj)
equals in interface Comparator<Object>equals in class ObjectzObj - the TableSorterModel instance
Comparatorpublic ArrayList<? extends Object> getData()
public void setData(ArrayList<? extends Object> zData)
zData - the data model
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||