Source Code Cross Referenced for AWTEventMask.java in  » Testing » jacareto » jacareto » eventmask » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » jacareto » jacareto.eventmask 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Jacareto Copyright (c) 2002-2005
003:         * Applied Computer Science Research Group, Darmstadt University of
004:         * Technology, Institute of Mathematics & Computer Science,
005:         * Ludwigsburg University of Education, and Computer Based
006:         * Learning Research Group, Aachen University. All rights reserved.
007:         *
008:         * Jacareto is free software; you can redistribute it and/or
009:         * modify it under the terms of the GNU General Public
010:         * License as published by the Free Software Foundation; either
011:         * version 2 of the License, or (at your option) any later version.
012:         *
013:         * Jacareto is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
016:         * General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU General Public
019:         * License along with Jacareto; if not, write to the Free
020:         * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021:         *
022:         */
023:
024:        package jacareto.eventmask;
025:
026:        import jacareto.record.AWTEventRecordable;
027:        import jacareto.system.Environment;
028:        import jacareto.system.EnvironmentMember;
029:        import jacareto.toolkit.HashtableChangeEvent;
030:        import jacareto.toolkit.HashtableChangeListener;
031:
032:        import java.awt.AWTEvent;
033:
034:        import java.util.Iterator;
035:        import java.util.Vector;
036:
037:        /**
038:         * An event mask with additional features.
039:         *
040:         * @author <a href="mailto:cspannagel@web.de">Christian Spannagel</a>
041:         * @version 1.0
042:         */
043:        public abstract class AWTEventMask extends EnvironmentMember implements 
044:                HashtableChangeListener {
045:            /** The listeners. */
046:            private Vector listeners;
047:
048:            /** Whether or not this event mask listens to hashtable changes. */
049:            private boolean isListeningToHashtableChanges;
050:
051:            /**
052:             * Creates an AWTEventMask. The event mask does not listen to customization changes by default.
053:             *
054:             * @param env the environment
055:             */
056:            public AWTEventMask(Environment env) {
057:                super (env);
058:                listeners = new Vector(5);
059:                isListeningToHashtableChanges = false;
060:            }
061:
062:            /**
063:             * Adds an eventmask listener to the list of listeners.
064:             *
065:             * @param listener the listener
066:             */
067:            public void addEventMaskListener(EventMaskListener listener) {
068:                if (listener != null) {
069:                    listeners.add(listener);
070:                }
071:            }
072:
073:            /**
074:             * Removes an eventmask listener from the list of listeners.
075:             *
076:             * @param listener the listener
077:             */
078:            public void removeEventMaskListener(EventMaskListener listener) {
079:                if (listener != null) {
080:                    listeners.remove(listener);
081:                }
082:            }
083:
084:            /**
085:             * Fires an eventmask event when the event mask has changed to all listeners.
086:             *
087:             * @param event the hashtable change event
088:             */
089:            protected void fireEventMaskChange(EventMaskEvent event) {
090:                Iterator i = listeners.iterator();
091:
092:                while (i.hasNext()) {
093:                    ((EventMaskListener) i.next()).eventMaskChanged(event);
094:                }
095:            }
096:
097:            /**
098:             * Returns the event mask as long value.
099:             *
100:             * @return the event mask, as long
101:             */
102:            public abstract long getLongValue();
103:
104:            /**
105:             * Returns <code>true</code> if the specified event is included in this event mask.
106:             *
107:             * @param event the event
108:             *
109:             * @return Whether this event mask includes the event or not
110:             */
111:            public abstract boolean isIncluded(AWTEvent event);
112:
113:            /**
114:             * Returns <code>true</code> if the specified {@link AWTEventRecordable} is included in this
115:             * event mask.
116:             *
117:             * @param AWTEventRecordable the event recordable
118:             *
119:             * @return Whether this event mask includes the event recordable or not
120:             */
121:            public boolean isIncluded(AWTEventRecordable AWTEventRecordable) {
122:                return isIncluded(AWTEventRecordable.getEvent());
123:            }
124:
125:            /**
126:             * Invoked when the hashtable has changed. This method calls the {@link
127:             * AWTEventMask#applyCustomization()} method to get the new values.
128:             *
129:             * @param event the hashtable change event
130:             */
131:            public void hashtableChanged(HashtableChangeEvent event) {
132:                if (isListeningToHashtableChanges) {
133:                    applyCustomization();
134:                }
135:            }
136:
137:            /**
138:             * Specifies whether or not this instance is listening to changes of the customization.
139:             *
140:             * @param isListening if instance is listening to customization
141:             */
142:            public void setListeningToHashtableChanges(boolean isListening) {
143:                this .isListeningToHashtableChanges = isListening;
144:            }
145:
146:            /**
147:             * Returns whether or not this instance is listening to changes of the customization.
148:             *
149:             * @return true, if mask is listening to changes in the customization
150:             */
151:            public boolean isListeningToHashtableChanges() {
152:                return isListeningToHashtableChanges;
153:            }
154:
155:            /**
156:             * Load the values from the customization. In this method a subclass should read out the
157:             * customization values it is interested in.
158:             */
159:            protected abstract void applyCustomization();
160:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.