Package com.qspin.qtaste.ui.testcampaign

Examples of com.qspin.qtaste.ui.testcampaign.TestCampaignTreeModel


          TreePath[] selectedPaths = tree.getSelectionPaths();
          for (TreePath selectedPath : selectedPaths) {
              TCTreeNode node = (TCTreeNode) selectedPath.getLastPathComponent();
              //
              //remove it from the model
              TestCampaignTreeModel model = (TestCampaignTreeModel) tree.getModel();
              model.removeTestSuite(node);
          }
      }
    }
View Full Code Here


                                    } else {
                                        TableColumn col = JTreeTable.this.getColumnModel().getColumn(JTreeTable.this.convertColumnIndexToView(colIndex));
                                        JTreeTable.this.getColumnModel().removeColumn(col);
                                        // remove it from the model
                                      if (tree.getModel() instanceof TestCampaignTreeModel) {
                                        TestCampaignTreeModel model = (TestCampaignTreeModel) tree.getModel();
                                        model.removeTestbed(colName);
                                      }

                                    }
                                    break;
View Full Code Here

    }

    public void displayNecessaryColumns() {
        //
        if (tree.getModel() instanceof TestCampaignTreeModel) {
            TestCampaignTreeModel model = (TestCampaignTreeModel) tree.getModel();
            TCTreeNode rootNode = (TCTreeNode) model.getRoot();
            int colcount = this.getColumnCount();
            for (int viewColIndex = 1; viewColIndex < colcount; viewColIndex++) {
                this.removeColumn(getColumnModel().getColumn(1));
            }
            for (int i = 1; i < getModel().getColumnCount(); i++) {
                TristateCheckBox.State state = (TristateCheckBox.State) model.getValueAt(rootNode, i);
                if (state != TristateCheckBox.NOT_SELECTED) {
                    // add the column
                    this.addColumn(new TableColumn(i));
                }
            }
View Full Code Here

        expandSelected(rootNode);
    }

    public void expandSelected(TCTreeNode node) {
      if (tree.getModel() instanceof TestCampaignTreeModel) {
          TestCampaignTreeModel model = (TestCampaignTreeModel) tree.getModel();
          Enumeration<?> children = node.children();
          while (children.hasMoreElements()) {
              TCTreeNode childNode = (TCTreeNode) children.nextElement();
              for (int i = 1; i < model.getColumnCount(); i++) {
                  TristateCheckBox.State state = (TristateCheckBox.State) model.getValueAt(childNode, i);
                  if (state == TristateCheckBox.DONT_CARE) {
                      TreeNode[] nodes = childNode.getPath();
                      TreePath treepath = new TreePath(nodes);
                      tree.expandPath(treepath);
                  }
View Full Code Here

      }
    }

    public void updateParentCells(int childRow, int col) {
      if (tree.getModel() instanceof TestCampaignTreeModel) {
          TestCampaignTreeModel model = (TestCampaignTreeModel) tree.getModel();
          // retrieve Treepath associated to the child row
          TreePath treePath = tree.getPathForRow(childRow);
          // get its node
          TCTreeNode node = (TCTreeNode) treePath.getLastPathComponent();
          // only applicable if the child is a JTreeNode (otherwise there is no parent (rootNode)
          if (node.getUserObject() instanceof JTreeNode) {
              String testbedName = model.getColumnName(col);
              model.updateParent((JTreeNode) node.getUserObject(), testbedName);
          }
      }
    }
View Full Code Here

          }
      }
    }

    public void removeAll() {
        TestCampaignTreeModel model = (TestCampaignTreeModel) tree.getModel();
        model.removeAll();
        // remove also testbeds
        for (int colIndex = 1; colIndex < this.getModel().getColumnCount(); colIndex++) {
            String colName = this.getModel().getColumnName(colIndex);
            if (this.convertColumnIndexToView(colIndex) == -1) {
                continue;
            }
            TableColumn col = this.getColumnModel().getColumn(this.convertColumnIndexToView(colIndex));
            this.getColumnModel().removeColumn(col);
            // remove it from the model
            model.removeTestbed(colName);
        }
    }
View Full Code Here

        return hasChanged;
    }

    public void save(String fileName, String campaignName) {
      if (tree.getModel() instanceof TestCampaignTreeModel) {
          TestCampaignTreeModel model = (TestCampaignTreeModel) tree.getModel();
          model.save(fileName, campaignName);
          hasChanged = false;
          displayNecessaryColumns();
      }
    }
View Full Code Here

    }

    public void load(String fileName) {
        try {
          if (tree.getModel() instanceof TestCampaignTreeModel) {
              TestCampaignTreeModel model = (TestCampaignTreeModel) tree.getModel();
              model.load(fileName);
              hasChanged = false;
              displayNecessaryColumns();
              expandSelected();
          }
        } catch (Exception ex) {
View Full Code Here

        }
    }

    public void updateChildCells(TreePath treePath, int col) {
      if (tree.getModel() instanceof TestCampaignTreeModel) {
          TestCampaignTreeModel model = (TestCampaignTreeModel) tree.getModel();
          // get the node associated to the treepath
          TCTreeNode node = (TCTreeNode) treePath.getLastPathComponent();
          JTreeNode fNode = null;
          // retrieve userObject only if based on a JTreeNode
          if (node.getUserObject() instanceof FileNode || node.getUserObject() instanceof TestDataNode) {
              fNode = (JTreeNode) node.getUserObject();
          }
          int childCount = node.getChildCount();
          if (fNode != null) {
              childCount = fNode.getChildren().length;
          } // it can be different is user didn't expand the tree view


          String testbedName = model.getColumnName(col);
          if (fNode != null) {
              model.updateChild(fNode, testbedName);
              return;
          } else {
              // update child from root
              for (int i = 0; i < childCount; i++) {
                  TCTreeNode childNode = (TCTreeNode) node.getChildAt(i);
                  JTreeNode childFileNode = (JTreeNode) childNode.getUserObject();
                  // set the value to child from its parent
                  TristateCheckBox.State rootState = model.getNodeState(node.toString(), testbedName);
                  model.setNodeState(childFileNode, testbedName, rootState);
                  model.updateChild(childFileNode, testbedName);
              }
          }
      }
    }
View Full Code Here

TOP

Related Classes of com.qspin.qtaste.ui.testcampaign.TestCampaignTreeModel

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.