예제 #1
0
파일: Trends.java 프로젝트: Gorbush/jagger
    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();
    }
예제 #2
0
파일: Trends.java 프로젝트: Gorbush/jagger
    @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();
                    }
                  }
                });
      }
    }
예제 #3
0
파일: Trends.java 프로젝트: Gorbush/jagger
    @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);
                }
              });
    }
예제 #4
0
파일: Trends.java 프로젝트: Gorbush/jagger
    @Override
    public void onSelectionChange(SelectionChangeEvent event) {

      Set<TaskDataDto> selected =
          ((MultiSelectionModel<TaskDataDto>) event.getSource()).getSelectedSet();
      List<TaskDataDto> result = new ArrayList<TaskDataDto>(selected);

      TaskDataTreeViewModel taskDataTreeViewModel =
          (TaskDataTreeViewModel) taskDetailsTree.getTreeViewModel();
      MultiSelectionModel<PlotNameDto> plotNameSelectionModel =
          taskDataTreeViewModel.getSelectionModel();

      // chosen plots
      Set<PlotNameDto> plotTempSet = plotNameSelectionModel.getSelectedSet();
      // chosen metrics
      Set<MetricNameDto> metricTempSet = metricPanel.getSelected();

      chosenPlots.clear();
      // Clear markings dto map
      markingsMap.clear();
      taskDataTreeViewModel.clear();
      plotNameSelectionModel.clear();
      metricPanel.updateTests(result);
      taskDataTreeViewModel.populateTaskList(result);
      // Populate available plots tree level for each task for selected session
      for (TaskDataDto taskDataDto : result) {
        taskDataTreeViewModel
            .getPlotNameDataProviders()
            .put(
                taskDataDto,
                new TaskPlotNamesAsyncDataProvider(taskDataDto, summaryPanel.getSessionIds()));
      }
      summaryPanel.updateTests(result);

      if (selectTests) {
        makeSelectionForMetricPanel(metricTempSet, metricPanel, result);
        makeSelectionForTaskDetailsTree(plotTempSet, plotNameSelectionModel, result);
      } else {
        selectTests = true;
        ifItWasLink(result, metricPanel, taskDataTreeViewModel);
      }

      metricTempSet.clear();
      plotTempSet.clear();
    }
예제 #5
0
파일: Trends.java 프로젝트: Gorbush/jagger
    @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);
                  }
                });
      }
    }