示例#1
0
  public LessonsComposite() {
    initWidget(uiBinder.createAndBindUi(this));
    setWidth("100%");
    setHeight(Window.getClientHeight() + "px");

    lessonTreeTitle.getElement().getStyle().setFontSize(16, Style.Unit.PX);
    lessonPanel.setLessonsMap(lessonViewNameToWidgetMap);
    getAllTreeLessons();
    initLessonTree();
  }
  private void initData(SessionDataDto sessionData) {
    Label name = new Label("Session #" + sessionData.getSessionId());
    name.setStyleName(JaggerResources.INSTANCE.css().sessionNameHeader());
    add(name);

    Grid summaryGrid = new Grid(6, 2);
    summaryGrid.getElement().getStyle().setProperty("margin", "40px");

    Label sessionLabel = new Label("Session id");
    sessionLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD);
    summaryGrid.setWidget(0, 0, sessionLabel);
    summaryGrid.setWidget(0, 1, new Label(sessionData.getSessionId()));

    Label startTimeLabel = new Label("Session start time");
    startTimeLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD);
    summaryGrid.setWidget(1, 0, startTimeLabel);
    summaryGrid.setWidget(1, 1, new Label(sessionData.getStartDate()));

    Label endTimeLabel = new Label("Session end time");
    endTimeLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD);
    summaryGrid.setWidget(2, 0, endTimeLabel);
    summaryGrid.setWidget(2, 1, new Label(sessionData.getEndDate()));

    Label numberTasksLabel = new Label("Number of tasks");
    numberTasksLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD);
    summaryGrid.setWidget(3, 0, numberTasksLabel);
    summaryGrid.setWidget(3, 1, new Label(Integer.toString(sessionData.getTasksExecuted())));

    Label failuresLabel = new Label("Number of task failures");
    failuresLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD);
    summaryGrid.setWidget(4, 0, failuresLabel);
    summaryGrid.setWidget(4, 1, new Label(Integer.toString(sessionData.getTasksFailed())));

    Label activeKernels = new Label("Number of active kernels");
    activeKernels.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD);
    summaryGrid.setWidget(5, 0, activeKernels);
    summaryGrid.setWidget(5, 1, new Label(Integer.toString(sessionData.getActiveKernelsCount())));

    add(summaryGrid);

    Label testPanelName = new Label("Tests");
    testPanelName.addStyleName(JaggerResources.INSTANCE.css().testNameHeader());
    add(testPanelName);

    add(testPanel);
  }
示例#3
0
  public void testDebugId() {
    DialogBox dBox = new DialogBox();
    dBox.setAnimationEnabled(false);
    dBox.ensureDebugId("myDialogBox");
    dBox.setText("test caption");
    Label content = new Label("content");
    dBox.setWidget(content);
    dBox.show();

    // Check the body ids
    UIObjectTest.assertDebugId("myDialogBox", dBox.getElement());
    UIObjectTest.assertDebugId("myDialogBox-content", DOM.getParent(content.getElement()));

    delayTestFinish(5000);
    // Check the header IDs
    Scheduler.get()
        .scheduleDeferred(
            new ScheduledCommand() {
              public void execute() {
                UIObjectTest.assertDebugIdContents("myDialogBox-caption", "test caption");
                finishTest();
              }
            });
  }
示例#4
0
  private void renderPlots(
      HTMLPanel panel,
      List<PlotSeriesDto> plotSeriesDtoList,
      String id,
      double yMinimum,
      boolean isMetric) {
    panel.add(loadIndicator);

    SimplePlot redrawingPlot = null;

    VerticalPanel plotGroupPanel = new VerticalPanel();
    plotGroupPanel.setWidth("100%");
    plotGroupPanel.getElement().setId(id);

    for (PlotSeriesDto plotSeriesDto : plotSeriesDtoList) {
      Markings markings = null;
      if (plotSeriesDto.getMarkingSeries() != null) {
        markings = new Markings();
        for (MarkingDto plotDatasetDto : plotSeriesDto.getMarkingSeries()) {
          double x = plotDatasetDto.getValue();
          markings.addMarking(
              new Marking()
                  .setX(new Range(x, x))
                  .setLineWidth(1)
                  .setColor(plotDatasetDto.getColor()));
        }

        markingsMap.put(id, new TreeSet<MarkingDto>(plotSeriesDto.getMarkingSeries()));
      }

      final SimplePlot plot =
          createPlot(id, markings, plotSeriesDto.getXAxisLabel(), yMinimum, isMetric);
      redrawingPlot = plot;
      PlotModel plotModel = plot.getModel();

      for (PlotDatasetDto plotDatasetDto : plotSeriesDto.getPlotSeries()) {
        SeriesHandler handler =
            plotModel.addSeries(plotDatasetDto.getLegend(), plotDatasetDto.getColor());

        // Populate plot with data
        for (PointDto pointDto : plotDatasetDto.getPlotData()) {
          handler.add(new DataPoint(pointDto.getX(), pointDto.getY()));
        }
      }

      // Add X axis label
      Label xLabel = new Label(plotSeriesDto.getXAxisLabel());
      xLabel.addStyleName(getResources().css().xAxisLabel());

      Label plotHeader = new Label(plotSeriesDto.getPlotHeader());
      plotHeader.addStyleName(getResources().css().plotHeader());

      Label plotLegend = new Label("PLOT LEGEND");
      plotLegend.addStyleName(getResources().css().plotLegend());

      VerticalPanel vp = new VerticalPanel();
      vp.setWidth("100%");

      Label panLeftLabel = new Label();
      panLeftLabel.addStyleName(getResources().css().panLabel());
      panLeftLabel.getElement().appendChild(new Image(getResources().getArrowLeft()).getElement());
      panLeftLabel.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              plot.pan(new Pan().setLeft(-100));
            }
          });

      Label panRightLabel = new Label();
      panRightLabel.addStyleName(getResources().css().panLabel());
      panRightLabel
          .getElement()
          .appendChild(new Image(getResources().getArrowRight()).getElement());
      panRightLabel.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              plot.pan(new Pan().setLeft(100));
            }
          });

      Label zoomInLabel = new Label("Zoom In");
      zoomInLabel.addStyleName(getResources().css().zoomLabel());
      zoomInLabel.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              plot.zoom();
            }
          });

      Label zoomOutLabel = new Label("Zoom Out");
      zoomOutLabel.addStyleName(getResources().css().zoomLabel());
      zoomOutLabel.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              plot.zoomOut();
            }
          });

      FlowPanel zoomPanel = new FlowPanel();
      zoomPanel.addStyleName(getResources().css().zoomPanel());
      zoomPanel.add(panLeftLabel);
      zoomPanel.add(panRightLabel);
      zoomPanel.add(zoomInLabel);
      zoomPanel.add(zoomOutLabel);

      vp.add(plotHeader);
      vp.add(zoomPanel);
      vp.add(plot);
      vp.add(xLabel);
      // Will be added if there is need it
      // vp.add(plotLegend);

      plotGroupPanel.add(vp);
    }
    int loadingId = panel.getWidgetCount() - 1;
    panel.remove(loadingId);
    panel.add(plotGroupPanel);

    // Redraw plot
    if (redrawingPlot != null) {
      redrawingPlot.redraw();
    }
  }