// Copyright 2007. Adobe Systems Incorporated. All Rights Reserved. package fl.events { import flash.events.Event; import fl.events.ListEvent; /** * The DataGridEvent class defines events that are associated with the DataGrid component. * These include the following events: * * * @see fl.controls.DataGrid * @see DataGridEventReason * * @includeExample examples/DataGridEventExample.as * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public class DataGridEvent extends ListEvent { /** * The DataGridEvent.COLUMN_STRETCH constant defines the value of the type property * of a columnStretch event object. * *

This event has the following properties:

* * * * * * * * * * * *
PropertyValue
bubblesfalse
cancelablefalse; there is no default * behavior to cancel.
columnIndexThe zero-based index of the header column * in the columns array of the DataGrid object.
currentTargetThe object that is actively processing * the event object with an event listener.
dataFieldThe name of the field or property in the data * associated with the column of the item.
itemRendererThe header renderer for the column that * was stretched.
reasonnull
rowIndexThe zero-based index of the item in the * data provider.
targetThe object that dispatched the event. The target is * not always the object listening for the event. Use the currentTarget * property to access the object that is listening for the event.
* * @includeExample ../controls/examples/DataGrid.columnStretch.1.as -noswf * * @eventType columnStretch * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public static const COLUMN_STRETCH:String = "columnStretch"; /** * The DataGridEvent.HEADER_RELEASE constant defines the value of the type property * of a headerRelease event object. * *

This event has the following properties:

* * * * * * * * * * * *
PropertyValue
bubblesfalse
cancelablefalse; there is no default * behavior to cancel.
columnIndexThe zero-based index of the header column * in the columns array of the DataGrid object.
currentTargetThe object that is actively processing * the event object with an event listener.
dataFieldThe name of the field or property in the data * associated with the column of the item.
itemRendererThe header renderer that was clicked.
reasonnull
rowIndex-1
targetThe object that dispatched the event. The target is * not always the object listening for the event. Use the currentTarget * property to access the object that is listening for the event.
* * @includeExample ../controls/examples/DataGrid.headerRelease.1.as -noswf * * @eventType headerRelease * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public static const HEADER_RELEASE:String = "headerRelease"; /** * The DataGridEvent.ITEM__EDIT_BEGINNING constant defines the value of the * type property of an itemEditBeginning event object. * *

This event has the following properties:

* * * * * * * * * * * *
PropertyValue
bubblesfalse
cancelablefalse; there is no default * behavior to cancel.
columnIndexThe zero-based index of the header column * in the columns array of the DataGrid object.
currentTargetThe object that is actively processing * the event object with an event listener.
dataFieldThe name of the field or property in the data * associated with the column of the item.
itemRendererThe item renderer for the item to * be edited.
reasonnull
rowIndexThe zero-based index of the item in the * data provider.
targetThe object that dispatched the event. The target is * not always the object listening for the event. Use the currentTarget * property to access the object that is listening for the event.
* * @eventType itemEditBeginning * * @see #ITEM_EDIT_BEGIN * @see #ITEM_EDIT_END * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public static const ITEM_EDIT_BEGINNING:String = "itemEditBeginning"; /** * The DataGridEvent.ITEM_EDIT_BEGIN constant defines the value of * the type property of an itemEditBegin event object. * *

This event has the following properties:

* * * * * * * * * * * *
PropertyValue
bubblesfalse
cancelablefalse; there is no default * behavior to cancel.
columnIndexThe zero-based index of the header column * in the columns array of the DataGrid object.
currentTargetThe object that is actively processing * the event object with an event listener.
dataFieldnull
itemRendererThe item renderer for the item to * be edited.
reasonnull
rowIndexThe zero-based index of the item in the * data provider.
targetThe object that dispatched the event. The target is * not always the object listening for the event. Use the currentTarget * property to access the object that is listening for the event.
* * @eventType itemEditBegin * * @see #ITEM_EDIT_BEGINNING * @see #ITEM_EDIT_END * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public static const ITEM_EDIT_BEGIN:String = "itemEditBegin"; /** * The DataGridEvent.ITEM_EDIT_END constant defines the value of the type * property of an itemEditEnd event object. * *

This event has the following properties:

* * * * * * * * * * * *
PropertyValue
bubblesfalse
cancelablefalse; there is no default * behavior to cancel.
columnIndexThe zero-based index of the header column * in the columns array of the DataGrid object.
currentTargetThe object that is actively processing * the event object with an event listener.
dataFieldThe name of the field or property in the data * associated with the column of the item.
itemRendererThe item renderer for the item to * be edited.
reasonA constant defining the reason for the event. The * value must be a member of the DataGridEventReason class.
rowIndexThe zero-based index of the item in the * data provider.
targetThe object that dispatched the event. The target is * not always the object listening for the event. Use the currentTarget * property to access the object that is listening for the event.
* * @eventType itemEditEnd * * @see #ITEM_EDIT_BEGIN * @see #ITEM_EDIT_BEGINNING * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public static const ITEM_EDIT_END:String = "itemEditEnd"; /** * The DataGridEvent.ITEM_FOCUS_IN constant defines the value of the type * property of a itemFocusIn event object. * *

This event has the following properties:

* * * * * * * * * * * *
PropertyValue
bubblesfalse
cancelablefalse; there is no default * behavior to cancel.
columnIndexThe zero-based index of the header column * in the columns array of the DataGrid object.
currentTargetThe object that is actively processing * the event object with an event listener.
dataFieldnull
itemRendererThe item renderer for the item to * be edited.
reasonnull
rowIndexThe zero-based index of the item in the * data provider.
targetThe object that dispatched the event. The target is * not always the object listening for the event. Use the currentTarget * property to access the object that is listening for the event.
* * @eventType itemFocusIn * * @see #ITEM_FOCUS_OUT * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public static const ITEM_FOCUS_IN:String = "itemFocusIn"; /** * The DataGridEvent.ITEM_FOCUS_OUT constant defines the value of the type * property of an itemFocusOut event object. * *

This event has the following properties:

* * * * * * * * * * * *
PropertyValue
bubblesfalse
cancelablefalse; there is no default * behavior to cancel.
columnIndexThe zero-based index of the header column * in the columns array of the DataGrid object.
currentTargetThe object that is actively processing * the event object with an event listener.
dataFieldnull
itemRendererThe item renderer for the item to * be edited.
reasonnull
rowIndexThe zero-based index of the item in the * data provider.
targetThe object that dispatched the event. The target is * not always the object listening for the event. Use the currentTarget * property to access the object that is listening for the event.
* * @eventType itemFocusOut * * @see #ITEM_FOCUS_IN * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public static const ITEM_FOCUS_OUT:String = "itemFocusOut"; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var _dataField:String; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var _itemRenderer:Object; /** * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ protected var _reason:String; /** * Gets the item renderer for the item that is being edited or the * header renderer that is being clicked or resized. * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function get itemRenderer():Object { return _itemRenderer; } /** * Gets or sets the name of the field or property in the data associated with the column. * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function get dataField():String { return _dataField; } /** * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function set dataField(value:String):void { _dataField = value; } /** * Gets the reason the itemEditEnd event was dispatched. * This property is only valid for events of type DataGridEvent.ITEM_EDIT_END. *

The possible values are defined in the DataGridEventReason class.

* * @see fl.controls.DataGrid#event:itemEditEnd * @see DataGridEventReason * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function get reason():String { return _reason; } /** * Creates a new DataGridEvent object with the specified parameters. * * @param type The event type; this value indicates the action that caused the event. * * @param bubbles Indicates whether the event can bubble up the display list hierarchy. * * @param cancelable Indicates whether the behavior associated with the event can be * prevented. * * @param columnIndex The zero-based index of the column that contains the renderer. * * @param rowIndex The zero-based index of the row that contains the renderer. * * @param itemRenderer The item renderer for the item that is being edited or the header * render that is being clicked or stretched. * * @param dataField The name of the field or property in the data associated with the column. * * @param reason The reason the itemEditEnd event was dispatched. * * @see DataGridEventReason * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ public function DataGridEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, columnIndex:int=-1, rowIndex:int=-1, itemRenderer:Object=null, dataField:String=null, reason:String=null) { super(type, bubbles, cancelable, columnIndex, rowIndex); _itemRenderer = itemRenderer; _dataField = dataField; _reason = reason; } /** * Returns a string that contains all the properties of the DataGridEvent object. The * string is in the following format: * *

[DataGridEvent type=value bubbles=value * cancelable=value columnIndex=value rowIndex=value * itemRenderer=value dataField=value reason=value]

* * @return A string that contains all the properties of the DataGridEvent object. * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ override public function toString():String { return formatToString("DataGridEvent", "type", "bubbles", "cancelable", "columnIndex", "rowIndex", "itemRenderer", "dataField", "reason"); } /** * Creates a copy of the DataGridEvent object and sets the value of each * property to match the original. * * @return A new DataGridEvent object with parameter values that match those of the original. * * @langversion 3.0 * @playerversion Flash 9.0.28.0 */ override public function clone():Event { return new DataGridEvent(type, bubbles, cancelable, columnIndex, int(rowIndex), _itemRenderer, _dataField, _reason); } } }