Exemplo n.º 1
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);
    }
Exemplo n.º 2
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();
    }
Exemplo n.º 3
0
    @Override
    public void onSelectionChange(SelectionChangeEvent event) {

      Set<PlotNameDto> selected =
          ((MultiSelectionModel<PlotNameDto>) event.getSource()).getSelectedSet();

      if (selected.isEmpty()) {
        // Remove plots from display which were unchecked
        removeUncheckedPlots(Collections.EMPTY_SET);
      } else {
        // Generate all id of plots which should be displayed
        Set<String> selectedTaskIds = generateTaskPlotIds(selected, chosenSessions.size());

        // Remove plots from display which were unchecked
        removeUncheckedPlots(selectedTaskIds);

        PlotProviderService.Async.getInstance()
            .getPlotDatas(
                selected,
                new AsyncCallback<Map<PlotNameDto, List<PlotSeriesDto>>>() {

                  @Override
                  public void onFailure(Throwable caught) {
                    caught.printStackTrace();
                  }

                  @Override
                  public void onSuccess(Map<PlotNameDto, List<PlotSeriesDto>> result) {
                    for (PlotNameDto plotNameDto : result.keySet()) {
                      if (isMaxPlotCountReached()) {
                        Window.alert("You are reached max count of plot on display");
                        break;
                      }

                      final String id;
                      // Generate DOM id for plot
                      if (chosenSessions.size() == 1) {
                        id = generateTaskScopePlotId(plotNameDto);
                      } else {
                        id = generateCrossSessionsTaskScopePlotId(plotNameDto);
                      }

                      // If plot has already displayed, then pass it
                      if (chosenPlots.containsKey(id)) {
                        continue;
                      }

                      chosenPlots.put(id, result.get(plotNameDto));
                    }
                    if (mainTabPanel.getSelectedIndex() == 2) {
                      onMetricsTabSelected();
                    }
                  }
                });
      }
    }
Exemplo n.º 4
0
    @Override
    public void onSelectionChange(SelectionChangeEvent event) {
      // Currently selection model for sessions is a single selection model
      Set<SessionDataDto> selected =
          ((MultiSelectionModel<SessionDataDto>) event.getSource()).getSelectedSet();

      // Refresh summary
      chosenMetrics.clear();
      chosenPlots.clear();
      summaryPanel.updateSessions(selected);
      // Clear plots display
      plotPanel.clear();
      plotTrendsPanel.clear();
      // Clear markings dto map
      markingsMap.clear();
      testDataGrid.setRowData(Collections.EMPTY_LIST);
      chosenSessions.clear();
      sessionPlotPanel.clearPlots();

      if (selected.isEmpty()) {
        ((MultiSelectionModel) testDataGrid.getSelectionModel()).clear();
        return;
      }

      final Set<String> sessionIds = new HashSet<String>();
      for (SessionDataDto sessionDataDto : selected) {
        sessionIds.add(sessionDataDto.getSessionId());
        chosenSessions.add(sessionDataDto.getSessionId());
      }
      Collections.sort(
          chosenSessions,
          new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
              return (Long.parseLong(o2) - Long.parseLong(o1)) > 0 ? 0 : 1;
            }
          });

      TaskDataService.Async.getInstance()
          .getTaskDataForSessions(
              sessionIds,
              new AsyncCallback<List<TaskDataDto>>() {
                @Override
                public void onFailure(Throwable caught) {
                  caught.printStackTrace();
                }

                @Override
                public void onSuccess(List<TaskDataDto> result) {
                  updateTests(result);
                }
              });
    }
Exemplo n.º 5
0
    private void makeSelectionForMetricPanel(
        Set<MetricNameDto> metricTempSet, MetricPanel metricPanel, List<TaskDataDto> result) {

      if (!metricTempSet.isEmpty()) {
        for (MetricNameDto metricName : metricTempSet) {
          for (TaskDataDto mN : result) {
            if (metricName.getTests().getTaskName().equals(mN.getTaskName())) {
              metricPanel.setSelected(new MetricNameDto(mN, metricName.getName()));
            }
          }
        }
      }
    }
