Beispiel #1
0
  private void userChanged() {
    if (users == null) {
      return;
    }
    ClientUser user = null;
    if (users.getSelectedIndex() > 0) {
      final String email = users.getValue(users.getSelectedIndex());
      if (userInfo.containsKey(email)) {
        user = userInfo.get(email);
      }

      Cookies.setCookie(
          "email",
          users.getValue(users.getSelectedIndex()),
          ParamSetSelectionController.getCookieExpirationDate(),
          null,
          "/",
          false);
    }

    // Figure out whether this user can edit parameters or not
    final boolean editorEnabled = user != null && user.isParameterEditorEnabled();
    if (paramsEditor != null) {
      paramsEditor.setEditorEnabled(editorEnabled, user);
    }
    setOutputPathChangeEnabled(user != null && user.isOutputPathChangeEnabled());
  }
 private static void sort() {
   if (!clientUsers.isEmpty() && clientUsers.get(0) != null) {
     int j;
     for (int i = 1; i < clientUsers.size(); i++) {
       ClientUser clientUser = clientUsers.get(i);
       if (clientUsers.get(i - 1).getId() > clientUser.getId()) {
         j = i;
         do {
           clientUsers.set(j, clientUsers.get(j - 1));
           j--;
         } while (j > 0 && clientUsers.get(j - 1).getId() > clientUser.getId());
         clientUsers.set(j, clientUser);
       }
     }
   }
 }
Beispiel #3
0
  private void initUserList(final ClientUser[] list) {
    // The user listing is downloaded by an async call.
    final RootPanel userPanel = RootPanel.get("email");
    userPanel.add(users);
    users.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(final ChangeEvent event) {
            userChanged();
          }
        });
    users.addItem(SELECT_USER_STRING, "");
    userInfo.clear();
    for (final ClientUser user : list) {
      users.addItem(user.getName(), user.getEmail());
      userInfo.put(user.getEmail(), user);
    }

    // Select the user according to the cookie stored
    final String userEmail = Cookies.getCookie("email");
    selectUser(userEmail);
  }
  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();
  }