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 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); }