PageRenderTime 35ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/FD3/FlashDevelop/Bin/Debug/Library/AS3/frameworks/FlashIDE/fl/controls/DataGrid.as

https://bitbucket.org/kkszysiu/flashdevelop
ActionScript | 641 lines | 187 code | 4 blank | 450 comment | 0 complexity | 5389c979e5988373510d78dc7a0a991b MD5 | raw file
  1. package fl.controls
  2. {
  3. import fl.controls.dataGridClasses.DataGridColumn;
  4. import fl.controls.dataGridClasses.HeaderRenderer;
  5. import fl.controls.listClasses.CellRenderer;
  6. import fl.controls.listClasses.ICellRenderer;
  7. import fl.controls.listClasses.ListData;
  8. import fl.controls.ScrollPolicy;
  9. import fl.controls.SelectableList;
  10. import fl.controls.TextInput;
  11. import fl.core.UIComponent;
  12. import fl.core.InvalidationType;
  13. import fl.data.DataProvider;
  14. import fl.events.ScrollEvent;
  15. import fl.events.ListEvent;
  16. import fl.events.DataGridEvent;
  17. import fl.events.DataGridEventReason;
  18. import fl.events.DataChangeType;
  19. import fl.events.DataChangeEvent;
  20. import fl.managers.IFocusManager;
  21. import fl.managers.IFocusManagerComponent;
  22. import flash.display.Sprite;
  23. import flash.display.Graphics;
  24. import flash.display.InteractiveObject;
  25. import flash.display.DisplayObjectContainer;
  26. import flash.events.MouseEvent;
  27. import flash.events.Event;
  28. import flash.events.KeyboardEvent;
  29. import flash.events.FocusEvent;
  30. import flash.ui.Keyboard;
  31. import flash.ui.Mouse;
  32. import flash.display.DisplayObject;
  33. import flash.utils.Dictionary;
  34. import flash.utils.describeType;
  35. import flash.geom.Point;
  36. import flash.system.IME;
  37. /**
  38. * Dispatched after the user clicks a header cell. * * @includeExample examples/DataGrid.headerRelease.1.as -noswf * * @eventType fl.events.DataGridEvent.HEADER_RELEASE * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  39. */
  40. [Event(name="headerRelease", type="fl.events.DataGridEvent")]
  41. /**
  42. * Dispatched after a user expands a column horizontally. * * @includeExample examples/DataGrid.columnStretch.1.as -noswf * * @eventType fl.events.DataGridEvent.COLUMN_STRETCH * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  43. */
  44. [Event(name="columnStretch", type="fl.events.DataGridEvent")]
  45. /**
  46. * Dispatched after a user prepares to edit an item, for example, * by releasing the mouse button over the item. * * @eventType fl.events.DataGridEvent.ITEM_EDIT_BEGINNING * * @see #event:itemEditBegin * @see #event:itemEditEnd * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  47. */
  48. [Event(name="itemEditBeginning", type="fl.events.DataGridEvent")]
  49. /**
  50. * Dispatched after the <code>editedItemPosition</code> property is set * and the item can be edited. * * @eventType fl.events.DataGridEvent.ITEM_EDIT_BEGIN * * @see #event:itemEditBeginning * @see #event:itemEditEnd * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  51. */
  52. [Event(name="itemEditBegin", type="fl.events.DataGridEvent")]
  53. /**
  54. * Dispatched when an item editing session ends for any reason. * * @eventType fl.events.DataGridEvent.ITEM_EDIT_END * * @see #event:itemEditBegin * @see #event:itemEditBeginning * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  55. */
  56. [Event(name="itemEditEnd", type="fl.events.DataGridEvent")]
  57. /**
  58. * Dispatched after an item receives focus. * * @eventType fl.events.DataGridEvent.ITEM_FOCUS_IN * * @see #event:itemFocusOut * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  59. */
  60. [Event(name="itemFocusIn", type="fl.events.DataGridEvent")]
  61. /**
  62. * Dispatched after an item loses focus. * * @eventType fl.events.DataGridEvent.ITEM_FOCUS_OUT * * @see #event:itemFocusIn * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  63. */
  64. [Event(name="itemFocusOut", type="fl.events.DataGridEvent")]
  65. /**
  66. * The name of the class that provides the cursor that is used when * the mouse is between two column headers and the <code>resizableColumns</code> * property is set to <code>true</code>. * * @default DataGrid_columnStretchCursorSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  67. */
  68. [Style(name="columnStretchCursorSkin", type="Class")]
  69. /**
  70. * The name of the class that provides the divider that appears * between columns. * * @default DataGrid_columnDividerSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  71. */
  72. [Style(name="columnDividerSkin", type="Class")]
  73. /**
  74. * The name of the class that provides the background for each column header. * * @default HeaderRenderer_upSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  75. */
  76. [Style(name="headerUpSkin", type="Class")]
  77. /**
  78. * The name of the class that provides the background for each column header * when the mouse is over it. * * @default HeaderRenderer_overSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  79. */
  80. [Style(name="headerOverSkin", type="Class")]
  81. /**
  82. * The name of the class that provides the background for each column header * when the mouse is down. * * @default HeaderRenderer_downSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  83. */
  84. [Style(name="headerDownSkin", type="Class")]
  85. /**
  86. * The name of the class that provides the background for each column header * when the component is disabled. * * @default HeaderRenderer_disabledSkin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  87. */
  88. [Style(name="headerDisabledSkin", type="Class")]
  89. /**
  90. * The name of the class that provides the sort arrow when the sorted * column is in descending order. * * @default HeaderSortArrow_descIcon * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  91. */
  92. [Style(name="headerSortArrowDescSkin", type="Class")]
  93. /**
  94. * The name of the class that provides the sort arrow when the sorted * column is in ascending order. * * @default HeaderSortArrow_ascIcon * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  95. */
  96. [Style(name="headerSortArrowAscSkin", type="Class")]
  97. /**
  98. * The format to be applied to the text contained in each column header. * * @default null * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  99. */
  100. [Style(name="headerTextFormat", type="flash.text.TextFormat")]
  101. /**
  102. * The format to be applied to the text contained in each column header * when the component is disabled. * * @default null * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  103. */
  104. [Style(name="headerDisabledTextFormat", type="flash.text.TextFormat")]
  105. /**
  106. * The padding that separates the column header border from the column header * text, in pixels. * * @default 5 * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  107. */
  108. [Style(name="headerTextPadding", type="Number", format="Length")]
  109. /**
  110. * The name of the class that provides each column header. * * @default fl.controls.dataGridClasses.HeaderRenderer * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  111. */
  112. [Style(name="headerRenderer", type="Class")]
  113. /**
  114. * The DataGrid class is a list-based component that provides a grid of * rows and columns. You can specify an optional header row at the top * of the component that shows all the property names. Each row consists * of one or more columns, each of which represents a property that belongs * to the specified data object. The DataGrid component is used to view data; * it is not intended to be used as a layout tool like an HTML table. * * <p>A DataGrid component is well suited for the display of objects that contain * multiple properties. The data that a DataGrid component displays can * be contained in a DataProvider object or as an array of objects. The columns of a DataGrid * component can be represented by a list of DataGridColumn objects, * each of which contains information that is specific to the column.</p> * * <p>The DataGrid component provides the following features:</p> * <ul> * <li>Columns of different widths or identical fixed widths</li> * <li>Columns that the user can resize at run time</li> * <li>Columns that the user can reorder at run time by using ActionScript</li> * <li>Optional customizable column headers</li> * <li>Support for custom item renderers to display data other than text * in any column</li> * <li>Support for sorting data by clicking on the column that contains it</li> * </ul> * * <p>The DataGrid component is composed of subcomponents including ScrollBar, * HeaderRenderer, CellRenderer, DataGridCellEditor, and ColumnDivider components, all of which * can be skinned during authoring or at run time.</p> * * <p>The DataGrid component uses the following classes that can be found in the dataGridClasses package:</p> * <ul> * <li>DataGridColumn: Describes a column in a DataGrid component. Contains the indexes, * widths, and other properties of the column. Does not contain cell data.</li> * <li>HeaderRenderer: Displays the column header for the current DataGrid column. Contains * the label and other properties of the column header.</li> * <li>DataGridCellEditor: Manages the editing of the data for each cell.</li> * </ul> * * @includeExample examples/DataGridExample.as * * @see fl.controls.dataGridClasses.DataGridCellEditor DataGridCellEditor * @see fl.controls.dataGridClasses.DataGridColumn DataGridColumn * @see fl.controls.dataGridClasses.HeaderRenderer HeaderRenderer * @see fl.controls.listClasses.CellRenderer CellRenderer * @see fl.events.DataGridEvent DataGridEvent * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  115. */
  116. public class DataGrid extends SelectableList implements IFocusManagerComponent
  117. {
  118. /**
  119. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  120. */
  121. protected var _rowHeight : Number;
  122. /**
  123. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  124. */
  125. protected var _headerHeight : Number;
  126. /**
  127. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  128. */
  129. protected var _showHeaders : Boolean;
  130. /**
  131. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  132. */
  133. protected var _columns : Array;
  134. /**
  135. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  136. */
  137. protected var _minColumnWidth : Number;
  138. /**
  139. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  140. */
  141. protected var header : Sprite;
  142. /**
  143. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  144. */
  145. protected var headerMask : Sprite;
  146. /**
  147. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  148. */
  149. protected var headerSortArrow : Sprite;
  150. /**
  151. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  152. */
  153. protected var _cellRenderer : Object;
  154. /**
  155. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  156. */
  157. protected var _headerRenderer : Object;
  158. /**
  159. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  160. */
  161. protected var _labelFunction : Function;
  162. /**
  163. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  164. */
  165. protected var visibleColumns : Array;
  166. /**
  167. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  168. */
  169. protected var displayableColumns : Array;
  170. /**
  171. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  172. */
  173. protected var columnsInvalid : Boolean;
  174. /**
  175. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  176. */
  177. protected var minColumnWidthInvalid : Boolean;
  178. /**
  179. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  180. */
  181. protected var activeCellRenderersMap : Dictionary;
  182. /**
  183. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  184. */
  185. protected var availableCellRenderersMap : Dictionary;
  186. /**
  187. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  188. */
  189. protected var dragHandlesMap : Dictionary;
  190. /**
  191. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  192. */
  193. protected var columnStretchIndex : Number;
  194. /**
  195. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  196. */
  197. protected var columnStretchStartX : Number;
  198. /**
  199. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  200. */
  201. protected var columnStretchStartWidth : Number;
  202. /**
  203. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  204. */
  205. protected var columnStretchCursor : Sprite;
  206. /**
  207. * @private (protected) * The index of the column being sorted. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  208. */
  209. protected var _sortIndex : int;
  210. /**
  211. * @private (protected) * The index of the last column being sorted on. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  212. */
  213. protected var lastSortIndex : int;
  214. /**
  215. * @private (protected) * The direction of the current sort. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  216. */
  217. protected var _sortDescending : Boolean;
  218. /**
  219. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  220. */
  221. protected var _editedItemPosition : Object;
  222. /**
  223. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  224. */
  225. protected var editedItemPositionChanged : Boolean;
  226. /**
  227. * @private (protected) * <code>undefined</code> means we've processed it, <code>null</code> means don't put up an editor * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  228. */
  229. protected var proposedEditedItemPosition : *;
  230. /**
  231. * @private (protected) * Last known position of item editor instance * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  232. */
  233. protected var actualRowIndex : int;
  234. /**
  235. * @private (protected) * Last known position of item editor instance * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  236. */
  237. protected var actualColIndex : int;
  238. /**
  239. * @private (protected) * Whether the mouse button is pressed. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  240. */
  241. protected var isPressed : Boolean;
  242. /**
  243. * @private (protected) * True if we want to block editing on mouseUp. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  244. */
  245. protected var losingFocus : Boolean;
  246. /**
  247. * @private (protected) * Stores the user set headerheight (we modify header height when dg is resized down) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  248. */
  249. protected var maxHeaderHeight : Number;
  250. /**
  251. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  252. */
  253. protected var currentHoveredRow : int;
  254. /**
  255. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  256. */
  257. private static var defaultStyles : Object;
  258. /**
  259. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  260. */
  261. protected static const HEADER_STYLES : Object;
  262. /**
  263. * @private * Creates the Accessibility class. * This method is called from UIComponent. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  264. */
  265. public var createAccessibilityImplementation : Function;
  266. /**
  267. * Indicates whether or not the user can edit items in the data provider. * A value of <code>true</code> indicates that the user can edit items in the * data provider; a value of <code>false</code> indicates that the user cannot. * * <p>If this value is <code>true</code>, the item renderers in the component * are editable. The user can click on an item renderer to open an editor.</p> * * <p>You can turn off editing for individual columns of the DataGrid component * by using the <code>DataGridColumn.editable</code> property, or by handling * the <code>itemEditBeginning</code> and <code>itemEditBegin</code> events.</p> * * @default false * * @see #event:itemEditBegin * @see #event:itemEditBeginning * @see fl.controls.dataGridClasses.DataGridColumn#editable DataGridColumn.editable * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  268. */
  269. public var editable : Boolean;
  270. /**
  271. * Indicates whether the user can change the size of the * columns. A value of <code>true</code> indicates that the user can * change the column size; a value of <code>false</code> indicates that * column size is fixed. * * <p>If this value is <code>true</code>, the user can stretch or shrink * the columns of the DataGrid component by dragging the grid lines between * the header cells. Additionally, if this value is <code>true</code>, * the user can change the size of the columns unless the <code>resizeable</code> * properties of individual columns are set to <code>false</code>.</p> * * @default true * * @includeExample examples/DataGrid.resizableColumns.1.as -noswf * * @see fl.controls.dataGridClasses.DataGridColumn#resizable DataGridColumn.resizable * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  272. */
  273. public var resizableColumns : Boolean;
  274. /**
  275. * Indicates whether the user can sort the items in the data provider * by clicking on a column header cell. If this value is <code>true</code>, * the user can sort the data provider items by clicking on a column header cell; * if this value is <code>false</code>, the user cannot. * * <p>If this value is <code>true</code>, to prevent an individual column * from responding to a user mouse click on a header cell, set the * <code>sortable</code> property of that column to <code>false</code>.</p> * * <p>The sort field of a column is either the <code>dataField</code> or * <code>sortCompareFunction</code> property of the DataGridColumn component. * If the user clicks a column more than one time, the sort operation * alternates between ascending and descending order.</p> * * <p>If both this property and the <code>sortable</code> property of a * column are set to <code>true</code>, the DataGrid component dispatches * a <code>headerRelease</code> event after the user releases the mouse * button of the column header cell. If a call is not made to the <code>preventDefault()</code> * method from a handler method of the <code>headerRelease</code> event, * the DataGrid component performs a sort based on the values of the <code>dataField</code> * or <code>sortCompareFunction</code> properties.</p> * * @default true * * @includeExample examples/DataGrid.sortableColumns.1.as -noswf * * @see fl.controls.dataGridClasses.DataGridColumn#sortable DataGridColumn.sortable * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  276. */
  277. public var sortableColumns : Boolean;
  278. /**
  279. * A reference to the currently active instance of the item editor, * if one exists. * * <p>To access the item editor instance and the new item value when an * item is being edited, use the <code>itemEditorInstance</code> * property. The <code>itemEditorInstance</code> property is not valid * until after the event listener for the <code>itemEditBegin</code> * event executes. For this reason, the <code>itemEditorInstance</code> property * is typically accessed from the event listener for the <code>itemEditEnd</code> * event.</p> * * <p>The <code>DataGridColumn.itemEditor</code> property defines the * class of the item editor, and therefore, the data type of the * item editor instance.</p> * * @includeExample examples/DataGrid.itemEditorInstance.1.as -noswf * * @see #event:itemEditBegin * @see #event:itemEditEnd * @see fl.controls.dataGridClasses.DataGridColumn#itemEditor DataGridColumn.itemEditor * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  280. */
  281. public var itemEditorInstance : Object;
  282. /**
  283. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  284. */
  285. public function set dataProvider (dataSource:DataProvider) : void;
  286. /**
  287. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  288. */
  289. public function set enabled (value:Boolean) : void;
  290. /**
  291. * Gets or sets a Boolean value that indicates whether the * horizontal scroll bar is always on. The following list describes * the valid values: * * <ul> * <li><code>ScrollPolicy.ON</code>: The scroll bar is always on.</li> * <li><code>ScrollPolicy.OFF</code>: The scroll bar is always off.</li> * <li><code>ScrollPolicy.AUTO</code>: The state of the scroll bar changes * based on the parameters that are passed to the <code>setScrollBarProperties()</code> * method.</li> * </ul> * * <p><strong>Note:</strong> If the combined width of the visible columns in the DataGrid * component is smaller than the available width of the DataGrid component, the columns may not expand to fill * the available space of the DataGrid component, depending on the value of the * <code>horizontalScrollPolicy</code> property. The following list describes * these values and their effects:</p> * * <ul> * <li><code>ScrollPolicy.ON</code>: The horizontal scroll bar is disabled. The columns do not expand * to fill the available space of the DataGrid component.</li> * <li><code>ScrollPolicy.AUTO</code>: The horizontal scroll bar is not visible. The columns do not expand * to fill the available space of the DataGrid component.</li> * </ul> * * @default ScrollPolicy.OFF * * @see fl.containers.BaseScrollPane#verticalScrollPolicy BaseScrollPane.verticalScrollPolicy * @see ScrollPolicy * * @includeExample examples/DataGrid.horizontalScrollPolicy.1.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  292. */
  293. public function get horizontalScrollPolicy () : String;
  294. /**
  295. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  296. */
  297. public function set horizontalScrollPolicy (policy:String) : void;
  298. /**
  299. * Gets or sets an array of DataGridColumn objects, one for each column that can be displayed. * If not explicitly set, the DataGrid component examines the first item in the * data provider, locates its properties, and then displays those properties * in alphabetic order. * * <p>You can make changes to the columns and to their order in this DataGridColumn * array. After the changes are made, however, you must explicitly assign the * changed array to the <code>columns</code> property. If an explicit assignment * is not made, the set of columns that was used before will continue to be used.</p> * * @default [] * * @includeExample examples/DataGrid.columns.1.as -noswf * @includeExample examples/DataGrid.columns.2.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  300. */
  301. public function get columns () : Array;
  302. /**
  303. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  304. */
  305. public function set columns (value:Array) : void;
  306. /**
  307. * Gets or sets the minimum width of a DataGrid column, in pixels. * If this value is set to <code>NaN</code>, the minimum column * width can be individually set for each column of the DataGrid component. * * @default NaN * * @includeExample examples/DataGrid.minColumnWidth.1.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  308. */
  309. public function get minColumnWidth () : Number;
  310. /**
  311. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  312. */
  313. public function set minColumnWidth (value:Number) : void;
  314. /**
  315. * Gets or sets a function that determines which fields of each * item to use for the label text. * * @default null * * @includeExample examples/DataGrid.labelFunction.1.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  316. */
  317. public function get labelFunction () : Function;
  318. /**
  319. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  320. */
  321. public function set labelFunction (value:Function) : void;
  322. /**
  323. * Gets or sets the number of rows that are at least partially visible in the * list. * * @includeExample examples/DataGrid.rowCount.1.as -noswf * * @see SelectableList#length SelectableList.length * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  324. */
  325. public function get rowCount () : uint;
  326. /**
  327. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  328. */
  329. public function set rowCount (value:uint) : void;
  330. /**
  331. * Gets or sets the height of each row in the DataGrid component, in pixels. * * @default 20 * * @includeExample examples/DataGrid.rowHeight.1.as -noswf * * @see #headerHeight * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  332. */
  333. public function get rowHeight () : Number;
  334. /**
  335. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  336. */
  337. public function set rowHeight (value:Number) : void;
  338. /**
  339. * Gets or sets the height of the DataGrid header, in pixels. * * @default 25 * * @includeExample examples/DataGrid.headerHeight.1.as -noswf * * @see #rowHeight * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  340. */
  341. public function get headerHeight () : Number;
  342. /**
  343. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  344. */
  345. public function set headerHeight (value:Number) : void;
  346. /**
  347. * Gets or sets a Boolean value that indicates whether the DataGrid component shows column headers. * A value of <code>true</code> indicates that the DataGrid component shows column headers; a value * of <code>false</code> indicates that it does not. * * @default true * * @includeExample examples/DataGrid.showHeaders.1.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  348. */
  349. public function get showHeaders () : Boolean;
  350. /**
  351. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  352. */
  353. public function set showHeaders (value:Boolean) : void;
  354. /**
  355. * Gets the index of the column to be sorted. * * @default -1 * * @see #sortDescending * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  356. */
  357. public function get sortIndex () : int;
  358. /**
  359. * Gets the order in which a column is sorted when * the user clicks its header. A value of <code>true</code> * indicates that the column is sorted in descending order; a * value of <code>false</code> indicates that the column is * sorted in ascending order. * * <p>The <code>sortDescending</code> property does not affect * how the sort method completes the sort operation. By default, * the sort operation involves a case-sensitive string sort. * To change this behavior, modify the <code>sortOptions</code> * and <code>sortCompareFunction</code> properties of the DataGridColumn * class.</p> * * <p><strong>Note:</strong> If you query this property from an event * listener for the <code>headerRelease</code> event, the property value * identifies the sort order for the previous sort operation. This * is because the next sort has not yet occurred.</p> * * * * @default false * * @includeExample examples/DataGrid.sortDescending.1.as -noswf * * @see fl.controls.dataGridClasses.DataGridColumn#sortOptions DataGridColumn.sortOptions * @see fl.controls.dataGridClasses.DataGridColumn#sortCompareFunction DataGridColumn.sortCompareFunction * @see Array#sort() Array.sort() * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  360. */
  361. public function get sortDescending () : Boolean;
  362. /**
  363. * @copy fl.controls.TextArea#imeMode * * @see flash.system.IMEConversionMode IMEConversionMode * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  364. */
  365. public function get imeMode () : String;
  366. /**
  367. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  368. */
  369. public function set imeMode (value:String) : void;
  370. /**
  371. * Gets a reference to the item renderer in the DataGrid component whose item is currently being * edited. If no item is being edited, this property contains a value of <code>null</code>. * * <p>You can obtain the current value of the item that is being edited by using the * <code>editedItemRenderer.data</code> property from an event listener for the * <code>itemEditBegin</code> event or the <code>itemEditEnd</code> event.</p> * * <p>This is a read-only property. To set a custom item editor, use the <code>itemEditor</code> * property of the class that represents the relevant column.</p> * * @see fl.controls.dataGridClasses.DataGridColumn#itemEditor DataGridColumn.itemEditor * * @includeExample examples/DataGrid.editedItemPosition.1.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  372. */
  373. public function get editedItemRenderer () : ICellRenderer;
  374. /**
  375. * Gets or sets the column and row index of the item renderer for * the data provider item that is being edited. If no item is being * edited, this property is <code>null</code>. * * <p>This object has two fields:</p> * * <ul> * <li><code>columnIndex</code>: The zero-based column index of the current item</li> * <li><code>rowIndex</code>: The zero-based row index of the current item</li> * </ul> * * <p>For example: <code>{ columnIndex:2, rowIndex:3 }</code></p> * * <p>Setting this property scrolls the item into view and dispatches the * <code>itemEditBegin</code> event to open an item editor on the specified * item renderer.</p> * * @default null * * @includeExample examples/DataGrid.editedItemPosition.1.as -noswf * * @see #event:itemEditBegin * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  376. */
  377. public function get editedItemPosition () : Object;
  378. /**
  379. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  380. */
  381. public function set editedItemPosition (value:Object) : void;
  382. /**
  383. * @copy fl.core.UIComponent#getStyleDefinition() * * @includeExample ../core/examples/UIComponent.getStyleDefinition.1.as -noswf * * @see fl.core.UIComponent#getStyle() UIComponent.getStyle() * @see fl.core.UIComponent#setStyle() UIComponent.setStyle() * @see fl.managers.StyleManager StyleManager * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  384. */
  385. public static function getStyleDefinition () : Object;
  386. /**
  387. * Creates a new DataGrid component instance. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  388. */
  389. public function DataGrid ();
  390. /**
  391. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  392. */
  393. public function setSize (w:Number, h:Number) : void;
  394. /**
  395. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  396. */
  397. protected function calculateAvailableHeight () : Number;
  398. /**
  399. * Adds a column to the end of the <code>columns</code> array. * * @param column A String or a DataGridColumn object. * * @return The DataGridColumn object that was added. * * @see #addColumnAt() * * @includeExample examples/DataGrid.addColumn.2.as -noswf * @includeExample examples/DataGrid.addColumn.3.as -noswf * @includeExample examples/DataGrid.addColumn.1.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  400. */
  401. public function addColumn (column:*) : DataGridColumn;
  402. /**
  403. * Inserts a column at the specified index in the <code>columns</code> array. * * @param column The string or DataGridColumn object that represents the column to be inserted. * @param index The array index that identifies the location at which the column is to be inserted. * * @return The DataGridColumn object that was inserted into the array of columns. * * @see #addColumn() * * @includeExample examples/DataGrid.addColumn.1.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  404. */
  405. public function addColumnAt (column:*, index:uint) : DataGridColumn;
  406. /**
  407. * Removes the column that is located at the specified index of the <code>columns</code> array. * * @param index The index of the column to be removed. * * @return The DataGridColumn object that was removed. This method returns <code>null</code> * if a column is not found at the specified index. * * @see #removeAllColumns() * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  408. */
  409. public function removeColumnAt (index:uint) : DataGridColumn;
  410. /**
  411. * Removes all columns from the DataGrid component. * * @see #removeColumnAt() * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  412. */
  413. public function removeAllColumns () : void;
  414. /**
  415. * Retrieves the column that is located at the specified index of the <code>columns</code> array. * * @param index The index of the column to be retrieved, or <code>null</code> * if a column is not found. * * @return The DataGridColumn object that was found at the specified index. * * @see #getColumnIndex() * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  416. */
  417. public function getColumnAt (index:uint) : DataGridColumn;
  418. /**
  419. * Retrieves the index of the column of the specified name, * or -1 if no match is found. * * @param name The data field of the column to be located. * * @return The index of the location at which the column of the * specified name is found. * * @see #getColumnAt() * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  420. */
  421. public function getColumnIndex (name:String) : int;
  422. /**
  423. * Retrieves the number of columns in the DataGrid component. * * @return The number of columns contained in the DataGrid component. * * @includeExample examples/DataGrid.columns.2.as -noswf * @includeExample examples/DataGrid.columns.3.as -noswf * * @see #rowCount * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  424. */
  425. public function getColumnCount () : uint;
  426. /**
  427. * Resets the widths of the visible columns to the same size. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  428. */
  429. public function spaceColumnsEqually () : void;
  430. /**
  431. * Edits a given field or property in the DataGrid component. * * @param index The index of the data provider item to be edited. * * @param dataField The name of the field or property in the data provider item to be edited. * * @param data The new data value. * * @throws RangeError The specified index is less than 0 or greater than or equal to the * length of the data provider. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  432. */
  433. public function editField (index:uint, dataField:String, data:Object) : void;
  434. /**
  435. * The DataGrid component has multiple cells for any given item, so the <code>itemToCellRenderer</code> * method always returns <code>null</code>. * * @param item The item in the data provider. * * @return <code>null</code>. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  436. */
  437. public function itemToCellRenderer (item:Object) : ICellRenderer;
  438. /**
  439. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  440. */
  441. protected function configUI () : void;
  442. /**
  443. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  444. */
  445. protected function draw () : void;
  446. /**
  447. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  448. */
  449. protected function drawLayout () : void;
  450. /**
  451. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  452. */
  453. protected function drawList () : void;
  454. /**
  455. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  456. */
  457. protected function updateRendererStyles () : void;
  458. /**
  459. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  460. */
  461. protected function removeCellRenderers () : void;
  462. /**
  463. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  464. */
  465. protected function removeCellRenderersByColumn (col:DataGridColumn) : void;
  466. /**
  467. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  468. */
  469. protected function handleCellRendererMouseEvent (event:MouseEvent) : void;
  470. /**
  471. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  472. */
  473. protected function isHovered (renderer:ICellRenderer) : Boolean;
  474. /**
  475. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  476. */
  477. protected function setHorizontalScrollPosition (scroll:Number, fireEvent:Boolean = false) : void;
  478. /**
  479. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  480. */
  481. protected function setVerticalScrollPosition (scroll:Number, fireEvent:Boolean = false) : void;
  482. /**
  483. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  484. */
  485. public function columnItemToLabel (columnIndex:uint, item:Object) : String;
  486. /**
  487. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  488. */
  489. protected function calculateColumnSizes () : void;
  490. /**
  491. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  492. */
  493. protected function calculateContentWidth () : void;
  494. /**
  495. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  496. */
  497. protected function handleHeaderRendererClick (event:MouseEvent) : void;
  498. /**
  499. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  500. */
  501. public function resizeColumn (columnIndex:int, w:Number) : void;
  502. /**
  503. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  504. */
  505. protected function sortByColumn (index:int) : void;
  506. /**
  507. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  508. */
  509. protected function createColumnsFromDataProvider () : void;
  510. /**
  511. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  512. */
  513. protected function getVisibleColumnIndex (column:DataGridColumn) : int;
  514. /**
  515. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  516. */
  517. protected function handleHeaderResizeOver (event:MouseEvent) : void;
  518. /**
  519. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  520. */
  521. protected function handleHeaderResizeOut (event:MouseEvent) : void;
  522. /**
  523. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  524. */
  525. protected function handleHeaderResizeDown (event:MouseEvent) : void;
  526. /**
  527. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  528. */
  529. protected function handleHeaderResizeMove (event:MouseEvent) : void;
  530. /**
  531. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  532. */
  533. protected function handleHeaderResizeUp (event:MouseEvent) : void;
  534. /**
  535. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  536. */
  537. protected function showColumnStretchCursor (show:Boolean = true) : void;
  538. /**
  539. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  540. */
  541. protected function positionColumnStretchCursor (event:MouseEvent) : void;
  542. /**
  543. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  544. */
  545. protected function setEditedItemPosition (coord:Object) : void;
  546. /**
  547. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  548. */
  549. protected function commitEditedItemPosition (coord:Object) : void;
  550. /**
  551. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  552. */
  553. protected function itemEditorItemEditBeginningHandler (event:DataGridEvent) : void;
  554. /**
  555. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  556. */
  557. protected function itemEditorItemEditBeginHandler (event:DataGridEvent) : void;
  558. /**
  559. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  560. */
  561. protected function itemEditorItemEditEndHandler (event:DataGridEvent) : void;
  562. /**
  563. * @private (protected) * When we get focus, focus an item renderer. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  564. */
  565. protected function focusInHandler (event:FocusEvent) : void;
  566. /**
  567. * @private (protected) * When we lose focus, close the editor. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  568. */
  569. protected function focusOutHandler (event:FocusEvent) : void;
  570. /**
  571. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  572. */
  573. protected function editorMouseDownHandler (event:MouseEvent) : void;
  574. /**
  575. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  576. */
  577. protected function editorKeyDownHandler (event:KeyboardEvent) : void;
  578. /**
  579. * @private (protected) * Determines the next item renderer to navigate to using the Tab key. * If the item renderer to be focused falls out of range (the end or beginning * of the grid) then move focus outside the grid. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  580. */
  581. protected function findNextItemRenderer (shiftKey:Boolean) : Boolean;
  582. /**
  583. * @private (protected) * Find the next item renderer down from the currently edited item renderer, and focus it. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  584. */
  585. protected function findNextEnterItemRenderer (event:KeyboardEvent) : void;
  586. /**
  587. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  588. */
  589. protected function mouseFocusChangeHandler (event:MouseEvent) : void;
  590. /**
  591. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  592. */
  593. protected function keyFocusChangeHandler (event:FocusEvent) : void;
  594. /**
  595. * @private * Hides the itemEditorInstance. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  596. */
  597. private function itemEditorFocusOutHandler (event:FocusEvent) : void;
  598. /**
  599. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  600. */
  601. protected function deactivateHandler (event:Event) : void;
  602. /**
  603. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  604. */
  605. protected function mouseDownHandler (event:MouseEvent) : void;
  606. /**
  607. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  608. */
  609. protected function mouseUpHandler (event:MouseEvent) : void;
  610. /**
  611. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  612. */
  613. protected function handleCellRendererClick (event:MouseEvent) : void;
  614. /**
  615. * Uses the editor specified by the <code>itemEditor</code> property to * create an item editor for the item renderer at the column and row index * identified by the <code>editedItemPosition</code> property. * * <p>This method sets the editor instance as the <code>itemEditorInstance</code> * property.</p> * * <p>You can call this method from the event listener for the <code>itemEditBegin</code> * event. To create an editor from other code, set the <code>editedItemPosition</code> * property to generate the <code>itemEditBegin</code> event.</p> * * @param colIndex The column index of the item to be edited in the data provider. * @param rowIndex The row index of the item to be edited in the data provider. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  616. */
  617. public function createItemEditor (colIndex:uint, rowIndex:uint) : void;
  618. /**
  619. * Closes an item editor that is currently open on an item renderer. This method is * typically called from the event listener for the <code>itemEditEnd</code> event, * after a call is made to the <code>preventDefault()</code> method to prevent the * default event listener from executing. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  620. */
  621. public function destroyItemEditor () : void;
  622. /**
  623. * @private (protected) * This method is called after the user finishes editing an item. * It dispatches the <code>itemEditEnd</code> event to start the process * of copying the edited data from * the <code>itemEditorInstance</code> to the data provider and hiding the <code>itemEditorInstance</code>. * returns <code>true</code> if nobody called the <code>preventDefault()</code> method. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  624. */
  625. protected function endEdit (reason:String) : Boolean;
  626. /**
  627. * Get the instance of a cell renderer at the specified position * in the DataGrid. * * <p><strong>Note:</strong> This method returns <code>null</code> * for positions that are not visible (i.e. scrolled out of the * view).</p> * * @param row A row index. * @param column A column index. * * @return The ICellRenderer object at the specified position, or * <code>null</code> if no cell renderer exists at that position. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  628. */
  629. public function getCellRendererAt (row:uint, column:uint) : ICellRenderer;
  630. /**
  631. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  632. */
  633. protected function itemRendererContains (renderer:Object, object:DisplayObject) : Boolean;
  634. /**
  635. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  636. */
  637. protected fu