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 | */↵ | | |
|
24 | public static JMenuItem makeMenuItem(String label, String name, String actionCommand) {↵ | | 15 | public static JMenuItem makeMenuItem(String label, String name, String actionCommand) {↵
|
25 | JMenuItem newMenuChoice = new JMenuItem(label);↵ | | 16 | JMenuItem newMenuChoice = new JMenuItem(label);↵
|
26 | newMenuChoice.setName(name);↵ | | 17 | newMenuChoice.setName(name);↵
|
27 | newMenuChoice.addActionListener(ActionRouter.getInstance());↵ | | 18 | newMenuChoice.addActionListener(ReportActionRouter.getInstance());↵
|
28 | if (actionCommand != null) {↵ | | 19 | if (actionCommand != null) {↵
|
29 | newMenuChoice.setActionCommand(actionCommand);↵ | | 20 | newMenuChoice.setActionCommand(actionCommand);↵
|
30 | }↵ | | 21 | }↵
|
|
31 | return newMenuChoice;↵ | | 22 | return newMenuChoice;↵
|
32 | }↵ | | 23 | }↵
|
|
33 | public static JMenuItem makeMenuItem(String label, String name, String actionCommand, KeyStroke accel) {↵ | | 24 | public static JMenuItem makeMenuItem(String label, String name, String actionCommand, KeyStroke accel) {↵
|
34 | JMenuItem item = makeMenuItem(label, name, actionCommand);↵ | | 25 | JMenuItem item = makeMenuItem(label, name, actionCommand);↵
|
35 | item.setAccelerator(accel);↵ | | 26 | item.setAccelerator(accel);↵
|
36 | return item;↵ | | 27 | return item;↵
|
37 | }↵ | | 28 | }↵
|
|
38 | private static void initializeMenus() {↵ | | 29 | private static void initializeMenus() {↵
|
39 | try {↵ | | 30 | try {↵
|
40 | List guiClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] {↵ | | 31 | List guiClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] {↵
|
41 | JMeterGUIComponent.class, TestBean.class });↵ | | 32 | JMeterGUIComponent.class, TestBean.class });↵
|
42 | timers = new LinkedList();↵ | | 33 | controllers = new LinkedList();↵
|
43 | controllers = new LinkedList();↵ | | 34 | configElements = new LinkedList();↵
|
44 | samplers = new LinkedList();↵ | | 35 | listeners = new LinkedList();↵
|
45 | configElements = new LinkedList();↵ | | 36 | postProcessors = new LinkedList();↵
|
46 | assertions = new LinkedList();↵ | | 37 | preProcessors = new LinkedList();↵
|
47 | listeners = new LinkedList();↵ | | 38 | tables = new LinkedList();↵
|
48 | postProcessors = new LinkedList();↵ | | 39 | reportPage = new LinkedList();↵
|
49 | preProcessors = new LinkedList();↵ | | 40 | nonTestElements = new LinkedList();↵
|
50 | nonTestElement | | 41 | menuMa
|