public class DefaultTableColumnModelExt extends DefaultTableColumnModel implements TableColumnModelExt
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.)
Modifier and Type | Class and Description |
---|---|
private class |
DefaultTableColumnModelExt.VisibilityListener
TODO JW: move into propertyChanged!
|
Modifier and Type | Field and Description |
---|---|
private List<TableColumn> |
currentColumns
contains a list of all column, in the order they would appear if
all were visible.
|
private List<TableColumn> |
initialColumns
contains a list of all columns, in the order in which were
added to the model.
|
private boolean |
isVisibilityChange
flag to distinguish a shown/hidden column from really added/removed
columns during notification.
|
private DefaultTableColumnModelExt.VisibilityListener |
visibilityListener
Listener attached to TableColumnExt instances to listen for changes
to their visibility status, and to hide/show the column as oppropriate
|
changeEvent, columnMargin, columnSelectionAllowed, listenerList, selectionModel, tableColumns, totalColumnWidth
Constructor and Description |
---|
DefaultTableColumnModelExt()
Creates a an empty DefaultTableColumnModelExt.
|
Modifier and Type | Method and Description |
---|---|
void |
addColumn(TableColumn aColumn)
Overridden to update internals related to column visibility.
|
void |
addColumnModelListener(TableColumnModelListener x)
Adds a listener for table column model events.
|
protected void |
fireColumnPropertyChange(PropertyChangeEvent evt)
Notifies
TableColumnModelExtListener s 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 TableColumn s. |
protected EventListenerList |
getEventListenerList()
Exposed for testing only - don't use!
|
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)
Overridden to update internals related to column visibility.
|
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) |
void |
removeColumn(TableColumn column)
Overridden to update internals related to column visibility.
|
void |
removeColumnModelListener(TableColumnModelListener x)
Overridden to uninstall enhanced notification of listeners of type.
|
private void |
updateCurrentColumns(int oldIndex,
int newIndex)
Adjusts the current column sequence when a visible column is moved.
|
createSelectionModel, fireColumnAdded, fireColumnMarginChanged, fireColumnMoved, fireColumnRemoved, fireColumnSelectionChanged, getColumn, getColumnCount, getColumnIndex, getColumnIndexAtX, getColumnMargin, getColumnModelListeners, getColumns, getColumnSelectionAllowed, getListeners, getSelectedColumnCount, getSelectedColumns, getSelectionModel, getTotalColumnWidth, recalcWidthCache, setColumnMargin, setColumnSelectionAllowed, setSelectionModel, valueChanged
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getColumn, getColumnCount, getColumnIndex, getColumnIndexAtX, getColumnMargin, getColumns, getColumnSelectionAllowed, getSelectedColumnCount, getSelectedColumns, getSelectionModel, getTotalColumnWidth, setColumnMargin, setColumnSelectionAllowed, setSelectionModel
private boolean isVisibilityChange
private List<TableColumn> initialColumns
private List<TableColumn> currentColumns
private DefaultTableColumnModelExt.VisibilityListener visibilityListener
public DefaultTableColumnModelExt()
public List<TableColumn> getColumns(boolean includeHidden)
List
of contained TableColumn
s.
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 TableColumnModelExt
includeHidden
- a boolean to indicate whether invisible columns
should be includedList
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 TableColumnModelExt
includeHidden
- a boolean to indicate whether invisible columns
should be includedpublic 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 TableColumnModelExt
identifier
- the object used as column identifierTableColumnExt
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 TableColumnModelExt
columnIndex
- the index of the column desiredTableColumnExt
object that matches the column
indexpublic boolean isRemovedToInvisibleEvent(int oldIndex)
oldIndex
- the fromIndex of the columnEventpublic boolean isAddedFromInvisibleEvent(int newIndex)
newIndex
- the toIndex of the columnEventpublic void removeColumn(TableColumn column)
Overridden to update internals related to column visibility.
removeColumn
in interface TableColumnModel
removeColumn
in class DefaultTableColumnModel
public void addColumn(TableColumn aColumn)
Overridden to update internals related to column visibility.
addColumn
in interface TableColumnModel
addColumn
in class DefaultTableColumnModel
public void moveColumn(int columnIndex, int newIndex)
Overridden to update internals related to column visibility.
moveColumn
in interface TableColumnModel
moveColumn
in class DefaultTableColumnModel
private void updateCurrentColumns(int oldIndex, int newIndex)
oldIndex
- the old visible position.newIndex
- the new visible position.protected 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 PropertyChangeListener
propertyChange
in class DefaultTableColumnModel
protected void fireColumnPropertyChange(PropertyChangeEvent evt)
TableColumnModelExtListener
s about property
changes of contained columns. The event instance
is the original as fired by the TableColumn
.evt
- the event receivedEventListenerList
public void addColumnModelListener(TableColumnModelListener x)
Overridden to install enhanced notification of listeners of type. TableColumnModelListenerExt about property changes of contained columns.
addColumnModelListener
in interface TableColumnModel
addColumnModelListener
in interface TableColumnModelExt
addColumnModelListener
in class DefaultTableColumnModel
x
- 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 TableColumnModel
removeColumnModelListener
in class DefaultTableColumnModel
public TableColumnModelExtListener[] getTableColumnModelExtListeners()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses