Source Code Cross Referenced for MouseClick.java in  » Testing » jacareto » jacareto » struct » 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.struct 
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.struct;
025:
026:        import jacareto.parse.RecordTokenizer;
027:        import jacareto.record.MouseEventRecordable;
028:        import jacareto.system.Environment;
029:
030:        import java.awt.event.MouseEvent;
031:
032:        import java.util.Iterator;
033:
034:        /**
035:         * This structure element stands for a mouse click. A structure element can parse a part of a
036:         * record.
037:         *
038:         * @author <a href="mailto:cspannagel@web.de">Christian Spannagel</a>
039:         * @version 1.0
040:         */
041:        public class MouseClick extends StructureElement {
042:            /** The x coordinate. */
043:            private int x;
044:
045:            /** The y coordinate. */
046:            private int y;
047:
048:            /** The x coordinate relative to the root's anchor */
049:            private int rootX;
050:
051:            /** The y coordinate relative to the root's anchor */
052:            private int rootY;
053:
054:            /** The source name. */
055:            private String sourceName;
056:
057:            /** The user defined component name. */
058:            private String componentName;
059:
060:            /** The root name. */
061:            private String rootName;
062:
063:            /** The click count. */
064:            private int clickCount;
065:
066:            /** The modifiers. */
067:            private int modifiers;
068:
069:            /** The mouse pressed child. */
070:            private MouseEventRecordable pressedChild;
071:
072:            /** The mouse released child. */
073:            private MouseEventRecordable releasedChild;
074:
075:            /** The mouse clicked child. */
076:            private MouseEventRecordable clickedChild;
077:
078:            /**
079:             * Creates a new "mouse click" structure element.
080:             *
081:             * @param env the environment
082:             * @param children the child structure elements
083:             */
084:            public MouseClick(Environment env, StructureElement[] children) {
085:                super (env, children);
086:
087:                MouseEventRecordable recordable = (MouseEventRecordable) children[2];
088:                x = recordable.getX();
089:                y = recordable.getY();
090:                rootX = recordable.getRootX();
091:                rootY = recordable.getRootY();
092:                sourceName = recordable.getSourceName();
093:                componentName = recordable.getComponentName();
094:                rootName = recordable.getRootName();
095:                clickCount = recordable.getClickCount();
096:                modifiers = recordable.getModifiers();
097:                pressedChild = (MouseEventRecordable) children[0];
098:                releasedChild = (MouseEventRecordable) children[1];
099:                clickedChild = (MouseEventRecordable) children[2];
100:            }
101:
102:            /**
103:             * Parses a record which is tokenized by the given record tokenizer.
104:             *
105:             * @param env DOCUMENT ME!
106:             * @param recordTokenizer the record tokenizer
107:             *
108:             * @return a structure element, or <code>null</code> if this class cannot parse the record at
109:             *         the current position
110:             */
111:            public static StructureElement parse(Environment env,
112:                    RecordTokenizer recordTokenizer) {
113:                StructureElement result = null;
114:                StructureElement[] children = null;
115:                boolean cond;
116:
117:                try {
118:                    MouseEventRecordable first = (MouseEventRecordable) recordTokenizer
119:                            .get();
120:                    MouseEventRecordable second = (MouseEventRecordable) recordTokenizer
121:                            .get(1);
122:                    MouseEventRecordable third = (MouseEventRecordable) recordTokenizer
123:                            .get(2);
124:
125:                    cond = true;
126:                    cond = cond && (first.getID() == MouseEvent.MOUSE_PRESSED);
127:                    cond = cond
128:                            && (second.getID() == MouseEvent.MOUSE_RELEASED);
129:                    cond = cond && (third.getID() == MouseEvent.MOUSE_CLICKED);
130:
131:                    cond = cond && (first.getX() == second.getX())
132:                            && (first.getX() == third.getX());
133:                    cond = cond && (first.getY() == second.getY())
134:                            && (first.getY() == third.getY());
135:                    cond = cond
136:                            && first.getSourceName().equals(
137:                                    second.getSourceName());
138:                    cond = cond
139:                            && first.getSourceName().equals(
140:                                    third.getSourceName());
141:
142:                    if (cond) {
143:                        children = new StructureElement[3];
144:                        children[0] = first;
145:                        children[1] = second;
146:                        children[2] = third;
147:                        result = new MouseClick(env, children);
148:                        recordTokenizer.forward(3);
149:                    }
150:                } catch (Throwable t) {
151:                    ;
152:                }
153:
154:                return result;
155:            }
156:
157:            /**
158:             * Returns the x-coordinate of the mouse click.
159:             *
160:             * @return DOCUMENT ME!
161:             */
162:            public int getX() {
163:                return x;
164:            }
165:
166:            /**
167:             * Returns the y-coordinate of the mouse click.
168:             *
169:             * @return DOCUMENT ME!
170:             */
171:            public int getY() {
172:                return y;
173:            }
174:
175:            /**
176:             * Sets the x coordinate.
177:             *
178:             * @param x DOCUMENT ME!
179:             */
180:            public void setX(int x) {
181:                this .x = x;
182:
183:                Iterator it = childrenIterator();
184:
185:                while (it.hasNext()) {
186:                    ((MouseEventRecordable) it.next()).setX(x);
187:                }
188:            }
189:
190:            /**
191:             * Sets the y coordinate.
192:             *
193:             * @param y DOCUMENT ME!
194:             */
195:            public void setY(int y) {
196:                this .y = y;
197:
198:                Iterator it = childrenIterator();
199:
200:                while (it.hasNext()) {
201:                    ((MouseEventRecordable) it.next()).setY(y);
202:                }
203:            }
204:
205:            /**
206:             * Returns the x-coordinate relative to the root's anchor
207:             *
208:             * @return DOCUMENT ME!
209:             */
210:            public int getRootX() {
211:                return rootX;
212:            }
213:
214:            /**
215:             * Returns the y-coordinate relative to the root's anchor
216:             *
217:             * @return DOCUMENT ME!
218:             */
219:            public int getRootY() {
220:                return rootY;
221:            }
222:
223:            /**
224:             * Sets the x coordinate relative to the root's anchor
225:             *
226:             * @param rootX DOCUMENT ME!
227:             */
228:            public void setRootX(int rootX) {
229:                this .rootX = rootX;
230:
231:                Iterator it = childrenIterator();
232:
233:                while (it.hasNext()) {
234:                    ((MouseEventRecordable) it.next()).setRootX(rootX);
235:                }
236:            }
237:
238:            /**
239:             * Sets the y coordinate relative to the root's anchor
240:             *
241:             * @param rootY DOCUMENT ME!
242:             */
243:            public void setRootY(int rootY) {
244:                this .rootY = rootY;
245:
246:                Iterator it = childrenIterator();
247:
248:                while (it.hasNext()) {
249:                    ((MouseEventRecordable) it.next()).setRootY(rootY);
250:                }
251:            }
252:
253:            /**
254:             * Returns the source name.
255:             *
256:             * @return DOCUMENT ME!
257:             */
258:            public String getSourceName() {
259:                return sourceName;
260:            }
261:
262:            /**
263:             * Sets the source name.
264:             *
265:             * @param sourceName DOCUMENT ME!
266:             */
267:            public void setSourceName(String sourceName) {
268:                this .sourceName = sourceName;
269:
270:                Iterator it = childrenIterator();
271:
272:                while (it.hasNext()) {
273:                    ((MouseEventRecordable) it.next())
274:                            .setSourceName(sourceName);
275:                }
276:            }
277:
278:            /**
279:             * Returns the user defined component name.
280:             *
281:             * @return DOCUMENT ME!
282:             */
283:            public String getComponentName() {
284:                return componentName;
285:            }
286:
287:            /**
288:             * Returns the name of the root component.
289:             *
290:             * @return DOCUMENT ME!
291:             */
292:            public String getRootName() {
293:                return rootName;
294:            }
295:
296:            /**
297:             * Sets the name of the root component.
298:             *
299:             * @param rootName DOCUMENT ME!
300:             */
301:            public void setRootName(String rootName) {
302:                this .rootName = rootName;
303:
304:                Iterator it = childrenIterator();
305:
306:                while (it.hasNext()) {
307:                    ((MouseEventRecordable) it.next()).setRootName(rootName);
308:                }
309:            }
310:
311:            /**
312:             * Returns the click count.
313:             *
314:             * @return DOCUMENT ME!
315:             */
316:            public int getClickCount() {
317:                return clickCount;
318:            }
319:
320:            /**
321:             * Sets the click count.
322:             *
323:             * @param clickCount DOCUMENT ME!
324:             */
325:            public void setClickCount(int clickCount) {
326:                this .clickCount = clickCount;
327:
328:                Iterator it = childrenIterator();
329:
330:                while (it.hasNext()) {
331:                    ((MouseEventRecordable) it.next())
332:                            .setClickCount(clickCount);
333:                }
334:            }
335:
336:            /**
337:             * Returns the modifiers.
338:             *
339:             * @return DOCUMENT ME!
340:             */
341:            public int getModifiers() {
342:                return modifiers;
343:            }
344:
345:            /**
346:             * Sets the modifiers.
347:             *
348:             * @param modifiers DOCUMENT ME!
349:             */
350:            public void setModifiers(int modifiers) {
351:                this .modifiers = modifiers;
352:
353:                Iterator it = childrenIterator();
354:
355:                while (it.hasNext()) {
356:                    ((MouseEventRecordable) it.next()).setModifiers(modifiers);
357:                }
358:            }
359:
360:            /**
361:             * Returns the name of the element.
362:             *
363:             * @return the name
364:             */
365:            public String getElementName() {
366:                return language.getString("Structures.MouseClick.Name");
367:            }
368:
369:            /**
370:             * Returns a description of the element.
371:             *
372:             * @return the description
373:             */
374:            public String getElementDescription() {
375:                return language.getString("Structures.MouseClick.Description");
376:            }
377:
378:            /**
379:             * Returns a String which describes the content of the element shortly.
380:             *
381:             * @return a string with a short description of the element
382:             */
383:            public String toShortString() {
384:                return getElementName() + " (" + getX() + "," + getY() + ")";
385:            }
386:
387:            /**
388:             * Returns the MOUSE_PRESSED child.
389:             *
390:             * @return DOCUMENT ME!
391:             */
392:            public MouseEventRecordable getPressedChild() {
393:                return pressedChild;
394:            }
395:
396:            /**
397:             * Returns the MOUSE_RELEASED child.
398:             *
399:             * @return DOCUMENT ME!
400:             */
401:            public MouseEventRecordable getReleasedChild() {
402:                return releasedChild;
403:            }
404:
405:            /**
406:             * Returns the MOUSE_CLICKED child.
407:             *
408:             * @return DOCUMENT ME!
409:             */
410:            public MouseEventRecordable getClickedChild() {
411:                return clickedChild;
412:            }
413:
414:            /**
415:             * Clones the element.
416:             *
417:             * @return DOCUMENT ME!
418:             */
419:            public Object clone() {
420:                StructureElement[] clonedChildren = getClonedChildren();
421:
422:                return new MouseClick(env, clonedChildren);
423:            }
424:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.