1 | catch (ClassNotFoundException e) {↵ | | 1 | catch (ClassNotFoundException e) {↵
|
2 | log.error("Problem retrieving gui for " + objClass, e);↵ | | 2 | log.error("Problem retrieving gui for " + objClass, e);↵
|
3 | throw new RuntimeException(e.toString()); // Programming error:↵ | | 3 | throw new RuntimeException(e.toString()); // Programming error:↵
|
4 | // bail out.↵ | | 4 | // bail out.↵
|
5 | } catch (InstantiationException e) {↵ | | 5 | } catch (InstantiationException e) {↵
|
6 | log.error("Problem retrieving gui for " + objClass, e);↵ | | 6 | log.error("Problem retrieving gui for " + objClass, e);↵
|
7 | throw new RuntimeException(e.toString()); // Programming error:↵ | | 7 | throw new RuntimeException(e.toString()); // Programming error:↵
|
8 | // bail out.↵ | | 8 | // bail out.↵
|
9 | } catch (IllegalAccessException e) {↵ | | 9 | } catch (IllegalAccessException e) {↵
|
10 | log.error("Problem retrieving gui for " + objClass, e);↵ | | 10 | log.error("Problem retrieving gui for " + objClass, e);↵
|
11 | throw new RuntimeException(e.toString()); // Programming error:↵ | | 11 | throw new RuntimeException(e.toString()); // Programming error:↵
|
12 | // bail out.↵ | | 12 | // bail out.↵
|
13 | }↵ | | 13 | }↵
|
14 | }↵ | | 14 | }↵
|
|
15 | /**↵ | | 15 | /**↵
|
16 | * Get an instance of the specified JMeterGUIComponent class. If an instance↵ | | 16 | * Get an instance of the specified JMeterGUIComponent class. If an instance↵
|
17 | * of the GUI class has previously been created and it is not marked as an↵ | | 17 | * of the GUI class has previously been created and it is not marked as an↵
|
18 | * {@link UnsharedComponent}, that shared instance will be returned.↵ | | 18 | * {@link UnsharedComponent}, that shared instance will be returned.↵
|
19 | * Otherwise, a new instance of the component will be created, and shared↵ | | 19 | * Otherwise, a new instance of the component will be created, and shared↵
|
20 | * components will be cached for future retrieval.↵ | | 20 | * components will be cached for future retrieval.↵
|
21 | * ↵ | | 21 | * ↵
|
22 | * @param guiClass↵ | | 22 | * @param guiClass↵
|
23 | * the fully qualified class name of the GUI component. This↵ | | 23 | * the fully qualified class name of the GUI component. This↵
|
24 | * class must implement JMeterGUIComponent.↵ | | 24 | * class must implement JMeterGUIComponent.↵
|
25 | * @param testClass↵ | | 25 | * @param testClass↵
|
26 | * the fully qualified class name of the test elements edited by↵ | | 26 | * the fully qualified class name of the test elements edited by↵
|
27 | * this GUI component. This class must implement TestElement.↵ | | 27 | * this GUI component. This class must implement TestElement.↵
|
28 | * @return an instance of the specified class↵ | | 28 | * @return an instance of the specified class↵
|
29 | * ↵ | | 29 | * ↵
|
30 | * @throws InstantiationException↵ | | 30 | * @throws InstantiationException↵
|
31 | * if an instance of the object cannot be created↵ | | 31 | * if an instance of the object cannot be created↵
|
32 | * @throws IllegalAccessException↵ | | 32 | * @throws IllegalAccessException↵
|
33 | * if access rights do not allow the default constructor to be↵ | | 33 | * if access rights do not allow the default constructor to be↵
|
34 | * called↵ | | 34 | * called↵
|
35 | * @throws ClassNotFoundException↵ | | 35 | * @throws ClassNotFoundException↵
|
36 | * if the specified GUI class cannot be found↵ | | 36 | * if the specified GUI class cannot be found↵
|
37 | */↵ | | 37 | */↵
|
38 | private JMeterGUIComponent getGuiFromCache(Class guiClass, Class testClass) throws InstantiationException,↵ | | 38 | private JMeterGUIComponent getGuiFromCache(Class guiClass, Class testClass) throws InstantiationException,↵
|
39 | IllegalAccessException {↵ | | 39 | IllegalAccessException {↵
|
40 | JMeterGUIComponent comp;↵ | | 40 | JMeterGUIComponent comp;↵
|
41 | if (guiClass == TestBeanGUI.class) {↵ | | 41 | if (guiClass == TestBeanGUI.class) {↵
|
42 | comp = (TestBeanGUI) testBeanGUIs.get(testClass);↵ | | 42 | comp = (TestBeanGUI) testBeanGUIs.get(testClass);↵
|
43 | if (comp == null) {↵ | | 43 | if (comp == null) {↵
|
44 | comp = new TestBeanGUI(testClass);↵ | | 44 | comp = new TestBeanGUI(testClass);↵
|
45 | testBeanGUIs.put(testClass, comp);↵ | | 45 | testBeanGUIs.put(testClass, comp);↵
|
46 | }↵ | | 46 | }↵
|
47 | } else {↵ | | 47 | } else {↵
|
48 | comp = (JMeterGUIComponent) guis.get(guiClass);↵ | | 48 | comp = (JMeterGUIComponent) guis.get(guiClass);↵
|
49 | if (comp == null) {↵ | | 49 | if (comp == null) {↵
|
50 | comp = (JMeterGUIComponent) guiClass.newInstance();↵ | | 50 | comp = (JMeterGUIComponent) guiClass.newInstance();↵
|
51 | if (!(comp instanceof UnsharedComponent)) {↵ | | 51 | if (!(comp instanceof UnsharedComponent)) {↵
|
52 | guis.put(guiClass, comp);↵ | | 52 | guis.put(guiClass, comp);↵
|
53 | }↵ | | 53 | }↵
|
54 | }↵ | | 54 | }↵
|
55 | }↵ | | 55 | }↵
|
56 | return comp;↵ | | 56 | return comp;↵
|
57 | }↵ | | 57 | }↵
|
|
58 | /**↵ | | 58 | /**↵
|
59 | * Update the GUI for the currently selected node. The GUI component is↵ | | 59 | * Update the GUI for the currently selected node. The GUI component is↵
|
60 | * configured to reflect the settings in the current tree node.↵ | | 60 | * configured to reflect the settings in the current tree node.↵
|
61 | * ↵ | | 61 | * ↵
|
62 | */↵ | | 62 | */↵
|
63 | public void updateCurrentGui() {↵ | | 63 | public void updateCurrentGui() {↵
|
64 | updateCurrentNode();↵ | | 64 | updateCurrentNode();↵
|
65 | currentNode = treeListener.getCurrentNode();↵ | | 65 | currentNode = treeListener.getCurrentNode();↵
|
66 | TestElement element = currentNode.getTestElement();↵ | | 66 | TestElement element = currentNode.getTestElement();↵
|
67 | JMeterGUIComponent comp = getGui(element);↵ | | 67 | JMeterGUIComponent comp = getGui(element);↵
|
68 | comp.configure(element);↵ | | 68 | comp.configure(element);↵
|
69 | currentNodeUpdated = false;↵ | | 69 | currentNodeUpdated = false;↵
|
70 | }↵ | | 70 | }↵
|
|
71 | /**↵ | | 71 | /**↵
|
72 | * This method should be called in order for GuiPackage to change the↵ | | 72 | * This method should be called in order for GuiPackage to change the↵
|
73 | * current node. This will save any changes made to the earlier node before↵ | | 73 | * current node. This will save any changes made to the earlier node before↵
|
74 | * choosing the new node.↵ | | 74 | * choosing the new node.↵
|
75 | */↵ | | 75 | */↵
|
76 | public void updateCurrentNode() {↵ | | 76 | public void updateCurrentNode() {↵
|
77 | try {↵ | | 77 | try {↵
|
78 | if (currentNode != null && !currentNodeUpdated) {↵ | | 78 | if (currentNode != null && !currentNodeUpdated) {↵
|
79 | log.debug("Updating current node " + currentNode.getName());↵ | | 79 | log.debug("Updating current node " + currentNode.getName());↵
|
80 | JMeterGUIComponent comp = getGui(currentNode.getTestElement());↵ | | 80 | JMeterGUIComponent comp = getGui(currentNode.getTestElement());↵
|
81 | TestElement el = currentNode.getTestElement();↵ | | 81 | TestElement el = currentNode.getTestElement();↵
|
82 | comp.modifyTestElement(el);↵ | | 82 | comp.modifyTestElement(el);↵
|
83 | | | 83 |
|