Source Code Cross Referenced for ReportGui.java in  » Testing » jakarta-jmeter » org » apache » jmeter » control » gui » 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.control.gui 
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.control.gui;
021:
022:        import java.awt.Color;
023:        import java.awt.BorderLayout;
024:        import java.awt.Container;
025:        import java.util.Collection;
026:
027:        import javax.swing.JCheckBox;
028:        import javax.swing.JLabel;
029:        import javax.swing.JMenu;
030:        import javax.swing.JPanel;
031:        import javax.swing.JPopupMenu;
032:        import javax.swing.JTextField;
033:
034:        import org.apache.jmeter.config.Arguments;
035:        import org.apache.jmeter.config.gui.ArgumentsPanel;
036:        import org.apache.jmeter.gui.util.DirectoryPanel;
037:        import org.apache.jmeter.gui.util.ReportMenuFactory;
038:        import org.apache.jmeter.report.gui.AbstractReportGui;
039:        import org.apache.jmeter.report.gui.ReportPageGui;
040:        import org.apache.jmeter.report.writers.gui.HTMLReportWriterGui;
041:        import org.apache.jmeter.testelement.TestElement;
042:        import org.apache.jmeter.testelement.ReportPlan;
043:        import org.apache.jmeter.util.JMeterUtils;
044:
045:        /**
046:         * JMeter GUI component representing the test plan which will be executed when
047:         * the test is run.
048:         * 
049:         * @version $Revision: 493793 $ Last Updated: $Date: 2007-01-07 18:19:27 +0000 (Sun, 07 Jan 2007) $
050:         */
051:        public class ReportGui extends AbstractReportGui {
052:
053:            private JCheckBox serializedMode;
054:
055:            /** A panel to contain comments on the test plan. */
056:            private JTextField commentPanel;
057:
058:            private DirectoryPanel baseDir = new DirectoryPanel(JMeterUtils
059:                    .getResString("report_base_directory"), "", Color.white);
060:
061:            /** A panel allowing the user to define variables. */
062:            private ArgumentsPanel argsPanel;
063:
064:            /**
065:             * Create a new TestPlanGui.
066:             */
067:            public ReportGui() {
068:                init();
069:            }
070:
071:            /**
072:             * Need to update this to make the context popupmenu correct
073:             * @return a JPopupMenu appropriate for the component.
074:             */
075:            public JPopupMenu createPopupMenu() {
076:                JPopupMenu pop = new JPopupMenu();
077:                JMenu addMenu = new JMenu(JMeterUtils.getResString("Add"));
078:                addMenu.add(ReportMenuFactory
079:                        .makeMenuItem(new ReportPageGui().getStaticLabel(),
080:                                ReportPageGui.class.getName(), "Add"));
081:                addMenu.add(ReportMenuFactory.makeMenuItem(
082:                        new HTMLReportWriterGui().getStaticLabel(),
083:                        HTMLReportWriterGui.class.getName(), "Add"));
084:                addMenu.add(ReportMenuFactory.makeMenu(
085:                        ReportMenuFactory.CONFIG_ELEMENTS, "Add"));
086:                pop.add(addMenu);
087:                ReportMenuFactory.addFileMenu(pop);
088:                ReportMenuFactory.addEditMenu(pop, true);
089:                return pop;
090:            }
091:
092:            /* Implements JMeterGUIComponent.createTestElement() */
093:            public TestElement createTestElement() {
094:                ReportPlan tp = new ReportPlan();
095:                modifyTestElement(tp);
096:                return tp;
097:            }
098:
099:            /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
100:            public void modifyTestElement(TestElement plan) {
101:                super .configureTestElement(plan);
102:                if (plan instanceof  ReportPlan) {
103:                    ReportPlan rp = (ReportPlan) plan;
104:                    rp.setUserDefinedVariables((Arguments) argsPanel
105:                            .createTestElement());
106:                    rp.setProperty(ReportPlan.COMMENTS, commentPanel.getText());
107:                    rp.setBasedir(baseDir.getFilename());
108:                }
109:            }
110:
111:            public String getLabelResource() {
112:                return "report_plan";
113:            }
114:
115:            /**
116:             * This is the list of menu categories this gui component will be available
117:             * under. This implementation returns null, since the TestPlan appears at
118:             * the top level of the tree and cannot be added elsewhere.
119:             * 
120:             * @return a Collection of Strings, where each element is one of the
121:             *         constants defined in MenuFactory
122:             */
123:            public Collection getMenuCategories() {
124:                return null;
125:            }
126:
127:            /**
128:             * A newly created component can be initialized with the contents of a Test
129:             * Element object by calling this method. The component is responsible for
130:             * querying the Test Element object for the relevant information to display
131:             * in its GUI.
132:             * 
133:             * @param el
134:             *            the TestElement to configure
135:             */
136:            public void configure(TestElement el) {
137:                super .configure(el);
138:
139:                if (el.getProperty(ReportPlan.USER_DEFINED_VARIABLES) != null) {
140:                    argsPanel
141:                            .configure((Arguments) el.getProperty(
142:                                    ReportPlan.USER_DEFINED_VARIABLES)
143:                                    .getObjectValue());
144:                }
145:                commentPanel.setText(el
146:                        .getPropertyAsString(ReportPlan.COMMENTS));
147:                baseDir.setFilename(el.getPropertyAsString(ReportPlan.BASEDIR));
148:            }
149:
150:            /**
151:             * Create a panel allowing the user to define variables for the test.
152:             * 
153:             * @return a panel for user-defined variables
154:             */
155:            private JPanel createVariablePanel() {
156:                argsPanel = new ArgumentsPanel(JMeterUtils
157:                        .getResString("user_defined_variables"), Color.white);
158:                return argsPanel;
159:            }
160:
161:            private Container createCommentPanel() {
162:                JPanel panel = new JPanel();
163:                panel.setBackground(Color.white);
164:                panel.setLayout(new BorderLayout(10, 10));
165:                Container title = makeTitlePanel();
166:                commentPanel = new JTextField();
167:                commentPanel.setBackground(Color.white);
168:                JLabel label = new JLabel(JMeterUtils
169:                        .getResString("testplan_comments"));
170:                label.setBackground(Color.white);
171:                label.setLabelFor(commentPanel);
172:                title.add(label);
173:                title.add(commentPanel);
174:                panel.add(title, BorderLayout.NORTH);
175:                panel.add(baseDir, BorderLayout.CENTER);
176:                return panel;
177:            }
178:
179:            /**
180:             * Initialize the components and layout of this component.
181:             */
182:            protected void init() {
183:                setLayout(new BorderLayout(10, 10));
184:                setBorder(makeBorder());
185:                setBackground(Color.white);
186:                add(createCommentPanel(), BorderLayout.NORTH);
187:                add(createVariablePanel(), BorderLayout.CENTER);
188:            }
189:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.