Ejemplo n.º 1
0
  /** refresh all of the cross nodes */
  private void refreshCrossNodes() {
    ProjectTreeNode projectNode = (ProjectTreeNode) this.getModel().getRoot();
    QtlProject project = projectNode.getProject();

    QtlDataModel dataModel = project.getDataModel();

    // remove tree nodes not in the QTL data model
    for (int crossNodeIndex = projectNode.getChildCount() - 1;
        crossNodeIndex >= 0;
        crossNodeIndex--) {
      CrossTreeNode currCrossNode = (CrossTreeNode) projectNode.getChildAt(crossNodeIndex);
      boolean crossInDataModel =
          dataModel
              .getCrossMap()
              .containsKey(currCrossNode.getCross().getAccessorExpressionString());
      if (!crossInDataModel) {
        this.getModel().removeNodeFromParent(currCrossNode);
      }
    }

    // add nodes that are missing (refresh existing)
    for (Cross currCross : dataModel.getCrossMap().values()) {
      int indexOfCross = SwingTreeUtilities.indexOfChildWithUserObject(projectNode, currCross);

      CrossTreeNode currCrossNode;
      if (indexOfCross == -1) {
        // append the cross to the end of the project node
        currCrossNode = new CrossTreeNode(currCross);
        this.getModel().insertNodeInto(currCrossNode, projectNode, projectNode.getChildCount());
        this.getModel()
            .insertNodeInto(
                currCrossNode.getScanOneFolderNode(), currCrossNode, currCrossNode.getChildCount());
        this.getModel()
            .insertNodeInto(
                currCrossNode.getScanTwoFolderNode(), currCrossNode, currCrossNode.getChildCount());
        this.getModel()
            .insertNodeInto(
                currCrossNode.getQtlBasketFolderNode(),
                currCrossNode,
                currCrossNode.getChildCount());
        this.getModel()
            .insertNodeInto(
                currCrossNode.getFitResultsFolderNode(),
                currCrossNode,
                currCrossNode.getChildCount());
        this.expandPath(new TreePath(currCrossNode.getPath()));
      } else {
        currCrossNode = (CrossTreeNode) projectNode.getChildAt(indexOfCross);
      }

      this.refreshCross(currCrossNode);
    }

    this.getModel().nodeChanged(projectNode);
  }
Ejemplo n.º 2
0
  /**
   * Refresh the given qtl basket folder
   *
   * @param qtlBasketFolderNode the qtl basket folder
   */
  private void refreshQtlBasketFolder(QtlBasketFolderNode qtlBasketFolderNode) {
    Cross cross = qtlBasketFolderNode.getCross();
    Map<String, QtlBasket> qtlBasketMap = cross.getQtlBasketMap();
    boolean anyNewNodes = false;

    // remove tree nodes that are no longer in the cross
    synchronized (qtlBasketMap) {
      for (int crossChildIndex = qtlBasketFolderNode.getChildCount() - 1;
          crossChildIndex >= 0;
          crossChildIndex--) {
        TreeNode currCrossChild = qtlBasketFolderNode.getChildAt(crossChildIndex);
        if (currCrossChild instanceof QtlBasketNode) {
          QtlBasketNode currQtlBasketNode = (QtlBasketNode) currCrossChild;
          if (!qtlBasketMap.containsKey(currQtlBasketNode.getQtlBasket().getName())) {
            // the basket node needs to be removed
            this.getModel().removeNodeFromParent(currQtlBasketNode);
          }
        }
      }

      // add the child nodes that are missing from the tree
      for (QtlBasket currQtlBasket : qtlBasketMap.values()) {
        int indexOfBasket =
            SwingTreeUtilities.indexOfChildWithUserObject(qtlBasketFolderNode, currQtlBasket);
        if (indexOfBasket == -1) {
          QtlBasketNode newQtlBasketNode = new QtlBasketNode(currQtlBasket);
          this.getModel()
              .insertNodeInto(
                  newQtlBasketNode, qtlBasketFolderNode, qtlBasketFolderNode.getChildCount());
          anyNewNodes = true;
        }
      }
    }

    if (anyNewNodes) {
      this.expandPath(new TreePath(qtlBasketFolderNode.getPath()));
    }

    this.getModel().nodeChanged(qtlBasketFolderNode);
  }
