Source code: com/virtuosotechnologies/lib/platform/PlatformEvent.java
1 /*
2 ================================================================================
3
4 FILE: PlatformEvent.java
5
6 PROJECT:
7
8 Virtuoso Utilities
9
10 CONTENTS:
11
12 A platform-specific event
13
14 PROGRAMMERS:
15
16 Daniel Azuma (DA) <dazuma@kagi.com>
17
18 COPYRIGHT:
19
20 Copyright (C) 2003 Daniel Azuma (dazuma@kagi.com)
21
22 This program is free software; you can redistribute it and/or
23 modify it under the terms of the GNU General Public License as
24 published by the Free Software Foundation; either version 2
25 of the License, or (at your option) any later version.
26
27 This program is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 GNU General Public License for more details.
31
32 You should have received a copy of the GNU General Public
33 License along with this program; if not, write to
34 Free Software Foundation, Inc.
35 59 Temple Place, Suite 330
36 Boston, MA 02111-1307 USA
37
38 ================================================================================
39 */
40
41
42 package com.virtuosotechnologies.lib.platform;
43
44
45 import java.util.EventObject;
46
47 import com.virtuosotechnologies.lib.base.UniqueObject;
48
49
50 /**
51 * A platform-specific event
52 */
53 public class PlatformEvent
54 extends EventObject
55 {
56 private static final Object globalSource_ = new Object();
57
58
59 public static class Type
60 extends UniqueObject
61 {
62 public Type()
63 {
64 super();
65 }
66
67 public Type(
68 String description)
69 {
70 super(description);
71 }
72 }
73
74
75 private boolean handled_;
76 private Type type_;
77
78
79 /**
80 * Constructor
81 */
82 public PlatformEvent(
83 Type type)
84 {
85 super(globalSource_);
86 handled_ = false;
87 type_ = type;
88 }
89
90
91 /**
92 * Get the event type
93 *
94 * @return event type
95 */
96 public Type getType()
97 {
98 return type_;
99 }
100
101
102 /**
103 * Has the event been handled?
104 *
105 * @return true if the event has been handled
106 */
107 public boolean isHandled()
108 {
109 return handled_;
110 }
111
112
113 /**
114 * Mark the event as having been handled.
115 */
116 public void setHandled()
117 {
118 handled_ = true;
119 }
120
121
122 /**
123 * Get the global event source used for all platform events
124 */
125 public static Object getGlobalSource()
126 {
127 return globalSource_;
128 }
129 }