|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.table.DefaultTableColumnModel
org.jdesktop.swingx.table.DefaultTableColumnModelExt
public class DefaultTableColumnModelExt
A default implementation of TableColumnModelExt.
TODO: explain sub-optimal notification on showing/hiding columns. (hot fixed issues #156, #157. To really do it need enhanced TableColumnModelEvent and -Listeners that are aware of the event.)
| Field Summary |
|---|
| Fields inherited from class javax.swing.table.DefaultTableColumnModel |
|---|
changeEvent, columnMargin, columnSelectionAllowed, listenerList, selectionModel, tableColumns, totalColumnWidth |
| Constructor Summary | |
|---|---|
DefaultTableColumnModelExt()
Creates a an empty DefaultTableColumnModelExt. |
|
| Method Summary | |
|---|---|
void |
addColumn(TableColumn aColumn)
Appends aColumn to the end of the
tableColumns array. |
void |
addColumnModelListener(TableColumnModelListener x)
Adds a listener for table column model events. |
protected void |
fireColumnPropertyChange(PropertyChangeEvent evt)
Notifies TableColumnModelExtListeners about property
changes of contained columns. |
int |
getColumnCount(boolean includeHidden)
Returns the number of contained columns. |
TableColumnExt |
getColumnExt(int columnIndex)
Returns the TableColumnExt at view position
columnIndex. |
TableColumnExt |
getColumnExt(Object identifier)
Returns the first TableColumnExt with the given
identifier. |
List<TableColumn> |
getColumns(boolean includeHidden)
Returns a List of contained TableColumns. |
protected EventListenerList |
getEventListenerList()
Exposed for testing only - don't use! Will be removed again! |
TableColumnModelExtListener[] |
getTableColumnModelExtListeners()
|
boolean |
isAddedFromInvisibleEvent(int newIndex)
hot fix for #157: listeners that are aware of the possible existence of invisible columns should check if the received columnAdded originated from moving a column from invisible to visible. |
boolean |
isRemovedToInvisibleEvent(int oldIndex)
hot fix for #157: listeners that are aware of the possible existence of invisible columns should check if the received columnRemoved originated from moving a column from visible to invisible. |
void |
moveColumn(int columnIndex,
int newIndex)
Moves the column and heading at columnIndex to
newIndex. |
protected void |
moveToInvisible(TableColumnExt col)
Update internal state after the visibility of the column was changed to invisible. |
protected void |
moveToVisible(TableColumnExt col)
Update internal state after the visibility of the column was changed to visible. |
void |
propertyChange(PropertyChangeEvent evt)
Property Change Listener change method. |
void |
removeColumn(TableColumn column)
Deletes the column from the
tableColumns array. |
void |
removeColumnModelListener(TableColumnModelListener x)
Removes a listener for table column model events. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.swing.table.TableColumnModel |
|---|
getColumn, getColumnCount, getColumnIndex, getColumnIndexAtX, getColumnMargin, getColumns, getColumnSelectionAllowed, getSelectedColumnCount, getSelectedColumns, getSelectionModel, getTotalColumnWidth, setColumnMargin, setColumnSelectionAllowed, setSelectionModel |
| Constructor Detail |
|---|
public DefaultTableColumnModelExt()
| Method Detail |
|---|
public List<TableColumn> getColumns(boolean includeHidden)
List of contained TableColumns.
Includes or excludes invisible columns, depending on whether the
includeHidden is true or false, respectively. If false, an
Iterator over the List is equivalent to the
Enumeration returned by getColumns().
NOTE: the order of columns in the List depends on whether or not the invisible columns are included, in the former case it's the insertion order in the latter it's the current order of the visible columns.
getColumns in interface TableColumnModelExtincludeHidden - a boolean to indicate whether invisible columns
should be included
List of contained columns.public int getColumnCount(boolean includeHidden)
includeHidden is true or
false, respectively. If false, this method returns the same count as
getColumnCount().
getColumnCount in interface TableColumnModelExtincludeHidden - a boolean to indicate whether invisible columns
should be included
public TableColumnExt getColumnExt(Object identifier)
TableColumnExt with the given
identifier. The return value is null if there is no contained
column with identifier or if the column with identifier is not
of type TableColumnExt. The returned column
may be visible or hidden.
getColumnExt in interface TableColumnModelExtidentifier - the object used as column identifier
TableColumnExt with the given identifier or
null if none is foundpublic TableColumnExt getColumnExt(int columnIndex)
TableColumnExt at view position
columnIndex. The return value is null, if the
column at position columnIndex is not of type
TableColumnExt.
The returned column is visible.
getColumnExt in interface TableColumnModelExtcolumnIndex - the index of the column desired
TableColumnExt object that matches the column
indexpublic boolean isRemovedToInvisibleEvent(int oldIndex)
oldIndex - the fromIndex of the columnEvent
public boolean isAddedFromInvisibleEvent(int newIndex)
newIndex - the toIndex of the columnEvent
public void removeColumn(TableColumn column)
column 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. Overridden to update internals related to column visibility.
removeColumn in interface TableColumnModelremoveColumn in class DefaultTableColumnModelcolumn - the TableColumn to be removedDefaultTableColumnModel.addColumn(javax.swing.table.TableColumn)public void addColumn(TableColumn aColumn)
aColumn to the end of the
tableColumns array.
This method also posts the columnAdded
event to its listeners. Overridden to update internals related to column visibility.
addColumn in interface TableColumnModeladdColumn in class DefaultTableColumnModelaColumn - the TableColumn to be addedDefaultTableColumnModel.removeColumn(javax.swing.table.TableColumn)
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 update internals related to column visibility.
moveColumn in interface TableColumnModelmoveColumn in class DefaultTableColumnModelcolumnIndex - the index of column to be movednewIndex - new index to move the columnprotected void moveToInvisible(TableColumnExt col)
col - the column which was hidden.protected void moveToVisible(TableColumnExt col)
col - the column which was made visible.protected EventListenerList getEventListenerList()
public void propertyChange(PropertyChangeEvent evt)
propertyChange in interface PropertyChangeListenerpropertyChange in class DefaultTableColumnModelevt - PropertyChangeEventprotected void fireColumnPropertyChange(PropertyChangeEvent evt)
TableColumnModelExtListeners about property
changes of contained columns. The event instance
is the original as fired by the TableColumn.
evt - the event receivedEventListenerListpublic void addColumnModelListener(TableColumnModelListener x)
Overridden to install enhanced notification of listeners of type. TableColumnModelListenerExt about property changes of contained columns.
addColumnModelListener in interface TableColumnModeladdColumnModelListener in interface TableColumnModelExtaddColumnModelListener in class DefaultTableColumnModelx - a TableColumnModelListener objectpublic void removeColumnModelListener(TableColumnModelListener x)
Overridden to uninstall enhanced notification of listeners of type. TableColumnModelListenerExt about property changes of contained columns.
removeColumnModelListener in interface TableColumnModelremoveColumnModelListener in class DefaultTableColumnModelx - a TableColumnModelListener objectpublic TableColumnModelExtListener[] getTableColumnModelExtListeners()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||