Apache JMeter

org.apache.jmeter.gui.tree
Class JMeterTreeModel

java.lang.Object
  extended by javax.swing.tree.DefaultTreeModel
      extended by org.apache.jmeter.gui.tree.JMeterTreeModel
All Implemented Interfaces:
Serializable, TreeModel

public class JMeterTreeModel
extends DefaultTreeModel

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultTreeModel
asksAllowsChildren, listenerList, root
 
Constructor Summary
JMeterTreeModel()
           
JMeterTreeModel(Object o)
          Deprecated. - only for use by JMeter class!
JMeterTreeModel(TestElement tp, TestElement wb)
           
 
Method Summary
 JMeterTreeNode addComponent(TestElement component, JMeterTreeNode node)
          Add a TestElement to a JMeterTreeNode
 HashTree addSubTree(HashTree subTree, JMeterTreeNode current)
          Adds the sub tree at the given node.
 void clearTestPlan()
          Clear the test plan, and use default node for test plan and workbench.
 void clearTestPlan(TestElement testPlan)
          Clear the test plan, and use specified node for test plan and default node for workbench N.B.
 HashTree getCurrentSubTree(JMeterTreeNode node)
          Get the current sub tree for a JMeterTreeNode
 JMeterTreeNode getNodeOf(TestElement userObject)
          Get the node for a given TestElement object.
 List<JMeterTreeNode> getNodesOfType(Class<?> type)
          Returns a list of tree nodes that hold objects of the given class type.
 HashTree getTestPlan()
          Get the TestPlan from the root of this tree
 HashTree getWorkBench()
          Get the WorkBench from the root of this tree
 void removeNodeFromParent(JMeterTreeNode node)
           
 
Methods inherited from class javax.swing.tree.DefaultTreeModel
addTreeModelListener, asksAllowsChildren, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getChild, getChildCount, getIndexOfChild, getListeners, getPathToRoot, getPathToRoot, getRoot, getTreeModelListeners, insertNodeInto, isLeaf, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, setRoot, valueForPathChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JMeterTreeModel

public JMeterTreeModel(TestElement tp,
                       TestElement wb)

JMeterTreeModel

public JMeterTreeModel()

JMeterTreeModel

@Deprecated
public JMeterTreeModel(Object o)
Deprecated. - only for use by JMeter class!

Hack to allow TreeModel to be used in non-GUI and headless mode.

Parameters:
o - - dummy
Method Detail

getNodesOfType

public List<JMeterTreeNode> getNodesOfType(Class<?> type)
Returns a list of tree nodes that hold objects of the given class type. If none are found, an empty list is returned.

Parameters:
type - The type of nodes, which are to be collected
Returns:
a list of tree nodes of the given type, or an empty list

getNodeOf

public JMeterTreeNode getNodeOf(TestElement userObject)
Get the node for a given TestElement object.

Parameters:
userObject - The object to be found in this tree
Returns:
the node corresponding to the userObject

addSubTree

public HashTree addSubTree(HashTree subTree,
                           JMeterTreeNode current)
                    throws IllegalUserActionException
Adds the sub tree at the given node. Returns a boolean indicating whether the added sub tree was a full test plan.

Parameters:
subTree - The HashTree which is to be inserted into current
current - The node in which the subTree is to be inserted. Will be overridden, when an instance of TestPlan or WorkBench is found in the subtree.
Returns:
newly created sub tree now found at current
Throws:
IllegalUserActionException - when current is not an instance of AbstractConfigGui and no instance of TestPlan or WorkBench could be found in the subTree

addComponent

public JMeterTreeNode addComponent(TestElement component,
                                   JMeterTreeNode node)
                            throws IllegalUserActionException
Add a TestElement to a JMeterTreeNode

Parameters:
component - The TestElement to be used as data for the newly created note
node - The JMeterTreeNode into which the newly created node is to be inserted
Returns:
new JMeterTreeNode for the given component
Throws:
IllegalUserActionException - when the user object for the node is not an instance of AbstractConfigGui

removeNodeFromParent

public void removeNodeFromParent(JMeterTreeNode node)

getCurrentSubTree

public HashTree getCurrentSubTree(JMeterTreeNode node)
Get the current sub tree for a JMeterTreeNode

Parameters:
node - The JMeterTreeNode from which the sub tree is to be taken
Returns:
newly copied sub tree

getTestPlan

public HashTree getTestPlan()
Get the TestPlan from the root of this tree

Returns:
The TestPlan found at the root of this tree

getWorkBench

public HashTree getWorkBench()
Get the WorkBench from the root of this tree

Returns:
The WorkBench found at the root of this tree

clearTestPlan

public void clearTestPlan()
Clear the test plan, and use default node for test plan and workbench. N.B. Should only be called by GuiPackage.clearTestPlan()


clearTestPlan

public void clearTestPlan(TestElement testPlan)
Clear the test plan, and use specified node for test plan and default node for workbench N.B. Should only be called by GuiPackage.clearTestPlan(TestElement)

Parameters:
testPlan - the node to use as the testplan top node

Apache JMeter

Copyright © 1998-2015 Apache Software Foundation. All Rights Reserved.