Packageorg.aswing.table
Classpublic class TableColumn
InheritanceTableColumn Inheritance flash.events.EventDispatcher

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 Methods
 MethodDefined by
  
TableColumn(modelIndex:int = 0, width:int = 75, cellRenderer:TableCellFactory = null, cellEditor:TableCellEditor = null)
Create a TableColumn.
TableColumn
  
addPropertyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Adds a property change listener.
TableColumn
  
TableColumn
  
TableColumn
  
TableColumn
  
TableColumn
  
getHeaderValue():Object
TableColumn
  
getIdentifier():Object
TableColumn
  
TableColumn
  
TableColumn
  
TableColumn
  
TableColumn
  
getResizable():Boolean
TableColumn
  
getWidth():int
TableColumn
  
removePropertyChangeListener(listener:Function):void
Removes a property change listener.
TableColumn
  
setCellEditor(cellEditor:TableCellEditor):void
TableColumn
  
setCellFactory(cellRenderer:TableCellFactory):void
TableColumn
  
TableColumn
  
setHeaderValue(headerValue:Object):void
TableColumn
  
setIdentifier(identifier:Object):void
TableColumn
  
setMaxWidth(maxWidth:int):void
TableColumn
  
setMinWidth(minWidth:int):void
TableColumn
  
setModelIndex(modelIndex:int):void
TableColumn
  
setPreferredWidth(preferredWidth:int):void
TableColumn
  
setResizable(isResizable:Boolean):void
TableColumn
  
setWidth(width:int):void
TableColumn
  
Resizes the TableColumn to fit the width of its header cell.
TableColumn
Protected Methods
 MethodDefined by
  
firePropertyChangeIfReallyChanged(propertyName:String, oldValue:*, newValue:*):void
TableColumn
Events
 EventSummaryDefined by
   Dispatched when a property changed.TableColumn
Public Constants
 ConstantDefined by
  CELL_RENDERER_PROPERTY : String = "cellRenderer"
[static]
TableColumn
  COLUMN_WIDTH_PROPERTY : String = "columWidth"
[static]
TableColumn
  HEADER_RENDERER_PROPERTY : String = "headerRenderer"
[static]
TableColumn
  HEADER_VALUE_PROPERTY : String = "headerValue"
[static]
TableColumn
Constructor detail
TableColumn()constructor
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
Method detail
addPropertyChangeListener()method
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
createDefaultHeaderRenderer()method 
public function createDefaultHeaderRenderer():TableCellFactory

Returns
TableCellFactory
firePropertyChangeIfReallyChanged()method 
protected function firePropertyChangeIfReallyChanged(propertyName:String, oldValue:*, newValue:*):voidParameters
propertyName:String
 
oldValue:*
 
newValue:*
getCellEditor()method 
public function getCellEditor():TableCellEditor

Returns
TableCellEditor
getCellFactory()method 
public function getCellFactory():TableCellFactory

Returns
TableCellFactory
getHeaderCellFactory()method 
public function getHeaderCellFactory():TableCellFactory

Returns
TableCellFactory
getHeaderValue()method 
public function getHeaderValue():Object

Returns
Object
getIdentifier()method 
public function getIdentifier():Object

Returns
Object
getMaxWidth()method 
public function getMaxWidth():int

Returns
int
getMinWidth()method 
public function getMinWidth():int

Returns
int
getModelIndex()method 
public function getModelIndex():int

Returns
int
getPreferredWidth()method 
public function getPreferredWidth():int

Returns
int
getResizable()method 
public function getResizable():Boolean

Returns
Boolean
getWidth()method 
public function getWidth():int

Returns
int
removePropertyChangeListener()method 
public function removePropertyChangeListener(listener:Function):void

Removes a property change listener.

Parameters
listener:Function — the listener to be removed.
setCellEditor()method 
public function setCellEditor(cellEditor:TableCellEditor):voidParameters
cellEditor:TableCellEditor
setCellFactory()method 
public function setCellFactory(cellRenderer:TableCellFactory):voidParameters
cellRenderer:TableCellFactory
setHeaderCellFactory()method 
public function setHeaderCellFactory(headerRenderer:TableCellFactory):voidParameters
headerRenderer:TableCellFactory
setHeaderValue()method 
public function setHeaderValue(headerValue:Object):voidParameters
headerValue:Object
setIdentifier()method 
public function setIdentifier(identifier:Object):voidParameters
identifier:Object
setMaxWidth()method 
public function setMaxWidth(maxWidth:int):voidParameters
maxWidth:int
setMinWidth()method 
public function setMinWidth(minWidth:int):voidParameters
minWidth:int
setModelIndex()method 
public function setModelIndex(modelIndex:int):voidParameters
modelIndex:int
setPreferredWidth()method 
public function setPreferredWidth(preferredWidth:int):voidParameters
preferredWidth:int
setResizable()method 
public function setResizable(isResizable:Boolean):voidParameters
isResizable:Boolean
setWidth()method 
public function setWidth(width:int):voidParameters
width:int
sizeWidthToFit()method 
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 detail
propertyChangeevent 
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:

PropertyValue
bubblesfalse
cancelablefalse
getPropertyName()value changed property name
getOldValue()old value
getNewValue()new value
currentTargetThe 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.
targetThe 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.
Constant detail
CELL_RENDERER_PROPERTYconstant
public static const CELL_RENDERER_PROPERTY:String = "cellRenderer"
COLUMN_WIDTH_PROPERTYconstant 
public static const COLUMN_WIDTH_PROPERTY:String = "columWidth"
HEADER_RENDERER_PROPERTYconstant 
public static const HEADER_RENDERER_PROPERTY:String = "headerRenderer"
HEADER_VALUE_PROPERTYconstant 
public static const HEADER_VALUE_PROPERTY:String = "headerValue"