use of org.apache.jmeter.gui.tree.JMeterTreeNode in project jmeter by apache.
the class UndoHistory method treeNodesChanged.
/**
* Record the changes in the node as the undo step
*
* @param tme {@link TreeModelEvent} with event details
*/
@Override
public void treeNodesChanged(TreeModelEvent tme) {
String name = ((JMeterTreeNode) tme.getTreePath().getLastPathComponent()).getName();
log.debug("Nodes changed {}", name);
final JMeterTreeModel sender = (JMeterTreeModel) tme.getSource();
add(sender, "Node changed " + name);
}
use of org.apache.jmeter.gui.tree.JMeterTreeNode in project jmeter by apache.
the class Clear method doAction.
@Override
public void doAction(ActionEvent e) {
GuiPackage guiPackage = GuiPackage.getInstance();
final String actionCommand = e.getActionCommand();
if (actionCommand.equals(ActionNames.CLEAR)) {
JMeterGUIComponent guiComp = guiPackage.getCurrentGui();
if (guiComp instanceof Clearable) {
((Clearable) guiComp).clearData();
}
} else {
guiPackage.getMainFrame().clearData();
for (JMeterTreeNode node : guiPackage.getTreeModel().getNodesOfType(Clearable.class)) {
JMeterGUIComponent guiComp = guiPackage.getGui(node.getTestElement());
if (guiComp instanceof Clearable) {
Clearable item = (Clearable) guiComp;
try {
item.clearData();
} catch (Exception ex) {
log.error("Can't clear: {} {}", node, guiComp, ex);
}
}
}
}
}
use of org.apache.jmeter.gui.tree.JMeterTreeNode in project jmeter by apache.
the class Copy method cloneChildren.
private static void cloneChildren(JMeterTreeNode to, JMeterTreeNode from) {
Enumeration<?> enumFrom = from.children();
while (enumFrom.hasMoreElements()) {
JMeterTreeNode child = (JMeterTreeNode) enumFrom.nextElement();
JMeterTreeNode childClone = (JMeterTreeNode) child.clone();
childClone.setUserObject(((TestElement) child.getUserObject()).clone());
to.add(childClone);
cloneChildren((JMeterTreeNode) to.getLastChild(), child);
}
}
use of org.apache.jmeter.gui.tree.JMeterTreeNode in project jmeter by apache.
the class Copy method cloneTreeNode.
public static JMeterTreeNode cloneTreeNode(JMeterTreeNode node) {
JMeterTreeNode treeNode = (JMeterTreeNode) node.clone();
treeNode.setUserObject(((TestElement) node.getUserObject()).clone());
cloneChildren(treeNode, node);
return treeNode;
}
use of org.apache.jmeter.gui.tree.JMeterTreeNode in project jmeter by apache.
the class Copy method doAction.
@Override
public void doAction(ActionEvent e) {
JMeterTreeListener treeListener = GuiPackage.getInstance().getTreeListener();
JMeterTreeNode[] nodes = treeListener.getSelectedNodes();
nodes = keepOnlyAncestors(nodes);
nodes = cloneTreeNodes(nodes);
setCopiedNodes(nodes);
}
Aggregations