Пример #1
0
  /** After clicking execute button, all data in dialog is saved to GoIOptionsPack */
  public void storeValuesToOptionsPack(QueryOptionsPack opt) {
    // store Length Limit
    opt.setLengthLimit(Integer.parseInt(lengthLimit.getText()));

    // if currentView is selected
    if (currentViewButton.getSelection()) {
      opt.setCurrentView(true);
    }
    // if newView is selected
    else {
      opt.setCurrentView(false);
    }

    if (downstreamButton != null) {
      // if downstream is selected
      if (downstreamButton.getSelection()) {
        opt.setDownstream(true);
        opt.setUpstream(false);
      }
      // if upstream is selected
      else if (upstreamButton.getSelection()) {
        opt.setDownstream(false);
        opt.setUpstream(true);
      }
      // if both is selected
      else {
        opt.setDownstream(true);
        opt.setUpstream(true);
      }
    }

    // store stop distance according to user's selection
    if (shortestPlusKButton != null) {
      opt.setLimitType(!shortestPlusKButton.getSelection());
      opt.setShortestPlusKLimit(Integer.parseInt(shortestPlusK.getText()));
    }

    // if strict is selected.
    if (strictButton != null && strictButton.getSelection()) {
      opt.setStrict(true);
    } else {
      opt.setStrict(false);
    }

    if (sourceST != null) opt.setSourceList(sourceST.getSymbols());
    if (targetST != null) opt.setTargetList(targetST.getSymbols());

    if (forSIF) {
      opt.setSifTypes(selectedTypes);
    }
  }
Пример #2
0
  /**
   * After creating the dialog box, initial values are assigned to the fields with data in opt
   * OptionsPack
   */
  public void setInitialValues(QueryOptionsPack opt) {
    if (main.getPathwayGraph() == null) {
      newViewButton.setSelection(true);
      currentViewButton.setSelection(false);
      currentViewButton.setEnabled(false);
      opt.setCurrentView(false);
    }

    if (opt.isCurrentView()) {
      currentViewButton.setSelection(true);
    } else {
      newViewButton.setSelection(true);
    }

    lengthLimit.setText(String.valueOf(opt.getLengthLimit()));

    if (sourceST != null && opt.getSourceList() != null) {
      sourceST.symbolText.setText(opt.getOneStringSources());
    }
    if (targetST != null && opt.getTargetList() != null) {
      targetST.symbolText.setText(opt.getOneStringTargets());
    }

    if (downstreamButton != null) {
      // Downstream, Upstream or Both

      if (opt.isDownstream() && opt.isUpstream() && bothButton != null) {
        bothButton.setSelection(true);
      } else if (opt.isDownstream()) {
        downstreamButton.setSelection(true);
      } else if (opt.isUpstream()) {
        upstreamButton.setSelection(true);
      }
    }

    if (strictButton != null) {
      // Strict
      if (opt.isStrict()) {
        strictButton.setSelection(true);
      }
    }

    // Set both texts' values

    if (shortestPlusK != null) {
      shortestPlusK.setText(String.valueOf(opt.getShortestPlusKLimit()));
    }

    if (shortestPlusKButton != null) {
      shortestPlusKButton.setSelection(!opt.getLimitType());
    }
  }