Source Code Cross Referenced for JMSSubscriberGui.java in  » Testing » jakarta-jmeter » org » apache » jmeter » protocol » jms » 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.protocol.jms.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.protocol.jms.control.gui;
020:
021:        import java.awt.Font;
022:        import java.awt.event.ActionEvent;
023:
024:        import javax.swing.JCheckBox;
025:        import javax.swing.JLabel;
026:        import javax.swing.JPanel;
027:        import javax.swing.border.Border;
028:        import javax.swing.border.EmptyBorder;
029:        import javax.swing.event.ChangeEvent;
030:        import javax.swing.event.ChangeListener;
031:
032:        import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
033:        import org.apache.jmeter.testelement.TestElement;
034:        import org.apache.jmeter.util.JMeterUtils;
035:        import org.apache.jorphan.gui.JLabeledTextField;
036:        import org.apache.jorphan.gui.JLabeledRadio;
037:        import org.apache.jorphan.gui.layout.VerticalLayout;
038:
039:        import org.apache.jmeter.protocol.jms.sampler.SubscriberSampler;
040:
041:        /**
042:         * This is the GUI for JMS Subscriber <br>
043:         * 
044:         */
045:        public class JMSSubscriberGui extends AbstractSamplerGui implements 
046:                java.awt.event.ActionListener, ChangeListener {
047:
048:            private JCheckBox useProperties = new JCheckBox(JMeterUtils
049:                    .getResString("jms_use_properties_file"), false); // $NON-NLS-1$
050:
051:            private JLabeledTextField jndiICF = new JLabeledTextField(
052:                    JMeterUtils.getResString("jms_initial_context_factory")); // $NON-NLS-1$
053:
054:            private JLabeledTextField urlField = new JLabeledTextField(
055:                    JMeterUtils.getResString("jms_provider_url")); // $NON-NLS-1$
056:
057:            private JLabeledTextField jndiConnFac = new JLabeledTextField(
058:                    JMeterUtils.getResString("jms_connection_factory")); // $NON-NLS-1$
059:
060:            private JLabeledTextField jmsTopic = new JLabeledTextField(
061:                    JMeterUtils.getResString("jms_topic")); // $NON-NLS-1$
062:
063:            private JLabeledTextField jmsUser = new JLabeledTextField(
064:                    JMeterUtils.getResString("jms_user")); // $NON-NLS-1$
065:
066:            private JLabeledTextField jmsPwd = new JLabeledTextField(
067:                    JMeterUtils.getResString("jms_pwd")); // $NON-NLS-1$
068:
069:            private JLabeledTextField iterations = new JLabeledTextField(
070:                    JMeterUtils.getResString("jms_itertions")); // $NON-NLS-1$
071:
072:            private static final String required = JMeterUtils
073:                    .getResString("jms_auth_required"); // $NON-NLS-1$
074:
075:            private static final String not_req = JMeterUtils
076:                    .getResString("jms_auth_not_required"); // $NON-NLS-1$
077:
078:            private static final String[] auth_items = { required, not_req };
079:
080:            private JLabeledRadio reqAuth = new JLabeledRadio(JMeterUtils
081:                    .getResString("jms_authentication"), auth_items, not_req); // $NON-NLS-1$
082:
083:            private JCheckBox readResponse = new JCheckBox(JMeterUtils
084:                    .getResString("jms_read_response"), true); // $NON-NLS-1$
085:
086:            public static final String receive_str = JMeterUtils
087:                    .getResString("jms_subscriber_receive"); // $NON-NLS-1$
088:
089:            public static final String onmessage_str = JMeterUtils
090:                    .getResString("jms_subscriber_on_message"); // $NON-NLS-1$
091:
092:            private static final String[] client_items = { receive_str,
093:                    onmessage_str };
094:
095:            private JLabeledRadio clientChoice = new JLabeledRadio(JMeterUtils
096:                    .getResString("jms_client_type"), client_items, // $NON-NLS-1$
097:                    receive_str);
098:
099:            /**
100:             * This is the font for the note.
101:             */
102:            //Font plainText = new Font("plain", Font.PLAIN, 10); // $NON-NLS-1$
103:            private JPanel lookup = null;
104:
105:            public JMSSubscriberGui() {
106:                init();
107:            }
108:
109:            public String getLabelResource() {
110:                return "jms_subscriber_title"; // $NON-NLS-1$
111:            }
112:
113:            /**
114:             * @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
115:             */
116:            public TestElement createTestElement() {
117:                SubscriberSampler sampler = new SubscriberSampler();
118:                this .configureTestElement(sampler);
119:                sampler.setUseJNDIProperties(String.valueOf(useProperties
120:                        .isSelected()));
121:                sampler.setJNDIIntialContextFactory(jndiICF.getText());
122:                sampler.setProviderUrl(urlField.getText());
123:                sampler.setConnectionFactory(jndiConnFac.getText());
124:                sampler.setTopic(jmsTopic.getText());
125:                sampler.setUsername(jmsUser.getText());
126:                sampler.setPassword(jmsPwd.getText());
127:                sampler.setUseAuth(reqAuth.getText());
128:                sampler.setIterations(iterations.getText());
129:                sampler.setReadResponse(String.valueOf(readResponse
130:                        .isSelected()));
131:                sampler.setClientChoice(clientChoice.getText());
132:                return sampler;
133:            }
134:
135:            /**
136:             * Modifies a given TestElement to mirror the data in the gui components.
137:             * 
138:             * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
139:             */
140:            public void modifyTestElement(TestElement s) {
141:                SubscriberSampler sampler = (SubscriberSampler) s;
142:                this .configureTestElement(sampler);
143:                sampler.setUseJNDIProperties(String.valueOf(useProperties
144:                        .isSelected()));
145:                sampler.setJNDIIntialContextFactory(jndiICF.getText());
146:                sampler.setProviderUrl(urlField.getText());
147:                sampler.setConnectionFactory(jndiConnFac.getText());
148:                sampler.setTopic(jmsTopic.getText());
149:                sampler.setUsername(jmsUser.getText());
150:                sampler.setPassword(jmsPwd.getText());
151:                sampler.setUseAuth(reqAuth.getText());
152:                sampler.setIterations(iterations.getText());
153:                sampler.setReadResponse(String.valueOf(readResponse
154:                        .isSelected()));
155:                sampler.setClientChoice(clientChoice.getText());
156:            }
157:
158:            /**
159:             * init() adds jndiICF to the mainPanel. The class reuses logic from
160:             * SOAPSampler, since it is common.
161:             */
162:            private void init() {
163:                this .setLayout(new VerticalLayout(5, VerticalLayout.LEFT,
164:                        VerticalLayout.TOP));
165:
166:                // MAIN PANEL
167:                JPanel mainPanel = new JPanel();
168:                Border margin = new EmptyBorder(10, 10, 5, 10);
169:                mainPanel.setBorder(margin);
170:                mainPanel.setLayout(new VerticalLayout(5, VerticalLayout.LEFT));
171:
172:                // TITLE
173:                JLabel panelTitleLabel = new JLabel(getStaticLabel());
174:                Font curFont = panelTitleLabel.getFont();
175:                int curFontSize = curFont.getSize();
176:                curFontSize += 4;
177:                panelTitleLabel.setFont(new Font(curFont.getFontName(), curFont
178:                        .getStyle(), curFontSize));
179:                mainPanel.add(panelTitleLabel);
180:                // NAME
181:                mainPanel.add(getNamePanel());
182:
183:                // Button for browsing webservice wsdl
184:                lookup = new JPanel();
185:                lookup.setLayout(new VerticalLayout(6, VerticalLayout.LEFT));
186:                mainPanel.add(lookup);
187:                lookup.add(useProperties);
188:                useProperties.addChangeListener(this );
189:                lookup.add(jndiICF);
190:                lookup.add(urlField);
191:                lookup.add(jndiConnFac);
192:
193:                reqAuth.addChangeListener(this );
194:
195:                JPanel commonParams = new JPanel();
196:                commonParams.setLayout(new VerticalLayout(6,
197:                        VerticalLayout.LEFT));
198:                mainPanel.add(commonParams);
199:                commonParams.add(jmsTopic);
200:                commonParams.add(reqAuth);
201:                commonParams.add(jmsUser);
202:                commonParams.add(jmsPwd);
203:                commonParams.add(iterations);
204:                commonParams.add(readResponse);
205:                commonParams.add(clientChoice);
206:
207:                // we have to add the gui to the change listener
208:                this .add(mainPanel);
209:            }
210:
211:            /**
212:             * the implementation loads the URL and the soap action for the request.
213:             */
214:            public void configure(TestElement el) {
215:                super .configure(el);
216:                SubscriberSampler sampler = (SubscriberSampler) el;
217:                useProperties.setSelected(sampler
218:                        .getUseJNDIPropertiesAsBoolean());
219:                jndiICF.setText(sampler.getJNDIInitialContextFactory());
220:                urlField.setText(sampler.getProviderUrl());
221:                jndiConnFac.setText(sampler.getConnectionFactory());
222:                jmsTopic.setText(sampler.getTopic());
223:                jmsUser.setText(sampler.getUsername());
224:                jmsPwd.setText(sampler.getPassword());
225:                iterations.setText(sampler.getIterations());
226:                reqAuth.setText(sampler.getUseAuth());
227:                readResponse.setSelected(sampler.getReadResponseAsBoolean());
228:                clientChoice.setText(sampler.getClientChoice());
229:            }
230:
231:            public void clearGui() {
232:                super .clearGui();
233:                useProperties.setSelected(false); // $NON-NLS-1$
234:                jndiICF.setText(""); // $NON-NLS-1$
235:                urlField.setText(""); // $NON-NLS-1$
236:                jndiConnFac.setText(""); // $NON-NLS-1$
237:                jmsTopic.setText(""); // $NON-NLS-1$
238:                jmsUser.setText(""); // $NON-NLS-1$
239:                jmsPwd.setText(""); // $NON-NLS-1$
240:                iterations.setText(""); // $NON-NLS-1$
241:                reqAuth.setText(""); // $NON-NLS-1$
242:                readResponse.setSelected(true);
243:                clientChoice.setText(""); // $NON-NLS-1$
244:            }
245:
246:            /**
247:             * method from ActionListener
248:             * 
249:             * @param event
250:             *            that occurred
251:             */
252:            public void actionPerformed(ActionEvent event) {
253:                if (event.getSource() == useProperties) {
254:                }
255:            }
256:
257:            /**
258:             * When the state of a widget changes, it will notify the gui. the method
259:             * then enables or disables certain parameters.
260:             */
261:            public void stateChanged(ChangeEvent event) {
262:                if (event.getSource() == useProperties) {
263:                    if (useProperties.isSelected()) {
264:                        this .jndiICF.setEnabled(false);
265:                        this .urlField.setEnabled(false);
266:                    } else {
267:                        this .jndiICF.setEnabled(true);
268:                        this .urlField.setEnabled(true);
269:                    }
270:                }
271:            }
272:        }
w__ww___.___j___av___a_2_s._com_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.