Lines 18-30
Link Here
|
18 |
|
18 |
|
19 |
package org.apache.jmeter.gui.tree; |
19 |
package org.apache.jmeter.gui.tree; |
20 |
|
20 |
|
21 |
import java.util.Enumeration; |
|
|
22 |
import java.util.Iterator; |
23 |
import java.util.LinkedList; |
24 |
import java.util.List; |
25 |
|
26 |
import javax.swing.tree.DefaultTreeModel; |
27 |
|
28 |
import org.apache.jmeter.config.gui.AbstractConfigGui; |
21 |
import org.apache.jmeter.config.gui.AbstractConfigGui; |
29 |
import org.apache.jmeter.control.gui.TestPlanGui; |
22 |
import org.apache.jmeter.control.gui.TestPlanGui; |
30 |
import org.apache.jmeter.control.gui.WorkBenchGui; |
23 |
import org.apache.jmeter.control.gui.WorkBenchGui; |
Lines 38-54
Link Here
|
38 |
import org.apache.jorphan.collections.HashTree; |
31 |
import org.apache.jorphan.collections.HashTree; |
39 |
import org.apache.jorphan.collections.ListedHashTree; |
32 |
import org.apache.jorphan.collections.ListedHashTree; |
40 |
|
33 |
|
|
|
34 |
import javax.swing.tree.DefaultTreeModel; |
35 |
import java.util.Enumeration; |
36 |
import java.util.Iterator; |
37 |
import java.util.LinkedList; |
38 |
import java.util.List; |
39 |
|
41 |
public class JMeterTreeModel extends DefaultTreeModel { |
40 |
public class JMeterTreeModel extends DefaultTreeModel { |
42 |
|
41 |
|
43 |
private static final long serialVersionUID = 240L; |
42 |
private static final long serialVersionUID = 240L; |
44 |
|
43 |
|
45 |
public JMeterTreeModel(TestElement tp, TestElement wb) { |
44 |
public JMeterTreeModel(TestElement tp, TestElement wb) { |
46 |
super(new JMeterTreeNode(wb, null)); |
45 |
super(new JMeterTreeNode(wb, null)); |
47 |
initTree(tp,wb); |
46 |
initTree(tp, wb); |
48 |
} |
47 |
} |
49 |
|
48 |
|
50 |
public JMeterTreeModel() { |
49 |
public JMeterTreeModel() { |
51 |
this(new TestPlanGui().createTestElement(),new WorkBenchGui().createTestElement()); |
50 |
this(new TestPlanGui().createTestElement(), new WorkBenchGui().createTestElement()); |
52 |
// super(new JMeterTreeNode(new WorkBenchGui().createTestElement(), null)); |
51 |
// super(new JMeterTreeNode(new WorkBenchGui().createTestElement(), null)); |
53 |
// TestElement tp = new TestPlanGui().createTestElement(); |
52 |
// TestElement tp = new TestPlanGui().createTestElement(); |
54 |
// initTree(tp); |
53 |
// initTree(tp); |
Lines 57-68
Link Here
|
57 |
/** |
56 |
/** |
58 |
* Hack to allow TreeModel to be used in non-GUI and headless mode. |
57 |
* Hack to allow TreeModel to be used in non-GUI and headless mode. |
59 |
* |
58 |
* |
60 |
* @deprecated - only for use by JMeter class! |
|
|
61 |
* @param o - dummy |
59 |
* @param o - dummy |
|
|
60 |
* @deprecated - only for use by JMeter class! |
62 |
*/ |
61 |
*/ |
63 |
@Deprecated |
62 |
@Deprecated |
64 |
public JMeterTreeModel(Object o) { |
63 |
public JMeterTreeModel(Object o) { |
65 |
this(new TestPlan(),new WorkBench()); |
64 |
this(new TestPlan(), new WorkBench()); |
66 |
// super(new JMeterTreeNode(new WorkBench(), null)); |
65 |
// super(new JMeterTreeNode(new WorkBench(), null)); |
67 |
// TestElement tp = new TestPlan(); |
66 |
// TestElement tp = new TestPlan(); |
68 |
// initTree(tp, new WorkBench()); |
67 |
// initTree(tp, new WorkBench()); |
Lines 128-134
Link Here
|
128 |
guicomp.configure(component); |
127 |
guicomp.configure(component); |
129 |
guicomp.modifyTestElement(component); |
128 |
guicomp.modifyTestElement(component); |
130 |
guiPackage.getCurrentGui(); // put the gui object back |
129 |
guiPackage.getCurrentGui(); // put the gui object back |
131 |
// to the way it was. |
130 |
// to the way it was. |
132 |
} |
131 |
} |
133 |
JMeterTreeNode newNode = new JMeterTreeNode(component, this); |
132 |
JMeterTreeNode newNode = new JMeterTreeNode(component, this); |
134 |
|
133 |
|
Lines 195-203
Link Here
|
195 |
return getCurrentSubTree((JMeterTreeNode) ((JMeterTreeNode) this.getRoot()).getChildAt(0)); |
194 |
return getCurrentSubTree((JMeterTreeNode) ((JMeterTreeNode) this.getRoot()).getChildAt(0)); |
196 |
} |
195 |
} |
197 |
|
196 |
|
|
|
197 |
public HashTree getWorkBench() { |
198 |
return getCurrentSubTree((JMeterTreeNode) ((JMeterTreeNode) this.getRoot()).getChildAt(1)); |
199 |
} |
200 |
|
198 |
/** |
201 |
/** |
199 |
* Clear the test plan, and use default node for test plan and workbench. |
202 |
* Clear the test plan, and use default node for test plan and workbench. |
200 |
* |
203 |
* <p/> |
201 |
* N.B. Should only be called by {@link GuiPackage#clearTestPlan()} |
204 |
* N.B. Should only be called by {@link GuiPackage#clearTestPlan()} |
202 |
*/ |
205 |
*/ |
203 |
public void clearTestPlan() { |
206 |
public void clearTestPlan() { |
Lines 207-213
Link Here
|
207 |
|
210 |
|
208 |
/** |
211 |
/** |
209 |
* Clear the test plan, and use specified node for test plan and default node for workbench |
212 |
* Clear the test plan, and use specified node for test plan and default node for workbench |
210 |
* |
213 |
* <p/> |
211 |
* N.B. Should only be called by {@link GuiPackage#clearTestPlan(TestElement)} |
214 |
* N.B. Should only be called by {@link GuiPackage#clearTestPlan(TestElement)} |
212 |
* |
215 |
* |
213 |
* @param testPlan the node to use as the testplan top node |
216 |
* @param testPlan the node to use as the testplan top node |
Lines 216-227
Link Here
|
216 |
// Remove the workbench and testplan nodes |
219 |
// Remove the workbench and testplan nodes |
217 |
int children = getChildCount(getRoot()); |
220 |
int children = getChildCount(getRoot()); |
218 |
while (children > 0) { |
221 |
while (children > 0) { |
219 |
JMeterTreeNode child = (JMeterTreeNode)getChild(getRoot(), 0); |
222 |
JMeterTreeNode child = (JMeterTreeNode) getChild(getRoot(), 0); |
220 |
super.removeNodeFromParent(child); |
223 |
super.removeNodeFromParent(child); |
221 |
children = getChildCount(getRoot()); |
224 |
children = getChildCount(getRoot()); |
222 |
} |
225 |
} |
223 |
// Init the tree |
226 |
// Init the tree |
224 |
initTree(testPlan,new WorkBenchGui().createTestElement()); // Assumes this is only called from GUI mode |
227 |
initTree(testPlan, new WorkBenchGui().createTestElement()); // Assumes this is only called from GUI mode |
225 |
} |
228 |
} |
226 |
|
229 |
|
227 |
/** |
230 |
/** |
Lines 238-243
Link Here
|
238 |
// Let others know that the tree content has changed. |
241 |
// Let others know that the tree content has changed. |
239 |
// This should not be necessary, but without it, nodes are not shown when the user |
242 |
// This should not be necessary, but without it, nodes are not shown when the user |
240 |
// uses the Close menu item |
243 |
// uses the Close menu item |
241 |
nodeStructureChanged((JMeterTreeNode)getRoot()); |
244 |
nodeStructureChanged((JMeterTreeNode) getRoot()); |
242 |
} |
245 |
} |
243 |
} |
246 |
} |