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: KTreeModelEvent.java,v $
023   Revision 1.1  2004/05/13 22:25:42  markl
024   new classes
025
026   ----------------------------------------------------------------------------
027*/
028
029package kiwi.event;
030
031import kiwi.ui.model.*;
032
033import java.util.EventObject;
034
035/** Event generated by a <code>KTreeModel</code> to notify its listeners that
036  * the structure or state of the tree data structure has changed in some way.
037  *
038  * @see kiwi.ui.model.KTreeModel
039  * @see kiwi.event.KTreeModelListener
040  *
041  * @author Mark Lindner
042  * @since Kiwi 2.0
043  */
044
045public class KTreeModelEvent extends EventObject
046  {
047  private Object node;
048  private int startIndex = 0;
049  private int endIndex = 0;
050
051  /** Construct a new <code>KTreeModelEvent</code>.
052    *
053    * @param source The source of the event.
054    * @param node The node associated with this event.
055    * @param startIndex The start index of a range of child nodes.
056    * @param endIndex The end index of a range of child nodes.
057    */
058  
059  public KTreeModelEvent(Object source, Object node, int startIndex,
060                         int endIndex)
061    {
062    super(source);
063
064    this.node = node;
065    this.startIndex = startIndex;
066    this.endIndex = endIndex;
067    }
068
069  /** Construct a new <code>KTreeModelEvent</code>. The start and end index
070   * are set to 0.
071   *
072   * @param source The source of the event.
073   * @param node The node associated with this event.
074   */
075  
076  public KTreeModelEvent(Object source, Object node)
077    {
078    this(source, node, 0, 0);
079    }
080
081  /** Construct a new <code>KTreeModelEvent</code>.
082   * 
083   * @param source The source of the event.
084   * @param node The node associated with this event.
085   * @param index The index of a child node. The start and end index are
086   * both set to this value.
087   */
088
089  public KTreeModelEvent(Object source, Object node, int index)
090    {
091    this(source, node, index, index);
092    }
093
094  /** Construct a new <code>KTreeModelEvent</code>. The node is set to
095   * <code>null</code> and the start and end index are set to 0.
096   */
097  
098  public KTreeModelEvent(Object source)
099    {
100    this(source, null, 0, 0);
101    }
102
103  /** Get the node object for this event. */
104
105  public Object getNode()
106    {
107    return(node);
108    }
109
110  /** Get the start index for this event. */
111
112  public int getIndex()
113    {
114    return(startIndex);
115    }
116
117  /** Get the start index for this event. */
118
119  public int getStartIndex()
120    {
121    return(startIndex);
122    }
123
124  /** Get the end index for this event. */
125  
126  public int getEndIndex()
127    {
128    return(endIndex);
129    }
130  
131  }
132
133/* end of source file */