public interface TableHandler extends ComponentHandler<Object>
A specialized ComponentHandler
interface dealing with specific
functionality provided by tables.
Tables provide some special functionality that is not covered by the default
ComponentHandler
interface. So this extended interface was
introduced. It provides access to the selected index (or indices in
multi-selection mode), or allows sending change notifications if the data of
the table's model has changed.
Modifier and Type | Method and Description |
---|---|
void |
clearSelection()
Clears the table's selection.
|
List<Object> |
getModel()
Returns the underlying model of this table.
|
int |
getSelectedIndex()
Returns the index of the selected row.
|
int[] |
getSelectedIndices()
Returns an array with the indices of the selected rows.
|
Color |
getSelectionBackground()
Returns the current background color of the selection.
|
Color |
getSelectionForeground()
Returns the current foreground color of the selection.
|
void |
rowsDeleted(int startIdx,
int endIdx)
Notifies the table that a number of rows has been deleted.
|
void |
rowsInserted(int startIdx,
int endIdx)
Notifies the table that new rows have been inserted.
|
void |
rowsUpdated(int startIdx,
int endIdx)
Notifies the table that a number of rows has been modified.
|
void |
setSelectedIndex(int rowIdx)
Sets the index of the selected row.
|
void |
setSelectedIndices(int[] rowIndices)
Sets the indices of the selected rows in multi selection mode.
|
void |
setSelectionBackground(Color c)
Sets the background color for the selection.
|
void |
setSelectionForeground(Color c)
Sets the foreground color for the selection.
|
void |
tableDataChanged()
Notifies the table about an unspecific change in the data of its model.
|
getComponent, getData, getOuterComponent, getType, isEnabled, setData, setEnabled
int getSelectedIndex()
void setSelectedIndex(int rowIdx)
rowIdx
- the (0-based) index of the row to selectint[] getSelectedIndices()
getSelectedIndex()
, but multiple indices can be returned.void setSelectedIndices(int[] rowIndices)
rowIndices
- an array with the indices of the selected rows (must
not be null; use clearSelection()
for clearing any
selected rows)void clearSelection()
void tableDataChanged()
void rowsInserted(int startIdx, int endIdx)
tableDataChanged()
, but will probably be more efficient
because the table only needs to be redrawn if necessary.startIdx
- the start index of the newly added rowsendIdx
- the end index of the newly added rows (inclusive)tableDataChanged()
void rowsDeleted(int startIdx, int endIdx)
tableDataChanged()
, but will probably be
more efficient because the table only needs to be redrawn if necessary.startIdx
- the index of the first affected rowendIdx
- the index of the last affected row (inclusive)void rowsUpdated(int startIdx, int endIdx)
tableDataChanged()
, but will
probably be more efficient because the table only needs to be redrawn if
necessary.startIdx
- the index of the first affected rowendIdx
- the index of the last affected row (inclusive)List<Object> getModel()
Color getSelectionBackground()
void setSelectionBackground(Color c)
c
- the selection background colorColor getSelectionForeground()
void setSelectionForeground(Color c)
c
- the selection foreground colorCopyright © 2016 The JGUIraffe Team. All rights reserved.