Package org.apache.jmeter.report.gui.tree

Examples of org.apache.jmeter.report.gui.tree.ReportTreeNode


   * The tree traverses itself depth-first, calling processNode for each
   * object it encounters as it goes.
   */
  public void addNode(Object node, HashTree subTree) {
    log.debug("Node is class:" + node.getClass());
    ReportTreeNode treeNode = (ReportTreeNode) node;
    if (checkMode) {
      if (previousGuiItems.containsKey(treeNode)) {
        if (!previousGuiItems.get(treeNode).equals(treeNode.getTestElement())) {
          dirty = true;
        }
      } else {
        dirty = true;
      }
    } else if (removeMode) {
      previousGuiItems.remove(treeNode);
    } else {
      previousGuiItems.put(treeNode, treeNode.getTestElement().clone());
    }
  }
View Full Code Here


  /**
   * @see Command#doAction(ActionEvent)
   */
  public void doAction(ActionEvent e) {
    ReportTreeNode draggedNodes[] = ReportCopy.getCopiedNodes();
    ReportTreeListener treeListener = ReportGuiPackage.getInstance().getTreeListener();
    ReportTreeNode currentNode = treeListener.getCurrentNode();
    if (ReportDragNDrop.canAddTo(currentNode)) {
      for (int i = 0; i < draggedNodes.length; i++) {
        if (draggedNodes[i] != null) {
          ReportGuiPackage.getInstance().getTreeModel().insertNodeInto(draggedNodes[i], currentNode,
              currentNode.getChildCount());
        }
      }
    }
    ReportGuiPackage.getInstance().getMainFrame().repaint();
  }
View Full Code Here

  public void doAction(ActionEvent e) {
    String action = e.getActionCommand();
    ReportGuiPackage guiPackage = ReportGuiPackage.getInstance();
    ReportTreeNode[] draggedNodes = guiPackage.getTreeListener().getDraggedNodes();
    ReportTreeListener treeListener = guiPackage.getTreeListener();
    ReportTreeNode currentNode = treeListener.getCurrentNode();
    ReportTreeNode parentNode = (ReportTreeNode) currentNode.getParent();
    TestElement te = currentNode.getTestElement();
    if (te instanceof TestPlan || te instanceof WorkBench) {
      parentNode = null; // So elements can only be added as children
    }
    // System.out.println(action+" "+te.getClass().getName());

    if (ADD.equals(action) && canAddTo(currentNode)) {
      removeNodesFromParents(draggedNodes);
      for (int i = 0; i < draggedNodes.length; i++) {
        ReportGuiPackage.getInstance().getTreeModel().insertNodeInto(draggedNodes[i], currentNode,
            currentNode.getChildCount());
      }
    } else if (INSERT_BEFORE.equals(action) && canAddTo(parentNode)) {
      removeNodesFromParents(draggedNodes);
      for (int i = 0; i < draggedNodes.length; i++) {
        int index = parentNode.getIndex(currentNode);
        ReportGuiPackage.getInstance().getTreeModel().insertNodeInto(draggedNodes[i], parentNode, index);
      }
    } else if (INSERT_AFTER.equals(action) && canAddTo(parentNode)) {
      removeNodesFromParents(draggedNodes);
      for (int i = 0; i < draggedNodes.length; i++) {
        int index = parentNode.getIndex(currentNode) + 1;
        ReportGuiPackage.getInstance().getTreeModel().insertNodeInto(draggedNodes[i], parentNode, index);
      }
    }
    ReportGuiPackage.getInstance().getMainFrame().repaint();
  }
View Full Code Here

   * The tree traverses itself depth-first, calling processNode for each
   * object it encounters as it goes.
   */
  public void addNode(Object node, HashTree subTree) {
    log.debug("Node is class:" + node.getClass());
    ReportTreeNode treeNode = (ReportTreeNode) node;
    if (checkMode) {
      if (previousGuiItems.containsKey(treeNode)) {
        if (!previousGuiItems.get(treeNode).equals(treeNode.getTestElement())) {
          dirty = true;
        }
      } else {
        dirty = true;
      }
    } else if (removeMode) {
      previousGuiItems.remove(treeNode);
    } else {
      previousGuiItems.put(treeNode, treeNode.getTestElement().clone());
    }
  }
View Full Code Here

* @version $Revision: 493793 $
*/
public class ReportTreeModel extends DefaultTreeModel {

  public ReportTreeModel() {
    super(new ReportTreeNode(new ReportGui().createTestElement(), null));
    initTree();
  }
View Full Code Here

    JMeterGUIComponent guicomp = ReportGuiPackage.getInstance().getGui(component);
    guicomp.configure(component);
    guicomp.modifyTestElement(component);
    ReportGuiPackage.getInstance().getCurrentGui(); // put the gui object back
    // to the way it was.
    ReportTreeNode newNode = new ReportTreeNode(component, this);

    // This check the state of the TestElement and if returns false it
    // disable the loaded node
    try {
      if (component.getProperty(TestElement.ENABLED) instanceof NullProperty
          || component.getPropertyAsBoolean(TestElement.ENABLED)) {
        newNode.setEnabled(true);
      } else {
        newNode.setEnabled(false);
      }
    } catch (Exception e) {
      newNode.setEnabled(true);
    }

    this.insertNodeInto(newNode, node, node.getChildCount());
    return newNode;
  }
View Full Code Here

    if (type.isInstance(node.getUserObject())) {
      nodeList.add(node);
    }
    Enumeration enumNode = node.children();
    while (enumNode.hasMoreElements()) {
      ReportTreeNode child = (ReportTreeNode) enumNode.nextElement();
      traverseAndFind(type, child, nodeList);
    }
  }
View Full Code Here

    if (userObject == node.getUserObject()) {
      return node;
    }
    Enumeration enumNode = node.children();
    while (enumNode.hasMoreElements()) {
      ReportTreeNode child = (ReportTreeNode) enumNode.nextElement();
      ReportTreeNode result = traverseAndFind(userObject, child);
      if (result != null)
        return result;
    }
    return null;
  }
View Full Code Here

  public HashTree getCurrentSubTree(ReportTreeNode node) {
    ListedHashTree hashTree = new ListedHashTree(node);
    Enumeration enumNode = node.children();
    while (enumNode.hasMoreElements()) {
      ReportTreeNode child = (ReportTreeNode) enumNode.nextElement();
      hashTree.add(node, getCurrentSubTree(child));
    }
    return hashTree;
  }
View Full Code Here

    initTree();
  }

  private void initTree() {
    TestElement rp = new ReportGui().createTestElement();
    this.insertNodeInto(new ReportTreeNode(rp, this),
        (ReportTreeNode) getRoot(), 0);
  }
View Full Code Here

TOP

Related Classes of org.apache.jmeter.report.gui.tree.ReportTreeNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.