Exemple #1
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();
                    }
                  }
                });
      }
    }
Exemple #2
0
    private void updateTests(List<TaskDataDto> tests) {

      MultiSelectionModel<TaskDataDto> model =
          (MultiSelectionModel) testDataGrid.getSelectionModel();
      previousSelectedSet.addAll(model.getSelectedSet());

      model.clear();
      testDataGrid.redraw();
      testDataGrid.setRowData(tests);

      if (chosenSessions.size() == 1) {
        metricPanel.getSelectionModel().clear();
        final boolean selectTestsFinal = selectTests;
        final String sessionId = chosenSessions.get(0);
        PlotProviderService.Async.getInstance()
            .getSessionScopePlotList(
                sessionId,
                new AsyncCallback<Set<String>>() {
                  @Override
                  public void onFailure(Throwable throwable) {
                    throwable.printStackTrace();
                  }

                  @Override
                  public void onSuccess(Set<String> plotNames) {
                    sessionPlotPanel.update(sessionId, plotNames);
                    if (!selectTestsFinal) {
                      sessionPlotPanel.setSelected(place.getSessionTrends());
                    }
                    sessionPlotPanel
                        .getSelectionModel()
                        .addSelectionChangeHandler(new SessionScopePlotSelectionChangedHandler());
                    SelectionChangeEvent.fire(sessionPlotPanel.getSelectionModel());
                  }
                });
      }
      makeSelectionOnTaskDataGrid(model, tests);
    }