1 18 19 package org.apache.jmeter.control.gui; 20 import java.awt.BorderLayout ; 21 import java.util.Collection ; 22 23 import javax.swing.JMenu ; 24 import javax.swing.JPopupMenu ; 25 26 import org.apache.jmeter.gui.AbstractJMeterGuiComponent; 27 import org.apache.jmeter.gui.util.MenuFactory; 28 import org.apache.jmeter.testelement.TestElement; 29 import org.apache.jmeter.testelement.WorkBench; 30 import org.apache.jmeter.util.JMeterUtils; 31 32 38 public class WorkBenchGui extends AbstractJMeterGuiComponent 39 { 40 43 public WorkBenchGui() 44 { 45 super(); 46 init(); 47 } 48 49 57 public Collection getMenuCategories() 58 { 59 return null; 60 } 61 62 63 public TestElement createTestElement() 64 { 65 WorkBench wb = new WorkBench(); 66 modifyTestElement(wb); 67 return wb; 68 } 69 70 71 public void modifyTestElement(TestElement wb) 72 { 73 super.configureTestElement(wb); 74 } 75 76 84 public void configure(TestElement element) 85 { 86 getNamePanel().configure(element); 87 } 88 89 100 public JPopupMenu createPopupMenu() 101 { 102 JPopupMenu menu = new JPopupMenu (); 103 JMenu addMenu = 104 MenuFactory.makeMenus( 105 new String [] { 106 MenuFactory.CONTROLLERS, 107 MenuFactory.SAMPLERS, 108 MenuFactory.CONFIG_ELEMENTS, 109 MenuFactory.NON_TEST_ELEMENTS }, 110 JMeterUtils.getResString("Add"), 111 "Add"); 112 menu.add(addMenu); 113 MenuFactory.addEditMenu(menu, false); 114 MenuFactory.addFileMenu(menu); 115 return menu; 116 } 117 118 public String getLabelResource() 119 { 120 return "workbench_title"; 121 } 122 123 126 private void init() 127 { 128 setLayout(new BorderLayout ()); 129 setBorder(makeBorder()); 130 131 add(makeTitlePanel(), BorderLayout.NORTH); 132 } 133 } 134 | Popular Tags |