Source Code Cross Referenced for Recorder.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.*;
005:
006:        import abbot.*;
007:        import abbot.i18n.Strings;
008:        import abbot.script.*;
009:        import abbot.script.Resolver;
010:        import abbot.tester.Robot;
011:
012:        /**
013:         * The <code>Recorder</code> provides a mechanism for recording an event stream and
014:         * generating a sequence of script steps from that stream.
015:         * <p>
016:         * NOTE: when writing a recorder, be very careful not to test for
017:         * platform-specific behavior, and avoid being susceptible to
018:         * platform-specific bugs.  Please make sure the recorder works on both
019:         * pointer-focus and click-to-focus window managers, as well as on at least
020:         * two platforms.<p>
021:         */
022:        public abstract class Recorder {
023:            private ActionListener al;
024:            private Resolver resolver;
025:            private long lastEventTime = 0;
026:
027:            /** Create a Recorder for use in converting events into script steps. */
028:            public Recorder(Resolver resolver) {
029:                this .resolver = resolver;
030:            }
031:
032:            /** The recorder supports zero or one listeners. */
033:            public void addActionListener(ActionListener al) {
034:                this .al = al;
035:            }
036:
037:            protected ActionListener getListener() {
038:                return al;
039:            }
040:
041:            /** Start recording a new event stream. */
042:            public void start() {
043:                lastEventTime = System.currentTimeMillis();
044:            }
045:
046:            /** Indicate the end of the current event input stream. */
047:            public abstract void terminate() throws RecordingFailedException;
048:
049:            public long getLastEventTime() {
050:                return lastEventTime;
051:            }
052:
053:            /** Create a step or sequence of steps based on the event stream so far. */
054:            protected abstract Step createStep();
055:
056:            /** Return a step or sequence of steps representing the steps created thus
057:                far, or null if none.
058:             */
059:            public Step getStep() {
060:                return createStep();
061:            }
062:
063:            /** Insert an arbitrary step into the recording stream. */
064:            public void insertStep(Step step) {
065:                // Default does nothing
066:            }
067:
068:            /** Process the given event. 
069:                @throws RecordingFailedException if an error was encountered and
070:                recording should discontinue.
071:             */
072:            public void record(java.awt.AWTEvent event)
073:                    throws RecordingFailedException {
074:                if (Log.isClassDebugEnabled(getClass()))
075:                    Log.debug("REC: " + Robot.toString(event));
076:                lastEventTime = System.currentTimeMillis();
077:                try {
078:                    recordEvent(event);
079:                } catch (RecordingFailedException e) {
080:                    throw e;
081:                } catch (Throwable thrown) {
082:                    Log.log("REC: Unexpected failure: " + thrown);
083:                    String msg = Strings.get("editor.recording.exception");
084:                    throw new RecordingFailedException(new BugReport(msg,
085:                            thrown));
086:                }
087:            }
088:
089:            /** Implement this to actually handle the event.
090:                @throws RecordingFailedException if an error was encountered and
091:                recording should be discontinued.
092:             */
093:            protected abstract void recordEvent(AWTEvent event)
094:                    throws RecordingFailedException;
095:
096:            /** Return the events of interest to this Recorder. */
097:            public long getEventMask() {
098:                return -1;
099:            }
100:
101:            /** @return the {@link Resolver} to be used by this <code>Recorder</code>. */
102:            protected Resolver getResolver() {
103:                return resolver;
104:            }
105:
106:            /** Indicate the current recording state, so that the status may be
107:             * displayed elsewhere.
108:             */
109:            protected void setStatus(String msg) {
110:                if (al != null) {
111:                    ActionEvent event = new ActionEvent(this,
112:                            ActionEvent.ACTION_PERFORMED, msg);
113:                    al.actionPerformed(event);
114:                }
115:            }
116:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.