示例#1
0
  @Override
  protected void onAttach() {
    super.onAttach();
    Image img =
        new Image(
            getBaseImageUrl()
                + "?merchant_id="
                + getMerchantId()
                + "&w="
                + getWidth()
                + "&h="
                + getHeight()
                + "&style="
                + getStyle()
                + "&variant="
                + getVariant()
                + "&loc="
                + getLoc());
    img.setTitle("Fast checkout through Google");

    PushButton pb = new PushButton(img);
    pb.addClickHandler(this);
    vpanel.clear();
    vpanel.add(pb);
  }
示例#2
0
 private void initRunButton() {
   // Run Button ////////////////////////////////////////////
   runButton = new PushButton();
   RootPanel.get("runButton").add(runButton);
   runButton.setEnabled(false);
   runButton.addClickHandler(new RunClickHandler());
 }
示例#3
0
  /**
   * Builds a toolbar button.
   *
   * @param imageResource the button's icon
   * @param title the button's tooltip text
   * @param command the command to execute
   * @return a toolbar button
   */
  private Widget buildButton(ImageResource imageResource, String title, final Command command) {

    final PushButton btn = new PushButton(new Image(imageResource));
    btn.setTitle(title);
    btn.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            btn.setFocus(false);
            btn.removeStyleName("gwt-ToggleButton-up-hovering");
            command.execute();
          }
        });
    buttons.add(btn);
    return btn;
  }
示例#4
0
 private void initAddFilesButton() {
   // Add files button produces a dialog
   addFileButton =
       new PushButton(
           "",
           new ClickHandler() {
             @Override
             public void onClick(final ClickEvent event) {
               final int clientWidth = Window.getClientWidth();
               final int clientHeight = Window.getClientHeight();
               final int popupWidth = clientWidth * 3 / 4;
               final int popupHeight = clientHeight * 3 / 4;
               final int posX = (clientWidth - popupWidth) / 2;
               final int posY = (clientHeight - popupHeight) / 2;
               final FileTreeDialog dialog = new FileTreeDialog(popupWidth, popupHeight);
               dialog.setPopupPosition(posX, posY);
               dialog.setSelectedFilesListener(
                   new SelectedFilesListener() {
                     @Override
                     public void selectedFiles(final FileInfo[] info) {
                       files.addFiles(info);
                     }
                   });
               dialog.show();
             }
           });
   addFileButton.setEnabled(false);
   RootPanel.get("addFileButton").add(addFileButton);
 }
