1 | TestElement getCurrentElement() {↵ | | 1 | TestElement getCurrentElement() {↵
|
2 | return getCurrentNode().getTestElement();↵ | | 2 | return getCurrentNode().getTestElement();↵
|
3 | }↵ | | 3 | }↵
|
|
4 | /**↵ | | 4 | /**↵
|
5 | * The dirty property is a flag that indicates whether there are parts of↵ | | 5 | * The dirty property is a flag that indicates whether there are parts of↵
|
6 | * JMeter's test tree that the user has not saved since last modification.↵ | | 6 | * JMeter's test tree that the user has not saved since last modification.↵
|
7 | * Various (@link Command actions) set this property when components are↵ | | 7 | * Various (@link Command actions) set this property when components are↵
|
8 | * modified/created/saved.↵ | | 8 | * modified/created/saved.↵
|
9 | * ↵ | | 9 | * ↵
|
10 | * @param dirty↵ | | 10 | * @param dirty↵
|
11 | * the new value of the dirty flag↵ | | 11 | * the new value of the dirty flag↵
|
12 | */↵ | | 12 | */↵
|
13 | public void setDirty(boolean dirty) {↵ | | 13 | public void setDirty(boolean dirty) {↵
|
14 | this.dirty = dirty;↵ | | 14 | this.dirty = dirty;↵
|
15 | }↵ | | 15 | }↵
|
|
16 | /**↵ | | 16 | /**↵
|
17 | * Retrieves the state of the 'dirty' property, a flag that indicates if↵ | | 17 | * Retrieves the state of the 'dirty' property, a flag that indicates if↵
|
18 | * there are test tree components that have been modified since they were↵ | | 18 | * there are test tree components that have been modified since they were↵
|
19 | * last saved.↵ | | 19 | * last saved.↵
|
20 | * ↵ | | 20 | * ↵
|
21 | * @return true if some tree components have been modified since they were↵ | | 21 | * @return true if some tree components have been modified since they were↵
|
22 | * last saved, false otherwise↵ | | 22 | * last saved, false otherwise↵
|
23 | */↵ | | 23 | */↵
|
24 | public boolean isDirty() {↵ | | 24 | public boolean isDirty() {↵
|
25 | return dirty;↵ | | 25 | return dirty;↵
|
26 | }↵ | | 26 | }↵
|
|
27 | /**↵ | | 27 | /**↵
|
28 | * Add a subtree to the currently selected node.↵ | | 28 | * Add a subtree to the currently selected node.↵
|
29 | * ↵ | | 29 | * ↵
|
30 | * @param subTree↵ | | 30 | * @param subTree↵
|
31 | * the subtree to add.↵ | | 31 | * the subtree to add.↵
|
32 | * ↵ | | 32 | * ↵
|
33 | * @return the resulting subtree starting with the currently selected node↵ | | 33 | * @return the resulting subtree starting with the currently selected node↵
|
34 | * ↵ | | 34 | * ↵
|
35 | * @throws IllegalUserActionException↵ | | 35 | * @throws IllegalUserActionException↵
|
36 | * if a subtree cannot be added to the currently selected node↵ | | 36 | * if a subtree cannot be added to the currently selected node↵
|
37 | */↵ | | 37 | */↵
|
38 | public HashTree addSubTree(HashTree subTree) throws IllegalUserActionException {↵ | | 38 | public HashTree addSubTree(HashTree subTree) throws IllegalUserActionException {↵
|
39 | return treeModel.addSubTree(subTree, treeListener.getCurrentNode());↵ | | 39 | return treeModel.addSubTree(subTree, treeListener.getCurrentNode());↵
|
40 | }↵ | | 40 | }↵
|
|
41 | /**↵ | | 41 | /**↵
|
42 | * Get the currently selected subtree.↵ | | 42 | * Get the currently selected subtree.↵
|
43 | * ↵ | | 43 | * ↵
|
44 | * @return the subtree of the currently selected node↵ | | 44 | * @return the subtree of the currently selected node↵
|
45 | */↵ | | 45 | */↵
|
46 | public HashTree getCurrentSubTree() {↵ | | 46 | public HashTree getCurrentSubTree() {↵
|
47 | return treeModel.getCurrentSubTree(treeListener.getCurrentNode());↵ | | 47 | return treeModel.getCurrentSubTree(treeListener.getCurrentNode());↵
|
48 | }↵ | | 48 | }↵
|
|
49 | /**↵ | | 49 | /**↵
|
50 | * Get the model for JMeter's test tree.↵ | | 50 | * Get the model for JMeter's test tree.↵
|
51 | * ↵ | | 51 | * ↵
|
52 | * @return the JMeter tree model↵ | | 52 | * @return the JMeter tree model↵
|
53 | */↵ | | 53 | */↵
|
54 | public Report↵ | | 54 | /*↵
|
| | | 55 | * TODO consider removing this method, and providing method wrappers instead.↵
|
| | | 56 | * This would allow the Gui package to do any additional clearups if required,↵
|
| | | 57 | * as has been done with clearTestPlan()↵
|
| | | 58 | */ ↵
|
55 | TreeModel getTreeModel() {↵ | | 59 | public JMeterTreeModel getTreeModel() {↵
|
56 | return treeModel;↵ | | 60 | return treeModel;↵
|
57 | }↵ | | 61 | }↵
|
|
58 | /**↵ | | 62 | /**↵
|
59 | * Set the model for JMeter's test tree.↵ | | 63 | * Set the model for JMeter's test tree.↵
|
60 | * ↵ | | 64 | * ↵
|
61 | * @param newTreeModel↵ | | 65 | * @param newTreeModel↵
|
62 | * the new JMeter tree model↵ | | 66 | * the new JMeter tree model↵
|
63 | */↵ | | 67 | */↵
|
64 | public void setTreeModel(ReportTreeModel newTreeModel) {↵ | | 68 | public void setTreeModel(JMeterTreeModel newTreeModel) {↵
|
65 | treeModel = newTreeModel;↵ | | 69 | treeModel = newTreeModel;↵
|
66 | }↵ | | 70 | }↵
|
|
67 | /**↵ | | 71 | /**↵
|
68 | * Get a ValueReplacer for the test tree.↵ | | 72 | * Get a ValueReplacer for the test tree.↵
|
69 | * ↵ | | 73 | * ↵
|
70 | * @return a ValueReplacer configured for the test tree↵ | | 74 | * @return a ValueReplacer configured for the test tree↵
|
71 | */↵ | | 75 | */↵
|
72 | public ValueReplacer getReplacer() {↵ | | 76 | public ValueReplacer getReplacer() {↵
|
73 | return new ValueReplacer((ReportPlan) ((ReportTreeNode) getTreeModel().getReportPlan().getArray()[0])↵ | | 77 | return new ValueReplacer((TestPlan) ((JMeterTreeNode) getTreeModel().getTestPlan().getArray()[0])↵
|
74 | .getTestElement());↵ | | 78 | .getTestElement());↵
|
75 | }↵ | | 79 | }↵
|
|
76 | /**↵ | | 80 | /**↵
|
77 | * Set the main JMeter frame.↵ | | 81 | * Set the main JMeter frame.↵
|
78 | * ↵ | | 82 | * ↵
|
79 | * @param newMainFrame↵ | | 83 | * @param newMainFrame↵
|
80 | * the new JMeter main frame↵ | | 84 | * the new JMeter main frame↵
|
81 | */↵ | | 85 | */↵
|
82 | public void setMainFrame(ReportMainFrame newMainFrame) {↵ | | 86 | public void setMainFrame(MainFrame newMainFrame) {↵
|
83 | this.mainFrame = newMainFrame;↵ | | 87 | mainFrame = newMainFrame;↵
|
84 | }↵ | | 88 | }↵
|
|
85 | /**↵ | | 89 | /**↵
|
86 | * Get the main JMeter frame.↵ | | 90 | * Get the main JMeter frame.↵
|
87 | * ↵ | | 91 | * ↵
|
88 | * @return the main JMeter frame↵ | | 92 | * @return the main JMeter frame↵
|
89 | */↵ | | 93 | */↵
|
90 | public ReportMainFrame getMainFrame() {↵ | | 94 | public MainFrame getMainFrame() {↵
|
91 | return this.mainFrame;↵ | | 95 | return mainFrame;↵
|
92 | }↵ | | 96 | }↵
|
|
93 | /**↵ | | 97 | /**↵
|
94 | * Set the listener for JMeter's test tree.↵ | | 98 | * Set the listener for JMeter's test tree.↵
|
95 | * ↵ | | 99 | * ↵
|
96 | * @param newTreeListener↵ | | 100 | * @param newTreeListener↵
|
97 | * the new JMeter test tree listener↵ | | 101 | * the new JMeter test tree listener↵
|
98 | */↵ | | 102 | */↵
|
99 | public void setTreeListener(ReportTreeListener newTreeListener) {↵ | | 103 | public void setTreeListener(JMeterTreeListener newTreeListener) {↵
|
100 | treeListener = newTreeListener;↵ | | 104 | treeListener = newTreeListener;↵
|
101 | }↵ | | 105 | }↵
|
|
102 | /**↵ | | 106 | /**↵
|
103 | * Get the listener for JMeter's test tree.↵ | | 107 | * Get the listener for JMeter's test tree.↵
|
104 | * ↵ | | 108 | * ↵
|
105 | * @return the JMeter test tree listener↵ | | 109 | * @return the JMeter test tree listener↵
|
106 | */↵ | | 110 | */↵
|
107 | public ReportTreeListener getTreeListener() {↵ | | 111 | public JMeterTreeListener getTreeListener() {↵
|
108 | return treeListener;↵ | | 112 | return treeListener;↵
|
109 | }↵ | | 113 | }↵
|
|
110 | /**↵ | | 114 | /**↵
|
111 | * Display the specified popup menu with the source component and location↵ | | 115 | * Display the specified popup menu with the source component and location↵
|
112 | * from the specified mouse event.↵ | | 116 | * from the specified mouse event.↵
|
113 | * ↵ | | 117 | * ↵
|
114 | * @param e↵ | | 118 | * @param e↵
|
115 | * the mouse event causing this popup to be displayed↵ | | 119 | * the mouse event causing this popup to be displayed↵
|
116 | * @param popup↵ | | 120 | * @param popup↵
|
117 | * the popup menu to display↵ | | 121 | * the popup menu to display↵
|
118 | */↵ | | 122 | */↵
|
119 | public void displayPopUp(MouseEvent e, JPopupMenu popup) {↵ | | 123 | public void displayPopUp(MouseEvent e, JPopupMenu popup) {↵
|
120 | displayPopUp((Component) e.getSource(), e, popup);↵ | | 124 | displayPopUp((Component) e.getSource(), e, popup);↵
|
121 | }↵ | | 125 | }↵
|
|
122 | /**↵ | | 126 | /**↵
|
123 | * Display the specified popup menu at the location specified by a mouse↵ | | 127 | * Display the specified popup menu at the location specified by a mouse↵
|
124 | * event with the specified source component.↵ | | 128 | * event with the specified source component.↵
|
125 | * ↵ | | 129 | * ↵
|
126 | * @param invoker↵ | | 130 | * @param invoker↵
|
127 | * the source component↵ | | 131 | * the source component↵
|
128 | * @param e↵ | | 132 | * @param e↵
|
129 | * the mouse event causing this popup to be displayed↵ | | 133 | * the mouse event causing this popup to be displayed↵
|
130 | * @param popup↵ | | 134 | * @param popup↵
|
131 | * the popup menu to display↵ | | 135 | * the popup menu to display↵
|
132 | */↵ | | 136 | */↵
|
133 | public void displayPopUp(Component invoker, MouseEvent e, JPopupMenu popup) {↵ | | 137 | public void displayPopUp(Component invoker, MouseEvent e, JPopupMenu popup) {↵
|
134 | if (popup != null) {↵ | | 138 | if (popup != null) {↵
|
135 | log.debug("Showing pop up for " + invoker + " at x,y = " + e.getX() + "," + e.getY());↵ | | 139 | log.debug("Showing pop up for " + invoker + " at x,y = " + e.getX() + "," + e.getY());↵
|
|
136 | popup.pack();↵ | | 140 | popup.pack();↵
|
137 | popup.show(invoker, e.getX(), e.getY());↵ | | 141 | popup.show(invoker, e.getX(), e.getY());↵
|
138 | popup.setVisible(true);↵ | | 142 | popup.setVisible(true);↵
|
139 | popup.requestFocus();↵ | | 143 | popup.requestFocus();↵
|
140 | }↵ | | 144 | }↵
|
141 | }↵ | | 145 | }↵
|
|
142 | /*↵ | | 146 | /*↵
|
143 | * (non-Javadoc)↵ | | 147 | * (non-Javadoc)↵
|
144 | * ↵ | | 148 | * ↵
|
145 | * @see org.apache.jmeter.util.LocaleChangeListener#localeChanged(org.apache.jmeter.util.LocaleChangeEvent)↵ | | 149 | * @see org.apache.jmeter.util.LocaleChangeListener#localeChanged(org.apache.jmeter.util.LocaleChangeEvent)↵
|
146 | */↵ | | 150 | */↵
|
147 | public void localeChanged(LocaleChangeEvent event) {↵ | | 151 | public void localeChanged(LocaleChangeEvent event) {↵
|
148 | // FIrst make sure we save the content of the current GUI (since we↵ | | 152 | // FIrst make sure we save the content of the current GUI (since we↵
|
149 | // will flush it away):↵ | | 153 | // will flush it away):↵
|
150 | updateCurrentNode();↵ | | 154 | updateCurrentNode();↵
|
|
151 | // Forget about all GUIs we've created so far: we'll need to re-created↵ | | 155 | // Forget about all GUIs we've created so far: we'll need to re-created↵
|
152 | // them all!↵ | | 156 | // them all!↵
|
153 | guis = new HashMap();↵ | | 157 | guis = new HashMap();↵
|
154 | nodesToGui = new HashMap();↵ | | 158 | nodesToGui = new HashMap();↵
|
155 | testBeanGUIs = new HashMap();↵ | | 159 | testBeanGUIs = new HashMap();↵
|
|
156 | // BeanInfo objects also contain locale-sensitive data -- flush them↵ | | 160 | // BeanInfo objects also contain locale-sensitive data -- flush them↵
|
157 | // away:↵ | | 161 | // away:↵
|
158 | Introspector.flushCaches();↵ | | 162 | Introspector.flushCaches();↵
|
|
159 | // Now put the current GUI in place. [This code was copied from the↵ | | 163 | // Now put the current GUI in place. [This code was copied from the↵
|
160 | // EditCommand action -- we can't just trigger the action because that↵ | | 164 | // EditCommand action -- we can't just trigger the action because that↵
|
161 | // would populate the current node with the contents of the new GUI --↵ | | 165 | // would populate the current node with the contents of the new GUI --↵
|
162 | // which is empty.]↵ | | 166 | // which is empty.]↵
|
163 | ReportMainFrame mf = getMainFrame(); // Fetch once↵ | | 167 | MainFrame mf = getMainFrame(); // Fetch once↵
|
164 | if (mf == null) // Probably caused by unit testing on headless system↵ | | 168 | if (mf == null) // Probably caused by unit testing on headless system↵
|
165 | {↵ | | 169 | {↵
|
166 | log.warn("Mainframe is null");↵ | | 170 | log.warn("Mainframe is null");↵
|
167 | } else {↵ | | 171 | } else {↵
|
168 | mf.setMainPanel((javax.swing.JComponent) getCurrentGui());↵ | | 172 | mf.setMainPanel((javax.swing.JComponent) getCurrentGui());↵
|
169 | mf.setEditMenu(getTreeListener().getCurrentNode().createPopupMenu());↵ | | 173 | mf.setEditMenu(getTreeListener().getCurrentNode().createPopupMenu());↵
|
170 | }↵ | | 174 | }↵
|
171 | | | 175 |
|