Source Code Cross Referenced for ReportTreeNode.java in  » Testing » jakarta-jmeter » org » apache » jmeter » report » gui » tree » 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.tree 
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.tree;
021:
022:        import java.awt.Image;
023:        import java.beans.BeanInfo;
024:        import java.beans.IntrospectionException;
025:        import java.beans.Introspector;
026:        import java.util.Collection;
027:
028:        import javax.swing.ImageIcon;
029:        import javax.swing.JPopupMenu;
030:        import javax.swing.tree.DefaultMutableTreeNode;
031:
032:        import org.apache.jmeter.gui.GUIFactory;
033:        import org.apache.jmeter.gui.ReportGuiPackage;
034:        import org.apache.jmeter.gui.tree.NamedTreeNode;
035:        import org.apache.jmeter.testbeans.TestBean;
036:        import org.apache.jmeter.testelement.AbstractTestElement;
037:        import org.apache.jmeter.testelement.TestElement;
038:        import org.apache.jmeter.testelement.property.BooleanProperty;
039:        import org.apache.jmeter.testelement.property.StringProperty;
040:        import org.apache.jorphan.logging.LoggingManager;
041:        import org.apache.log.Logger;
042:
043:        /**
044:         * @author Peter Lin
045:         * @version $Revision: 493793 $
046:         */
047:        public class ReportTreeNode extends DefaultMutableTreeNode implements 
048:                NamedTreeNode {
049:            transient private static Logger log = LoggingManager
050:                    .getLoggerForClass();
051:
052:            private ReportTreeModel treeModel;
053:
054:            // boolean enabled = true;
055:
056:            public ReportTreeNode() {// Allow serializable test to work
057:                // TODO: is the serializable test necessary now that JMeterTreeNode is
058:                // no longer a GUI component?
059:                this (null, null);
060:            }
061:
062:            public ReportTreeNode(TestElement userObj, ReportTreeModel treeModel) {
063:                super (userObj);
064:                this .treeModel = treeModel;
065:            }
066:
067:            public boolean isEnabled() {
068:                return ((AbstractTestElement) getTestElement())
069:                        .getPropertyAsBoolean(TestElement.ENABLED);
070:            }
071:
072:            public void setEnabled(boolean enabled) {
073:                getTestElement().setProperty(
074:                        new BooleanProperty(TestElement.ENABLED, enabled));
075:                treeModel.nodeChanged(this );
076:            }
077:
078:            public ImageIcon getIcon() {
079:                return getIcon(true);
080:            }
081:
082:            public ImageIcon getIcon(boolean enabled) {
083:                try {
084:                    if (getTestElement() instanceof  TestBean) {
085:                        try {
086:                            Image img = Introspector.getBeanInfo(
087:                                    getTestElement().getClass()).getIcon(
088:                                    BeanInfo.ICON_COLOR_16x16);
089:                            // If icon has not been defined, then use GUI_CLASS property
090:                            if (img == null) {//
091:                                Object clazz = Introspector.getBeanInfo(
092:                                        getTestElement().getClass())
093:                                        .getBeanDescriptor().getValue(
094:                                                TestElement.GUI_CLASS);
095:                                if (clazz == null) {
096:                                    log.error("Can't obtain GUI class for "
097:                                            + getTestElement().getClass()
098:                                                    .getName());
099:                                    return null;
100:                                }
101:                                return GUIFactory.getIcon(Class
102:                                        .forName((String) clazz), enabled);
103:                            }
104:                            return new ImageIcon(img);
105:                        } catch (IntrospectionException e1) {
106:                            log.error("Can't obtain icon", e1);
107:                            throw new org.apache.jorphan.util.JMeterError(e1);
108:                        }
109:                    } else {
110:                        return GUIFactory.getIcon(Class
111:                                .forName(getTestElement().getPropertyAsString(
112:                                        TestElement.GUI_CLASS)), enabled);
113:                    }
114:                } catch (ClassNotFoundException e) {
115:                    log.warn("Can't get icon for class " + getTestElement(), e);
116:                    return null;
117:                }
118:            }
119:
120:            public Collection getMenuCategories() {
121:                try {
122:                    return ReportGuiPackage.getInstance().getGui(
123:                            getTestElement()).getMenuCategories();
124:                } catch (Exception e) {
125:                    log.error("Can't get popup menu for gui", e);
126:                    return null;
127:                }
128:            }
129:
130:            public JPopupMenu createPopupMenu() {
131:                try {
132:                    return ReportGuiPackage.getInstance().getGui(
133:                            getTestElement()).createPopupMenu();
134:                } catch (Exception e) {
135:                    log.error("Can't get popup menu for gui", e);
136:                    return null;
137:                }
138:            }
139:
140:            public TestElement getTestElement() {
141:                return (TestElement) getUserObject();
142:            }
143:
144:            public String getStaticLabel() {
145:                return ReportGuiPackage.getInstance().getGui(
146:                        (TestElement) getUserObject()).getStaticLabel();
147:            }
148:
149:            public String getDocAnchor() {
150:                return ReportGuiPackage.getInstance().getGui(
151:                        (TestElement) getUserObject()).getDocAnchor();
152:            }
153:
154:            public void setName(String name) {
155:                ((TestElement) getUserObject()).setProperty(new StringProperty(
156:                        TestElement.NAME, name));
157:            }
158:
159:            public String getName() {
160:                return ((TestElement) getUserObject())
161:                        .getPropertyAsString(TestElement.NAME);
162:            }
163:
164:            public void nameChanged() {
165:                treeModel.nodeChanged(this);
166:            }
167:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.