コード例 #1
0
ファイル: DetailsView.java プロジェクト: karrim/karrim
 @Override
 public void setInSlot(Object slot, IsWidget content) {
   if (slot == DetailsPresenter.IMAGE) {
     img.clear();
     img.add(content);
   }
 }
コード例 #2
0
ファイル: DetailsView.java プロジェクト: karrim/karrim
 @Override
 public void show(Detail detail) {
   ImageResource res = detail.imageResource();
   if (res.getWidth() > IMG_MAX_WIDTH || res.getHeight() > IMG_MAX_HEIGHT) {
     setInSlot(
         DetailsPresenter.IMAGE,
         new FitImage(res.getSafeUri().asString(), IMG_MAX_WIDTH, IMG_MAX_HEIGHT));
   } else {
     setInSlot(DetailsPresenter.IMAGE, new Image(res));
   }
   main.clear();
   main.add(detail.main());
   side.clear();
   side.add(detail.side());
   title.setText(detail.title());
 }
コード例 #3
0
ファイル: Trends.java プロジェクト: Gorbush/jagger
  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();
      }
    }
  }
コード例 #4
0
ファイル: Trends.java プロジェクト: Gorbush/jagger
 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;
   }
 }
コード例 #5
0
ファイル: Trends.java プロジェクト: Gorbush/jagger
  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();
    }
  }
コード例 #6
0
ファイル: Trends.java プロジェクト: Gorbush/jagger
 private boolean isMaxPlotCountReached() {
   return plotPanel.getWidgetCount() >= MAX_PLOT_COUNT;
 }
