|
What this is
Other links
The source code// $Header: /home/cvs/jakarta-jmeter/src/components/org/apache/jmeter/timers/gui/ConstantTimerGui.java,v 1.12 2004/03/05 01:33:13 sebb Exp $ /* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package org.apache.jmeter.timers.gui; import javax.swing.Box; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JTextField; import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.timers.ConstantTimer; import org.apache.jmeter.util.JMeterUtils; import org.apache.jorphan.gui.layout.VerticalLayout; /** * The GUI for ConstantTimer. * * @version $Revision: 1.12 $ on $Date: 2004/03/05 01:33:13 $ */ public class ConstantTimerGui extends AbstractTimerGui { /** * The default value for the delay. */ private static final String DEFAULT_DELAY = "300"; private static final String DELAY_FIELD = "Delay Field"; private JTextField delayField; /** * No-arg constructor. */ public ConstantTimerGui() { init(); } /** * Handle an error. * * @param e the Exception that was thrown. * @param thrower the JComponent that threw the Exception. */ public static void error(Exception e, JComponent thrower) { JOptionPane.showMessageDialog(thrower, e, "Error", JOptionPane.ERROR_MESSAGE); } public String getLabelResource() { return "constant_timer_title"; } /** * Create the test element underlying this GUI component. * * @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement() */ public TestElement createTestElement() { ConstantTimer timer = new ConstantTimer(); modifyTestElement(timer); return timer; } /** * Modifies a given TestElement to mirror the data in the gui components. * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement) */ public void modifyTestElement(TestElement timer) { this.configureTestElement(timer); ((ConstantTimer) timer).setDelay(delayField.getText()); } /** * Configure this GUI component from the underlying TestElement. * * @see org.apache.jmeter.gui.JMeterGUIComponent#configure(TestElement) */ public void configure(TestElement el) { super.configure(el); delayField.setText(((ConstantTimer) el).getDelay()); } /** * Initialize this component. */ private void init() { setLayout(new VerticalLayout(5, VerticalLayout.LEFT, VerticalLayout.TOP)); setBorder(makeBorder()); add(makeTitlePanel()); Box delayPanel = Box.createHorizontalBox(); JLabel delayLabel = new JLabel(JMeterUtils.getResString("constant_timer_delay")); delayPanel.add(delayLabel); delayField = new JTextField(6); delayField.setText(DEFAULT_DELAY); delayField.setName(DELAY_FIELD); delayPanel.add(delayField); add(delayPanel); } /* (non-Javadoc) * @see org.apache.jmeter.gui.JMeterGUIComponent#clear() */ public void clear() { delayField.setText(DEFAULT_DELAY); super.clear(); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.