A
TableColumn represents all the attributes of a column in a
JTable, such as width, resizibility, minimum and maximum width.
In addition, the
TableColumn provides slots for a renderer and
an editor that can be used to display and edit the values in this column.
It is also possible to specify renderers and editors on a per type basis
rather than a per column basis - see the
setDefaultRenderer method in the JTable class.
This default mechanism is only used when the renderer (or
editor) in the TableColumn is null.
The TableColumn stores the link between the columns in the
JTable and the columns in the TableModel.
The modelIndex is the column in the
TableModel, which will be queried for the data values for the
cells in this column. As the column moves around in the view this
modelIndex does not change.
Note: Some implementations may assume that all
TableColumnModels are unique, therefore we would
recommend that the same TableColumn instance
not be added more than once to a TableColumnModel.
To show TableColumns with the same column of
data from the model, create a new instance with the same
modelIndex.
public function TableColumn(modelIndex:int = 0, width:int = 75, cellRenderer:TableCellFactory = null, cellEditor:TableCellEditor = null)
Create a TableColumn.
Parameters
| modelIndex:int (default = 0) — modelIndex
|
| |
| width:int (default = 75) — the (optional)width of the column, default to 75
|
| |
| cellRenderer:TableCellFactory (default = null) — (optional)the cell renderer for this column cells
|
| |
| cellEditor:TableCellEditor (default = null) — (optional)the cell editor for this column cells
|
public function addPropertyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Adds a property change listener.
Parameters
| listener:Function — the listener
|
| |
| priority:int (default = 0) — the priority
|
| |
| useWeakReference:Boolean (default = false) — Determines whether the reference to the listener is strong or weak.
|
See also
org.aswing.event.PropertyChangeEvent.PROPERTY_CHANGE
public function createDefaultHeaderRenderer():TableCellFactory
Returns
protected function firePropertyChangeIfReallyChanged(propertyName:String, oldValue:*, newValue:*):voidParameters
| propertyName:String |
| |
| oldValue:* |
| |
| newValue:* |
public function getCellEditor():TableCellEditor
Returns
public function getCellFactory():TableCellFactory
Returns
public function getHeaderCellFactory():TableCellFactory
Returns
public function getHeaderValue():Object
Returns
public function getIdentifier():Object
Returns
public function getMaxWidth():int
Returns
public function getMinWidth():int
Returns
public function getModelIndex():int
Returns
public function getPreferredWidth():int
Returns
public function getResizable():Boolean
Returns
public function getWidth():int
Returns
public function removePropertyChangeListener(listener:Function):void
Removes a property change listener.
Parameters
| listener:Function — the listener to be removed.
|
public function setCellEditor(cellEditor:TableCellEditor):voidParameters
public function setCellFactory(cellRenderer:TableCellFactory):voidParameters
public function setHeaderCellFactory(headerRenderer:TableCellFactory):voidParameters
public function setHeaderValue(headerValue:Object):voidParameters
public function setIdentifier(identifier:Object):voidParameters
public function setMaxWidth(maxWidth:int):voidParameters
public function setMinWidth(minWidth:int):voidParameters
public function setModelIndex(modelIndex:int):voidParameters
public function setPreferredWidth(preferredWidth:int):voidParameters
public function setResizable(isResizable:Boolean):voidParameters
public function setWidth(width:int):voidParameters
public function sizeWidthToFit():void
Resizes the TableColumn to fit the width of its header cell.
This method does nothing if the header renderer is null
(the default case). Otherwise, it sets the minimum, maximum and preferred
widths of this column to the widths of the minimum, maximum and preferred
sizes of the Component delivered by the header renderer.
The transient "width" property of this TableColumn is also set to the
preferred width. Note this method is not used internally by the table
package.
See also
Event object type: org.aswing.event.PropertyChangeEvent
PropertyChangeEvent.type property = org.aswing.event.PropertyChangeEvent.PROPERTY_CHANGE
Dispatched when a property changed.
The PropertyChangeEvent.PROPERTY_CHANGE constant defines the value of the
type property of the event object for a propertyChange event.
The properties of the event object have the following values:
| Property | Value |
bubbles | false |
cancelable | false |
getPropertyName() | value changed property name |
getOldValue() | old value |
getNewValue() | new value |
currentTarget | The Object that defines the
event listener that handles the event. For example, if you use
comp.addEventListener() to register an event listener,
comp is the value of the currentTarget. |
target | The Object that dispatched the event;
it is not always the Object listening for the event.
Use the currentTarget property to always access the
Object listening for the event. |
public static const CELL_RENDERER_PROPERTY:String = "cellRenderer"
public static const COLUMN_WIDTH_PROPERTY:String = "columWidth"
public static const HEADER_RENDERER_PROPERTY:String = "headerRenderer"
public static const HEADER_VALUE_PROPERTY:String = "headerValue"