|
JavaTM 2 Platform Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.table.DefaultTableColumnModel
The standard column-handler for a JTable.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.
JTable
, Serialized FormField Summary | |
protected ChangeEvent |
changeEvent
Change event (only one needed) |
protected int |
columnMargin
Width margin between each column |
protected boolean |
columnSelectionAllowed
Column selection allowed in this column model |
protected EventListenerList |
listenerList
List of TableColumnModelListener |
protected ListSelectionModel |
selectionModel
Model for keeping track of column selections |
protected Vector |
tableColumns
Array of TableColumn objects in this model |
protected int |
totalColumnWidth
A local cache of the combined width of all columns |
Constructor Summary | |
DefaultTableColumnModel()
Creates a default table column model. |
Method Summary | |
void |
addColumn(TableColumn aColumn)
Appends aColumn to the end of the receiver's tableColumns array. |
void |
addColumnModelListener(TableColumnModelListener x)
Add a listener for table column model events. |
protected ListSelectionModel |
createSelectionModel()
|
protected void |
fireColumnAdded(TableColumnModelEvent e)
|
protected void |
fireColumnMarginChanged()
|
protected void |
fireColumnMoved(TableColumnModelEvent e)
|
protected void |
fireColumnRemoved(TableColumnModelEvent e)
|
protected void |
fireColumnSelectionChanged(ListSelectionEvent e)
|
TableColumn |
getColumn(int columnIndex)
Returns the TableColumn object for the column at columnIndex |
int |
getColumnCount()
Returns the number of columns in the receiver's table columns array. |
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(). |
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. |
int |
getColumnMargin()
Returns the width margin for TableColumn. |
Enumeration |
getColumns()
Returns an Enumeration of all the columns in the model |
boolean |
getColumnSelectionAllowed()
Returns true if columns can be selected. |
int |
getSelectedColumnCount()
Returns the number of selected columns. |
int[] |
getSelectedColumns()
Returns an array of indexes for selected columns |
ListSelectionModel |
getSelectionModel()
Returns the ListSelectionModel that is used to maintain column selection state. |
int |
getTotalColumnWidth()
Returns the total width of all the columns. |
void |
moveColumn(int columnIndex,
int newIndex)
Moves the column and heading at columnIndex to newIndex. |
void |
propertyChange(PropertyChangeEvent evt)
This method gets called when a bound property is changed. |
protected void |
recalcWidthCache()
|
void |
removeColumn(TableColumn column)
Deletes the TableColumn column from the receiver's table columns array. |
void |
removeColumnModelListener(TableColumnModelListener x)
Remove a listener for table column model events. |
void |
setColumnMargin(int newMargin)
Sets the column margin to newMargin. |
void |
setColumnSelectionAllowed(boolean flag)
Sets whether the columns in this model can be selected. |
void |
setSelectionModel(ListSelectionModel newModel)
Sets the selection model for this TableColumnModel to newModel and registers with for listner notifications from the new selection model. |
void |
valueChanged(ListSelectionEvent e)
Called whenever the value of the selection changes. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected Vector tableColumns
protected ListSelectionModel selectionModel
protected int columnMargin
protected EventListenerList listenerList
protected transient ChangeEvent changeEvent
protected boolean columnSelectionAllowed
protected int totalColumnWidth
Constructor Detail |
public DefaultTableColumnModel()
Method Detail |
public void addColumn(TableColumn aColumn)
column
- The TableColumn to be addedremoveColumn(javax.swing.table.TableColumn)
public void removeColumn(TableColumn column)
column
- The TableColumn to be removedaddColumn(javax.swing.table.TableColumn)
public void moveColumn(int columnIndex, int newIndex)
columnIndex
- the index of column to be movednewIndex
- New index to move the columnpublic void setColumnMargin(int newMargin)
newMargin
- the width margin of the columngetColumnMargin()
,
getTotalColumnWidth()
public int getColumnCount()
getColumns()
public Enumeration getColumns()
public int getColumnIndex(Object identifier)
identifier
- the identifier objectgetColumn(int)
public TableColumn getColumn(int columnIndex)
columnIndex
- the index of the column desiredpublic int getColumnMargin()
setColumnMargin(int)
public int getColumnIndexAtX(int xPosition)
public int getTotalColumnWidth()
public void setSelectionModel(ListSelectionModel newModel)
newModel
- the new selection modelgetSelectionModel()
public ListSelectionModel getSelectionModel()
#setSelectionModel()
public void setColumnSelectionAllowed(boolean flag)
public boolean getColumnSelectionAllowed()
TableColumnModel.setColumnSelectionAllowed(boolean)
public int[] getSelectedColumns()
public int getSelectedColumnCount()
public void addColumnModelListener(TableColumnModelListener x)
x
- a TableColumnModelListener objectpublic void removeColumnModelListener(TableColumnModelListener x)
x
- a TableColumnModelListener objectprotected void fireColumnAdded(TableColumnModelEvent e)
protected void fireColumnRemoved(TableColumnModelEvent e)
protected void fireColumnMoved(TableColumnModelEvent e)
protected void fireColumnSelectionChanged(ListSelectionEvent e)
protected void fireColumnMarginChanged()
public void propertyChange(PropertyChangeEvent evt)
evt
- A PropertyChangeEvent object describing the event source
and the property that has changed.public void valueChanged(ListSelectionEvent e)
e
- the event that characterizes the change.protected ListSelectionModel createSelectionModel()
protected void recalcWidthCache()
|
JavaTM 2 Platform Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |