1 /* 2 Copyright aswing.org, see the LICENCE.txt. 3 */ 4 5 import org.aswing.Event; 6 7 /** 8 * @see org.aswing.JList 9 * @see org.aswing.events.ListDataListener 10 * @author iiley 11 */ 12 class org.aswing.events.ListDataEvent extends Event{ 13 14 /** Identifies one or more changes in the lists contents. */ 15 public static var CONTENTS_CHANGED:String = "CONTENTS_CHANGED"; 16 /** Identifies the addition of one or more contiguous items to the list */ 17 public static var INTERVAL_ADDED:String = "INTERVAL_ADDED"; 18 /** Identifies the removal of one or more contiguous items from the list */ 19 public static var INTERVAL_REMOVED:String = "INTERVAL_REMOVED"; 20 21 private var index0:Number; 22 private var index1:Number; 23 24 /** 25 * Returns the event type. The possible values are: 26 * <ul> 27 * <li> {@link #CONTENTS_CHANGED} 28 * <li> {@link #INTERVAL_ADDED} 29 * <li> {@link #INTERVAL_REMOVED} 30 * </ul> 31 * 32 * @return an number representing the type value 33 */ 34 public function getType():String { return super.getType(); } 35 36 /** 37 * Returns the lower index of the range. For a single 38 * element, this value is the same as that returned by {@link #getIndex1}. 39 * @return an int representing the lower index value 40 */ 41 public function getIndex0():Number { return index0; } 42 /** 43 * Returns the upper index of the range. For a single 44 * element, this value is the same as that returned by {@link #getIndex0}. 45 * @return an int representing the upper index value 46 */ 47 public function getIndex1():Number { return index1; } 48 49 /** 50 * Constructs a ListDataEvent object. 51 * 52 * @param source the source Object (typically <code>this</code>) 53 * @param type an int specifying {@link #CONTENTS_CHANGED}, 54 * {@link #INTERVAL_ADDED}, or {@link #INTERVAL_REMOVED} 55 * @param index0 an int specifying the bottom of a range 56 * @param index1 an int specifying the top of a range 57 */ 58 public function ListDataEvent(source:Object, type:String, index0:Number, index1:Number) { 59 super(source, type); 60 this.index0 = index0; 61 this.index1 = index1; 62 } 63 64 public function toString():String { 65 return "ListDataEvent[type=" + getType() + 66 ",index0=" + index0 + 67 ",index1=" + index1 + "]"; 68 } 69 } 70