|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cosylab.gui.components.table.TableRowModelSupport
public class TableRowModelSupport
TableRowModelSupport
support implementation of
TableRowModel
based on ArrayList
.
Note!
This class is not synchronized and is not thread safe.
Constructor Summary | |
---|---|
TableRowModelSupport()
Creates new instance. |
Method Summary | |
---|---|
void |
addRow(int index,
TableRow row)
Inserts row at the specified index. |
void |
addRow(TableRow row)
Adds row to the end of the row list. |
void |
addTableRowModelListener(TableRowModelListener l)
Add listener, which receives notification of changes in the model. |
protected void |
fireChange(TableRowModelEvent event)
|
protected void |
fireRowAdded(TableRow row,
int index)
|
protected void |
fireRowRemoved(TableRow row,
int index)
|
void |
fireRowUpdate(TableRow row,
int valueIndex)
This method is called from table row, when wants to notify its parent model about value change. |
protected void |
fireStructureChange(TableRow r)
|
int |
getColumnCount()
Number of columns inside this model. |
java.lang.String |
getColumnName(int index)
Returns name of column. |
java.util.Comparator |
getComparator()
|
TableRow |
getRow(int index)
Returns row at given index, |
TableRow |
getRowAt(int rowIndex)
Returns a row object at row index. |
int |
getRowCount()
Returns number of rows contained in this model. |
int |
getRowIndex(TableRow row)
Returns index of a row. |
void |
removeAllRows()
Removes all rows from this model. |
TableRow |
removeRow(int index)
Removes row from this model. |
void |
removeRow(TableRow row)
Removes row from this model. |
void |
removeTableRowModelListener(TableRowModelListener l)
Removes listener. |
void |
setColumnCount(int count)
Sets the number of columns this model presents. |
void |
setColumnNames(java.lang.String[] names)
Sets column names. |
void |
setComparator(java.util.Comparator<TableRow> comparator)
|
void |
sortRows(int column,
boolean descending)
Sort rows in ascending or descengin order according to the natural order of cells in specified column. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TableRowModelSupport()
Method Detail |
---|
public int getColumnCount()
TableRowModel
getColumnCount
in interface TableRowModel
public void setColumnCount(int count)
count
- the number of columnspublic int getRowCount()
TableRowModel
getRowCount
in interface TableRowModel
public TableRow getRowAt(int rowIndex)
TableRowModel
getRowAt
in interface TableRowModel
rowIndex
- the row index
public int getRowIndex(TableRow row)
TableRowModel
getRowIndex
in interface TableRowModel
row
- a row form this model
public void addTableRowModelListener(TableRowModelListener l)
TableRowModel
addTableRowModelListener
in interface TableRowModel
l
- a TableRowModelListener
listenerpublic void removeTableRowModelListener(TableRowModelListener l)
TableRowModel
removeTableRowModelListener
in interface TableRowModel
l
- a TableRowModelListener
listenerpublic java.lang.String getColumnName(int index)
TableRowModel
getColumnName
in interface TableRowModel
index
- the index of the colummn
TableModel.getColumnName(int)
public void setColumnNames(java.lang.String[] names)
names
- the column namespublic void addRow(TableRow row)
row
- the row to be addedpublic void addRow(int index, TableRow row)
index
- the index where to insertrow
- the row to be addedpublic TableRow getRow(int index)
index
- the index of the row
public TableRow removeRow(int index)
index
- rowindex to be roemoved
public void removeRow(TableRow row)
row
- the row to be removedprotected void fireChange(TableRowModelEvent event)
protected void fireStructureChange(TableRow r)
protected void fireRowAdded(TableRow row, int index)
protected void fireRowRemoved(TableRow row, int index)
public void fireRowUpdate(TableRow row, int valueIndex)
TableRowModel
fireRowUpdate
in interface TableRowModel
row
- the row which value has changesvalueIndex
- the index of the value, if -1
all values
has been changedpublic void removeAllRows()
public void sortRows(int column, boolean descending)
TableRowModel
Comparable
.
sortRows
in interface TableRowModel
column
- the column index, according to which rows are sorteddescending
- sorted rows are ordered ascending if
false
, or descending if true
.public java.util.Comparator getComparator()
public void setComparator(java.util.Comparator<TableRow> comparator)
comparator
- the comparator to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |