1////////////////////////////////////////////////////////////////////////////////
2//
3//  ADOBE SYSTEMS INCORPORATED
4//  Copyright 2010 Adobe Systems Incorporated
5//  All Rights Reserved.
6//
7//  NOTICE: Adobe permits you to use, modify, and distribute this file
8//  in accordance with the terms of the license agreement accompanying it.
9//
10////////////////////////////////////////////////////////////////////////////////
11
12package spark.events
13{
14import flash.display.InteractiveObject;
15import flash.events.Event;
16import flash.events.MouseEvent;
17
18import spark.components.Grid;
19import spark.components.gridClasses.GridColumn;
20import spark.components.gridClasses.IDataGridElement;
21import spark.components.gridClasses.IGridItemRenderer;
22
23/**
24 *  The GridEvent class extends the MouseEvent class to includes additional
25 *  grid specific information based on the event's location relative to a grid cell.
26 *  This information includes the following:
27 *
28 *  <ul>
29 *    <li>The row and column index of the cell.</li>
30 *    <li>The GridColumn object of the cell.</li>
31 *    <li>The data provider item that corresponds to the row of the cell.</li>
32 *    <li>The item renderer.</li>
33 *  </ul>
34 *
35 *  <p>Grid events have a one-to-one correspondence with mouse events.
36 *  They are dispatched in response to mouse events that have "bubbled"
37 *  from some Grid descendant to the Grid itself.
38 *  One significant difference is that event listeners for grid events
39 *  are guaranteed to see an entire down-drag-up mouse gesture,
40 *  even if the drag and up parts of the gesture do not occur over the grid.
41 *  The <code>gridMouseDrag</code> event corresponds to a
42 *  mouse move event with the button held down.</p>
43 *
44 *  @see spark.components.DataGrid
45 *  @see spark.components.Grid
46 *  @see spark.components.gridClasses.GridSelectionMode
47 *
48 *  @langversion 3.0
49 *  @playerversion Flash 10
50 *  @playerversion AIR 2.5
51 *  @productversion Flex 4.5
52 */
53public class GridEvent extends MouseEvent
54{
55    include "../core/Version.as";
56
57    //--------------------------------------------------------------------------
58    //
59    //  Class constants
60    //
61    //--------------------------------------------------------------------------
62
63    /**
64     *  The value of the <code>type</code> property for a <code>gridMouseDown</code> GridEvent.
65     *
66     *  <p>The properties of the event object have the following values:</p>
67     *  <table class="innertable">
68     *     <tr><th>Property</th><th>Value</th></tr>
69     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
70     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
71     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
72     *       event listener that handles the event. For example, if you use
73     *       <code>myButton.addEventListener()</code> to register an event listener,
74     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
75     *     <tr><td><code>column</code></td><td>The column where the event occurred,
76     *        or null if the event did not occur over a column.</td></tr>
77     *     <tr><td><code>columnIndex</code></td><td>The index of the column where
78     *        the event occurred, or -1 if the event did not occur over a grid column.</td></tr>
79     *     <tr><td><code>grid</code></td><td>The Grid associated with this event.</td></tr>
80     *     <tr><td><code>item</code></td><td>The data provider item for this row,
81     *        or null if the event did not occur over a grid row.</td></tr>
82     *     <tr><td><code>itemRenderer</code></td><td>The The item renderer that displayed
83     *       this cell, or null if the event did not occur over a visible cell.</td></tr>
84     *     <tr><td><code>rowIndex</code></td><td>The index of the row where the event occurred,
85     *        or -1 if the event did not occur over a grid row.</td></tr>
86     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
87     *        it is not always the Object listening for the event.
88     *        Use the <code>currentTarget</code> property to always access the
89     *        Object listening for the event.</td></tr>
90     *     <tr><td><code>type</code></td><td>GirdEvent.GRID_MOUSE_DOWN</td></tr>
91     *  </table>
92     *
93     *  @eventType gridMouseDown
94     *
95     *  @see flash.display.InteractiveObject#event:mouseDown
96     *
97     *  @langversion 3.0
98     *  @playerversion Flash 10
99     *  @playerversion AIR 2.5
100     *  @productversion Flex 4.5
101     */
102    public static const GRID_MOUSE_DOWN:String = "gridMouseDown";
103
104    /**
105     *  The value of the <code>type</code> property for a <code>gridMouseDrag</code> GridEvent.
106     *  This event is only dispatched when a listener has handled a <code>mouseDown</code> event,
107     *  and then only while the mouse moves with the button held down.
108     *
109     *  <p>The properties of the event object have the following values:</p>
110     *  <table class="innertable">
111     *     <tr><th>Property</th><th>Value</th></tr>
112     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
113     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
114     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
115     *       event listener that handles the event. For example, if you use
116     *       <code>myButton.addEventListener()</code> to register an event listener,
117     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
118     *     <tr><td><code>column</code></td><td>The column where the event occurred,
119     *        or null if the event did not occur over a column.</td></tr>
120     *     <tr><td><code>columnIndex</code></td><td>The index of the column where
121     *        the event occurred, or -1 if the event did not occur over a grid column.</td></tr>
122     *     <tr><td><code>grid</code></td><td>The Grid associated with this event.</td></tr>
123     *     <tr><td><code>item</code></td><td>The data provider item for this row,
124     *        or null if the event did not occur over a grid row.</td></tr>
125     *     <tr><td><code>itemRenderer</code></td><td>The The item renderer that displayed
126     *       this cell, or null if the event did not occur over a visible cell.</td></tr>
127     *     <tr><td><code>rowIndex</code></td><td>The index of the row where the event occurred,
128     *        or -1 if the event did not occur over a grid row.</td></tr>
129     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
130     *        it is not always the Object listening for the event.
131     *        Use the <code>currentTarget</code> property to always access the
132     *        Object listening for the event.</td></tr>
133     *     <tr><td><code>type</code></td><td>GirdEvent.GRID_MOUSE_DRAG</td></tr>
134     *  </table>
135     *
136     *  @eventType gridMouseDrag
137     *
138     *  @langversion 3.0
139     *  @playerversion Flash 10
140     *  @playerversion AIR 2.5
141     *  @productversion Flex 4.5
142     */
143    public static const GRID_MOUSE_DRAG:String = "gridMouseDrag";
144
145    /**
146     *  The value of the <code>type</code> property for a <code>gridMouseUp</code> GridEvent.
147     *
148     *  <p>The properties of the event object have the following values:</p>
149     *  <table class="innertable">
150     *     <tr><th>Property</th><th>Value</th></tr>
151     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
152     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
153     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
154     *       event listener that handles the event. For example, if you use
155     *       <code>myButton.addEventListener()</code> to register an event listener,
156     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
157     *     <tr><td><code>column</code></td><td>The column where the event occurred,
158     *        or null if the event did not occur over a column.</td></tr>
159     *     <tr><td><code>columnIndex</code></td><td>The index of the column where
160     *        the event occurred, or -1 if the event did not occur over a grid column.</td></tr>
161     *     <tr><td><code>grid</code></td><td>The Grid associated with this event.</td></tr>
162     *     <tr><td><code>item</code></td><td>The data provider item for this row,
163     *        or null if the event did not occur over a grid row.</td></tr>
164     *     <tr><td><code>itemRenderer</code></td><td>The The item renderer that displayed
165     *       this cell, or null if the event did not occur over a visible cell.</td></tr>
166     *     <tr><td><code>rowIndex</code></td><td>The index of the row where the event occurred,
167     *        or -1 if the event did not occur over a grid row.</td></tr>
168     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
169     *        it is not always the Object listening for the event.
170     *        Use the <code>currentTarget</code> property to always access the
171     *        Object listening for the event.</td></tr>
172     *     <tr><td><code>type</code></td><td>GirdEvent.GRID_MOUSE_UP</td></tr>
173     *  </table>
174     *
175     *  @eventType gridMouseUp
176     *
177     *  @see flash.display.InteractiveObject#event:mouseUp
178     *
179     *  @langversion 3.0
180     *  @playerversion Flash 10
181     *  @playerversion AIR 2.5
182     *  @productversion Flex 4.5
183     */
184    public static const GRID_MOUSE_UP:String = "gridMouseUp";
185
186    /**
187     *  The value of the <code>type</code> property for a <code>gridClick</code> GridEvent.
188     *
189     *  <p>The properties of the event object have the following values:</p>
190     *  <table class="innertable">
191     *     <tr><th>Property</th><th>Value</th></tr>
192     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
193     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
194     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
195     *       event listener that handles the event. For example, if you use
196     *       <code>myButton.addEventListener()</code> to register an event listener,
197     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
198     *     <tr><td><code>column</code></td><td>The column where the event occurred,
199     *        or null if the event did not occur over a column.</td></tr>
200     *     <tr><td><code>columnIndex</code></td><td>The index of the column where
201     *        the event occurred, or -1 if the event did not occur over a grid column.</td></tr>
202     *     <tr><td><code>grid</code></td><td>The Grid associated with this event.</td></tr>
203     *     <tr><td><code>item</code></td><td>The data provider item for this row,
204     *        or null if the event did not occur over a grid row.</td></tr>
205     *     <tr><td><code>itemRenderer</code></td><td>The The item renderer that displayed
206     *       this cell, or null if the event did not occur over a visible cell.</td></tr>
207     *     <tr><td><code>rowIndex</code></td><td>The index of the row where the event occurred,
208     *        or -1 if the event did not occur over a grid row.</td></tr>
209     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
210     *        it is not always the Object listening for the event.
211     *        Use the <code>currentTarget</code> property to always access the
212     *        Object listening for the event.</td></tr>
213     *     <tr><td><code>type</code></td><td>GirdEvent.GRID_CLICK</td></tr>
214     *  </table>
215     *
216     *  @eventType gridClick
217     *
218     *  @see flash.display.InteractiveObject#event:click
219     *
220     *  @langversion 3.0
221     *  @playerversion Flash 10
222     *  @playerversion AIR 2.5
223     *  @productversion Flex 4.5
224     */
225    public static const GRID_CLICK:String = "gridClick";
226
227    /**
228     *  The value of the <code>type</code> property for a <code>gridDoubleClick</code> GridEvent.
229     *
230     *  <p>The properties of the event object have the following values:</p>
231     *  <table class="innertable">
232     *     <tr><th>Property</th><th>Value</th></tr>
233     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
234     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
235     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
236     *       event listener that handles the event. For example, if you use
237     *       <code>myButton.addEventListener()</code> to register an event listener,
238     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
239     *     <tr><td><code>column</code></td><td>The column where the event occurred,
240     *        or null if the event did not occur over a column.</td></tr>
241     *     <tr><td><code>columnIndex</code></td><td>The index of the column where
242     *        the event occurred, or -1 if the event did not occur over a grid column.</td></tr>
243     *     <tr><td><code>grid</code></td><td>The Grid associated with this event.</td></tr>
244     *     <tr><td><code>item</code></td><td>The data provider item for this row,
245     *        or null if the event did not occur over a grid row.</td></tr>
246     *     <tr><td><code>itemRenderer</code></td><td>The The item renderer that displayed
247     *       this cell, or null if the event did not occur over a visible cell.</td></tr>
248     *     <tr><td><code>rowIndex</code></td><td>The index of the row where the event occurred,
249     *        or -1 if the event did not occur over a grid row.</td></tr>
250     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
251     *        it is not always the Object listening for the event.
252     *        Use the <code>currentTarget</code> property to always access the
253     *        Object listening for the event.</td></tr>
254     *     <tr><td><code>type</code></td><td>GirdEvent.GRID_DOUBLE_CLICK</td></tr>
255     *  </table>
256     *
257     *  @eventType gridDoubleClick
258     *
259     *  @see flash.display.InteractiveObject#event:doubleClick
260     *
261     *  @langversion 3.0
262     *  @playerversion Flash 10
263     *  @playerversion AIR 2.5
264     *  @productversion Flex 4.5
265     */
266    public static const GRID_DOUBLE_CLICK:String = "gridDoubleClick";
267
268    /**
269     *  The value of the <code>type</code> property for a <code>gridRollOver</code> GridEvent.
270     *
271     *  <p>The properties of the event object have the following values:</p>
272     *  <table class="innertable">
273     *     <tr><th>Property</th><th>Value</th></tr>
274     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
275     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
276     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
277     *       event listener that handles the event. For example, if you use
278     *       <code>myButton.addEventListener()</code> to register an event listener,
279     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
280     *     <tr><td><code>column</code></td><td>The column where the event occurred,
281     *        or null if the event did not occur over a column.</td></tr>
282     *     <tr><td><code>columnIndex</code></td><td>The index of the column where
283     *        the event occurred, or -1 if the event did not occur over a grid column.</td></tr>
284     *     <tr><td><code>grid</code></td><td>The Grid associated with this event.</td></tr>
285     *     <tr><td><code>item</code></td><td>The data provider item for this row,
286     *        or null if the event did not occur over a grid row.</td></tr>
287     *     <tr><td><code>itemRenderer</code></td><td>The The item renderer that displayed
288     *       this cell, or null if the event did not occur over a visible cell.</td></tr>
289     *     <tr><td><code>rowIndex</code></td><td>The index of the row where the event occurred,
290     *        or -1 if the event did not occur over a grid row.</td></tr>
291     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
292     *        it is not always the Object listening for the event.
293     *        Use the <code>currentTarget</code> property to always access the
294     *        Object listening for the event.</td></tr>
295     *     <tr><td><code>type</code></td><td>GirdEvent.GRID_ROLL_OVER</td></tr>
296     *  </table>
297     *
298     *  @eventType gridRollOver
299     *
300     *  @see flash.display.InteractiveObject#event:rollOver
301     *
302     *  @langversion 3.0
303     *  @playerversion Flash 10
304     *  @playerversion AIR 2.5
305     *  @productversion Flex 4.5
306     */
307    public static const GRID_ROLL_OVER:String = "gridRollOver";
308
309    /**
310     *  The value of the <code>type</code> property for a <code>gridRollOut</code> GridEvent.
311     *
312     *  <p>The properties of the event object have the following values:</p>
313     *  <table class="innertable">
314     *     <tr><th>Property</th><th>Value</th></tr>
315     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
316     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
317     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
318     *       event listener that handles the event. For example, if you use
319     *       <code>myButton.addEventListener()</code> to register an event listener,
320     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
321     *     <tr><td><code>column</code></td><td>The column where the event occurred,
322     *        or null if the event did not occur over a column.</td></tr>
323     *     <tr><td><code>columnIndex</code></td><td>The index of the column where
324     *        the event occurred, or -1 if the event did not occur over a grid column.</td></tr>
325     *     <tr><td><code>grid</code></td><td>The Grid associated with this event.</td></tr>
326     *     <tr><td><code>item</code></td><td>The data provider item for this row,
327     *        or null if the event did not occur over a grid row.</td></tr>
328     *     <tr><td><code>itemRenderer</code></td><td>The The item renderer that displayed
329     *       this cell, or null if the event did not occur over a visible cell.</td></tr>
330     *     <tr><td><code>rowIndex</code></td><td>The index of the row where the event occurred,
331     *        or -1 if the event did not occur over a grid row.</td></tr>
332     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
333     *        it is not always the Object listening for the event.
334     *        Use the <code>currentTarget</code> property to always access the
335     *        Object listening for the event.</td></tr>
336     *     <tr><td><code>type</code></td><td>GirdEvent.GRID_ROLL_OUT</td></tr>
337     *  </table>
338     *
339     *  @eventType gridRollOut
340     *
341     *  @see flash.display.InteractiveObject#event:rollOut
342     *
343     *  @langversion 3.0
344     *  @playerversion Flash 10
345     *  @playerversion AIR 2.5
346     *  @productversion Flex 4.5
347     */
348    public static const GRID_ROLL_OUT:String = "gridRollOut";
349
350    /**
351     *  The value of the <code>type</code> property for a <code>separatorMouseDrag</code> GridEvent.
352     *
353     *  <p>The properties of the event object have the following values:</p>
354     *  <table class="innertable">
355     *     <tr><th>Property</th><th>Value</th></tr>
356     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
357     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
358     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
359     *       event listener that handles the event. For example, if you use
360     *       <code>myButton.addEventListener()</code> to register an event listener,
361     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
362     *     <tr><td><code>column</code></td><td>The column where the event occurred,
363     *        or null if the event did not occur over a column.</td></tr>
364     *     <tr><td><code>columnIndex</code></td><td>The index of the column where
365     *        the event occurred, or -1 if the event did not occur over a grid column.</td></tr>
366     *     <tr><td><code>grid</code></td><td>The Grid associated with this event.</td></tr>
367     *     <tr><td><code>item</code></td><td>The data provider item for this row,
368     *        or null if the event did not occur over a grid row.</td></tr>
369     *     <tr><td><code>itemRenderer</code></td><td>The The item renderer that displayed
370     *       this cell, or null if the event did not occur over a visible cell.</td></tr>
371     *     <tr><td><code>rowIndex</code></td><td>The index of the row where the event occurred,
372     *        or -1 if the event did not occur over a grid row.</td></tr>
373     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
374     *        it is not always the Object listening for the event.
375     *        Use the <code>currentTarget</code> property to always access the
376     *        Object listening for the event.</td></tr>
377     *     <tr><td><code>type</code></td><td>GirdEvent.SEPARATOR_MOUSE_DRAG</td></tr>
378     *  </table>
379     *
380     *  @eventType separatorMouseDrag
381     *
382     *  @langversion 3.0
383     *  @playerversion Flash 10
384     *  @playerversion AIR 2.5
385     *  @productversion Flex 4.5
386     */
387    public static const SEPARATOR_MOUSE_DRAG:String = "separatorMouseDrag";
388
389    /**
390     *  The value of the <code>type</code> property for a <code>separatorClick</code> GridEvent.
391     *
392     *  <p>The properties of the event object have the following values:</p>
393     *  <table class="innertable">
394     *     <tr><th>Property</th><th>Value</th></tr>
395     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
396     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
397     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
398     *       event listener that handles the event. For example, if you use
399     *       <code>myButton.addEventListener()</code> to register an event listener,
400     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
401     *     <tr><td><code>column</code></td><td>The column where the event occurred,
402     *        or null if the event did not occur over a column.</td></tr>
403     *     <tr><td><code>columnIndex</code></td><td>The index of the column where
404     *        the event occurred, or -1 if the event did not occur over a grid column.</td></tr>
405     *     <tr><td><code>grid</code></td><td>The Grid associated with this event.</td></tr>
406     *     <tr><td><code>item</code></td><td>The data provider item for this row,
407     *        or null if the event did not occur over a grid row.</td></tr>
408     *     <tr><td><code>itemRenderer</code></td><td>The The item renderer that displayed
409     *       this cell, or null if the event did not occur over a visible cell.</td></tr>
410     *     <tr><td><code>rowIndex</code></td><td>The index of the row where the event occurred,
411     *        or -1 if the event did not occur over a grid row.</td></tr>
412     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
413     *        it is not always the Object listening for the event.
414     *        Use the <code>currentTarget</code> property to always access the
415     *        Object listening for the event.</td></tr>
416     *     <tr><td><code>type</code></td><td>GirdEvent.SEPARATOR_CLICK</td></tr>
417     *  </table>
418     *
419     *  @eventType separatorClick
420     *
421     *  @langversion 3.0
422     *  @playerversion Flash 10
423     *  @playerversion AIR 2.5
424     *  @productversion Flex 4.5
425     */
426    public static const SEPARATOR_CLICK:String = "separatorClick";
427
428    /**
429     *  The value of the <code>type</code> property for a <code>separatorDoubleClick</code> GridEvent.
430     *
431     *  <p>The properties of the event object have the following values:</p>
432     *  <table class="innertable">
433     *     <tr><th>Property</th><th>Value</th></tr>
434     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
435     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
436     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
437     *       event listener that handles the event. For example, if you use
438     *       <code>myButton.addEventListener()</code> to register an event listener,
439     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
440     *     <tr><td><code>column</code></td><td>The column where the event occurred,
441     *        or null if the event did not occur over a column.</td></tr>
442     *     <tr><td><code>columnIndex</code></td><td>The index of the column where
443     *        the event occurred, or -1 if the event did not occur over a grid column.</td></tr>
444     *     <tr><td><code>grid</code></td><td>The Grid associated with this event.</td></tr>
445     *     <tr><td><code>item</code></td><td>The data provider item for this row,
446     *        or null if the event did not occur over a grid row.</td></tr>
447     *     <tr><td><code>itemRenderer</code></td><td>The The item renderer that displayed
448     *       this cell, or null if the event did not occur over a visible cell.</td></tr>
449     *     <tr><td><code>rowIndex</code></td><td>The index of the row where the event occurred,
450     *        or -1 if the event did not occur over a grid row.</td></tr>
451     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
452     *        it is not always the Object listening for the event.
453     *        Use the <code>currentTarget</code> property to always access the
454     *        Object listening for the event.</td></tr>
455     *     <tr><td><code>type</code></td><td>GirdEvent.SEPARATOR_DOUBLE_CLICK</td></tr>
456     *  </table>
457     *
458     *  @eventType separatorDoubleClick
459     *
460     *  @langversion 3.0
461     *  @playerversion Flash 10
462     *  @playerversion AIR 2.5
463     *  @productversion Flex 4.5
464     */
465    public static const SEPARATOR_DOUBLE_CLICK:String = "separatorDoubleClick";
466
467    /**
468     *  The value of the <code>type</code> property for a <code>separatorMouseDown</code> GridEvent.
469     *
470     *  <p>The properties of the event object have the following values:</p>
471     *  <table class="innertable">
472     *     <tr><th>Property</th><th>Value</th></tr>
473     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
474     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
475     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
476     *       event listener that handles the event. For example, if you use
477     *       <code>myButton.addEventListener()</code> to register an event listener,
478     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
479     *     <tr><td><code>column</code></td><td>The column where the event occurred,
480     *        or null if the event did not occur over a column.</td></tr>
481     *     <tr><td><code>columnIndex</code></td><td>The index of the column where
482     *        the event occurred, or -1 if the event did not occur over a grid column.</td></tr>
483     *     <tr><td><code>grid</code></td><td>The Grid associated with this event.</td></tr>
484     *     <tr><td><code>item</code></td><td>The data provider item for this row,
485     *        or null if the event did not occur over a grid row.</td></tr>
486     *     <tr><td><code>itemRenderer</code></td><td>The The item renderer that displayed
487     *       this cell, or null if the event did not occur over a visible cell.</td></tr>
488     *     <tr><td><code>rowIndex</code></td><td>The index of the row where the event occurred,
489     *        or -1 if the event did not occur over a grid row.</td></tr>
490     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
491     *        it is not always the Object listening for the event.
492     *        Use the <code>currentTarget</code> property to always access the
493     *        Object listening for the event.</td></tr>
494     *     <tr><td><code>type</code></td><td>GirdEvent.SEPARATOR_MOUSE_DOWN</td></tr>
495     *  </table>
496     *
497     *  @eventType separatorMouseDown
498     *
499     *  @see flash.display.InteractiveObject#event:rollOut
500     *
501     *  @langversion 3.0
502     *  @playerversion Flash 10
503     *  @playerversion AIR 2.5
504     *  @productversion Flex 4.5
505     */
506    public static const SEPARATOR_MOUSE_DOWN:String = "separatorMouseDown";
507
508    /**
509     *  The value of the <code>type</code> property for a <code>separatorMouseUp</code> GridEvent.
510     *
511     *  <p>The properties of the event object have the following values:</p>
512     *  <table class="innertable">
513     *     <tr><th>Property</th><th>Value</th></tr>
514     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
515     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
516     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
517     *       event listener that handles the event. For example, if you use
518     *       <code>myButton.addEventListener()</code> to register an event listener,
519     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
520     *     <tr><td><code>column</code></td><td>The column where the event occurred,
521     *        or null if the event did not occur over a column.</td></tr>
522     *     <tr><td><code>columnIndex</code></td><td>The index of the column where
523     *        the event occurred, or -1 if the event did not occur over a grid column.</td></tr>
524     *     <tr><td><code>grid</code></td><td>The Grid associated with this event.</td></tr>
525     *     <tr><td><code>item</code></td><td>The data provider item for this row,
526     *        or null if the event did not occur over a grid row.</td></tr>
527     *     <tr><td><code>itemRenderer</code></td><td>The The item renderer that displayed
528     *       this cell, or null if the event did not occur over a visible cell.</td></tr>
529     *     <tr><td><code>rowIndex</code></td><td>The index of the row where the event occurred,
530     *        or -1 if the event did not occur over a grid row.</td></tr>
531     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
532     *        it is not always the Object listening for the event.
533     *        Use the <code>currentTarget</code> property to always access the
534     *        Object listening for the event.</td></tr>
535     *     <tr><td><code>type</code></td><td>GirdEvent.SEPARATOR_MOUSE_UP</td></tr>
536     *  </table>
537     *
538     *  @eventType separatorMouseUp
539     *
540     *  @see flash.display.InteractiveObject#event:rollOut
541     *
542     *  @langversion 3.0
543     *  @playerversion Flash 10
544     *  @playerversion AIR 2.5
545     *  @productversion Flex 4.5
546     */
547    public static const SEPARATOR_MOUSE_UP:String = "separatorMouseUp";
548
549    /**
550     *  The value of the <code>type</code> property for a <code>separatorRollOut</code> GridEvent.
551     *
552     *  <p>The properties of the event object have the following values:</p>
553     *  <table class="innertable">
554     *     <tr><th>Property</th><th>Value</th></tr>
555     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
556     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
557     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
558     *       event listener that handles the event. For example, if you use
559     *       <code>myButton.addEventListener()</code> to register an event listener,
560     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
561     *     <tr><td><code>column</code></td><td>The column where the event occurred,
562     *        or null if the event did not occur over a column.</td></tr>
563     *     <tr><td><code>columnIndex</code></td><td>The index of the column where
564     *        the event occurred, or -1 if the event did not occur over a grid column.</td></tr>
565     *     <tr><td><code>grid</code></td><td>The Grid associated with this event.</td></tr>
566     *     <tr><td><code>item</code></td><td>The data provider item for this row,
567     *        or null if the event did not occur over a grid row.</td></tr>
568     *     <tr><td><code>itemRenderer</code></td><td>The The item renderer that displayed
569     *       this cell, or null if the event did not occur over a visible cell.</td></tr>
570     *     <tr><td><code>rowIndex</code></td><td>The index of the row where the event occurred,
571     *        or -1 if the event did not occur over a grid row.</td></tr>
572     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
573     *        it is not always the Object listening for the event.
574     *        Use the <code>currentTarget</code> property to always access the
575     *        Object listening for the event.</td></tr>
576     *     <tr><td><code>type</code></td><td>GirdEvent.SEPARATOR_ROLL_OUT</td></tr>
577     *  </table>
578     *
579     *  @eventType separatorRollOut
580     *
581     *  @langversion 3.0
582     *  @playerversion Flash 10
583     *  @playerversion AIR 2.5
584     *  @productversion Flex 4.5
585     */
586    public static const SEPARATOR_ROLL_OUT:String = "separatorRollOut";
587
588    /**
589     *  The value of the <code>type</code> property for a <code>separatorRollOver</code> GridEvent.
590     *
591     *  <p>The properties of the event object have the following values:</p>
592     *  <table class="innertable">
593     *     <tr><th>Property</th><th>Value</th></tr>
594     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
595     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
596     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
597     *       event listener that handles the event. For example, if you use
598     *       <code>myButton.addEventListener()</code> to register an event listener,
599     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
600     *     <tr><td><code>column</code></td><td>The column where the event occurred,
601     *        or null if the event did not occur over a column.</td></tr>
602     *     <tr><td><code>columnIndex</code></td><td>The index of the column where
603     *        the event occurred, or -1 if the event did not occur over a grid column.</td></tr>
604     *     <tr><td><code>grid</code></td><td>The Grid associated with this event.</td></tr>
605     *     <tr><td><code>item</code></td><td>The data provider item for this row,
606     *        or null if the event did not occur over a grid row.</td></tr>
607     *     <tr><td><code>itemRenderer</code></td><td>The The item renderer that displayed
608     *       this cell, or null if the event did not occur over a visible cell.</td></tr>
609     *     <tr><td><code>rowIndex</code></td><td>The index of the row where the event occurred,
610     *        or -1 if the event did not occur over a grid row.</td></tr>
611     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
612     *        it is not always the Object listening for the event.
613     *        Use the <code>currentTarget</code> property to always access the
614     *        Object listening for the event.</td></tr>
615     *     <tr><td><code>type</code></td><td>GirdEvent.SEPARATOR_ROLL_OVER</td></tr>
616     *  </table>
617     *
618     *  @eventType separatorRollOver
619     *
620     *  @langversion 3.0
621     *  @playerversion Flash 10
622     *  @playerversion AIR 2.5
623     *  @productversion Flex 4.5
624     */
625    public static const SEPARATOR_ROLL_OVER:String = "separatorRollOver";
626
627    //--------------------------------------------------------------------------
628    //
629    //  Constructor
630    //
631    //--------------------------------------------------------------------------
632
633    /**
634     *  GridEvents dispatched by the Grid class in response to mouse event are constructed with
635     *  the incoming mouse event's properties.
636     *  The grid event's x,y location, meaning the value of
637     *  its <code>localX</code> and <code>localY</code> properties,
638     *  is defined relative to the entire grid, not just the
639     *  part of the grid that has been scrolled into view.
640     *  Similarly, the event's row and column
641     *  indices might correspond to a cell that has not been scrolled into view.
642     *
643     *  @param type Distinguishes the mouse gesture that caused this event to be dispatched.
644     *
645     *  @param bubbles Specifies whether the event can bubble up the display list hierarchy.
646     *
647     *  @param cancelable Specifies whether the behavior associated with the event can be prevented.
648     *
649     *  @param localX The event's x coordinate relative to grid.
650     *
651     *  @param localY The event's y coordinate relative to grid.
652     *
653     *  @param rowIndex The index of the row where the event occurred, or -1.
654     *
655     *  @param columnIndex The index of the column where the event occurred, or -1.
656     *
657     *  @param column The column where the event occurred, or null.
658     *
659     *  @param item The data provider item at <code>rowIndex</code>.
660     *
661     *  @param relatedObject The <code>relatedObject</code> property of the
662     *  MouseEvent that triggered this GridEvent.
663     *
664     *  @param itemRenderer The visible item renderer where the event occurred, or null.
665     *
666     *  @param ctrlKey Whether the Control key is down.
667     *
668     *  @param altKey Whether the Alt key is down.
669     *
670     *  @param shiftKey Whether the Shift key is down.
671     *
672     *  @param buttonDown Whether the Control key is down.
673     *
674     *  @param delta Not used.
675     *
676     *  @langversion 3.0
677     *  @playerversion Flash 10
678     *  @playerversion AIR 2.5
679     *  @productversion Flex 4.5
680     */
681    public function GridEvent(
682        type:String,
683        bubbles:Boolean = false,
684        cancelable:Boolean = false,
685        localX:Number = NaN,
686        localY:Number = NaN,
687        relatedObject:InteractiveObject = null,
688        ctrlKey:Boolean = false,
689        altKey:Boolean = false,
690        shiftKey:Boolean = false,
691        buttonDown:Boolean = false,
692        delta:int = 0,
693        rowIndex:int = -1,
694        columnIndex:int = -1,
695        column:GridColumn = null,
696        item:Object = null,
697        itemRenderer:IGridItemRenderer = null)
698    {
699        super(type, bubbles, cancelable, localX, localY,
700              relatedObject, ctrlKey, altKey, shiftKey, buttonDown, delta);
701
702        this.rowIndex = rowIndex;
703        this.columnIndex = columnIndex;
704        this.column = column;
705        this.item = item;
706        this.itemRenderer = itemRenderer;
707    }
708
709    //--------------------------------------------------------------------------
710    //
711    //  Properties
712    //
713    //--------------------------------------------------------------------------
714
715    //----------------------------------
716    //  rowIndex
717    //----------------------------------
718
719    /**
720     *  The index of the row where the event occurred, or -1 if the event
721     *  did not occur over a grid row.
722     *
723     *  @langversion 3.0
724     *  @playerversion Flash 10
725     *  @playerversion AIR 2.5
726     *  @productversion Flex 4.5
727     */
728    public var rowIndex:int;
729
730    //----------------------------------
731    //  columnIndex
732    //----------------------------------
733
734    /**
735     *  The index of the column where the event occurred, or -1 if the event
736     *  did not occur over a grid column.
737     *
738     *  @langversion 3.0
739     *  @playerversion Flash 10
740     *  @playerversion AIR 2.5
741     *  @productversion Flex 4.5
742     */
743    public var columnIndex:int;
744
745    //----------------------------------
746    //  column
747    //----------------------------------
748
749    /**
750     *  The column where the event occurred, or null if the event
751     *  did not occur over a column.
752     *
753     *  @langversion 3.0
754     *  @playerversion Flash 10
755     *  @playerversion AIR 2.5
756     *  @productversion Flex 4.5
757     */
758    public var column:GridColumn;
759
760
761    //----------------------------------
762    //  grid
763    //----------------------------------
764
765    /**
766     *  The Grid associated with this event.
767     *
768     *  @langversion 3.0
769     *  @playerversion Flash 10
770     *  @playerversion AIR 2.5
771     *  @productversion Flex 4.5
772     */
773    public function get grid():Grid
774    {
775        if (column)
776            return column.grid;
777
778        if (target is Grid)
779            return Grid(target);
780
781        const elt:IDataGridElement = target as IDataGridElement;
782        if (elt && elt.dataGrid)
783            return elt.dataGrid.grid;
784
785        return null;
786    }
787
788    //----------------------------------
789    //  item
790    //----------------------------------
791
792    /**
793     *  The data provider item for this row, or null if the event
794     *  did not occur over a grid row.
795     *
796     *  @langversion 3.0
797     *  @playerversion Flash 10
798     *  @playerversion AIR 2.5
799     *  @productversion Flex 4.5
800     */
801    public var item:Object;
802
803    //----------------------------------
804    //  itemRenderer
805    //----------------------------------
806
807    /**
808     *  The item renderer that displayed this cell, or null if the event
809     *  did not occur over a visible cell.
810     *
811     *  @langversion 3.0
812     *  @playerversion Flash 10
813     *  @playerversion AIR 2.5
814     *  @productversion Flex 4.5
815     */
816    public var itemRenderer:IGridItemRenderer;
817
818    //--------------------------------------------------------------------------
819    //
820    //  Overridden methods: Event
821    //
822    //--------------------------------------------------------------------------
823
824    /**
825     *  @private
826     */
827    override public function clone():Event
828    {
829        var cloneEvent:GridEvent = new GridEvent(
830            type, bubbles, cancelable,
831            localX, localY,
832            relatedObject, ctrlKey, altKey, shiftKey, buttonDown, delta,
833            rowIndex, columnIndex, column, item, itemRenderer);
834
835        cloneEvent.relatedObject = this.relatedObject;
836
837        return cloneEvent;
838    }
839
840    /**
841     *  @private
842     */
843    override public function toString():String
844    {
845        return "GridEvent{" +
846            "type=\"" + type + "\"" +
847            " localX,Y=" + localX + "," + localY +
848            " rowIndex,columnIndex=" + rowIndex + "," + columnIndex +
849            "}";
850    }
851}
852}
853