示例#5
0
  @AfterClass
  public static void finish() {
    final Component content = Application.getContent().getTestArea();
    content.removeAll();
    final Column column = new Column();
    column.add(get());
    // The following rows are used to test the Z-index behaviour
    Row d1row = new Row();
    dateField2 = new DateField();
    dateField2.setDateFormat("dd.MM.yyyy");
    dateField2.setFirstDayOfWeek(1);
    dateField2.setInputWidth(new Extent(8, Extent.EM));
    dateField2.setShowWeeks(true);
    d1row.add(dateField2);
    d1row.add(new Label("The following rows are used to test the Z-index behaviour"));
    column.add(d1row);
    Row d2row = new Row();
    dateField3 = new DateField();
    dateField3.setDate(new Date());
    d2row.add(dateField3);
    d2row.add(new Label("Field initialised with date"));
    column.add(d2row);
    column.add(new SelectField());

    Row d3row = new Row();
    PushButton pButton = new PushButton("Get Date value from second date field");
    d3row.add(pButton);
    pButton.addActionListener(
        new ActionListener() {
          private static final long serialVersionUID = 1l;

          public void actionPerformed(final ActionEvent event) {
            Date myDate = dateField2.getDate();
            if (myDate != null) {
              dateLabel.setText(myDate.toLocaleString());
            } else {
              dateLabel.setText("Date value is null");
            }
          }
        });
    dateLabel = new Label();
    d3row.add(dateLabel);

    column.add(d3row);

    content.add(column);
  }
  /**
   * The actual function that does the grunt work of making the editor visible if it is expanded,
   * and hiding it when it is not. Tests whether the editor was visible previously and changes
   * visibility only if there was a change.
   *
   * @param editorVisible Whether the editor should be made visible.
   * @param errorMessageVisible Whether the editor error message should be made visible instead of
   *     the editor.
   */
  private void setEditorVisible(boolean editorVisible, boolean errorMessageVisible) {
    if (this.editorVisible != editorVisible) {
      saveButton.setVisible(editorVisible && this.editorEnabled);
      for (Element e : editorElements) {
        DOM.setStyleAttribute(e, "display", editorVisible ? "" : "none");
      }
      if (editorVisible) {
        // We are becoming visible. We load list of fixed/variable mods so the controls are ready
        // when the user needs them
        if (fixedMods.getAllowedValues() == null || fixedMods.getAllowedValues().size() == 0) {
          loadModificationAllowedValues();
        }
      }
    }
    this.editorVisible = editorVisible;

    if (this.editorErrorMessageVisible != errorMessageVisible) {
      DOM.setStyleAttribute(
          DOM.getElementById("parameterEditorDisabledMessage"),
          "display",
          errorMessageVisible ? "" : "none");
    }
    this.editorErrorMessageVisible = errorMessageVisible;
  }
  protected void refreshPatternBar() {
    patternBar.removeAllComponents();

    final Collection<NType> allPatterns = app.getTypes(null);

    patternBar.setColumns(patternColumns);
    patternBar.setRows((int) Math.ceil(allPatterns.size() / patternColumns));

    // 1. add all non-present patterns to 'patternMenu'
    for (final NType pattern : allPatterns) {
      String pName = pattern.getName();

      final PushButton pButton =
          new PushButton(pName, detail.getTypes().contains(pattern)) {

            @Override
            public void setPushed(boolean b) {
              super.setPushed(b);
              if (isPushed()) {
                addNewPattern(pattern.getId());
              } else {
                removePattern(pattern.getId());
              }
            }
          };
      pButton.setWidth("100%");
      pButton.setHeight("100%");
      // pButton.setIcon(new ThemeResource(pattern.getIconURL()));

      patternBar.addComponent(pButton);
    }
    //        patternMenu.addSeparator();
    //        patternMenu.addItem("New Pattern...", new Command() {
    //
    //            @Override
    //            public void menuSelected(MenuItem selectedItem) {
    //                createNewPattern();
    //            }
    //        });

    //        //2. add all present patterns to 'patternBar' as menus
    //        for (final String p : presentPatterns) {
    //            Pattern pattern = schema.getPatterns().get(p);
    //            int total = getPropertiesTotal(pattern);
    //            MenuItem i = patternBar.addItem(pattern.getName() + " (" + (total -
    // getPropertiesNotPresent(pattern)) + "/" + total + ")", null, null);
    //
    //            for (String property : pattern.keySet()) {
    //                if (supportsAnotherProperty(property)) {
    //                    final Property pr = schema.getProperty(property);
    //                    i.addItem(pr.getName(), new Command() {
    //
    //                        @Override
    //                        public void menuSelected(MenuItem selectedItem) {
    //                            addProperty(pr.getID());
    //                        }
    //                    });
    //                }
    //            }
    //
    //            i.addSeparator();
    //
    //            //move left (more important)
    //            //move right (less important)
    //
    //            i.addItem("Remove", new Command() {
    //
    //                @Override
    //                public void menuSelected(MenuItem selectedItem) {
    //                    removePattern(p);
    //                }
    //            });
    //        }
  }
