Esempio n. 1
0
    /**
     * Respond to a popup trigger event.
     *
     * @param e the event we're responding to
     */
    @SuppressWarnings("serial")
    private void popupTriggered(MouseEvent e) {
      Cross cross = this.getCross();

      JPopupMenu popupMenu = new JPopupMenu(cross.toString());
      popupMenu.add(new ShowCrossSummaryAction(cross));
      popupMenu.add(new RunJittermapAction(cross));
      popupMenu.addSeparator();
      popupMenu.add(
          new SafeDeleteAction(
              this.getCross().toString(), e.getComponent(), QTL.getInstance().getDesktop()) {
            /** {@inheritDoc} */
            @Override
            public void delete() {
              CrossTreeNode.this.delete();
            }
          });

      popupMenu.show((Component) e.getSource(), e.getX(), e.getY());
    }
Esempio 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);
  }
Esempio 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);
  }
Esempio 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);
  }