private void popupDbCurator() {

    ClientSequenceDatabase csd = (ClientSequenceDatabase) dlb.getSelected();
    Integer selected = csd.getId();

    Map<String, String> emailInitialPairs = new TreeMap<String, String>();

    for (Map.Entry<String, ClientUser> me : userInfo.entrySet()) {
      emailInitialPairs.put(me.getKey(), me.getValue().getInitials());
    }

    final DialogBox dialogBox = new DialogBox(false);
    CurationEditor ce =
        new CurationEditor(
            selected,
            user.getEmail(),
            emailInitialPairs,
            new EditorCloseCallback() {
              public void editorClosed(final Integer openCurationID) {
                validationController.getAllowedValues(
                    dlb,
                    new Callback() {
                      public void done() {
                        if (openCurationID != null) {
                          dlb.select(openCurationID, validationController);
                        }
                        dialogBox.hide();
                      }
                    });
              }
            });
    DOM.setElementAttribute(dialogBox.getElement(), "id", "db-curator");
    dialogBox.setStyleName("dbCuratorEmbed");
    dialogBox.setWidget(ce);
    dialogBox.setSize(Window.getClientWidth() * .8 + "px", Window.getClientHeight() * .8 + "px");
    ce.setPixelSize(
        Math.max((int) (Window.getClientWidth() * .8), 770), (int) (Window.getClientHeight() * .8));
    //		LightBox lb = new LightBox(dialogBox);
    //		try {
    //			lb.show();
    //		} catch (Exception ignore) {
    dialogBox.show();
    //		}
    dialogBox.center();
  }
Exemple #2
0
  private void updateTitleFromFileTable() {
    // User edited the title field. We have no business here
    if (userEditedTitle) {
      return;
    }
    List<String> names = files.getFileNames();
    if (names.size() == 0) {
      setTitleText("");
    } else {
      Iterator<String> iterator = names.iterator();
      String longestPrefix = iterator.next();
      while (iterator.hasNext()) {
        String next = iterator.next();
        for (int i = 0; i < Math.min(longestPrefix.length(), next.length()); i++) {
          if (next.charAt(i) != longestPrefix.charAt(i)) {
            longestPrefix = longestPrefix.substring(0, i);
            break;
          }
        }
      }
      // The users like to name files with underscores separating different fields.
      // If we detect more than 1 underscore, we will try to remove everything beyond the last
      // underscore
      // That takes care of test_S1, test_S2, test_S3 or test_Inj1, test_Inj2 type of repeats,
      // resulting
      // with just "test".

      // If there is just one underscore, we remove it if it is the last one.
      int numUnderscores = longestPrefix.length() - longestPrefix.replaceAll("_", "").length();
      if (numUnderscores <= 1) {
        longestPrefix = longestPrefix.replaceAll("_$", "");
      } else {
        longestPrefix = longestPrefix.replaceAll("_[^_]*$", "");
      }
      setTitleText(longestPrefix + paramsEditor.getTitleSuffix());
    }
    updateOutputLocation();
  }