Author: sebb Date: Thu Jun 26 10:53:03 2008 New Revision: 671964 URL: http://svn.apache.org/viewvc?rev=671964&view=rev Log: Introduce new AbstractListenerGui class to make it easier to build Visualisers without a display element
Added: jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/gui/AbstractListenerGui.java (with props) Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/gui/AbstractVisualizer.java Added: jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/gui/AbstractListenerGui.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/gui/AbstractListenerGui.java?rev=671964&view=auto ============================================================================== --- jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/gui/AbstractListenerGui.java (added) +++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/gui/AbstractListenerGui.java Thu Jun 26 10:53:03 2008 @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.visualizers.gui; + +import java.util.Arrays; +import java.util.Collection; + +import javax.swing.JPopupMenu; + +import org.apache.jmeter.gui.AbstractJMeterGuiComponent; +import org.apache.jmeter.gui.util.MenuFactory; + +/** + * Basic Listener/Visualiser Gui class to correspond with AbstractPreProcessorGui etc. + */ +public abstract class AbstractListenerGui extends AbstractJMeterGuiComponent { + + /** + * When a user right-clicks on the component in the test tree, or selects + * the edit menu when the component is selected, the component will be asked + * to return a JPopupMenu that provides all the options available to the + * user from this component. + * <p> + * This implementation returns menu items appropriate for most visualizer + * components. + * + * @return a JPopupMenu appropriate for the component. + */ + public JPopupMenu createPopupMenu() { + return MenuFactory.getDefaultVisualizerMenu(); + } + + /** + * This is the list of menu categories this gui component will be available + * under. This implementation returns + * [EMAIL PROTECTED] org.apache.jmeter.gui.util.MenuFactory#LISTENERS}, which is + * appropriate for most visualizer components. + * + * @return a Collection of Strings, where each element is one of the + * constants defined in MenuFactory + */ + public Collection getMenuCategories() { + return Arrays.asList(new String[] { MenuFactory.LISTENERS }); + } + +} Propchange: jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/gui/AbstractListenerGui.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/gui/AbstractListenerGui.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/gui/AbstractVisualizer.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/gui/AbstractVisualizer.java?rev=671964&r1=671963&r2=671964&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/gui/AbstractVisualizer.java (original) +++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/gui/AbstractVisualizer.java Thu Jun 26 10:53:03 2008 @@ -22,22 +22,17 @@ import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.Arrays; -import java.util.Collection; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JLabel; -import javax.swing.JPopupMenu; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import org.apache.jmeter.gui.AbstractJMeterGuiComponent; import org.apache.jmeter.gui.GuiPackage; import org.apache.jmeter.gui.SavePropertyDialog; import org.apache.jmeter.gui.UnsharedComponent; import org.apache.jmeter.gui.util.FilePanel; -import org.apache.jmeter.gui.util.MenuFactory; import org.apache.jmeter.reporters.AbstractListenerElement; import org.apache.jmeter.reporters.ResultCollector; import org.apache.jmeter.samplers.Clearable; @@ -106,7 +101,7 @@ * */ public abstract class AbstractVisualizer - extends AbstractJMeterGuiComponent + extends AbstractListenerGui implements Visualizer, ChangeListener, UnsharedComponent, Clearable { /** Logging. */ @@ -241,21 +236,6 @@ } /** - * When a user right-clicks on the component in the test tree, or selects - * the edit menu when the component is selected, the component will be asked - * to return a JPopupMenu that provides all the options available to the - * user from this component. - * <p> - * This implementation returns menu items appropriate for most visualizer - * components. - * - * @return a JPopupMenu appropriate for the component. - */ - public JPopupMenu createPopupMenu() { - return MenuFactory.getDefaultVisualizerMenu(); - } - - /** * Invoked when the target of the listener has changed its state. This * implementation assumes that the target is the FilePanel, and will update * the result collector for the new filename. @@ -269,19 +249,6 @@ collector.loadExistingFile(); } - /** - * This is the list of menu categories this gui component will be available - * under. This implementation returns - * [EMAIL PROTECTED] org.apache.jmeter.gui.util.MenuFactory#LISTENERS}, which is - * appropriate for most visualizer components. - * - * @return a Collection of Strings, where each element is one of the - * constants defined in MenuFactory - */ - public Collection getMenuCategories() { - return Arrays.asList(new String[] { MenuFactory.LISTENERS }); - } - /* Implements JMeterGUIComponent.createTestElement() */ public TestElement createTestElement() { if (collector == null) { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]