001: /*
002: * This file is part of the Echo Web Application Framework (hereinafter "Echo").
003: * Copyright (C) 2002-2005 NextApp, Inc.
004: *
005: * Version: MPL 1.1/GPL 2.0/LGPL 2.1
006: *
007: * The contents of this file are subject to the Mozilla Public License Version
008: * 1.1 (the "License"); you may not use this file except in compliance with
009: * the License. You may obtain a copy of the License at
010: * http://www.mozilla.org/MPL/
011: *
012: * Software distributed under the License is distributed on an "AS IS" basis,
013: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
014: * for the specific language governing rights and limitations under the
015: * License.
016: *
017: * Alternatively, the contents of this file may be used under the terms of
018: * either the GNU General Public License Version 2 or later (the "GPL"), or
019: * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
020: * in which case the provisions of the GPL or the LGPL are applicable instead
021: * of those above. If you wish to allow use of your version of this file only
022: * under the terms of either the GPL or the LGPL, and not to allow others to
023: * use your version of this file under the terms of the MPL, indicate your
024: * decision by deleting the provisions above and replace them with the notice
025: * and other provisions required by the GPL or the LGPL. If you do not delete
026: * the provisions above, a recipient may use your version of this file under
027: * the terms of any one of the MPL, the GPL or the LGPL.
028: */
029:
030: package nextapp.echo2.app.event;
031:
032: import java.util.EventObject;
033:
034: /**
035: * An event describing an update to items in a list.
036: *
037: * @see nextapp.echo2.app.event.ListDataListener
038: */
039: public class ListDataEvent extends EventObject {
040:
041: /**
042: * An event type indicating items in the list were changed.
043: */
044: public static final int CONTENTS_CHANGED = 0;
045:
046: /**
047: * An event type indicating items were added to the list.
048: */
049: public static final int INTERVAL_ADDED = 1;
050:
051: /**
052: * An event type indicating items were removed from the list.
053: */
054: public static final int INTERVAL_REMOVED = 2;
055:
056: private int index0;
057: private int index1;
058: private int type;
059:
060: /**
061: * Creates a new <code>ListDataEvent</code>
062: *
063: * @param source the object that generated the event
064: * @param type the type of event, one of the following values:
065: * <ul>
066: * <li>CONTENTS_CHANGED - Indicates a change was made to one or more
067: * items in the list.</li>
068: * <li>INTERVAL_ADDED - Indicates one or more items were added to
069: * the list.</li>
070: * <li>INTERVAL_REMOVED - Indicates one or more items were removed
071: * from the list.</li>
072: * </ul>
073: * @param index0 the first index of the interval affected by the list change
074: * @param index1 the last index of the interval affected by the list change
075: *
076: */
077: public ListDataEvent(Object source, int type, int index0, int index1) {
078: super (source);
079:
080: this .type = type;
081: this .index0 = index0;
082: this .index1 = index1;
083: }
084:
085: /**
086: * Returns the first index of the interval affected by the list change.
087: *
088: * @return the first index
089: */
090: public int getIndex0() {
091: return index0;
092: }
093:
094: /**
095: * Returns the last index of the interval affected by the list change.
096: *
097: * @return the last index
098: */
099: public int getIndex1() {
100: return index1;
101: }
102:
103: /**
104: * Returns the type of the event
105: *
106: * @return the type of event, one of the following values:
107: * <ul>
108: * <li>CONTENTS_CHANGED - Indicates a change was made to one or more
109: * items in the list.</li>
110: * <li>INTERVAL_ADDED - Indicates one or more items were added to
111: * the list.</li>
112: * <li>INTERVAL_REMOVED - Indicates one or more items were removed
113: * from the list.</li>
114: * </ul>
115: */
116: public int getType() {
117: return type;
118: }
119: }
|