|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.table.DefaultTableColumnModel
org.tentackle.ui.FormTableColumnModel
public class FormTableColumnModel
Extended table column model.
Adds the feature to display/hide a column by model index.
| Field Summary | |
|---|---|
protected Vector<TableColumn> |
originalColumns
all columns whether visible or not are stored here. |
| Fields inherited from class javax.swing.table.DefaultTableColumnModel |
|---|
changeEvent, columnMargin, columnSelectionAllowed, listenerList, selectionModel, tableColumns, totalColumnWidth |
| Constructor Summary | |
|---|---|
FormTableColumnModel()
Creates a formtable column model. This is the standard constructor with no columns displayed. |
|
| Method Summary | |
|---|---|
void |
addColumn(TableColumn aColumn)
Appends aColumn to the end of the
tableColumns array. |
TableColumn |
getColumnByModelIndex(int modelIndex)
Gets the column for the given data-modelindex |
int[] |
getModelIndexes()
Gets all model indexes sorted according to the current view. The invisible columns come last. |
TableColumn |
getOriginalColumn(int originalIndex)
Gets the original column at a given model index |
Enumeration |
getOriginalColumns()
Gets all original columns. |
int |
getOriginalIndex(int visibleIndex)
Maps between the visible and model indexes. |
int |
getOriginalIndex(TableColumn column)
Returns the original index of a table column. |
boolean |
isModelColumnVisible(int modelIndex)
Checks if a column is visible. |
boolean |
isOriginalColumnVisible(int originalIndex)
Checks if a column is visible. |
void |
moveColumn(int columnIndex,
int newIndex)
Moves the column and heading at columnIndex to
newIndex. |
void |
removeAllColumns()
Removes all columns, original and visible. |
void |
removeColumn(TableColumn column)
Deletes the column from the
tableColumns array. |
void |
reorderColumns(int[] modelIndexes)
Reorders columns according an array of ints. The index in the array is the column index, whereas the value is the data-model index. |
void |
setModelColumnVisible(int modelIndex,
boolean visible)
Same as setOriginalColumn but index corresponds to the data-model (model-index). |
void |
setOriginalColumnVisible(int originalIndex,
boolean visible)
Sets a column invisible/visible. Removes/adds the column from/to the underlying vector but keeps it in the original vector. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Vector<TableColumn> originalColumns
| Constructor Detail |
|---|
public FormTableColumnModel()
addColumn(javax.swing.table.TableColumn).
| Method Detail |
|---|
public int getOriginalIndex(TableColumn column)
column - the table column
public int getOriginalIndex(int visibleIndex)
visibleIndex - the visible index
public TableColumn getOriginalColumn(int originalIndex)
originalIndex - the original model index
public Enumeration getOriginalColumns()
public TableColumn getColumnByModelIndex(int modelIndex)
modelIndex - the data model index
public void addColumn(TableColumn aColumn)
javax.swing.table.DefaultTableColumnModelaColumn to the end of the
tableColumns array.
This method also posts the columnAdded
event to its listeners.
addColumn in interface TableColumnModeladdColumn in class DefaultTableColumnModelaColumn - the TableColumn to be addedDefaultTableColumnModel.removeColumn(javax.swing.table.TableColumn)public void removeColumn(TableColumn column)
javax.swing.table.DefaultTableColumnModelcolumn from the
tableColumns array. This method will do nothing if
column is not in the table's columns list.
tile is called
to resize both the header and table views.
This method also posts a columnRemoved
event to its listeners.
removeColumn in interface TableColumnModelremoveColumn in class DefaultTableColumnModelcolumn - the TableColumn to be removedDefaultTableColumnModel.addColumn(javax.swing.table.TableColumn)public void removeAllColumns()
public void moveColumn(int columnIndex,
int newIndex)
columnIndex to
newIndex. The old column at columnIndex
will now be found at newIndex. The column
that used to be at newIndex is shifted
left or right to make room. This will not move any columns if
columnIndex equals newIndex. This method
also posts a columnMoved event to its listeners.
Overridden to move a column according to the visible index.
The columns in the "original"-space are moved accordingly.
moveColumn in interface TableColumnModelmoveColumn in class DefaultTableColumnModelcolumnIndex - the index of column to be movednewIndex - new index to move the columnpublic boolean isOriginalColumnVisible(int originalIndex)
originalIndex - the original column index
isModelColumnVisible(int)public boolean isModelColumnVisible(int modelIndex)
modelIndex - the model index
isOriginalColumnVisible(int)
public void setOriginalColumnVisible(int originalIndex,
boolean visible)
originalIndex - the column indexvisible - true to set visible, false to set invisiblesetModelColumnVisible(int, boolean)
public void setModelColumnVisible(int modelIndex,
boolean visible)
modelIndex - the model column indexvisible - true to set visible, false to set invisiblesetOriginalColumnVisible(int, boolean)public void reorderColumns(int[] modelIndexes)
modelIndexes - the column indexespublic int[] getModelIndexes()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||