001/* ----------------------------------------------------------------------------
002   The Kiwi Toolkit - A Java Class Library
003   Copyright (C) 1998-2004 Mark A. Lindner
004
005   This library is free software; you can redistribute it and/or
006   modify it under the terms of the GNU General Public License as
007   published by the Free Software Foundation; either version 2 of the
008   License, or (at your option) any later version.
009
010   This library is distributed in the hope that it will be useful,
011   but WITHOUT ANY WARRANTY; without even the implied warranty of
012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013   General Public License for more details.
014
015   You should have received a copy of the GNU General Public License
016   along with this library; if not, write to the Free Software
017   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
018   02111-1307, USA.
019 
020   The author may be contacted at: mark_a_lindner@yahoo.com
021   ----------------------------------------------------------------------------
022   $Log: KListModelEvent.java,v $
023   Revision 1.2  2004/05/31 07:30:59  markl
024   javadoc updates
025
026   Revision 1.1  2004/05/13 21:44:19  markl
027   new classes
028   ----------------------------------------------------------------------------
029*/
030
031package kiwi.event;
032
033import java.util.EventObject;
034
035/** Event for notifying listeners that a list data structure has changed.
036  *
037  * @see kiwi.event.KListModelListener
038  * @author Mark Lindner
039  *
040  * @since Kiwi 2.0
041  */
042
043public class KListModelEvent extends EventObject
044  {
045  private int startIndex = 0;
046  private int endIndex = 0;
047
048  /** Construct a new <code>KListModelEvent</code>.
049    *
050    * @param source The source of the event.
051    * @param startIndex The offset of the first item in a range of items that is
052    * affected by this event.
053    * @param endIndex The offset of the last item in a range of items that is
054    * affected by this event.
055    */
056
057  public KListModelEvent(Object source, int startIndex, int endIndex)
058    {
059    super(source);
060
061    this.startIndex = startIndex;
062    this.endIndex = endIndex;
063    }
064
065  /** Construct a new <code>KListModelEvent</code>. The index is set to
066    * 0.
067    *
068    * @param source The source of the event.
069    */
070
071  public KListModelEvent(Object source)
072    {
073    this(source, -1, -1);
074    }
075  
076  /** Get the offset (index) for this event. For insertions, the
077    * position at which an item will be inserted; for deletions, the
078    * position of an item being removed; for updates, the position of an item
079    * that has changed.
080    */
081
082  public int getIndex()
083    {
084    return(startIndex);
085    }
086
087  /** Get the start index for this event. For insertions, the offset
088   * of the first item in a range of items that will be inserted; for
089   * deletions, the position of the first item in a range of items
090   * being removed; for updates, the position of the first item in a range of
091   * items that have changed.
092   */
093
094  public int getStartIndex()
095    {
096    return(startIndex);
097    }
098
099  /** Get the end index for this event. For insertions, the offset of
100   * the last item in a range of items that will be inserted; for
101   * deletions, the position of the last item in a range of items
102   * being removed; for updates, the position of the last item in a
103   * range of items that have changed.
104   */
105  
106  public int getEndIndex()
107    {
108    return(endIndex);
109    }
110  
111  }
112
113/* end of source file */