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.mvc;
09:
10: /**
11: * <code>AppEvents</code> are used to pass messages between
12: * <code>Controllers</code> and <code>Views</code>. All events have a
13: * specific type which are used to identify the event. Typically, applications
14: * will define all application events in a constants class.
15: */
16: public class AppEvent {
17:
18: /**
19: * The type of the event.
20: */
21: public int type;
22:
23: /**
24: * Application specific data such as the model.
25: */
26: public Object data;
27:
28: /**
29: * Depending on the event, a flag indicating whether the operation should be
30: * allowed.
31: */
32: public boolean doit = true;
33:
34: /**
35: * Creates a new event with the given type.
36: *
37: * @param type the event type
38: */
39: public AppEvent(int type) {
40: this .type = type;
41: }
42:
43: /**
44: * Creates a new event with the given type and data.
45: *
46: * @param type the event type
47: * @param data the data
48: */
49: public AppEvent(int type, Object data) {
50: this .type = type;
51: this .data = data;
52: }
53:
54: public String toString() {
55: return "Event Type: " + type;
56: }
57: }
|