Source Code Cross Referenced for WhileControllerGui.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:        /*
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.control.gui;
020:
021:        import java.awt.BorderLayout;
022:        import java.awt.event.ActionEvent;
023:        import java.awt.event.ActionListener;
024:
025:        import javax.swing.Box;
026:        import javax.swing.JLabel;
027:        import javax.swing.JPanel;
028:        import javax.swing.JTextField;
029:
030:        import org.apache.jmeter.control.WhileController;
031:        import org.apache.jmeter.gui.util.FocusRequester;
032:        import org.apache.jmeter.testelement.TestElement;
033:        import org.apache.jmeter.util.JMeterUtils;
034:
035:        public class WhileControllerGui extends AbstractControllerGui implements 
036:                ActionListener {
037:
038:            private static final String CONDITION_LABEL = "while_controller_label"; // $NON-NLS-1$
039:
040:            /**
041:             * A field allowing the user to specify the condition (not yet used).
042:             */
043:            private JTextField theCondition;
044:
045:            /** The name of the condition field component. */
046:            private static final String CONDITION = "While_Condition"; // $NON-NLS-1$
047:
048:            /**
049:             * Create a new LoopControlPanel as a standalone component.
050:             */
051:            public WhileControllerGui() {
052:                init();
053:            }
054:
055:            /**
056:             * A newly created component can be initialized with the contents of a Test
057:             * Element object by calling this method. The component is responsible for
058:             * querying the Test Element object for the relevant information to display
059:             * in its GUI.
060:             * 
061:             * @param element
062:             *            the TestElement to configure
063:             */
064:            public void configure(TestElement element) {
065:                super .configure(element);
066:                if (element instanceof  WhileController) {
067:                    theCondition.setText(((WhileController) element)
068:                            .getCondition());
069:                }
070:
071:            }
072:
073:            /**
074:             * Implements JMeterGUIComponent.createTestElement()
075:             */
076:            public TestElement createTestElement() {
077:                WhileController controller = new WhileController();
078:                modifyTestElement(controller);
079:                return controller;
080:            }
081:
082:            /**
083:             * Implements JMeterGUIComponent.modifyTestElement(TestElement)
084:             */
085:            public void modifyTestElement(TestElement controller) {
086:                configureTestElement(controller);
087:                if (controller instanceof  WhileController) {
088:                    if (theCondition.getText().length() > 0) {
089:                        ((WhileController) controller)
090:                                .setCondition(theCondition.getText());
091:                    } else {
092:                        ((WhileController) controller).setCondition(""); // $NON-NLS-1$
093:                    }
094:                }
095:            }
096:
097:            /**
098:             * Implements JMeterGUIComponent.clearGui
099:             */
100:            public void clearGui() {
101:                super .clearGui();
102:                theCondition.setText(""); // $NON-NLS-1$
103:            }
104:
105:            /**
106:             * Invoked when an action occurs. This implementation assumes that the
107:             * target component is the infinite loops checkbox.
108:             * 
109:             * @param event
110:             *            the event that has occurred
111:             */
112:            public void actionPerformed(ActionEvent event) {
113:                new FocusRequester(theCondition);
114:            }
115:
116:            public String getLabelResource() {
117:                return "while_controller_title"; // $NON-NLS-1$
118:            }
119:
120:            /**
121:             * Initialize the GUI components and layout for this component.
122:             */
123:            private void init() {
124:                setLayout(new BorderLayout(0, 5));
125:                setBorder(makeBorder());
126:                add(makeTitlePanel(), BorderLayout.NORTH);
127:
128:                JPanel mainPanel = new JPanel(new BorderLayout());
129:                mainPanel.add(createConditionPanel(), BorderLayout.NORTH);
130:                add(mainPanel, BorderLayout.CENTER);
131:
132:            }
133:
134:            /**
135:             * Create a GUI panel containing the condition. TODO make use of the field
136:             * 
137:             * @return a GUI panel containing the condition components
138:             */
139:            private JPanel createConditionPanel() {
140:                JPanel conditionPanel = new JPanel(new BorderLayout(5, 0));
141:
142:                // Condition LABEL
143:                JLabel conditionLabel = new JLabel(JMeterUtils
144:                        .getResString(CONDITION_LABEL));
145:                conditionPanel.add(conditionLabel, BorderLayout.WEST);
146:
147:                // TEXT FIELD
148:                // This means exit if last sample failed
149:                theCondition = new JTextField(""); // $NON-NLS-1$
150:                theCondition.setName(CONDITION);
151:                conditionLabel.setLabelFor(theCondition);
152:                conditionPanel.add(theCondition, BorderLayout.CENTER);
153:                theCondition.addActionListener(this);
154:
155:                conditionPanel.add(Box.createHorizontalStrut(conditionLabel
156:                        .getPreferredSize().width
157:                        + theCondition.getPreferredSize().width),
158:                        BorderLayout.NORTH);
159:
160:                return conditionPanel;
161:            }
162:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.