Exemple #1
0
    private void makeSelectionOnTaskDataGrid(
        MultiSelectionModel<TaskDataDto> model, List<TaskDataDto> tests) {

      if (selectTests) {
        if (!previousSelectedSet.isEmpty()) {
          for (TaskDataDto taskDataDto : tests) {
            for (TaskDataDto taskDataPrevious : previousSelectedSet) {
              if (taskDataDto.getTaskName().equals(taskDataPrevious.getTaskName())) {
                model.setSelected(taskDataDto, true);
              }
            }
          }
          SelectionChangeEvent.fire(testDataGrid.getSelectionModel());
        }

      } else {
        Set<TestsMetrics> testsMetrics = place.getSelectedTestsMetrics();
        for (TaskDataDto taskDataDto : tests) {
          for (TestsMetrics testMetric : testsMetrics) {
            if (testMetric.getTestName().equals(taskDataDto.getTaskName())) {
              model.setSelected(taskDataDto, true);
            }
          }
        }
        model.addSelectionChangeHandler(new TestSelectChangeHandler());

        SelectionChangeEvent.fire(model);
      }
      previousSelectedSet.clear();
    }
Exemple #2
0
    private void ifItWasLink(
        List<TaskDataDto> result,
        MetricPanel metricPanel,
        TaskDataTreeViewModel taskDataTreeViewModel) {

      Set<MetricNameDto> metricsToSelect = new HashSet<MetricNameDto>();
      Set<PlotNameDto> trendsToSelect = new HashSet<PlotNameDto>();

      for (TaskDataDto taskDataDto : result) {
        for (TestsMetrics testMetric : place.getSelectedTestsMetrics()) {
          if (testMetric.getTestName().equals(taskDataDto.getTaskName())) {
            // add metrics
            for (String metricName : testMetric.getMetrics()) {
              MetricNameDto meticDto = new MetricNameDto();
              meticDto.setName(metricName);
              meticDto.setTests(taskDataDto);
              metricsToSelect.add(meticDto);
            }

            // add plots
            for (String trendsName : testMetric.getTrends()) {
              PlotNameDto plotNameDto = new PlotNameDto(taskDataDto, trendsName);
              trendsToSelect.add(plotNameDto);
            }
          }
        }
      }

      MetricNameDto fireMetric = null;
      if (!metricsToSelect.isEmpty()) fireMetric = metricsToSelect.iterator().next();

      for (MetricNameDto metric : metricsToSelect) {
        metricPanel.setSelected(metric);
      }
      metricPanel.addSelectionListener(new MetricsSelectionChangedHandler());

      if (fireMetric != null) metricPanel.setSelected(fireMetric);

      PlotNameDto firePlot = null;
      if (!trendsToSelect.isEmpty()) firePlot = trendsToSelect.iterator().next();

      for (PlotNameDto plotNameDto : trendsToSelect) {
        taskDataTreeViewModel.getSelectionModel().setSelected(plotNameDto, true);
      }
      taskDataTreeViewModel
          .getSelectionModel()
          .addSelectionChangeHandler(new TaskPlotSelectionChangedHandler());

      if (firePlot != null) taskDataTreeViewModel.getSelectionModel().setSelected(firePlot, true);
    }