Example #1
0
 private void chooseTab(String token) {
   if (NameTokens.SUMMARY.equals(token)) {
     mainTabPanel.selectTab(0);
   } else if (NameTokens.TRENDS.equals(token)) {
     mainTabPanel.selectTab(1);
   } else {
     mainTabPanel.selectTab(2);
   }
 }
Example #2
0
  private void onMetricsTabSelected() {

    testsMetricsPanel.showWidget(1);
    mainTabPanel.forceLayout();
    for (String plotId : chosenPlots.keySet()) {
      if (plotPanel.getElementById(plotId) == null) {
        renderPlots(plotPanel, chosenPlots.get(plotId), plotId);
        scrollPanelMetrics.scrollToBottom();
      }
    }
  }
Example #3
0
 private void onTrendsTabSelected() {
   testsMetricsPanel.showWidget(0);
   mainTabPanel.forceLayout();
   if (!chosenMetrics.isEmpty() && hasChanged) {
     plotTrendsPanel.clear();
     for (Map.Entry<String, MetricDto> entry : chosenMetrics.entrySet()) {
       renderPlots(
           plotTrendsPanel,
           Arrays.asList(entry.getValue().getPlotSeriesDto()),
           entry.getKey(),
           entry.getValue().getPlotSeriesDto().getYAxisMin(),
           true);
     }
     scrollPanelTrends.scrollToBottom();
     hasChanged = false;
   }
 }
Example #4
0
 private void setupTabPanel() {
   mainTabPanel.addSelectionHandler(
       new SelectionHandler<Integer>() {
         @Override
         public void onSelection(SelectionEvent<Integer> event) {
           int selected = event.getSelectedItem();
           switch (selected) {
             case 0:
               onSummaryTabSelected();
               break;
             case 1:
               onTrendsTabSelected();
               break;
             case 2:
               onMetricsTabSelected();
             default:
           }
         }
       });
 }
Example #5
0
 private void onSummaryTabSelected() {
   mainTabPanel.forceLayout();
   testsMetricsPanel.showWidget(0);
   // to make columns fit 100% width if grid created not on Summary Tab
   summaryPanel.getSessionComparisonPanel().refresh();
 }
Example #6
0
  @UiHandler("getHyperlink")
  void getHyperlink(ClickEvent event) {
    MultiSelectionModel<SessionDataDto> sessionModel =
        (MultiSelectionModel) sessionsDataGrid.getSelectionModel();
    MultiSelectionModel<TaskDataDto> testModel =
        (MultiSelectionModel) testDataGrid.getSelectionModel();

    Set<SessionDataDto> sessions = sessionModel.getSelectedSet();

    Set<TaskDataDto> tests = testModel.getSelectedSet();

    Set<MetricNameDto> metrics = metricPanel.getSelected();

    TaskDataTreeViewModel taskDataTreeViewModel =
        (TaskDataTreeViewModel) taskDetailsTree.getTreeViewModel();
    Set<PlotNameDto> trends = taskDataTreeViewModel.getSelectionModel().getSelectedSet();

    HashSet<String> sessionsIds = new HashSet<String>();
    HashSet<TestsMetrics> testsMetricses = new HashSet<TestsMetrics>(tests.size());
    HashMap<String, TestsMetrics> map = new HashMap<String, TestsMetrics>(tests.size());

    for (SessionDataDto session : sessions) {
      sessionsIds.add(session.getSessionId());
    }

    for (TaskDataDto taskDataDto : tests) {
      TestsMetrics testsMetrics =
          new TestsMetrics(taskDataDto.getTaskName(), new HashSet<String>(), new HashSet<String>());
      testsMetricses.add(testsMetrics);
      map.put(taskDataDto.getTaskName(), testsMetrics);
    }

    for (MetricNameDto metricNameDto : metrics) {
      map.get(metricNameDto.getTests().getTaskName()).getMetrics().add(metricNameDto.getName());
    }

    for (PlotNameDto plotNameDto : trends) {
      map.get(plotNameDto.getTest().getTaskName()).getTrends().add(plotNameDto.getPlotName());
    }

    TrendsPlace newPlace =
        new TrendsPlace(
            mainTabPanel.getSelectedIndex() == 0
                ? NameTokens.SUMMARY
                : mainTabPanel.getSelectedIndex() == 1 ? NameTokens.TRENDS : NameTokens.METRICS);

    newPlace.setSelectedSessionIds(sessionsIds);
    newPlace.setSelectedTestsMetrics(testsMetricses);
    newPlace.setSessionTrends(sessionPlotPanel.getSelected());

    String linkText =
        Window.Location.getHost()
            + Window.Location.getPath()
            + Window.Location.getQueryString()
            + "#"
            + new JaggerPlaceHistoryMapper().getToken(newPlace);
    linkText = URL.encode(linkText);

    // create a dialog for copy link
    final DialogBox dialog = new DialogBox(false, true);
    dialog.setText("Share link");
    dialog.setModal(true);
    dialog.setAutoHideEnabled(true);
    dialog.setPopupPosition(event.getClientX(), event.getClientY());

    final TextArea textArea = new TextArea();
    textArea.setText(linkText);
    textArea.setWidth("300px");
    textArea.setHeight("40px");
    // select text
    Scheduler.get()
        .scheduleDeferred(
            new Scheduler.ScheduledCommand() {
              @Override
              public void execute() {
                textArea.setVisible(true);
                textArea.setFocus(true);
                textArea.selectAll();
              }
            });

    dialog.add(textArea);

    dialog.show();
  }