1 // $Header: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/samplers/gui/AbstractSamplerGui.java,v 1.4 2004/02/14 03:34:29 sebb Exp $ 2 /* 3 * Copyright 2000-2004 The Apache Software Foundation. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 */ 18 19 package org.apache.jmeter.samplers.gui; 20 import java.util.Arrays; 21 import java.util.Collection; 22 23 import javax.swing.JPopupMenu; 24 25 import org.apache.jmeter.gui.AbstractJMeterGuiComponent; 26 import org.apache.jmeter.gui.util.MenuFactory; 27 28 /** 29 * This is the base class for JMeter GUI components which manage samplers. 30 * 31 * @author Michael Stover 32 * @version $Revision: 1.4 $ 33 */ 34 public abstract class AbstractSamplerGui extends AbstractJMeterGuiComponent 35 { 36 /** 37 * When a user right-clicks on the component in the test tree, or 38 * selects the edit menu when the component is selected, the 39 * component will be asked to return a JPopupMenu that provides 40 * all the options available to the user from this component. 41 * <p> 42 * This implementation returns menu items appropriate for most 43 * sampler components. 44 * 45 * @return a JPopupMenu appropriate for the component. 46 */ 47 public JPopupMenu createPopupMenu() 48 { 49 return MenuFactory.getDefaultSamplerMenu(); 50 } 51 52 /** 53 * This is the list of menu categories this gui component will be available 54 * under. This implementation returns 55 * {@link org.apache.jmeter.gui.util.MenuFactory#SAMPLERS}, which 56 * is appropriate for most sampler components. 57 * 58 * @return a Collection of Strings, where each element is one of the 59 * constants defined in MenuFactory 60 */ 61 public Collection getMenuCategories() 62 { 63 return Arrays.asList(new String[]{MenuFactory.SAMPLERS}); 64 } 65 66 } 67