Exemplo n.º 6
0
 private void makeSelectionForTaskDetailsTree(
     Set<PlotNameDto> plotTempSet,
     SelectionModel<PlotNameDto> plotNameSelectionModel,
     List<TaskDataDto> result) {
   if (!plotTempSet.isEmpty()) {
     for (PlotNameDto plotName : plotTempSet) {
       for (TaskDataDto td : result) {
         if (plotName.getTest().getTaskName().equals(td.getTaskName())) {
           plotNameSelectionModel.setSelected(new PlotNameDto(td, plotName.getPlotName()), true);
         }
       }
     }
   }
 }
Exemplo n.º 7
0
  private void filterSessions(Set<SessionDataDto> sessionDataDtoSet) {
    if (sessionDataDtoSet == null || sessionDataDtoSet.isEmpty()) {
      sessionIdsTextBox.setText(null);
      stopTypingSessionIdsTimer.schedule(10);

      return;
    }

    final StringBuilder builder = new StringBuilder();
    boolean first = true;
    for (SessionDataDto sessionDataDto : sessionDataDtoSet) {
      if (!first) {
        builder.append("/");
      }
      builder.append(sessionDataDto.getSessionId());
      first = false;
    }
    sessionIdsTextBox.setText(builder.toString());
    stopTypingSessionIdsTimer.schedule(10);
  }
Exemplo n.º 8
0
    @Override
    public void onSelectionChange(SelectionChangeEvent event) {

      hasChanged = true;
      if (summaryPanel.getSessionComparisonPanel() == null) {
        plotTrendsPanel.clear();
        chosenMetrics.clear();
        return;
      }
      Set<MetricNameDto> metrics =
          ((MultiSelectionModel<MetricNameDto>) event.getSource()).getSelectedSet();

      if (metrics.isEmpty()) {
        // Remove plots from display which were unchecked
        chosenMetrics.clear();
        plotTrendsPanel.clear();
        summaryPanel.getSessionComparisonPanel().clearTreeStore();
      } else {

        final ArrayList<MetricNameDto> notLoaded = new ArrayList<MetricNameDto>();
        final ArrayList<MetricDto> loaded = new ArrayList<MetricDto>();

        for (MetricNameDto metricName : metrics) {
          if (!summaryPanel.getCachedMetrics().containsKey(metricName)) {
            notLoaded.add(metricName);
          } else {
            MetricDto metric = summaryPanel.getCachedMetrics().get(metricName);

            // if we have not checked it on previous selection, but already cached it some time
            if (!chosenMetrics.values().contains(metric)) {
              summaryPanel.getSessionComparisonPanel().addMetricRecord(metric);
            }

            loaded.add(metric);
          }
        }

        // Generate all id of plots which should be displayed
        Set<String> selectedMetricsIds = new HashSet<String>();
        for (MetricNameDto plotNameDto : metrics) {
          selectedMetricsIds.add(generateMetricPlotId(plotNameDto));
        }

        List<MetricDto> toRemoveFromTable = new ArrayList<MetricDto>();
        // Remove plots from display which were unchecked
        Set<String> metricIdsSet = new HashSet<String>(chosenMetrics.keySet());
        for (String plotId : metricIdsSet) {
          if (!selectedMetricsIds.contains(plotId)) {
            toRemoveFromTable.add(chosenMetrics.get(plotId));
            chosenMetrics.remove(plotId);
          }
        }
        metricIdsSet = chosenMetrics.keySet();
        List<Widget> toRemove = new ArrayList<Widget>();
        for (int i = 0; i < plotTrendsPanel.getWidgetCount(); i++) {
          Widget widget = plotTrendsPanel.getWidget(i);
          String wId = widget.getElement().getId();
          if (!metricIdsSet.contains(wId)) {
            toRemove.add(widget);
          }
        }
        for (Widget widget : toRemove) {
          plotTrendsPanel.remove(widget);
        }
        summaryPanel.getSessionComparisonPanel().removeRecords(toRemoveFromTable);

        MetricDataService.Async.getInstance()
            .getMetrics(
                notLoaded,
                new AsyncCallback<List<MetricDto>>() {
                  @Override
                  public void onFailure(Throwable caught) {
                    caught.printStackTrace();
                  }

                  @Override
                  public void onSuccess(List<MetricDto> result) {
                    loaded.addAll(result);
                    MetricRankingProvider.sortMetrics(loaded);

                    summaryPanel.getSessionComparisonPanel().addMetricRecords(result);

                    renderMetricPlots(loaded);
                  }
                });
      }
    }