示例#8
0
  /**
   * Prepares the widgets from the items as A FORM FOR SETTINGS
   *
   * @param items
   */
  public void prepareSettings(final ArrayList<ApplicationFormItem> items) {

    // refresh table events
    final JsonCallbackEvents refreshEvents =
        new JsonCallbackEvents() {
          public void onFinished(JavaScriptObject jso) {
            prepareSettings(items);
          }
        };

    FlexTable ft = new FlexTable();
    ft.addStyleName("borderTable");
    ft.setWidth("100%");
    ft.setCellPadding(8);
    FlexCellFormatter fcf = ft.getFlexCellFormatter();

    ft.setHTML(0, 0, "<strong>Short name</strong>");
    ft.setHTML(0, 1, "<strong>Type</strong>");
    ft.setHTML(0, 2, "<strong>Preview</strong>");
    ft.setHTML(0, 3, "<strong>Edit</strong>");

    fcf.setStyleName(0, 0, "GPBYFDEFD");
    fcf.setStyleName(0, 1, "GPBYFDEFD");
    fcf.setStyleName(0, 2, "GPBYFDEFD");
    fcf.setStyleName(0, 3, "GPBYFDEFD");

    String locale = "en";

    if (LocaleInfo.getCurrentLocale().getLocaleName().equals("default")
        || LocaleInfo.getCurrentLocale().getLocaleName().equals("en")) {
      locale = "en";
    } else {
      locale = "cs";
    }

    int i = 1;
    for (final ApplicationFormItem item : items) {

      final int index = i - 1;

      // not yet set locale on config page
      RegistrarFormItemGenerator gen = new RegistrarFormItemGenerator(item, locale);

      // 0 = label
      String label = "";
      if (gen.isLabelShown()) {
        label = item.getShortname();
      }
      if (item.isRequired() == true) {
        label += "*";
      }
      ft.setHTML(i, 0, label);

      // 1 = type
      ft.setHTML(i, 1, item.getType());

      // 2 = preview
      Widget w = gen.getWidget();
      ft.setWidget(i, 2, w);

      // 3 = EDIT
      FlexTable editTable = new FlexTable();
      editTable.setStyleName("noBorder");
      ft.setWidget(i, 3, editTable);

      // color for items with unsaved changes
      if (item.wasEdited() == true) {
        ft.getFlexCellFormatter().setStyleName(i, 0, "log-changed");
        ft.getFlexCellFormatter().setStyleName(i, 1, "log-changed");
        ft.getFlexCellFormatter().setStyleName(i, 2, "log-changed");
        ft.getFlexCellFormatter().setStyleName(i, 3, "log-changed");
      }

      // mark row for deletion
      if (item.isForDelete()) {

        ft.getFlexCellFormatter().setStyleName(i, 0, "log-error");
        ft.getFlexCellFormatter().setStyleName(i, 1, "log-error");
        ft.getFlexCellFormatter().setStyleName(i, 2, "log-error");
        ft.getFlexCellFormatter().setStyleName(i, 3, "log-error");

        // undelete button
        CustomButton undelete =
            new CustomButton(
                ButtonTranslation.INSTANCE.undeleteFormItemButton(),
                ButtonTranslation.INSTANCE.undeleteFormItem(),
                SmallIcons.INSTANCE.arrowLeftIcon(),
                new ClickHandler() {
                  public void onClick(ClickEvent event) {
                    items.get(index).setForDelete(false);
                    // refresh
                    prepareSettings(items);
                  }
                });

        FlexTable undelTable = new FlexTable();
        undelTable.setStyleName("noBorder");
        undelTable.setHTML(
            0, 0, "<strong><span style=\"color:red;\">MARKED FOR DELETION</span></strong>");
        undelTable.setWidget(0, 1, undelete);
        ft.setWidget(i, 3, undelTable);
      }

      // color for new items to be saved
      if (item.getId() == 0) {
        ft.getFlexCellFormatter().setStyleName(i, 0, "log-success");
        ft.getFlexCellFormatter().setStyleName(i, 1, "log-success");
        ft.getFlexCellFormatter().setStyleName(i, 2, "log-success");
        ft.getFlexCellFormatter().setStyleName(i, 3, "log-success");
      }

      // up
      PushButton upButton =
          new PushButton(
              new Image(SmallIcons.INSTANCE.arrowUpIcon()),
              new ClickHandler() {

                public void onClick(ClickEvent event) {

                  if (index - 1 < 0) return;

                  // move it
                  items.remove(index);
                  items.add(index - 1, item);
                  item.setOrdnum(item.getOrdnum() - 1);

                  item.setEdited(true);

                  // refresh
                  prepareSettings(items);
                }
              });
      editTable.setWidget(0, 0, upButton);
      upButton.setTitle(ButtonTranslation.INSTANCE.moveFormItemUp());

      // down
      PushButton downButton =
          new PushButton(
              new Image(SmallIcons.INSTANCE.arrowDownIcon()),
              new ClickHandler() {

                public void onClick(ClickEvent event) {

                  if (index + 1 >= items.size()) return;

                  // move it
                  items.remove(index);
                  items.add(index + 1, item);
                  item.setOrdnum(item.getOrdnum() + 1);

                  item.setEdited(true);

                  // refresh
                  prepareSettings(items);
                }
              });
      editTable.setWidget(0, 1, downButton);
      downButton.setTitle(ButtonTranslation.INSTANCE.moveFormItemDown());

      // edit
      CustomButton editButton =
          new CustomButton(
              ButtonTranslation.INSTANCE.editFormItemButton(),
              ButtonTranslation.INSTANCE.editFormItem(),
              SmallIcons.INSTANCE.applicationFormEditIcon());
      editButton.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {
              session
                  .getTabManager()
                  .addTabToCurrentTab(new EditFormItemTabItem(item, refreshEvents));
            }
          });
      editTable.setWidget(0, 2, editButton);

      // remove
      CustomButton removeButton =
          new CustomButton(
              ButtonTranslation.INSTANCE.deleteButton(),
              ButtonTranslation.INSTANCE.deleteFormItem(),
              SmallIcons.INSTANCE.deleteIcon());
      removeButton.addClickHandler(
          new ClickHandler() {

            public void onClick(ClickEvent event) {
              HTML text =
                  new HTML(
                      "<p>Deleting of form items is <strong>NOT RECOMMENDED!</strong><p>You will loose access to data users submitted in older applications within this form item!<p>Do you want to continue?");
              Confirm c =
                  new Confirm(
                      "Delete confirm",
                      text,
                      new ClickHandler() {
                        public void onClick(ClickEvent event) {
                          // mark for deletion when save changes
                          items.get(index).setForDelete(true);
                          // remove if newly created
                          if (items.get(index).getId() == 0) {
                            items.remove(index);
                          }
                          // refresh
                          prepareSettings(items);
                        }
                      },
                      true);
              c.setNonScrollable(true);
              c.show();
            }
          });
      editTable.setWidget(0, 3, removeButton);

      // format
      fcf.setHeight(i, 0, "28px");
      fcf.setVerticalAlignment(i, 0, HasVerticalAlignment.ALIGN_MIDDLE);
      fcf.setVerticalAlignment(i, 1, HasVerticalAlignment.ALIGN_MIDDLE);
      fcf.setVerticalAlignment(i, 2, HasVerticalAlignment.ALIGN_MIDDLE);

      i++;
    }

    contents.setWidget(ft);
  }
示例#9
0
 @Override
 public void renderPushButton(Graphics gfx, PushButton w) {
   renderButton(gfx, w, w.getText(), null);
 }
  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());
            }
          }
        });
  }
 private void setDeleteVisible(boolean editorEnabled) {
   deleteButton.setVisible(editorEnabled);
 }
示例#12
0
 private void loadCompleted() {
   // The load completed, enable buttons
   runButton.setEnabled(true);
   addFileButton.setEnabled(true);
 }