1 | JMenu makeMenu(Collection menuInfo, String actionCommand, String menuName) {↵ | | 1 | JMenu makeMenu(Collection menuInfo, String actionCommand, String menuName) {↵
|
2 | Iterator iter = menuInfo.iterator();↵ | | 2 | Iterator iter = menuInfo.iterator();↵
|
3 | JMenu menu = new JMenu(menuName);↵ | | 3 | JMenu menu = new JMenu(menuName);↵
|
4 | while (iter.hasNext()) {↵ | | 4 | while (iter.hasNext()) {↵
|
5 | MenuInfo info = (MenuInfo) iter.next();↵ | | 5 | MenuInfo info = (MenuInfo) iter.next();↵
|
6 | menu.add(makeMenuItem(info.label, info.className, actionCommand));↵ | | 6 | menu.add(makeMenuItem(info.label, info.className, actionCommand));↵
|
7 | }↵ | | 7 | }↵
|
8 | return menu;↵ | | 8 | return menu;↵
|
9 | }↵ | | 9 | }↵
|
|
10 | public static void setEnabled(JMenu menu) {↵ | | 10 | public static void setEnabled(JMenu menu) {↵
|
11 | if (menu.getSubElements().length == 0) {↵ | | 11 | if (menu.getSubElements().length == 0) {↵
|
12 | menu.setEnabled(false);↵ | | 12 | menu.setEnabled(false);↵
|
13 | }↵ | | 13 | }↵
|
14 | }↵ | | 14 | }↵
|
|
| | | 15 | /**↵
|
| | | 16 | * Create a single menu item↵
|
| | | 17 | * ↵
|
| | | 18 | * @param label for the MenuItem↵
|
| | | 19 | * @param name for the MenuItem↵
|
| | | 20 | * @param actionCommand - predefined string, e.g. ActionNames.ADD↵
|
| | | 21 | * @see org.apache.jmeter.gui.action.ActionNames↵
|
| | | 22 | * @return the menu item↵
|
| | | 23 | */↵
|
15 | public static JMenuItem makeMenuItem(String label, String name, String actionCommand) {↵ | | 24 | public static JMenuItem makeMenuItem(String label, String name, String actionCommand) {↵
|
16 | JMenuItem newMenuChoice = new JMenuItem(label);↵ | | 25 | JMenuItem newMenuChoice = new JMenuItem(label);↵
|
17 | newMenuChoice.setName(name);↵ | | 26 | newMenuChoice.setName(name);↵
|
18 | newMenuChoice.addActionListener(ReportActionRouter.getInstance());↵ | | 27 | newMenuChoice.addActionListener(ActionRouter.getInstance());↵
|
19 | if (actionCommand != null) {↵ | | 28 | if (actionCommand != null) {↵
|
20 | newMenuChoice.setActionCommand(actionCommand);↵ | | 29 | newMenuChoice.setActionCommand(actionCommand);↵
|
21 | }↵ | | 30 | }↵
|
|
22 | return newMenuChoice;↵ | | 31 | return newMenuChoice;↵
|
23 | }↵ | | 32 | }↵
|
|
24 | public static JMenuItem makeMenuItem(String label, String name, String actionCommand, KeyStroke accel) {↵ | | 33 | public static JMenuItem makeMenuItem(String label, String name, String actionCommand, KeyStroke accel) {↵
|
25 | JMenuItem item = makeMenuItem(label, name, actionCommand);↵ | | 34 | JMenuItem item = makeMenuItem(label, name, actionCommand);↵
|
26 | item.setAccelerator(accel);↵ | | 35 | item.setAccelerator(accel);↵
|
27 | return item;↵ | | 36 | return item;↵
|
28 | }↵ | | 37 | }↵
|
|
29 | private static void initializeMenus() {↵ | | 38 | private static void initializeMenus() {↵
|
30 | try {↵ | | 39 | try {↵
|
31 | List guiClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] {↵ | | 40 | List guiClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] {↵
|
32 | JMeterGUIComponent.class, TestBean.class });↵ | | 41 | JMeterGUIComponent.class, TestBean.class });↵
|
33 | controllers = new LinkedList();↵ | | 42 | timers = new LinkedList();↵
|
34 | configElements = new LinkedList();↵ | | 43 | controllers = new LinkedList();↵
|
35 | listeners = new LinkedList();↵ | | 44 | samplers = new LinkedList();↵
|
36 | postProcessors = new LinkedList();↵ | | 45 | configElements = new LinkedList();↵
|
37 | preProcessors = new LinkedList();↵ | | 46 | assertions = new LinkedList();↵
|
38 | tables = new LinkedList();↵ | | 47 | listeners = new LinkedList();↵
|
39 | reportPage = new LinkedList();↵ | | 48 | postProcessors = new LinkedList();↵
|
40 | nonTestElements = new LinkedList();↵ | | 49 | preProcessors = new LinkedList();↵
|
41 | menuMap | | 50 | nonTestElements
|