01: /*
02: * MyGWT Widget Library
03: * Copyright(c) 2007, MyGWT.
04: * licensing@mygwt.net
05: *
06: * http://mygwt.net/license
07: */
08: package net.mygwt.ui.client.data;
09:
10: /**
11: * Instances of this class are sent as a result of model changes.
12: *
13: * @see Model
14: */
15: public class ChangeEvent {
16:
17: /**
18: * The change type.
19: *
20: * @see Model#Add
21: * @see Model#Remove
22: * @see Model#Update
23: */
24: public int type;
25:
26: /**
27: * The model that fired the event.
28: */
29: public Model source;
30:
31: /**
32: * The item being added or removed.
33: */
34: public Model item;
35:
36: /**
37: * The location for inserts.
38: */
39: public int index;
40:
41: /**
42: * Creates a new instance.
43: *
44: * @param type the change type
45: * @param source the object that was changed
46: */
47: public ChangeEvent(int type, Model source) {
48: this .type = type;
49: this .source = source;
50: }
51:
52: /**
53: * Creates a new instance.
54: *
55: * @param type the change type
56: * @param source the object that has changed
57: * @param item the item that was added or removed
58: */
59: public ChangeEvent(int type, Model source, Model item) {
60: this(type, source);
61: this.item = item;
62: }
63:
64: }
|