Source Code Cross Referenced for JInternalFrameRecorder.java in  » Testing » abbot-1.0.1 » abbot » editor » recorder » 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 » abbot 1.0.1 » abbot.editor.recorder 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package abbot.editor.recorder;
002:
003:        import java.awt.*;
004:        import java.awt.event.ComponentEvent;
005:
006:        import javax.swing.JInternalFrame;
007:        import javax.swing.event.InternalFrameEvent;
008:
009:        import abbot.Log;
010:        import abbot.script.*;
011:        import abbot.tester.ComponentTester;
012:        import abbot.util.AWT;
013:
014:        /**
015:         * Handle the recording of events related to an internal frame
016:         * (JInternalFrame). Like instances of Window, we must insert
017:         * waits for the showing and hiding of internal frames.
018:         * <P>
019:         * NOTE: InternalFrameEvents are not normally posted to the AWT event queue.
020:         * @author pickens
021:         * @author twall
022:         */
023:        public class JInternalFrameRecorder extends JComponentRecorder {
024:            private JInternalFrame frame;
025:            private String type;
026:            private static final String UNKNOWN = "unknown";
027:            private static final String SHOW = "show";
028:            private static final String HIDE = "hide";
029:            private static final String CLOSE = "close";
030:            private static final String ICONIFY = "iconify";
031:            private static final String DEICONIFY = "deiconify";
032:            private static final String MOVE = "move";
033:            private static final String RESIZE = "resize";
034:
035:            public static final int SE_INTERNAL_FRAME = SE_ACTION_MAP + 1;
036:            public static final int SE_DECORATION = SE_INTERNAL_FRAME + 1;
037:
038:            /**
039:             * Constructor for JInternalFrameRecorder.
040:             * @param resolver
041:             */
042:            public JInternalFrameRecorder(Resolver resolver) {
043:                super (resolver);
044:            }
045:
046:            protected void init(int rtype) {
047:                super .init(rtype);
048:                frame = null;
049:                type = UNKNOWN;
050:            }
051:
052:            /**
053:             * @see abbot.editor.recorder.ComponentRecorder#accept(java.awt.AWTEvent)
054:             */
055:            public boolean accept(AWTEvent event) {
056:                int id = event.getID();
057:                Log.debug("Source is " + event.getSource());
058:                if (event.getSource() instanceof  JInternalFrame) {
059:                    if (id == ComponentEvent.COMPONENT_SHOWN
060:                            || id == ComponentEvent.COMPONENT_HIDDEN
061:                            || id == ComponentEvent.COMPONENT_MOVED
062:                            || id == ComponentEvent.COMPONENT_RESIZED
063:                            || id == InternalFrameEvent.INTERNAL_FRAME_CLOSING
064:                            || id == InternalFrameEvent.INTERNAL_FRAME_ICONIFIED
065:                            || id == InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED) {
066:                        init(SE_INTERNAL_FRAME);
067:                        return true;
068:                    }
069:                } else if (AWT.isInternalFrameDecoration((Component) event
070:                        .getSource())) {
071:                    init(SE_DECORATION);
072:                    return true;
073:                }
074:                return false;
075:            }
076:
077:            public boolean parse(AWTEvent event) {
078:                boolean consumed = true;
079:                switch (getRecordingType()) {
080:                case SE_INTERNAL_FRAME:
081:                    consumed = parseInternalFrameAction(event);
082:                    break;
083:                case SE_DECORATION:
084:                    setFinished(true);
085:                    break;
086:                default:
087:                    consumed = super .parse(event);
088:                    break;
089:                }
090:                return consumed;
091:            }
092:
093:            protected boolean parseInternalFrameAction(AWTEvent event) {
094:                frame = (JInternalFrame) event.getSource();
095:                switch (event.getID()) {
096:                case ComponentEvent.COMPONENT_SHOWN:
097:                    type = SHOW;
098:                    break;
099:                case ComponentEvent.COMPONENT_HIDDEN:
100:                    type = HIDE;
101:                    break;
102:                case ComponentEvent.COMPONENT_RESIZED:
103:                    type = RESIZE;
104:                    break;
105:                case ComponentEvent.COMPONENT_MOVED:
106:                    type = MOVE;
107:                    break;
108:                case InternalFrameEvent.INTERNAL_FRAME_CLOSING:
109:                    type = CLOSE;
110:                    break;
111:                case InternalFrameEvent.INTERNAL_FRAME_ICONIFIED:
112:                    type = ICONIFY;
113:                    break;
114:                case InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED:
115:                    type = DEICONIFY;
116:                    break;
117:                default:
118:                    throw new IllegalArgumentException("Unrecognized event: "
119:                            + event);
120:                }
121:                setFinished(true);
122:                return true;
123:            }
124:
125:            protected Step createStep() {
126:                Step step;
127:                switch (getRecordingType()) {
128:                case SE_INTERNAL_FRAME:
129:                    step = createInternalFrameAction(frame, type);
130:                    break;
131:                case SE_DECORATION:
132:                    step = null;
133:                    break;
134:                default:
135:                    step = super .createStep();
136:                    break;
137:                }
138:                return step;
139:            }
140:
141:            protected Step createInternalFrameAction(JInternalFrame target,
142:                    String type) {
143:                ComponentReference ref = getResolver().addComponent(target);
144:                if (type == SHOW || type == HIDE) {
145:                    Assert step = new Assert(getResolver(), null,
146:                            ComponentTester.class.getName(),
147:                            "assertComponentShowing", new String[] { ref
148:                                    .getID() }, "true", type == HIDE);
149:                    step.setWait(true);
150:                    return step;
151:                } else if (type == MOVE) {
152:                    Point loc = target.getLocation();
153:                    return new Action(getResolver(), null, "actionMove",
154:                            new String[] { ref.getID(), String.valueOf(loc.x),
155:                                    String.valueOf(loc.y) },
156:                            JInternalFrame.class);
157:                } else if (type == RESIZE) {
158:                    Dimension size = target.getSize();
159:                    return new Action(getResolver(), null, "actionResize",
160:                            new String[] { ref.getID(),
161:                                    String.valueOf(size.width),
162:                                    String.valueOf(size.height) },
163:                            JInternalFrame.class);
164:                } else {
165:                    String action = type == CLOSE ? "actionClose"
166:                            : ((type == ICONIFY) ? "actionIconify"
167:                                    : "actionDeiconify");
168:                    return new Action(getResolver(), null, action,
169:                            new String[] { ref.getID() }, JInternalFrame.class);
170:                }
171:            }
172:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.