All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.swing.table.DefaultTableColumnModel
java.lang.Object
|
+----java.awt.swing.table.DefaultTableColumnModel
- public class DefaultTableColumnModel
- extends Object
- implements TableColumnModel, PropertyChangeListener, ListSelectionListener, Serializable
- See Also:
- JTable
changeEvent- Change event (only one needed)
columnMargin- Width margin between each column
columnSelectionAllowed- Column selection allowed in this column model
emptySelectionAllowed- Empty selection allowed in this column model
listenerList- List of TableColumnModelListener
multipleSelectionAllowed- Multiple columns selected allowed in this column model
selectionModel- Model for keeping track of column selections
tableColumns- Array of TableColumn objects in this model
totalColumnWidth- A local cache of the combined width of all columns
DefaultTableColumnModel()
-
addColumn(TableColumn)
- Appends aColumn to the end of the receiver's tableColumns array.
addColumnModelListener(TableColumnModelListener)
-
addColumnSelectionInterval(int, int)
-
clearSelection()
-
createSelectionModel()
-
fireColumnAdded(TableColumnModelEvent)
-
fireColumnMarginChanged()
-
fireColumnMoved(TableColumnModelEvent)
-
fireColumnRemoved(TableColumnModelEvent)
-
fireColumnSelectionChanged(ListSelectionEvent)
-
getColumn(int)
- Returns the TableColumn object for the column at columnIndex
getColumn(Object)
- Returns the TableColumn object for the column in the receiver's
columns array whose identifier is equal to
identifier, when compared using equals().
getColumnCount()
- Returns the number of columns in the receiver's table columns array.
getColumnIndex(Object)
- Returns the index of the first column in the receiver's
columns array whose identifier is equal to identifier,
when compared using equals().
getColumnIndexAtX(int)
- Returns the index of the column that lies on the xPosition,
or -1 if it lies outside the any of the column's bounds.
getColumnMargin()
- Returns the width margin for TableColumn.
getColumns()
- Returns an Enumeration of all the columns in the model
getColumnSelectionAllowed()
-
getEmptySelectionAllowed()
-
getMultipleSelectionAllowed()
-
getSelectedColumn()
-
getSelectedColumnCount()
-
getSelectedColumns()
-
getSelectionModel()
- Returns the ListSelectionModel that is used to maintain column
selection state.
getTotalColumnWidth()
-
isColumnSelected(int)
-
isColumnSelected(Object)
-
makeSelectionEmpty()
-
moveColumn(int, int)
- Moves the column and heading at columnIndex to newIndex.
propertyChange(PropertyChangeEvent)
-
recalcWidthCache()
-
removeColumn(TableColumn)
- Deletes the TableColumn column from the
receiver's table columns array.
removeColumnModelListener(TableColumnModelListener)
-
removeColumnSelectionInterval(int, int)
-
selectAll()
-
setColumnMargin(int)
- Sets the column margin to newMargin.
setColumnSelectionAllowed(boolean)
-
setColumnSelectionInterval(int, int)
-
setEmptySelectionAllowed(boolean)
-
setMultipleSelectionAllowed(boolean)
-
setSelectionModel(ListSelectionModel)
- Sets the selection model for this TableColumnModel to newModel
and registers with for listner notifications from the new selection
model.
valueChanged(ListSelectionEvent)
-
tableColumns
protected Vector tableColumns
- Array of TableColumn objects in this model
selectionModel
protected ListSelectionModel selectionModel
- Model for keeping track of column selections
columnMargin
protected int columnMargin
- Width margin between each column
listenerList
protected EventListenerList listenerList
- List of TableColumnModelListener
changeEvent
protected transient ChangeEvent changeEvent
- Change event (only one needed)
multipleSelectionAllowed
protected boolean multipleSelectionAllowed
- Multiple columns selected allowed in this column model
emptySelectionAllowed
protected boolean emptySelectionAllowed
- Empty selection allowed in this column model
columnSelectionAllowed
protected boolean columnSelectionAllowed
- Column selection allowed in this column model
totalColumnWidth
protected int totalColumnWidth
- A local cache of the combined width of all columns
DefaultTableColumnModel
public DefaultTableColumnModel()
addColumn
public void addColumn(TableColumn aColumn)
- Appends aColumn to the end of the receiver's tableColumns array.
This method also posts the columnAdded() event to its listeners.
- Parameters:
- column - The TableColumn to be added
- Throws:
IllegalArgumentException
- if aColumn is null
- See Also:
- removeColumn
removeColumn
public void removeColumn(TableColumn column)
- Deletes the TableColumn column from the
receiver's table columns 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 the columnRemoved() event to its listeners.
- Parameters:
- column - The TableColumn to be removed
- See Also:
- addColumn
moveColumn
public void moveColumn(int columnIndex,
int newIndex)
- Moves the column and heading at 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 the columnMoved() event to its listeners.
- Parameters:
- columnIndex - the index of column to be moved
- newIndex - New index to move the column
- Throws:
IllegalArgumentException
- if column or
newIndex
are not in the valid range
setColumnMargin
public void setColumnMargin(int newMargin)
- Sets the column margin to newMargin.
This method also posts the columnMarginChanged() event to its
listeners.
- Parameters:
- newMargin - the width margin of the column
- See Also:
- getColumnMargin, getTotalColumnWidth
getColumnCount
public int getColumnCount()
- Returns the number of columns in the receiver's table columns array.
- Returns:
- the number of columns in the receiver's table columns array
- See Also:
- getColumns
getColumns
public Enumeration getColumns()
- Returns an Enumeration of all the columns in the model
getColumnIndex
public int getColumnIndex(Object identifier)
- Returns the index of the first column in the receiver's
columns array whose identifier is equal to identifier,
when compared using equals().
Returns -1 if no column is found with the specified identifier.
- Parameters:
- identifier - the identifier object
- Returns:
- the index of the first table column in the receiver's
tableColumns array whose identifier is equal to
identifier, when compared using equals().
- Throws:
IllegalArgumentException
- if identifier is null
- See Also:
- getColumn
getColumn
public TableColumn getColumn(Object identifier)
- Returns the TableColumn object for the column in the receiver's
columns array whose identifier is equal to
identifier, when compared using equals().
Returns null if no column is found with the specified identifier.
- Parameters:
- identifier - the identifier object
- Returns:
- the TableColumn object for the column in the receiver's
tableColumns array whose identifier is equal to
identifier, when compared using equals()
- Throws:
IllegalArgumentException
- if identifier is null
- See Also:
- getColumnIndex
getColumn
public TableColumn getColumn(int columnIndex)
- Returns the TableColumn object for the column at columnIndex
- Parameters:
- columnIndex - the index of the column desired
- Returns:
- the TableColumn object for the column at columnIndex
getColumnMargin
public int getColumnMargin()
- Returns the width margin for TableColumn.
The default columnMargin is 2.
- Returns:
- the maximum width for the TableColumn.
- See Also:
- setColumnMargin
getColumnIndexAtX
public int getColumnIndexAtX(int xPosition)
- Returns the index of the column that lies on the xPosition,
or -1 if it lies outside the any of the column's bounds.
- Returns:
- the index of the column or -1 if no column is found
getTotalColumnWidth
public int getTotalColumnWidth()
setSelectionModel
public void setSelectionModel(ListSelectionModel newModel)
- Sets the selection model for this TableColumnModel to newModel
and registers with for listner notifications from the new selection
model. If newModel is null, it means columns are not
selectable.
- Parameters:
- newModel - the new selection model
- See Also:
- getSelectionModel
getSelectionModel
public ListSelectionModel getSelectionModel()
- Returns the ListSelectionModel that is used to maintain column
selection state.
- Returns:
- the object that provides column selection state. Or
null if row selection is not allowed.
- See Also:
- setSelectionModel
setMultipleSelectionAllowed
public void setMultipleSelectionAllowed(boolean flag)
getMultipleSelectionAllowed
public boolean getMultipleSelectionAllowed()
setEmptySelectionAllowed
public void setEmptySelectionAllowed(boolean flag)
getEmptySelectionAllowed
public boolean getEmptySelectionAllowed()
setColumnSelectionAllowed
public void setColumnSelectionAllowed(boolean flag)
getColumnSelectionAllowed
public boolean getColumnSelectionAllowed()
selectAll
public void selectAll()
clearSelection
public void clearSelection()
makeSelectionEmpty
public void makeSelectionEmpty()
setColumnSelectionInterval
public void setColumnSelectionInterval(int index0,
int index1)
addColumnSelectionInterval
public void addColumnSelectionInterval(int index0,
int index1)
removeColumnSelectionInterval
public void removeColumnSelectionInterval(int index0,
int index1)
getSelectedColumn
public int getSelectedColumn()
getSelectedColumns
public int[] getSelectedColumns()
getSelectedColumnCount
public int getSelectedColumnCount()
isColumnSelected
public boolean isColumnSelected(int columnIndex)
isColumnSelected
public boolean isColumnSelected(Object identifier)
addColumnModelListener
public void addColumnModelListener(TableColumnModelListener x)
removeColumnModelListener
public void removeColumnModelListener(TableColumnModelListener x)
fireColumnAdded
protected void fireColumnAdded(TableColumnModelEvent e)
fireColumnRemoved
protected void fireColumnRemoved(TableColumnModelEvent e)
fireColumnMoved
protected void fireColumnMoved(TableColumnModelEvent e)
fireColumnSelectionChanged
protected void fireColumnSelectionChanged(ListSelectionEvent e)
fireColumnMarginChanged
protected void fireColumnMarginChanged()
propertyChange
public void propertyChange(PropertyChangeEvent evt)
valueChanged
public void valueChanged(ListSelectionEvent e)
createSelectionModel
protected ListSelectionModel createSelectionModel()
recalcWidthCache
protected void recalcWidthCache()
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature