|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.table.DefaultTableColumnModel
be.fgov.ehealth.ehvalidator.gui.XTableColumnModel
public class XTableColumnModel
XTableColumnModel extends the DefaultTableColumnModel .
It provides a comfortable way to hide/show columns.
Columns keep their positions when hidden and shown again.
In order to work with JTable it cannot add any events to TableColumnModelListener.
Therefore hiding a column will result in columnRemoved event and showing it
again will notify listeners of a columnAdded, and possibly a columnMoved event.
For the same reason the following methods still deal with visible columns only:
getColumnCount(), getColumns(), getColumnIndex(), getColumn()
There are overloaded versions of these methods that take a parameter onlyVisible which let's
you specify wether you want invisible columns taken into account.
DefaultTableColumnModel,
Serialized Form| Field Summary | |
|---|---|
protected Vector<TableColumn> |
allTableColumns
Array of TableColumn objects in this model. |
| Fields inherited from class javax.swing.table.DefaultTableColumnModel |
|---|
changeEvent, columnMargin, columnSelectionAllowed, listenerList, selectionModel, tableColumns, totalColumnWidth |
| Method Summary | |
|---|---|
void |
addColumn(TableColumn column)
Append column to the right of exisiting columns. |
TableColumn |
getColumn(int columnIndex,
boolean onlyVisible)
Returns the TableColumn object for the column
at columnIndex. |
TableColumn |
getColumnByModelIndex(int modelColumnIndex)
Maps the index of the column in the table model at modelColumnIndex to the TableColumn object. |
int |
getColumnCount(boolean onlyVisible)
Returns the total number of columns in this model. |
int |
getColumnIndex(Object identifier,
boolean onlyVisible)
Returns the position of the first column whose identifier equals identifier. |
Enumeration<TableColumn> |
getColumns(boolean onlyVisible)
Returns an Enumeration of all the columns in the model. |
boolean |
isColumnVisible(TableColumn aColumn)
Checks wether the specified column is currently visible. |
void |
moveColumn(int oldIndex,
int newIndex)
Moves the column from oldIndex to newIndex. |
void |
removeColumn(TableColumn column)
Removes column from this column model. |
void |
setAllColumnsVisible()
Makes all columns in this model visible |
void |
setColumnVisible(TableColumn column,
boolean visible)
Sets the visibility of the specified TableColumn. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Vector<TableColumn> allTableColumns
| Method Detail |
|---|
public void setColumnVisible(TableColumn column,
boolean visible)
column - the column to show/hidevisible - its new visibility statuspublic void setAllColumnsVisible()
public TableColumn getColumnByModelIndex(int modelColumnIndex)
modelColumnIndex to the TableColumn object.
There may me multiple TableColumn objects showing the same model column, though this is uncommon.
This method will always return the first visible or else the first invisible column with the specified index.
modelColumnIndex - index of column in table model
public boolean isColumnVisible(TableColumn aColumn)
aColumn - column to check
public void addColumn(TableColumn column)
column to the right of exisiting columns.
Posts columnAdded event.
addColumn in interface TableColumnModeladdColumn in class DefaultTableColumnModelcolumn - The column to be added
IllegalArgumentException - if column is nullremoveColumn(javax.swing.table.TableColumn)public void removeColumn(TableColumn column)
column from this column model.
Posts columnRemoved event.
Will do nothing if the column is not in this model.
removeColumn in interface TableColumnModelremoveColumn in class DefaultTableColumnModelcolumn - the column to be addedaddColumn(javax.swing.table.TableColumn)
public void moveColumn(int oldIndex,
int newIndex)
oldIndex to newIndex.
Posts columnMoved event.
Will not move any columns if oldIndex equals newIndex.
moveColumn in interface TableColumnModelmoveColumn in class DefaultTableColumnModeloldIndex - index of column to be movednewIndex - new index of the column
IllegalArgumentException - if either oldIndex or
newIndex
are not in [0, getColumnCount() - 1]public int getColumnCount(boolean onlyVisible)
onlyVisible - if set only visible columns will be counted
tableColumns arraygetColumns(boolean)public Enumeration<TableColumn> getColumns(boolean onlyVisible)
Enumeration of all the columns in the model.
onlyVisible - if set all invisible columns will be missing from the enumeration.
Enumeration of the columns in the model
public int getColumnIndex(Object identifier,
boolean onlyVisible)
identifier.
Position is the the index in all visible columns if onlyVisible is true or
else the index in all columns.
identifier - the identifier object to search foronlyVisible - if set searches only visible columns
identifier
IllegalArgumentException - if identifier
is null, or if no
TableColumn has this
identifiergetColumn(int, boolean)
public TableColumn getColumn(int columnIndex,
boolean onlyVisible)
TableColumn object for the column
at columnIndex.
columnIndex - the index of the column desiredonlyVisible - if set columnIndex is meant to be relative to all visible columns only
else it is the index in all columns
TableColumn object for the column
at columnIndex
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||