Esempio n. 1
0
  /**
   * Add the a recording to the selected sample starting in the first event year and ending in the
   * last year of the sample.
   *
   * @param recording
   */
  public static void addRecordingFromBeginningToEnd() {

    if (SampleController.getSelectedSampleIndex() > -1) {
      FHX2_Recording newRecording = new FHX2_Recording();
      FHX2_Sample selectedSample =
          IOController.getFile()
              .getRequiredPart()
              .getSample(SampleController.getSelectedSampleIndex());

      int firstyear = selectedSample.getSampleFirstYear();
      int lastyear = selectedSample.getSampleLastYear();

      // Handle year 0
      if (firstyear == 0) firstyear++;
      if (lastyear == 0) lastyear--;

      newRecording.setStartYear(firstyear);
      newRecording.setEndYear(lastyear);

      selectedSample.addRecording(newRecording);
    }
    SampleController.setSelectedSampleIndex(SampleController.getSelectedSampleIndex());
  }