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

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


    public static void setCopiedNode(ReportTreeNode node) {
        copiedNode = cloneTreeNode(node);
    }

    public static ReportTreeNode cloneTreeNode(ReportTreeNode node) {
        ReportTreeNode treeNode = (ReportTreeNode) node.clone();
        treeNode.setUserObject(((TestElement) node.getUserObject()).clone());
        cloneChildren(treeNode, node);
        return treeNode;
    }
View Full Code Here


            copiedNodes[i] = cloneTreeNode(nodes[i]);
        }
    }

    public static ReportTreeNode[] cloneTreeNodes(ReportTreeNode nodes[]) {
        ReportTreeNode treeNodes[] = new ReportTreeNode[nodes.length];
        for (int i = 0; i < nodes.length; i++) {
            treeNodes[i] = cloneTreeNode(nodes[i]);
        }
        return treeNodes;
    }
View Full Code Here

    }

    private static void cloneChildren(ReportTreeNode to, ReportTreeNode from) {
        Enumeration enumFrom = from.children();
        while (enumFrom.hasMoreElements()) {
            ReportTreeNode child = (ReportTreeNode) enumFrom.nextElement();
            ReportTreeNode childClone = (ReportTreeNode) child.clone();
            childClone.setUserObject(((TestElement) child.getUserObject())
                    .clone());
            to.add(childClone);
            cloneChildren((ReportTreeNode) to.getLastChild(), child);
        }
    }
View Full Code Here

        }
    }

    protected void addObjectToTree(TestElement el) {
        ReportGuiPackage guiPackage = ReportGuiPackage.getInstance();
        ReportTreeNode node = new ReportTreeNode(el, guiPackage.getTreeModel());
        guiPackage.getTreeModel().insertNodeInto(node,
                guiPackage.getTreeListener().getCurrentNode(),
                guiPackage.getTreeListener().getCurrentNode().getChildCount());
        TestElement curNode =
            (TestElement)guiPackage.getTreeListener().getCurrentNode().getUserObject();
        if (curNode != null) {
            curNode.addTestElement(el);
            guiPackage.getMainFrame().getTree().setSelectionPath(
                    new TreePath(node.getPath()));
        }
    }
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

    /**
     * @see org.apache.jmeter.gui.action.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

    }

    private void convertSubTree(HashTree tree) {
        Iterator iter = new LinkedList(tree.list()).iterator();
        while (iter.hasNext()) {
            ReportTreeNode item = (ReportTreeNode) iter.next();
            convertSubTree(tree.getTree(item));
            TestElement testElement = item.getTestElement();
            tree.replace(item, testElement);
        }
    }
View Full Code Here

        return commands;
    }

    protected void addParentToTree(TestElement newParent) {
        ReportGuiPackage guiPackage = ReportGuiPackage.getInstance();
        ReportTreeNode newNode = new ReportTreeNode(newParent, guiPackage
                .getTreeModel());
        ReportTreeNode currentNode = guiPackage.getTreeListener()
                .getCurrentNode();
        ReportTreeNode parentNode = (ReportTreeNode) currentNode.getParent();
        int index = parentNode.getIndex(currentNode);
        guiPackage.getTreeModel().insertNodeInto(newNode, parentNode, index);
        ReportTreeNode[] nodes = guiPackage.getTreeListener()
                .getSelectedNodes();
        for (int i = 0; i < nodes.length; i++) {
            moveNode(guiPackage, nodes[i], newNode);
View Full Code Here

    }

    private void convertSubTree(HashTree tree) {
        Iterator<Object> iter = new LinkedList<Object>(tree.list()).iterator();
        while (iter.hasNext()) {
            ReportTreeNode item = (ReportTreeNode) iter.next();
            convertSubTree(tree.getTree(item));
            TestElement testElement = item.getTestElement();
            tree.replace(item, testElement);
        }
    }
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.