|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.DefaultTableColumnModel
de.tkuhn.swing.table.ColumnStateTableColumnModel
public class ColumnStateTableColumnModel
This implementation of TableColumnModel
provides the ability of
hiding and unhiding table columns from display using a contextual menu of the
table header. It also offers support for preserving column state such as
size, position and hiding state over changes of TableModel
in a
JTable by providing objects that represent a distinct state that can be reset
lateron.
If you use JUserFriendlyTable
you should not need to use this
class.
JUserFriendlyTable
,
TableColumnModel
,
Serialized FormField Summary |
---|
Fields inherited from class javax.swing.table.DefaultTableColumnModel |
---|
changeEvent, columnMargin, columnSelectionAllowed, listenerList, selectionModel, tableColumns, totalColumnWidth |
Constructor Summary | |
---|---|
ColumnStateTableColumnModel()
Creates a new instance of RememberingTableColumnModel |
Method Summary | |
---|---|
void |
addColumn(javax.swing.table.TableColumn aColumn)
This should not be called by a user directly! |
protected ColumnState |
getColumnState(java.lang.Object colId)
Get the state for a single column in this model |
java.lang.Object |
getState()
Creates a Memento of the state of this column model. |
void |
hideColumn(java.lang.Object colId)
Hide a column and set the state of the popup menu |
void |
installPopup(javax.swing.JTable table)
Install the popup menu used by this column model for column hiding on a JTable |
void |
removeColumn(javax.swing.table.TableColumn aColumn)
This should not be called by a user directly! |
protected void |
setColumnState(ColumnState colState)
Resets the state of a single column in this model |
boolean |
setState(java.lang.Object aState)
Resets this column model to the given state if the column structure is similar to the one present while getState() was called. |
void |
showAllColumns()
Show all hidden columns |
void |
showColumn(java.lang.Object colId)
Show a previously hidden column and set the state of the popup menu |
void |
uninstallPopup(javax.swing.JTable table)
Remove the popup menu installed by this instance from the table |
Methods inherited from class javax.swing.table.DefaultTableColumnModel |
---|
addColumnModelListener, createSelectionModel, fireColumnAdded, fireColumnMarginChanged, fireColumnMoved, fireColumnRemoved, fireColumnSelectionChanged, getColumn, getColumnCount, getColumnIndex, getColumnIndexAtX, getColumnMargin, getColumnModelListeners, getColumns, getColumnSelectionAllowed, getListeners, getSelectedColumnCount, getSelectedColumns, getSelectionModel, getTotalColumnWidth, moveColumn, propertyChange, recalcWidthCache, removeColumnModelListener, setColumnMargin, setColumnSelectionAllowed, setSelectionModel, valueChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ColumnStateTableColumnModel()
Method Detail |
---|
public java.lang.Object getState()
Serializable
interface. It can also
be saved using the XMLEncoder
Serializable
,
XMLEncoder
public boolean setState(java.lang.Object aState)
getState()
was called. This
method must be called with a state object obtained by
getState()
.
aState
- the state to set.
getState()
protected ColumnState getColumnState(java.lang.Object colId)
colId
- the identifier of the column
protected void setColumnState(ColumnState colState)
colState
- the state to be establishedpublic void installPopup(javax.swing.JTable table)
JTable
table
- the table to install the popup onpublic void uninstallPopup(javax.swing.JTable table)
table
- the table to remove the popup frompublic void hideColumn(java.lang.Object colId)
colId
- the column identifierpublic void showColumn(java.lang.Object colId)
colId
- the column identifierpublic void showAllColumns()
public void addColumn(javax.swing.table.TableColumn aColumn)
addColumn(column)
in the TableColumnModel
interface. Adds a column to this column model and creates an item in the
popup menu for hiding
addColumn
in interface javax.swing.table.TableColumnModel
addColumn
in class javax.swing.table.DefaultTableColumnModel
aColumn
- the column to be addedpublic void removeColumn(javax.swing.table.TableColumn aColumn)
removeColumn(column)
in the TableColumnModel
interface. Removes a column from this column model and its corresponding
item in the popup menu
removeColumn
in interface javax.swing.table.TableColumnModel
removeColumn
in class javax.swing.table.DefaultTableColumnModel
aColumn
- the column to be removed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |