1 /***
2 * DataChangeEvent.java
3 *
4 * This file is part of the creme library.
5 * The creme library intends to ease the development effort of large
6 * applications by providing easy to use support classes.
7 *
8 * Copyright (C) 2002 Denis Bregeon
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 * contact information: dbregeon@sourceforge.net
25 */
26 package org.jcreme.reporting;
27
28 import java.util.EventObject;
29
30 /***
31 * This event signals that some data in the datasource has changed.
32 *
33 * @author $Author: dbregeon $
34 * @version $Revision: 1.1 $
35 */
36 public class DataChangeEvent extends EventObject {
37 /***
38 * Signals the change is an update of existing Data.
39 */
40 public static final int UPDATE = 0;
41
42 /***
43 * Signals the change is new Data.
44 */
45 public static final int NEW = 1;
46
47 /***
48 * Signals the change is deletion of Data.
49 */
50 public static final int DELETE = 2;
51
52 private Object data = null;
53
54 private int type = UPDATE;
55
56 /***
57 * Creates a new instance of DataChangeEvent
58 *
59 * @param src
60 * the source of the event.
61 * @param data
62 * the data that changed in the source.
63 */
64 public DataChangeEvent(Object src, Object data) {
65 super(src);
66 this.data = data;
67 }
68
69 /***
70 * Creates a new instance of DataChangeEvent
71 *
72 * @param src
73 * the source of the event.
74 * @param data
75 * the data that changed in the source.
76 * @param t
77 * the type of the event.
78 */
79 public DataChangeEvent(Object src, Object data, int t) {
80 this(src, data);
81 this.type = t;
82 }
83
84 /***
85 * This method gives access to the type of the change.
86 *
87 * @return the type of change that occured in the DataSource.
88 */
89 public Object getData() {
90 return this.data;
91 }
92
93 /***
94 * Gives access to the type of change this event reports.
95 *
96 * @return the type of the event.
97 */
98 public int getType() {
99 return this.type;
100 }
101 }