01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /**
19: * @author Anton Avtamonov
20: * @version $Revision$
21: */package javax.swing.event;
22:
23: import java.io.Serializable;
24: import java.util.EventObject;
25:
26: public class ListDataEvent extends EventObject implements Serializable {
27: public static final int CONTENTS_CHANGED = 0;
28: public static final int INTERVAL_ADDED = 1;
29: public static final int INTERVAL_REMOVED = 2;
30:
31: private final int type;
32: private final int index0;
33: private final int index1;
34:
35: public ListDataEvent(final Object source, final int type,
36: final int index0, final int index1) {
37: super (source);
38: this .type = type;
39: this .index0 = Math.min(index0, index1);
40: this .index1 = Math.max(index0, index1);
41: }
42:
43: public int getType() {
44: return type;
45: }
46:
47: public int getIndex0() {
48: return index0;
49: }
50:
51: public int getIndex1() {
52: return index1;
53: }
54:
55: /*
56: * The format of the string is based on 1.5 release behavior
57: * which can be revealed using the following code:
58: *
59: * Object obj = new ListDataEvent(null, ListDataEvent.CONTENTS_CHANGED, 0, 1);
60: * System.out.println(obj.toString());
61: */
62: public String toString() {
63: return this .getClass().getName() + "[source=" + source
64: + ",type=" + type + ",index0=" + index0 + ",index1="
65: + index1 + "]";
66: }
67: }
|