Apache JMeter
1.9

org.apache.jmeter.gui.tree
Class JMeterTreeNode

java.lang.Object
  |
  +--javax.swing.tree.DefaultMutableTreeNode
        |
        +--org.apache.jmeter.gui.tree.JMeterTreeNode
All Implemented Interfaces:
Cloneable, JMeterGUIComponent, MutableTreeNode, Serializable, TreeNode

public class JMeterTreeNode
extends DefaultMutableTreeNode
implements JMeterGUIComponent

Version:
$Revision: 1.12 $
Author:
Michael Stover
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
JMeterTreeNode(TestElement userObj, JMeterTreeModel treeModel)
           
 
Method Summary
 void clear()
          Clear the gui and return it to initial default values.
 void configure(TestElement element)
          The GUI must be able to extract the data from the TestElement and update all GUI fields to represent those data.
 JPopupMenu createPopupMenu()
          When a user right-clicks on the component in the test tree, or selects the edit menu when the component is selected, the component will be asked to return a JPopupMenu that provides all the options available to the user from this component.
 TestElement createTestElement()
          JMeter test components are separated into a model and a GUI representation.
 ImageIcon getIcon()
           
 Collection getMenuCategories()
          This is the list of add menu categories this gui component will be available under.
 String getName()
          Gets the name of the JMeter GUI component.
 String getStaticLabel()
          Get the component's label.
 boolean isEnabled()
          Test GUI elements can be disabled, in which case they do not become part of the test when run.
 void modifyTestElement(TestElement el)
          Modifies a given TestElement to mirror the data in the gui components.
 void nameChanged()
           
 void setEnabled(boolean enabled)
          Set whether this component is enabled
 void setName(String name)
          Sets the name of the JMeter GUI Component.
 void setNode(JMeterTreeNode node)
          Sets the tree node which this component is associated with
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JMeterTreeNode

public JMeterTreeNode(TestElement userObj,
                      JMeterTreeModel treeModel)
Method Detail

isEnabled

public boolean isEnabled()
Description copied from interface: JMeterGUIComponent
Test GUI elements can be disabled, in which case they do not become part of the test when run.

Specified by:
isEnabled in interface JMeterGUIComponent
Returns:
true if the element should be part of the test run, false otherwise

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: JMeterGUIComponent
Set whether this component is enabled. * @param enabled true for enabled, false for disabled.

Specified by:
setEnabled in interface JMeterGUIComponent

clear

public void clear()
Description copied from interface: JMeterGUIComponent
Clear the gui and return it to initial default values. This is necessary because most gui classes are instantiated just once and re-used for multiple test element objects and thus they need to be cleared between use. TODO: implement this in all gui classes.

Specified by:
clear in interface JMeterGUIComponent

getIcon

public ImageIcon getIcon()

getMenuCategories

public Collection getMenuCategories()
Description copied from interface: JMeterGUIComponent
This is the list of add menu categories this gui component will be available under. For instance, if this represents a Controller, then the MenuFactory.CONTROLLERS category should be in the returned collection. When a user right-clicks on a tree element and looks through the "add" menu, which category your GUI component shows up in is determined by which categories are returned by this method. Most GUI's belong to only one category, but it is possible for a component to exist in multiple categories.

Specified by:
getMenuCategories in interface JMeterGUIComponent
Returns:
a Collection of Strings, where each element is one of the constants defined in MenuFactory
See Also:
MenuFactory

createPopupMenu

public JPopupMenu createPopupMenu()
Description copied from interface: JMeterGUIComponent
When a user right-clicks on the component in the test tree, or selects the edit menu when the component is selected, the component will be asked to return a JPopupMenu that provides all the options available to the user from this component.

Specified by:
createPopupMenu in interface JMeterGUIComponent
Returns:
a JPopupMenu appropriate for the component.

configure

public void configure(TestElement element)
Description copied from interface: JMeterGUIComponent
The GUI must be able to extract the data from the TestElement and update all GUI fields to represent those data. This method is called to allow JMeter to show the user the GUI that represents the test element's data.

Specified by:
configure in interface JMeterGUIComponent
Parameters:
element - the TestElement to configure

modifyTestElement

public void modifyTestElement(TestElement el)
Modifies a given TestElement to mirror the data in the gui components.

Specified by:
modifyTestElement in interface JMeterGUIComponent
Parameters:
el - the TestElement to modify

createTestElement

public TestElement createTestElement()
Description copied from interface: JMeterGUIComponent
JMeter test components are separated into a model and a GUI representation. The model holds the data and the GUI displays it. The GUI class is responsible for knowing how to create and initialize with data the model class that it knows how to display, and this method is called when new test elements are created.

Specified by:
createTestElement in interface JMeterGUIComponent
Returns:
the Test Element object that the GUI component represents.

getStaticLabel

public String getStaticLabel()
Description copied from interface: JMeterGUIComponent
Get the component's label. This label is used in drop down lists that give the user the option of choosing one type of component in a list of many. It should therefore be a descriptive name for the end user to see. It must be unique to the class.

Specified by:
getStaticLabel in interface JMeterGUIComponent
Returns:
GUI label for the component.

setName

public void setName(String name)
Description copied from interface: JMeterGUIComponent
Sets the name of the JMeter GUI Component. The name of the component is used in the Test Tree as the name of the tree node.

Specified by:
setName in interface JMeterGUIComponent
Parameters:
name - the name of the component

getName

public String getName()
Description copied from interface: JMeterGUIComponent
Gets the name of the JMeter GUI component. The name of the component is used in the Test Tree as the name of the tree node.

Specified by:
getName in interface JMeterGUIComponent
Returns:
the name of the component

setNode

public void setNode(JMeterTreeNode node)
Description copied from interface: JMeterGUIComponent
Sets the tree node which this component is associated with. * @param node the tree node corresponding to this component

Specified by:
setNode in interface JMeterGUIComponent

nameChanged

public void nameChanged()

Apache JMeter
1.9

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