Package com.qspin.qtaste.ui.tools

Examples of com.qspin.qtaste.ui.tools.JTreeNode


        if (parentDir.equals(directory))
            return true;

        Object[] childNodes = parent.getChildren();
        for (int i=0; i < childNodes.length; i++) {
            JTreeNode child = (JTreeNode)childNodes[i];
            String childDir = child.getId();
            if (childDir.equals(directory))
                return true;
            if (child.getChildren().length>0) {
                boolean returnValue = isTestSuite(child, directory);
                if (returnValue) return returnValue;
            }
        }
        return false;
View Full Code Here


       
    }
    public boolean checkIfParentAdded(File directory) {
        File parentDir = directory.getParentFile();
        if (parentDir==null) return false;
        JTreeNode parentNode = this.getTestSuite(directory.getPath().replace("\\", "/"));
        if (parentNode!=null) return true;
        // recursive through parents
        return checkIfParentAdded(parentDir);
    }
View Full Code Here

    public void removeIfChildAdded(String directory) {
        // build the childrent of this new parent
        FileNode parentNode = new FileNode(new File(directory), directory,TESTUITE_DIR);
        Object[] childNodes = parentNode.getChildren();
        for (int i=0 ; i < childNodes.length; i++) {
            JTreeNode childNode = (JTreeNode)childNodes[i];
            // now check in the already added nodes if it is already added
            //
            TCTreeNode rootNode = (TCTreeNode)this.getRoot();
            Enumeration<?> childRootNodes  = rootNode.children();
            while (childRootNodes.hasMoreElements()) {
                TCTreeNode childRootNode = (TCTreeNode)childRootNodes.nextElement();
                JTreeNode childFileRootNode = (JTreeNode)childRootNode.getUserObject();
                if (childFileRootNode.getId().equals(childNode.getId()))
                {
                    this.removeNodeFromParent(childRootNode);
                }
            }
            if (childNode.getChildren().length>0) {
View Full Code Here

        //logger.trace("Adding '" + directory + "'" + " directory into the test campaign");
        TCTreeNode rootNode = (TCTreeNode)this.getRoot();
        Enumeration<?> childNodes = rootNode.children();
        while (childNodes.hasMoreElements()){
            TCTreeNode childNode = (TCTreeNode)childNodes.nextElement();
            JTreeNode child = (JTreeNode)childNode.getUserObject();
            if (isTestSuite(child, directory)) {
                //logger.trace(directory + "'" + " already defined in the current test campaign, so skip it");
                return getTestSuite(directory);
            }
        }   
View Full Code Here

    }
    public void saveSelectedTestSuites(CampaignWriter writer, JTreeNode parentNode, String testbedName)  {
        // navigate through children
        Object[] children = parentNode.getChildren();
        for (int i=0; i<children.length; i++) {
            JTreeNode childFileNode = (JTreeNode)children[i];
            TristateCheckBox.State state = this.getNodeState(childFileNode, testbedName);
            if (state == TristateCheckBox.SELECTED) {
                if (childFileNode instanceof TestDataNode) {
                     for (int childIndex=0; childIndex < children.length; childIndex++) {
                         TestDataNode dataNode = (TestDataNode)children[childIndex];
                         if (getNodeState(dataNode, testbedName) == TristateCheckBox.SELECTED) {
                           writer.addCampaign(testbedName, parentNode.getFile().getPath().replace("\\", "/"), dataNode.getRowIndex());
                         }
                     }
                     // quit the loop because testdata already added and so children are testdata
                     break;
                }
                else
                {
                  writer.addCampaign(testbedName, childFileNode.getFile().getPath().replace("\\", "/"));
                }
            }
             if (state == TristateCheckBox.DONT_CARE) {
                 // check its children
                 //if children are testdata add specific node
                 Object[] childChildren = childFileNode.getChildren();
                 if (childChildren.length>0) {
                     // check if it's datarow
                     JTreeNode childDataNode = (JTreeNode)childChildren[0];
                     if (childDataNode instanceof TestDataNode) {
                         for (int childIndex=0; childIndex < childChildren.length; childIndex++) {
                             TestDataNode dataNode = (TestDataNode)childChildren[childIndex];
                             if (getNodeState(dataNode, testbedName) == TristateCheckBox.SELECTED)
                             {
View Full Code Here

        for (int i = 1; i < this.getColumnCount(); i++) {
            String testbedName = this.getColumnName(i);
            Enumeration<?> enumRootNodeChildren = rootNode.children();
            while (enumRootNodeChildren.hasMoreElements()) {
                TCTreeNode childNode = (TCTreeNode) enumRootNodeChildren.nextElement();
                JTreeNode childFileNode = (JTreeNode) childNode.getUserObject();
                TristateCheckBox.State state = this.getNodeState(childFileNode, testbedName);
                if (state == TristateCheckBox.SELECTED) {
                  campaignWriter.addCampaign(testbedName, childFileNode.getFile().getPath().replace("\\", "/"));
                } else {
                    saveSelectedTestSuites(campaignWriter, childFileNode, testbedName);
                }
            }
        }           
View Full Code Here

                        testsuite = nodeList.item(testSuiteIndex).getAttributes().getNamedItem("directory").getNodeValue();
                        testsuite = testsuite.replace("\\", "/");
                        String dirToAdd = testsuite;
                        if (testsuite.contains("/" ))
                            dirToAdd = testsuite.split("\\/")[0]+ "/" + testsuite.split("\\/")[1];
                        JTreeNode addedNode = addTestSuite(dirToAdd);
                        for (int i=0; i<this.getColumnCount(); i++) {
                            if (this.getColumnName(i).equals(testbed)) {
                                FileNode fileNode = new FileNode(new File(testsuite), testsuite,TESTUITE_DIR);
                                // check if there is testdata or not
                                NodeList childList = nodeList.item(testSuiteIndex).getChildNodes();
View Full Code Here

        }
       
    }
    public void removeTestSuiteFromModel(TCTreeNode node) {
        if (node.getUserObject() instanceof JTreeNode) {
            JTreeNode fileNode = (JTreeNode)node.getUserObject();
            metaCampaignSelectionList.remove(fileNode.getId());
        }
        Enumeration<?> childNodesArray = node.children();
        ArrayList<TreeNode> childNodes = new ArrayList<TreeNode>();
        int[] indices = new int[node.getChildCount()];
        int index=0;
        while (childNodesArray.hasMoreElements()) {
            TCTreeNode childNode = (TCTreeNode)childNodesArray.nextElement();
            indices[index]=index;
            childNodes.add(childNode);
            index++;
            if (childNode.getUserObject() instanceof JTreeNode) {
                JTreeNode childFileNode = (JTreeNode)childNode.getUserObject();               
                metaCampaignSelectionList.remove(childFileNode.getId());           
            }
            removeTestSuiteFromModel(childNode);
        }
    }
View Full Code Here

        }
    }

    public void removeTestSuite(TCTreeNode node) {
        if (node.getUserObject() instanceof JTreeNode) {
            JTreeNode fileNode = (JTreeNode)node.getUserObject();
            metaCampaignSelectionList.remove(fileNode.getId());
        }
        Enumeration<?> childNodesArray = node.children();
        ArrayList<TreeNode> childNodes = new ArrayList<TreeNode>();
        int[] indices = new int[node.getChildCount()];
        int index=0;
        while (childNodesArray.hasMoreElements()) {
            TCTreeNode childNode = (TCTreeNode)childNodesArray.nextElement();
            indices[index]=index;
            childNodes.add(childNode);
            index++;
            if (childNode.getUserObject() instanceof JTreeNode) {
                JTreeNode childFileNode = (JTreeNode)childNode.getUserObject();               
                metaCampaignSelectionList.remove(childFileNode.getId());           
            }
            removeTestSuiteFromModel(childNode);
        }
        node.removeAllChildren();       
        this.fireTreeNodesRemoved(this, this.getPathToRoot(node), indices, childNodes.toArray());
View Full Code Here

TOP

Related Classes of com.qspin.qtaste.ui.tools.JTreeNode

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.