Source Code Cross Referenced for ReportCheckDirty.java in  » Testing » jakarta-jmeter » org » apache » jmeter » report » gui » action » 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 » jakarta jmeter » org.apache.jmeter.report.gui.action 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //$Header$
002:        /*
003:         * Licensed to the Apache Software Foundation (ASF) under one or more
004:         * contributor license agreements.  See the NOTICE file distributed with
005:         * this work for additional information regarding copyright ownership.
006:         * The ASF licenses this file to You under the Apache License, Version 2.0
007:         * (the "License"); you may not use this file except in compliance with
008:         * the License.  You may obtain a copy of the License at
009:         *
010:         *   http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing, software
013:         * distributed under the License is distributed on an "AS IS" BASIS,
014:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015:         * See the License for the specific language governing permissions and
016:         * limitations under the License.
017:         * 
018:         */
019:
020:        package org.apache.jmeter.report.gui.action;
021:
022:        import java.awt.event.ActionEvent;
023:        import java.awt.event.ActionListener;
024:        import java.util.HashMap;
025:        import java.util.HashSet;
026:        import java.util.Map;
027:        import java.util.Set;
028:
029:        import org.apache.jmeter.gui.ReportGuiPackage;
030:        import org.apache.jmeter.report.gui.action.AbstractAction;
031:        import org.apache.jmeter.report.gui.action.ReportActionRouter;
032:        import org.apache.jmeter.report.gui.action.ReportExitCommand;
033:        import org.apache.jmeter.report.gui.tree.ReportTreeNode;
034:        import org.apache.jorphan.collections.HashTree;
035:        import org.apache.jorphan.collections.HashTreeTraverser;
036:        import org.apache.jorphan.collections.ListedHashTree;
037:        import org.apache.jorphan.logging.LoggingManager;
038:        import org.apache.log.Logger;
039:
040:        /**
041:         * @author Peter Lin
042:         * @version $Revision: 571988 $
043:         */
044:        public class ReportCheckDirty extends AbstractAction implements 
045:                HashTreeTraverser, ActionListener {
046:            private static final Logger log = LoggingManager
047:                    .getLoggerForClass();
048:
049:            private static Map previousGuiItems;
050:
051:            public static final String CHECK_DIRTY = "check_dirty";
052:
053:            public static final String SUB_TREE_SAVED = "sub_tree_saved";
054:
055:            public static final String SUB_TREE_LOADED = "sub_tree_loaded";
056:
057:            public static final String ADD_ALL = "add_all";
058:
059:            // Not implemented: public static final String SAVE = "save_as";
060:            // Not implemented: public static final String SAVE_ALL = "save_all";
061:            // Not implemented: public static final String SAVE_TO_PREVIOUS = "save";
062:            public static final String REMOVE = "check_remove";
063:
064:            boolean checkMode = false;
065:
066:            boolean removeMode = false;
067:
068:            boolean dirty = false;
069:
070:            private static Set commands = new HashSet();
071:            static {
072:                commands.add(CHECK_DIRTY);
073:                commands.add(SUB_TREE_SAVED);
074:                commands.add(SUB_TREE_LOADED);
075:                commands.add(ADD_ALL);
076:                commands.add(REMOVE);
077:            }
078:
079:            public ReportCheckDirty() {
080:                previousGuiItems = new HashMap();
081:                ReportActionRouter.getInstance().addPreActionListener(
082:                        ReportExitCommand.class, this );
083:            }
084:
085:            public void actionPerformed(ActionEvent e) {
086:                if (e.getActionCommand().equals(ReportExitCommand.EXIT)) {
087:                    doAction(e);
088:                }
089:            }
090:
091:            /**
092:             * @see org.apache.jmeter.gui.action.Command#doAction(ActionEvent)
093:             */
094:            public void doAction(ActionEvent e) {
095:                String action = e.getActionCommand();
096:                if (action.equals(SUB_TREE_SAVED)) {
097:                    HashTree subTree = (HashTree) e.getSource();
098:                    subTree.traverse(this );
099:                } else if (action.equals(SUB_TREE_LOADED)) {
100:                    ListedHashTree addTree = (ListedHashTree) e.getSource();
101:                    addTree.traverse(this );
102:                } else if (action.equals(ADD_ALL)) {
103:                    previousGuiItems.clear();
104:                    ReportGuiPackage.getInstance().getTreeModel()
105:                            .getReportPlan().traverse(this );
106:                } else if (action.equals(REMOVE)) {
107:                    ReportGuiPackage guiPackage = ReportGuiPackage
108:                            .getInstance();
109:                    ReportTreeNode[] nodes = guiPackage.getTreeListener()
110:                            .getSelectedNodes();
111:                    removeMode = true;
112:                    for (int i = nodes.length - 1; i >= 0; i--) {
113:                        guiPackage.getTreeModel().getCurrentSubTree(nodes[i])
114:                                .traverse(this );
115:                    }
116:                    removeMode = false;
117:                }
118:                checkMode = true;
119:                dirty = false;
120:                HashTree wholeTree = ReportGuiPackage.getInstance()
121:                        .getTreeModel().getReportPlan();
122:                wholeTree.traverse(this );
123:                ReportGuiPackage.getInstance().setDirty(dirty);
124:                checkMode = false;
125:            }
126:
127:            /**
128:             * The tree traverses itself depth-first, calling processNode for each
129:             * object it encounters as it goes.
130:             */
131:            public void addNode(Object node, HashTree subTree) {
132:                log.debug("Node is class:" + node.getClass());
133:                ReportTreeNode treeNode = (ReportTreeNode) node;
134:                if (checkMode) {
135:                    if (previousGuiItems.containsKey(treeNode)) {
136:                        if (!previousGuiItems.get(treeNode).equals(
137:                                treeNode.getTestElement())) {
138:                            dirty = true;
139:                        }
140:                    } else {
141:                        dirty = true;
142:                    }
143:                } else if (removeMode) {
144:                    previousGuiItems.remove(treeNode);
145:                } else {
146:                    previousGuiItems.put(treeNode, treeNode.getTestElement()
147:                            .clone());
148:                }
149:            }
150:
151:            /**
152:             * Indicates traversal has moved up a step, and the visitor should remove
153:             * the top node from it's stack structure.
154:             */
155:            public void subtractNode() {
156:            }
157:
158:            /**
159:             * Process path is called when a leaf is reached. If a visitor wishes to
160:             * generate Lists of path elements to each leaf, it should keep a Stack data
161:             * structure of nodes passed to it with addNode, and removing top items for
162:             * every subtractNode() call.
163:             */
164:            public void processPath() {
165:            }
166:
167:            /**
168:             * @see org.apache.jmeter.gui.action.Command#getActionNames()
169:             */
170:            public Set getActionNames() {
171:                return commands;
172:            }
173:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.