コード例 #7
0
  public SimpleParamsEditorPanel(
      final ServiceAsync serviceAsync,
      final HidesPageContentsWhileLoading contentsHiding,
      Map<String, ClientUser> userInfo) {
    this.serviceAsync = serviceAsync;
    this.userInfo = userInfo;
    selectionController = new ParamSetSelectionController(serviceAsync);
    selectionController.setContentsHiding(contentsHiding);
    validationController = new ValidationController(serviceAsync, selectionController);
    validationController.setContentsHiding(contentsHiding);
    editorElements = new ArrayList();

    contentsHiding.hidePageContentsWhileLoading();
    serviceAsync.login(
        "",
        "",
        new AsyncCallback<Boolean>() { // TODO: real login

          public void onFailure(Throwable caught) {
            contentsHiding.showPageContents();
            handleGlobalError(caught);
          }

          public void onSuccess(Boolean result) {
            contentsHiding.showPageContentsAfterLoad();
          }
        });

    HorizontalPanel hp = new HorizontalPanel();
    RootPanel paramsSelectorPanel = RootPanel.get("paramsSelector");
    paramsSelectorPanel.add(hp);

    selector = new ParamsSelector();
    selectionController.setSelector(selector);
    selectionController.refresh();
    hp.add(selector);

    // save buttons //////////////////////////////////////////////////////////
    PushButton button;
    hp.add(saveButton = new PushButton("Save..."));
    saveButton.addStyleName(ACTION_LINK);
    saveButton.addStyleName(SPACE_AFTER);
    saveButton.addClickListener(
        new ClickListener() {
          public void onClick(Widget widget) {
            save();
          }
        });
    saveButton.setVisible(editorVisible);
    buttons.add(saveButton);

    hp.add(button = new PushButton("Preview..."));
    button.addStyleName(ACTION_LINK);
    button.addStyleName(SPACE_AFTER);
    button.addClickListener(
        new ClickListener() {
          public void onClick(Widget widget) {
            preview();
          }
        });
    buttons.add(button);

    hp.add(deleteButton = new PushButton("Delete..."));
    deleteButton.addStyleName(ACTION_LINK);
    deleteButton.addStyleName(SPACE_AFTER);
    deleteButton.addClickListener(
        new ClickListener() {
          public void onClick(Widget widget) {
            delete();
          }
        });
    buttons.add(deleteButton);

    // description, initially hidden /////////////////////////////////////////////

    HTMLPanel description;
    paramsSelectorPanel.add(
        description = new HTMLPanel("<I>This is a description of the ParameterSet.</I>"));
    description.setSize("500px", "50px");
    description.setStyleName("dottedBorder");
    description.setVisible(false);

    /// Existing DOM //////////////////////////////////////////////////////////////
    // Grab the existing DOM for the parameter rows.

    ExistingDOMPanel edp = new ExistingDOMPanel("paramRow");

    /// database ///////////////////////////////////////////
    {
      ExistingDOMPanel dbrow = new ExistingDOMPanel("paramDbRow");
      Label label = new Label("Database:");
      label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
      label.setStyleName(PARAMS_LABEL);
      editorElements.add(dbrow.append("database", "paramDbLabel", label, editorVisible));

      final ValidationPanel vp = new ValidationPanel(2);

      dlb = new DatabaseListBox("sequence.database", userInfo);

      final HorizontalPanel p = new HorizontalPanel();

      p.add(dlb);
      // dlb.setStyleName("spaceAfter");
      PushButton pb = new PushButton("Add or Review Database...");
      pb.addStyleName(ACTION_LINK);
      pb.setTitle(
          "Click here to review the selected database and potentially modify it for your own needs.");
      pb.addClickListener(
          new ClickListener() {
            public void onClick(Widget widget) {
              popupDbCurator();
            }
          });
      validationController.add(dlb, "sequence.database", vp);
      p.add(pb);

      // Add undeployer link if enabled.
      serviceAsync.isDatabaseUndeployerEnabled(
          new AsyncCallback<Boolean>() {

            public void onFailure(Throwable caught) {
              // Do nothing, do not add undeploy link.
              throw new RuntimeException(
                  "Can not determine if database undeployer is enabled", caught);
            }

            public void onSuccess(Boolean result) {
              if (result.booleanValue()) {
                PushButton du = new PushButton("Undeploy Database");
                du.addStyleName(ACTION_LINK);
                du.setTitle("Click here to undeploy database from search engines.");
                du.addClickListener(new DatabaseUndeploymentAction(serviceAsync, dlb));
                p.add(du);
              }
            }
          });

      editorElements.add(dbrow.append("database", "paramDbEntry", p, editorVisible));

      editorElements.add(dbrow.append("database", "paramDbValidation", vp, editorVisible));
    }

    /// enzyme /////////////////////////////////////////////

    {
      Label label = new Label("Protease:");
      label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
      label.setStyleName(PARAMS_LABEL);
      editorElements.add(edp.append("enzyme", LABEL1, label, editorVisible));

      ValidationPanel vp = new ValidationPanel(2);

      ProteaseListBox tb;
      validationController.add(tb = new ProteaseListBox("sequence.enzyme"), "sequence.enzyme", vp);

      editorElements.add(edp.append("enzyme", ENTRY1, tb, editorVisible));

      Label label1 = new Label("Missed Cleavages:");
      label1.setStyleName(PARAMS_LABEL);
      label1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
      ValidatableTextBox tdb =
          new ValidatableTextBox("sequence.missed_cleavages") {
            protected ClientValue getValueFromString(String value) {
              if ((value == null) || (value.length() == 0)) {
                return null;
              }
              try {
                return new ClientInteger(value);
              } catch (NumberFormatException ignore) {
                ClientValidationList list = new ClientValidationList();
                final ClientValidation cv =
                    new ClientValidation(
                        "Not a number: " + value,
                        "sequence.missed_cleavages",
                        ClientValidation.SEVERITY_ERROR);
                list.add(cv);
                validationController.update("sequence.missed_cleavages", list);
                return null;
              }
            }

            protected String setValueAsString(ClientValue object) {
              return object.toString();
            }

            public void setAllowedValues(List<? extends ClientValue> values) {
              // unused.
            }

            public String getAllowedValuesParam() {
              return null; // no allowed values.
            }
          };
      tdb.setVisibleLength(5);
      editorElements.add(edp.append("enzyme", LABEL2, label1, editorVisible));
      editorElements.add(edp.append("enzyme", ENTRY2, tdb, editorVisible));
      validationController.add(tdb, "sequence.missed_cleavages", vp);

      editorElements.add(edp.append("enzyme", VALIDATION, vp, editorVisible));
    }

    /// modifications /////////////////////////////////////////

    {
      ValidationPanel vp = new ValidationPanel(2);

      Label label = new Label("Fixed Modifications:");
      label.setStyleName(PARAMS_LABEL);
      label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
      editorElements.add(edp.append(MODIFICATIONS, LABEL1, label, editorVisible));

      // fixed mods label
      fixedMods =
          new ModificationsLabel(
              ModificationSelectionEditor.FIXED_PARAM_NAME,
              ModificationSelectionEditor.FIXED_PARAM_NAME);
      ModificationSelectionEditor fixedModsEditor =
          new ModificationSelectionEditor(
              ModificationSelectionEditor.FIXED_PARAM_NAME,
              ModificationSelectionEditor.FIXED_MOD_TYPE);
      fixedMods.setEditor(fixedModsEditor);
      validationController.add(fixedMods, ModificationSelectionEditor.FIXED_PARAM_NAME, vp);

      editorElements.add(edp.append(MODIFICATIONS, ENTRY1, fixedMods, editorVisible));

      // variable mods label
      varMods =
          new ModificationsLabel(
              ModificationSelectionEditor.VARIABLE_PARAM_NAME,
              ModificationSelectionEditor.VARIABLE_PARAM_NAME);
      ModificationSelectionEditor varModsEditor =
          new ModificationSelectionEditor(
              ModificationSelectionEditor.VARIABLE_PARAM_NAME,
              ModificationSelectionEditor.VARIABLE_MOD_TYPE);
      varMods.setEditor(varModsEditor);
      validationController.add(varMods, ModificationSelectionEditor.VARIABLE_PARAM_NAME, vp);

      Label label1 = new Label("Variable Modifications:");
      label1.setStyleName(PARAMS_LABEL);
      label1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
      editorElements.add(edp.append(MODIFICATIONS, LABEL2, label1, editorVisible));

      editorElements.add(edp.append(MODIFICATIONS, ENTRY2, varMods, editorVisible));

      editorElements.add(edp.append(MODIFICATIONS, VALIDATION, vp, editorVisible));
    }

    /// tolerances /////////////////////////////////////////

    {
      Label label = new Label("Peptide Tolerance:");
      label.setStyleName(PARAMS_LABEL);
      label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
      editorElements.add(edp.append(TOLERANCES, LABEL1, label, editorVisible));

      ValidationPanel vp = new ValidationPanel(2);

      ToleranceBox peptideTolerance;
      validationController.add(
          peptideTolerance = new ToleranceBox("tolerance.peptide"), "tolerance.peptide", vp);
      editorElements.add(edp.append(TOLERANCES, ENTRY1, peptideTolerance, editorVisible));

      Label label1 = new Label("Fragment Tolerance:");
      editorElements.add(edp.append(TOLERANCES, LABEL2, label1, editorVisible));
      label1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
      label1.setStyleName(PARAMS_LABEL);

      ToleranceBox fragmentTolerance;
      validationController.add(
          fragmentTolerance = new ToleranceBox("tolerance.fragment"), "tolerance.fragment", vp);
      editorElements.add(edp.append(TOLERANCES, ENTRY2, fragmentTolerance, editorVisible));

      editorElements.add(edp.append(TOLERANCES, VALIDATION, vp, editorVisible));
    }

    /// instrument /////////////////////////////////////////
    ValidationPanel instrumentVp;
    {
      Label label = new Label("Instrument:");
      editorElements.add(edp.append(INSTRUMENT, LABEL1, label, editorVisible));
      label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
      label.setStyleName(PARAMS_LABEL);
      instrumentVp = new ValidationPanel(2);
      InstrumentListBox lb;
      validationController.add(lb = new InstrumentListBox(INSTRUMENT), INSTRUMENT, instrumentVp);
      editorElements.add(edp.append(INSTRUMENT, ENTRY1, lb, editorVisible));
      editorElements.add(edp.append(INSTRUMENT, VALIDATION, instrumentVp, editorVisible));
    }

    /// spectrum extraction params /////////////////////////////////////////
    {
      Label label = new Label("Spectrum extraction:");
      editorElements.add(edp.append(INSTRUMENT, LABEL2, label, editorVisible));
      label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
      label.setStyleName(PARAMS_LABEL);
      SpectrumExtractionEditor ed = new SpectrumExtractionEditor();
      validationController.add(ed, "extractMsnSettings", instrumentVp);
      editorElements.add(edp.append(INSTRUMENT, ENTRY2, ed, editorVisible));
    }

    /// scaffold params /////////////////////////////////////////
    {
      ExistingDOMPanel row = new ExistingDOMPanel("scaffoldRow");

      Label label = new Label("Scaffold:");
      editorElements.add(row.append(SCAFFOLD_SETTINGS, "scaffoldLabel", label, editorVisible));
      label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
      label.setStyleName(PARAMS_LABEL);
      ValidationPanel vp = new ValidationPanel(2);
      ScaffoldSettingsEditor ed = new ScaffoldSettingsEditor();
      validationController.add(ed, SCAFFOLD_SETTINGS, vp);
      editorElements.add(row.append(SCAFFOLD_SETTINGS, "scaffoldEntry", ed, editorVisible));
      editorElements.add(row.append(SCAFFOLD_SETTINGS, "scaffoldValidation", vp, editorVisible));
    }

    validationController.setEnabled(false);
    selectionController.refresh();

    validationController.addChangeListener(
        new ChangeListener() {
          public void onChange(Widget widget) {
            for (PushButton button : buttons) {
              button.setEnabled(isValid());
            }
          }
        });
  }