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


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *   http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         * 
017:         */
018:
019:        package org.apache.jmeter.visualizers;
020:
021:        import java.awt.BorderLayout;
022:        import java.awt.Font;
023:        import java.awt.Image;
024:
025:        import javax.swing.BorderFactory;
026:        import javax.swing.BoxLayout;
027:        import javax.swing.JLabel;
028:        import javax.swing.JPanel;
029:        import javax.swing.JScrollPane;
030:        import javax.swing.JSplitPane;
031:        import javax.swing.border.Border;
032:        import javax.swing.border.EmptyBorder;
033:
034:        import org.apache.jmeter.samplers.Clearable;
035:        import org.apache.jmeter.samplers.SampleResult;
036:        import org.apache.jmeter.util.JMeterUtils;
037:        import org.apache.jmeter.visualizers.gui.AbstractVisualizer;
038:        import org.apache.jorphan.logging.LoggingManager;
039:        import org.apache.log.Logger;
040:
041:        /**
042:         * This class implements a statistical analyser that plots the accumulated time
043:         * taken to load each set of pages. The number of plots is equivalent to the
044:         * number of times the set of pages is configured to load.
045:         * 
046:         * 
047:         * Created 2001/08/11
048:         */
049:        public class GraphAccumVisualizer extends AbstractVisualizer implements 
050:                ImageVisualizer, GraphAccumListener, Clearable {
051:            private static final Logger log = LoggingManager
052:                    .getLoggerForClass();
053:
054:            protected transient GraphAccumModel model;
055:
056:            protected transient GraphAccum graph;
057:
058:            transient protected JPanel legendPanel;
059:
060:            /**
061:             * Constructor.
062:             */
063:            public GraphAccumVisualizer() {
064:                super ();
065:                model = new GraphAccumModel();
066:                model.addGraphAccumListener(this );
067:                init();
068:                log.debug("Start : GraphAccumVisualizer1");
069:                log.debug("End : GraphAccumVisualizer1");
070:            }
071:
072:            public String getLabelResource() {
073:                return "graph_full_results_title"; // $NON-NLS-1$
074:            }
075:
076:            public void add(SampleResult res) {
077:                model.addNewSample(res);
078:            }
079:
080:            /**
081:             * Returns the panel where labels can be added.
082:             * 
083:             * @return a panel where labels can be added
084:             */
085:            public Object getWhiteCanvas() {
086:                return legendPanel;
087:            }
088:
089:            /**
090:             * Gets the Image attribute of the GraphVisualizer object.
091:             * 
092:             * @return the Image value
093:             */
094:            public Image getImage() {
095:                log.debug("Start : getImage1");
096:                Image result = graph.createImage(graph.getWidth(), graph
097:                        .getHeight());
098:
099:                graph.paintComponent(result.getGraphics());
100:                log.debug("End : getImage1");
101:                return result;
102:            }
103:
104:            /**
105:             * Updates the gui to reflect changes.
106:             */
107:            public void updateGui() {
108:                log.debug("Start : updateGui1");
109:                graph.updateGui();
110:                log.debug("End : updateGui1");
111:            }
112:
113:            /**
114:             * Updates gui to reflect small changes.
115:             * 
116:             * @param s
117:             *            sample to be added to plot
118:             */
119:            public void updateGui(SampleResult s) {
120:                log.debug("Start : updateGui2");
121:                log.debug("End : updateGui2");
122:            }
123:
124:            /**
125:             * Clear this visualizer data.
126:             */
127:            public synchronized void clearData() {
128:                model.clearData();
129:                graph.clearData();
130:                log.debug("Start : clear1");
131:                repaint();
132:                log.debug("End : clear1");
133:            }
134:
135:            /**
136:             * Returns a description of this instance.
137:             * 
138:             * @return description of this instance
139:             */
140:            public String toString() {
141:                String toString = "Show the samples analysys as dot plots";
142:
143:                log.debug("toString1 : Returning - " + toString);
144:                return toString;
145:            }
146:
147:            /**
148:             * Setup all the swing components.
149:             */
150:            private void init() {
151:                log.debug("Start : init1");
152:                graph = new GraphAccum(model);
153:                graph.setVisualizer(this );
154:
155:                this .setLayout(new BorderLayout());
156:
157:                // MAIN PANEL
158:                JPanel mainPanel = new JPanel();
159:                Border margin = new EmptyBorder(10, 10, 5, 10);
160:
161:                mainPanel.setBorder(margin);
162:                mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
163:
164:                // TITLE
165:                JLabel panelTitleLabel = new JLabel(JMeterUtils
166:                        .getResString("graph_full_results_title")); // $NON-NLS-1$
167:                Font curFont = panelTitleLabel.getFont();
168:                int curFontSize = curFont.getSize();
169:
170:                curFontSize += 4;
171:                panelTitleLabel.setFont(new Font(curFont.getFontName(), curFont
172:                        .getStyle(), curFontSize));
173:                mainPanel.add(panelTitleLabel);
174:
175:                mainPanel.add(getNamePanel());
176:                mainPanel.add(getFilePanel());
177:
178:                JScrollPane graphScrollPanel = new JScrollPane(graph,
179:                        JScrollPane.VERTICAL_SCROLLBAR_NEVER,
180:                        JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
181:
182:                graphScrollPanel.setViewportBorder(BorderFactory
183:                        .createEmptyBorder(2, 2, 2, 2));
184:                legendPanel = new JPanel();
185:
186:                JScrollPane legendScrollPanel = new JScrollPane(legendPanel);
187:                JSplitPane graphSplitPane = new JSplitPane(
188:                        JSplitPane.VERTICAL_SPLIT, graphScrollPanel,
189:                        legendScrollPanel);
190:
191:                this .add(mainPanel, BorderLayout.NORTH);
192:                this .add(graphSplitPane, BorderLayout.CENTER);
193:                log.debug("End : init1");
194:            }
195:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.