Source Code Cross Referenced for LoginConfigGui.java in  » Testing » jakarta-jmeter » org » apache » jmeter » config » 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.config.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.config.gui;
020:
021:        import java.awt.BorderLayout;
022:
023:        import javax.swing.JLabel;
024:        import javax.swing.JPanel;
025:        import javax.swing.JPasswordField;
026:        import javax.swing.JTextField;
027:
028:        import org.apache.jmeter.config.ConfigTestElement;
029:        import org.apache.jmeter.gui.util.VerticalPanel;
030:        import org.apache.jmeter.testelement.TestElement;
031:        import org.apache.jmeter.testelement.property.StringProperty;
032:        import org.apache.jmeter.util.JMeterUtils;
033:
034:        /**
035:         * A GUI component allowing the user to enter a username and password for a
036:         * login.
037:         * 
038:         */
039:        public class LoginConfigGui extends AbstractConfigGui {
040:            /** Field allowing the user to enter a username. */
041:            private JTextField username = new JTextField(15);
042:
043:            /** Field allowing the user to enter a password. */
044:            private JPasswordField password = new JPasswordField(15);
045:
046:            /**
047:             * Boolean indicating whether or not this component should display its name.
048:             * If true, this is a standalone component. If false, this component is
049:             * intended to be used as a subpanel for another component.
050:             */
051:            private boolean displayName = true;
052:
053:            /**
054:             * Create a new LoginConfigGui as a standalone component.
055:             */
056:            public LoginConfigGui() {
057:                this (true);
058:            }
059:
060:            /**
061:             * Create a new LoginConfigGui as either a standalone or an embedded
062:             * component.
063:             * 
064:             * @param displayName
065:             *            indicates whether or not this component should display its
066:             *            name. If true, this is a standalone component. If false, this
067:             *            component is intended to be used as a subpanel for another
068:             *            component.
069:             */
070:            public LoginConfigGui(boolean displayName) {
071:                this .displayName = displayName;
072:                init();
073:            }
074:
075:            public String getLabelResource() {
076:                return "login_config_element"; // $NON-NLS-1$
077:            }
078:
079:            /**
080:             * A newly created component can be initialized with the contents of a Test
081:             * Element object by calling this method. The component is responsible for
082:             * querying the Test Element object for the relevant information to display
083:             * in its GUI.
084:             * 
085:             * @param element
086:             *            the TestElement to configure
087:             */
088:            public void configure(TestElement element) {
089:                super .configure(element);
090:                username.setText(element
091:                        .getPropertyAsString(ConfigTestElement.USERNAME));
092:                password.setText(element
093:                        .getPropertyAsString(ConfigTestElement.PASSWORD));
094:            }
095:
096:            /* Implements JMeterGUIComponent.createTestElement() */
097:            public TestElement createTestElement() {
098:                ConfigTestElement element = new ConfigTestElement();
099:                modifyTestElement(element);
100:                return element;
101:            }
102:
103:            /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
104:            public void modifyTestElement(TestElement element) {
105:                configureTestElement(element);
106:                element.setProperty(new StringProperty(
107:                        ConfigTestElement.USERNAME, username.getText()));
108:
109:                String passwordString = new String(password.getPassword());
110:                element.setProperty(new StringProperty(
111:                        ConfigTestElement.PASSWORD, passwordString));
112:            }
113:
114:            /**
115:             * Implements JMeterGUIComponent.clearGui
116:             */
117:            public void clearGui() {
118:                super .clearGui();
119:
120:                username.setText(""); //$NON-NLS-1$
121:                password.setText(""); //$NON-NLS-1$
122:            }
123:
124:            /**
125:             * Initialize the components and layout of this component.
126:             */
127:            private void init() {
128:                setLayout(new BorderLayout(0, 5));
129:
130:                if (displayName) {
131:                    setBorder(makeBorder());
132:                    add(makeTitlePanel(), BorderLayout.NORTH);
133:                }
134:
135:                VerticalPanel mainPanel = new VerticalPanel();
136:                mainPanel.add(createUsernamePanel());
137:                mainPanel.add(createPasswordPanel());
138:                add(mainPanel, BorderLayout.CENTER);
139:            }
140:
141:            /**
142:             * Create a panel containing the username field and corresponding label.
143:             * 
144:             * @return a GUI panel containing the username field
145:             */
146:            private JPanel createUsernamePanel() {
147:                JPanel panel = new JPanel(new BorderLayout(5, 0));
148:                JLabel label = new JLabel(JMeterUtils.getResString("username")); // $NON-NLS-1$
149:                label.setLabelFor(username);
150:                panel.add(label, BorderLayout.WEST);
151:                panel.add(username, BorderLayout.CENTER);
152:                return panel;
153:            }
154:
155:            /**
156:             * Create a panel containing the password field and corresponding label.
157:             * 
158:             * @return a GUI panel containing the password field
159:             */
160:            private JPanel createPasswordPanel() {
161:                JPanel panel = new JPanel(new BorderLayout(5, 0));
162:                JLabel label = new JLabel(JMeterUtils.getResString("password")); // $NON-NLS-1$
163:                label.setLabelFor(password);
164:                panel.add(label, BorderLayout.WEST);
165:                panel.add(password, BorderLayout.CENTER);
166:                return panel;
167:            }
168:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.