Ejemplo n.º 3
0
  private void refreshFitResultsFolder(FitResultsFolderNode fitResultsFolder) {
    Cross cross = fitResultsFolder.getCross();
    Set<FitQtlResult> fitQtlResults = cross.getFitQtlResults();

    // remove tree nodes that are no longer in the cross
    for (int crossChildIndex = fitResultsFolder.getChildCount() - 1;
        crossChildIndex >= 0;
        crossChildIndex--) {
      TreeNode currCrossChild = fitResultsFolder.getChildAt(crossChildIndex);
      if (currCrossChild instanceof FitResultsTreeNode) {
        FitResultsTreeNode currFitResultsTreeNode = (FitResultsTreeNode) currCrossChild;
        if (!fitQtlResults.contains(currFitResultsTreeNode.getFitQtlResult())) {
          // the fit node needs to be removed
          this.getModel().removeNodeFromParent(currFitResultsTreeNode);
        }
      }
    }

    // add the child nodes that are missing from the tree
    boolean anyNewNodes = false;
    for (FitQtlResult currFitQtlResult : fitQtlResults) {
      int indexOfFitResult =
          SwingTreeUtilities.indexOfChildWithUserObject(fitResultsFolder, currFitQtlResult);
      if (indexOfFitResult == -1) {
        FitResultsTreeNode newFitTreeNode = new FitResultsTreeNode(currFitQtlResult);
        this.getModel()
            .insertNodeInto(newFitTreeNode, fitResultsFolder, fitResultsFolder.getChildCount());
        anyNewNodes = true;
      }
    }

    if (anyNewNodes) {
      this.expandPath(new TreePath(fitResultsFolder.getPath()));
    }

    this.getModel().nodeChanged(fitResultsFolder);
  }
Ejemplo n.º 4
0
  /**
   * Refresh the scan one folder for a cross
   *
   * @param scanTwoFolder the folder that we're refreshing
   */
  private void refreshScanTwoFolder(ScanTwoFolderNode scanTwoFolder) {
    Cross cross = scanTwoFolder.getCross();
    Set<ScanTwoResult> scanTwoResults = cross.getScanTwoResults();

    // remove tree nodes that are no longer in the cross
    for (int crossChildIndex = scanTwoFolder.getChildCount() - 1;
        crossChildIndex >= 0;
        crossChildIndex--) {
      TreeNode currCrossChild = scanTwoFolder.getChildAt(crossChildIndex);
      if (currCrossChild instanceof ScanTwoTreeNode) {
        ScanTwoTreeNode currScanTwoNode = (ScanTwoTreeNode) currCrossChild;
        if (!scanTwoResults.contains(currScanTwoNode.getScanTwoResult())) {
          // the scan one node needs to be removed
          this.getModel().removeNodeFromParent(currScanTwoNode);
        }
      }
    }

    // add the child nodes that are missing from the tree
    boolean anyNewNodes = false;
    for (ScanTwoResult currScanTwoResult : scanTwoResults) {
      int indexOfScanResult =
          SwingTreeUtilities.indexOfChildWithUserObject(scanTwoFolder, currScanTwoResult);
      if (indexOfScanResult == -1) {
        ScanTwoTreeNode newScanTwoNode = new ScanTwoTreeNode(currScanTwoResult);
        this.getModel()
            .insertNodeInto(newScanTwoNode, scanTwoFolder, scanTwoFolder.getChildCount());
        anyNewNodes = true;
      }
    }

    if (anyNewNodes) {
      this.expandPath(new TreePath(scanTwoFolder.getPath()));
    }

    this.getModel().nodeChanged(scanTwoFolder);
  }