CVSROOT: /sources/classpath Module name: classpath Changes by: David Gilbert <trebligd> 06/06/16 13:15:19
Modified files: . : ChangeLog javax/swing/event: ListDataEvent.java Log message: 2006-06-16 David Gilbert <[EMAIL PROTECTED]> * javax/swing/event/ListDataEvent.java: updated API docs, plus (ListDataEvent): Handle case where index0 > index1, (toString): Implemented. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.7841&r2=1.7842 http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/event/ListDataEvent.java?cvsroot=classpath&r1=1.8&r2=1.9 Patches: Index: ChangeLog =================================================================== RCS file: /sources/classpath/classpath/ChangeLog,v retrieving revision 1.7841 retrieving revision 1.7842 diff -u -b -r1.7841 -r1.7842 --- ChangeLog 16 Jun 2006 12:54:47 -0000 1.7841 +++ ChangeLog 16 Jun 2006 13:15:14 -0000 1.7842 @@ -1,3 +1,9 @@ +2006-06-16 David Gilbert <[EMAIL PROTECTED]> + + * javax/swing/event/ListDataEvent.java: updated API docs, plus + (ListDataEvent): Handle case where index0 > index1, + (toString): Implemented. + 2006-06-16 Robert Schuster <[EMAIL PROTECTED]> * javax/swing/plaf/metal/MetalMenuBarUI.java: Index: javax/swing/event/ListDataEvent.java =================================================================== RCS file: /sources/classpath/classpath/javax/swing/event/ListDataEvent.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -b -r1.8 -r1.9 --- javax/swing/event/ListDataEvent.java 2 Jul 2005 20:32:50 -0000 1.8 +++ javax/swing/event/ListDataEvent.java 16 Jun 2006 13:15:19 -0000 1.9 @@ -1,5 +1,5 @@ /* ListDataEvent.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -41,6 +41,9 @@ import java.util.EventObject; /** + * An event that contains information about a modification to the content of + * a list. + * * @author Andrew Selkirk * @author Ronald Veldema */ @@ -48,32 +51,46 @@ { private static final long serialVersionUID = 2510353260071004774L; + /** An event type indicating that the list content has been modified. */ public static final int CONTENTS_CHANGED = 0; + + /** An event type indicating that an interval has been added to the list. */ public static final int INTERVAL_ADDED = 1; + + /** + * An event type indicating that an interval has been removed from the + * list. + */ public static final int INTERVAL_REMOVED = 2; - private int type = 0; - private int index0 = 0; - private int index1 = 0; + private int type; + private int index0; + private int index1; /** * Creates a <code>ListDataEvent</code> object. * - * @param source The source of the event. - * @param type The type of the event - * @param index0 Bottom of range - * @param index1 Top of range + * @param source the source of the event (<code>null</code> not permitted). + * @param type the type of the event (should be one of + * [EMAIL PROTECTED] #CONTENTS_CHANGED}, [EMAIL PROTECTED] #INTERVAL_ADDED} or + * [EMAIL PROTECTED] #INTERVAL_REMOVED}, although this is not enforced). + * @param index0 the index for one end of the modified range of list + * elements. + * @param index1 the index for the other end of the modified range of list + * elements. */ public ListDataEvent(Object source, int type, int index0, int index1) { super(source); this.type = type; - this.index0 = index0; - this.index1 = index1; + this.index0 = Math.min(index0, index1); + this.index1 = Math.max(index0, index1); } /** - * Returns the bottom index. + * Returns the index of the first item in the range of modified list items. + * + * @return The index of the first item in the range of modified list items. */ public int getIndex0() { @@ -81,7 +98,9 @@ } /** - * Returns the top index. + * Returns the index of the last item in the range of modified list items. + * + * @return The index of the last item in the range of modified list items. */ public int getIndex1() { @@ -89,10 +108,25 @@ } /** - * Returns the type of this event. + * Returns a code representing the type of this event, which is usually one + * of [EMAIL PROTECTED] #CONTENTS_CHANGED}, [EMAIL PROTECTED] #INTERVAL_ADDED} or + * [EMAIL PROTECTED] #INTERVAL_REMOVED}. + * + * @return The event type. */ public int getType() { return type; } + + /** + * Returns a string representing the state of this event. + * + * @return A string. + */ + public String toString() + { + return getClass().getName() + "[type=" + type + ",index0=" + index0 + + ",index1=" + index1 + "]"; + } }