Source Code Cross Referenced for WindowActivation.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.FocusEventRecordable;
028:        import jacareto.record.Recordable;
029:        import jacareto.record.WindowEventRecordable;
030:        import jacareto.system.Environment;
031:
032:        import java.awt.event.FocusEvent;
033:        import java.awt.event.WindowEvent;
034:
035:        /**
036:         * A window has been activated . A structure element can parse a part of a record.
037:         *
038:         * @author <a href="mailto:cspannagel@web.de">Christian Spannagel</a>
039:         * @version 1.01
040:         */
041:        public class WindowActivation extends StructureElement {
042:            /** The window name. */
043:            private String windowName;
044:
045:            /** The title of the window. */
046:            private String windowTitle;
047:
048:            /**
049:             * Creates a new "window activation" structure element. The first element in the children array
050:             * must be a window event recordable with the id WINDOW_ACTIVATED.
051:             *
052:             * @param env the environment
053:             * @param children the child structure elements
054:             */
055:            public WindowActivation(Environment env, StructureElement[] children) {
056:                super (env, children);
057:                this .windowName = ((WindowEventRecordable) children[0])
058:                        .getWindowName();
059:                this .windowTitle = ((WindowEventRecordable) children[0])
060:                        .getWindowTitle();
061:            }
062:
063:            /**
064:             * Creates a new "window activation" structure element.
065:             *
066:             * @param env the environment
067:             * @param children the child structure elements
068:             * @param windowName the name of the window
069:             * @param windowTitle the title of the window
070:             */
071:            public WindowActivation(Environment env,
072:                    StructureElement[] children, String windowName,
073:                    String windowTitle) {
074:                super (env, children);
075:                this .windowName = windowName;
076:                this .windowTitle = windowTitle;
077:            }
078:
079:            /**
080:             * Parses a record which is tokenized by the given record tokenizer.
081:             *
082:             * @param env DOCUMENT ME!
083:             * @param recordTokenizer the record tokenizer
084:             *
085:             * @return a structure element, or <code>null</code> if this class cannot parse the record at
086:             *         the current position
087:             */
088:            public static StructureElement parse(Environment env,
089:                    RecordTokenizer recordTokenizer) {
090:                StructureElement result = null;
091:                StructureElement[] children = null;
092:                boolean cond;
093:
094:                try {
095:                    WindowEventRecordable first = (WindowEventRecordable) recordTokenizer
096:                            .get();
097:                    FocusEventRecordable second = (FocusEventRecordable) recordTokenizer
098:                            .get(1);
099:
100:                    Recordable third = recordTokenizer.get(2);
101:
102:                    cond = true;
103:                    cond = cond
104:                            && (first.getID() == WindowEvent.WINDOW_ACTIVATED);
105:                    cond = cond && (second.getID() == FocusEvent.FOCUS_GAINED);
106:
107:                    if (cond) {
108:                        if ((third != null)
109:                                && third instanceof  WindowEventRecordable
110:                                && (((WindowEventRecordable) third).getID() == WindowEvent.WINDOW_ACTIVATED)
111:                                && ((WindowEventRecordable) third)
112:                                        .getSourceName().equals(
113:                                                first.getSourceName())) {
114:                            children = new StructureElement[3];
115:                            children[2] = third;
116:                            recordTokenizer.forward(3);
117:                        } else {
118:                            children = new StructureElement[2];
119:                            recordTokenizer.forward(2);
120:                        }
121:
122:                        children[0] = first;
123:                        children[1] = second;
124:
125:                        //result = new WindowActivation (env, children);
126:                        result = new WindowActivation(env, children, first
127:                                .getWindowName(), first.getWindowTitle());
128:                    }
129:                } catch (Throwable t) {
130:                    ;
131:                }
132:
133:                if (result == null) {
134:                    try {
135:                        WindowEventRecordable windowEvent = (WindowEventRecordable) recordTokenizer
136:                                .get();
137:
138:                        if (windowEvent.getID() == WindowEvent.WINDOW_ACTIVATED) {
139:                            children = new StructureElement[1];
140:                            children[0] = windowEvent;
141:                            recordTokenizer.forward();
142:
143:                            //result = new WindowActivation (env, children);
144:                            result = new WindowActivation(env, children,
145:                                    windowEvent.getWindowName(), windowEvent
146:                                            .getWindowTitle());
147:                        }
148:                    } catch (Exception e) {
149:                        ;
150:                    }
151:                }
152:
153:                return result;
154:            }
155:
156:            /**
157:             * Returns the name of the element.
158:             *
159:             * @return the name
160:             */
161:            public String getElementName() {
162:                return language.getString("Structures.WindowActivation.Name");
163:            }
164:
165:            /**
166:             * Returns a description of the element.
167:             *
168:             * @return the description
169:             */
170:            public String getElementDescription() {
171:                return language
172:                        .getString("Structures.WindowActivation.Description");
173:            }
174:
175:            /**
176:             * Returns a String which describes the content of the element shortly.
177:             *
178:             * @return a string with a short description of the element
179:             */
180:            public String toShortString() {
181:                String result = getElementName();
182:
183:                if (windowName != null) {
184:                    String windowIdentifier = (((windowTitle == null) || windowTitle
185:                            .equals("")) ? windowName : windowTitle);
186:                    String insertedText = ((windowIdentifier.length() < 40) ? windowIdentifier
187:                            : (windowIdentifier.substring(0, 37) + "..."));
188:                    result += (" (" + insertedText + ")");
189:                }
190:
191:                return result;
192:            }
193:
194:            /**
195:             * The name of the activated window.
196:             *
197:             * @return DOCUMENT ME!
198:             */
199:            public String getWindowName() {
200:                return windowName;
201:            }
202:
203:            /**
204:             * The title of the activated window.
205:             *
206:             * @return DOCUMENT ME!
207:             */
208:            public String getWindowTitle() {
209:                return windowTitle;
210:            }
211:
212:            /**
213:             * Clones the element.
214:             *
215:             * @return DOCUMENT ME!
216:             */
217:            public Object clone() {
218:                StructureElement[] clonedChildren = getClonedChildren();
219:
220:                return new WindowActivation(env, clonedChildren, windowName,
221:                        windowTitle);
222:            }
223:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.