1. /*
  2. * @(#)IndexedPropertyChangeEvent.java 1.4 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.beans;
  8. /**
  9. * An "IndexedPropertyChange" event gets delivered whenever a component that
  10. * conforms to the JavaBeans<TM> specification (a "bean") changes a bound
  11. * indexed property. This class is an extension of <code>PropertyChangeEvent</code>
  12. * but contains the index of the property that has changed.
  13. * <P>
  14. * Null values may be provided for the old and the new values if their
  15. * true values are not known.
  16. * <P>
  17. * An event source may send a null object as the name to indicate that an
  18. * arbitrary set of if its properties have changed. In this case the
  19. * old and new values should also be null.
  20. *
  21. * @version 1.4 12/19/03
  22. * @since 1.5
  23. * @author Mark Davidson
  24. */
  25. public class IndexedPropertyChangeEvent extends PropertyChangeEvent {
  26. private int index;
  27. /**
  28. * Constructs a new <code>IndexedPropertyChangeEvent</code> object.
  29. *
  30. * @param source The bean that fired the event.
  31. * @param propertyName The programmatic name of the property that
  32. * was changed.
  33. * @param oldValue The old value of the property.
  34. * @param newValue The new value of the property.
  35. * @param index index of the property element that was changed.
  36. */
  37. public IndexedPropertyChangeEvent(Object source, String propertyName,
  38. Object oldValue, Object newValue,
  39. int index) {
  40. super (source, propertyName, oldValue, newValue);
  41. this.index = index;
  42. }
  43. /**
  44. * Gets the index of the property that was changed.
  45. *
  46. * @return The index specifying the property element that was
  47. * changed.
  48. */
  49. public int getIndex() {
  50. return index;
  51. }
  52. }