/**
  * Implemented as specified by the {@link Importer} interface.
  *
  * @see Importer#activate(int, TreeImageDisplay, Collection)
  */
 public void activate(
     int type, TreeImageDisplay selectedContainer, Collection<TreeImageDisplay> objects) {
   if (model.getState() == DISCARDED) return;
   if (chooser == null) {
     chooser =
         new ImportDialog(
             view,
             model.getSupportedFormats(),
             selectedContainer,
             objects,
             type,
             ImporterAgent.getAvailableUserGroups());
     chooser.addPropertyChangeListener(controller);
     view.addComponent(chooser);
   } else {
     ExperimenterData exp = ImporterAgent.getUserDetails();
     chooser.reset(selectedContainer, objects, type, model.getGroupId(), exp.getId());
     chooser.requestFocusInWindow();
     view.selectChooser();
   }
   chooser.setSelectedGroup(getSelectedGroup());
   if (model.isMaster() || objects == null || objects.size() == 0)
     refreshContainers(new ImportLocationDetails(type));
   // load available disk space
   model.fireDiskSpaceLoading();
   view.setOnScreen();
   view.toFront();
 }
 /**
  * Sets the rendering settings associated to the image.
  *
  * @param viewedBy The value to set.
  */
 void setViewedBy(Map viewedBy) {
   Map m = new LinkedHashMap();
   if (viewedBy != null) {
     long id = MetadataViewerAgent.getUserDetails().getId();
     Entry entry;
     Iterator i = viewedBy.entrySet().iterator();
     ExperimenterData exp;
     while (i.hasNext()) {
       entry = (Entry) i.next();
       exp = (ExperimenterData) entry.getKey();
       if (exp.getId() == id) {
         m.put(exp, entry.getValue());
       }
     }
     i = viewedBy.entrySet().iterator();
     while (i.hasNext()) {
       entry = (Entry) i.next();
       exp = (ExperimenterData) entry.getKey();
       if (exp.getId() != id) {
         m.put(exp, entry.getValue());
       }
     }
   }
   this.viewedBy = m;
 }
 /**
  * Indicates that the group has been successfully switched if <code>true</code>, unsuccessfully if
  * <code>false</code>.
  *
  * @param success Pass <code>true</code> if successful, <code>false</code> otherwise.
  */
 void onGroupSwitched(boolean success) {
   if (!model.isMaster()) return;
   if (!success) return;
   ExperimenterData exp = ImporterAgent.getUserDetails();
   GroupData group = exp.getDefaultGroup();
   long oldGroup = model.getGroupId();
   model.setGroupId(group.getId());
   ImportLocationDetails details = new ImportLocationDetails(chooser.getType());
   refreshContainers(details);
   firePropertyChange(CHANGED_GROUP_PROPERTY, oldGroup, model.getGroupId());
 }
Exemplo n.º 4
0
  /**
   * Tests the <code>lookupExperimenter</code> method. Retrieves an experimenter and converts the
   * group into the corresponding POJO.
   *
   * @throws Exception Thrown if an error occurred.
   */
  @Test
  public void testLookupExperimenter() throws Exception {
    IAdminPrx svc = root.getSession().getAdminService();
    Experimenter exp = svc.lookupExperimenter("root");
    assertNotNull(exp);

    // Test the conversion into the corresponding POJO
    ExperimenterData data = new ExperimenterData(exp);
    assertTrue(data.getId() == exp.getId().getValue());
    assertTrue(data.getUserName() == exp.getOmeName().getValue());
  }
  /** Refreshes the view when a user reconnects. */
  void onReconnected() {
    ExperimenterData exp = ImporterAgent.getUserDetails();
    GroupData group = exp.getDefaultGroup();
    long oldGroup = -1;
    if (model.getExperimenterId() == exp.getId() && group.getId() == model.getGroupId()) return;
    view.reset();
    model.setGroupId(group.getId());

    ImportLocationDetails info = new ImportLocationDetails(chooser.getType());
    refreshContainers(info);
    firePropertyChange(CHANGED_GROUP_PROPERTY, oldGroup, model.getGroupId());
  }
Exemplo n.º 6
0
 /**
  * Returns <code>true</code> if the user is an administrator, <code>false</code> otherwise.
  *
  * @return See above.
  */
 private boolean isUserAdministrator() {
   ExperimenterData user = (ExperimenterData) model.getRefObject();
   ExperimenterData loggedInUser = MetadataViewerAgent.getUserDetails();
   if (user.getId() == loggedInUser.getId()) return MetadataViewerAgent.isAdministrator();
   List<GroupData> groups = user.getGroups();
   Iterator<GroupData> i = groups.iterator();
   GroupData g;
   while (i.hasNext()) {
     g = i.next();
     if (GroupData.SYSTEM.equals(g.getName())) return true;
   }
   return false;
 }
 /**
  * Sets the action enabled depending on the selected type.
  *
  * @see TreeViewerAction#onDisplayChange(TreeImageDisplay)
  */
 protected void onDisplayChange(TreeImageDisplay selectedDisplay) {
   if (nodeType == GROUP || nodeType == EXPERIMENTER) {
     setEnabled(TreeViewerAgent.isAdministrator());
     return;
   }
   if (nodeType != EXPERIMENTER) {
     if (selectedDisplay != null) {
       Object ho = selectedDisplay.getUserObject();
       if (ho instanceof ExperimenterData) {
         ExperimenterData data = (ExperimenterData) ho;
         long id = TreeViewerAgent.getUserDetails().getId();
         setEnabled(data.getId() == id);
         return;
       }
       /*
           		switch (nodeType) {
       	case TAG:
       		if (ho instanceof TagAnnotationData) {
       			TagAnnotationData tag = (TagAnnotationData) ho;
       			String ns = tag.getNameSpace();
       			if (TagAnnotationData.INSIGHT_TAGSET_NS.equals(ns)) {
       				setEnabled(model.isUserOwner(ho));
       			} else setEnabled(false);
       		}
       		//setEnabled(model.isUserOwner(ho));
       		break;
       	case DATASET:
       		if (ho instanceof DatasetData) {
       			setEnabled(false);
       		} else
       			setEnabled(model.isUserOwner(ho));
       		break;
       	default:
       		setEnabled(true);
       }
       */
       setEnabled(true);
     }
   } else {
     Browser browser = model.getSelectedBrowser();
     if (browser == null || selectedDisplay == null) {
       setEnabled(false);
       return;
     }
     Object ho = selectedDisplay.getUserObject();
     if (ho instanceof GroupData) {
       TreeImageDisplay[] selected = browser.getSelectedDisplays();
       setEnabled(selected.length == 1);
     } else setEnabled(false);
   }
 }
  /**
   * Implemented as specified by the {@link Importer} interface.
   *
   * @see Importer#getSelectedGroup()
   */
  public GroupData getSelectedGroup() {
    Collection<GroupData> m = loadGroups();

    if (m == null) {
      ExperimenterData exp = ImporterAgent.getUserDetails();
      return exp.getDefaultGroup();
    }

    long id = model.getGroupId();

    for (GroupData group : m) {
      if (group.getId() == id) return group;
    }
    ExperimenterData exp = ImporterAgent.getUserDetails();
    return exp.getDefaultGroup();
  }
Exemplo n.º 9
0
 /**
  * Selects or not the {@link #ownerBox} if the selected user is an owner. Returns <code>true
  * </code> if the currently logged in user is an owner of the group.
  *
  * @param group The group to handle.
  */
 private boolean setGroupOwner(GroupData group) {
   ExperimenterData ref = (ExperimenterData) model.getRefObject();
   long userID = MetadataViewerAgent.getUserDetails().getId();
   Set leaders = group.getLeaders();
   ExperimenterData exp;
   boolean isOwner = false;
   if (leaders != null) {
     Iterator i = leaders.iterator();
     while (i.hasNext()) {
       exp = (ExperimenterData) i.next();
       if (exp.getId() == ref.getId()) {
         groupOwner = true;
         ownerBox.setSelected(true);
       }
       if (exp.getId() == userID) isOwner = true;
     }
   }
   return isOwner;
 }
Exemplo n.º 10
0
  /**
   * Returns <code>true</code> if data to save, <code>false</code> otherwise.
   *
   * @return See above.
   */
  boolean hasDataToSave() {
    String text = loginArea.getText();
    if (text == null || text.trim().length() == 0) return false;
    text = text.trim();
    ExperimenterData original = (ExperimenterData) model.getRefObject();
    if (!text.equals(original.getUserName())) return true;
    // if (selectedIndex != originalIndex) return true;
    if (details == null) return false;
    Entry entry;
    Iterator i = details.entrySet().iterator();
    String key;
    String value;
    JTextField field;
    String v;
    if (items.size() > 0) {
      while (i.hasNext()) {
        entry = (Entry) i.next();
        key = (String) entry.getKey();
        field = items.get(key);
        if (field != null) {
          v = field.getText();
          if (v != null) {
            v = v.trim();
            value = (String) entry.getValue();
            if (value != null && !v.equals(value)) return true;
          }
        }
      }
    }

    Boolean b = ownerBox.isSelected();
    if (b.compareTo(groupOwner) != 0) return true;
    if (adminBox.isVisible()) {
      b = adminBox.isSelected();
      if (b.compareTo(admin) != 0) return true;
    }
    if (activeBox.isVisible()) {
      b = activeBox.isSelected();
      if (b.compareTo(active) != 0) return true;
    }
    return false;
  }
Exemplo n.º 11
0
  /**
   * Returns the experimenter to save.
   *
   * @return See above.
   */
  Object getExperimenterToSave() {
    ExperimenterData original = (ExperimenterData) model.getRefObject();
    // Required fields first

    String v = loginArea.getText();
    if (v == null || v.trim().length() == 0) showRequiredField();
    original.setLastName(v);
    JTextField f = items.get(EditorUtil.EMAIL);
    v = f.getText();
    if (v == null || v.trim().length() == 0) v = ""; // showRequiredField();
    original.setEmail(v);
    f = items.get(EditorUtil.INSTITUTION);
    v = f.getText();
    if (v == null) v = "";
    original.setInstitution(v.trim());
    f = items.get(EditorUtil.LAST_NAME);
    v = f.getText();
    if (v == null) v = "";
    original.setLastName(v.trim());

    f = items.get(EditorUtil.FIRST_NAME);
    v = f.getText();
    if (v == null) v = "";
    original.setFirstName(v.trim());

    f = items.get(EditorUtil.MIDDLE_NAME);
    v = f.getText();
    if (v == null) v = "";
    original.setMiddleName(v.trim());

    // set the groups
    GroupData g = null;
    /*

     	if (selectedIndex != originalIndex) {
     		if (selectedIndex < groupData.length)
     			g = groupData[selectedIndex];
     		ExperimenterData user = (ExperimenterData) model.getRefObject();
     		List userGroups = user.getGroups();
     		List<GroupData> newGroups = new ArrayList<GroupData>();
     		if (g != null) newGroups.add(g);
     		Iterator i = userGroups.iterator();
     		long id = -1;
     		if (g != null) id = g.getId();
     		GroupData group;
     		while (i.hasNext()) {
    	group = (GroupData) i.next();
    	if (group.getId() != id)
    		newGroups.add(group);
    }
     		//Need to see what to do b/c no ExperimenterGroupMap
     		original.setGroups(newGroups);
     	}
     	*/
    String value = loginArea.getText().trim();
    UserCredentials uc = new UserCredentials(value, "");
    Boolean b = ownerBox.isSelected();
    // if (g == null) g = original.getDefaultGroup();
    boolean a = false;
    if (b.compareTo(groupOwner) != 0) {
      a = true;
      uc.setOwner(b);
      Object parent = model.getParentRootObject();
      if (parent instanceof GroupData) {
        Map<GroupData, Boolean> map = new HashMap<GroupData, Boolean>();
        map.put((GroupData) parent, b);
        uc.setGroupsOwner(map);
      }
    }
    if (adminBox.isVisible()) {
      b = adminBox.isSelected();
      if (b.compareTo(admin) != 0) {
        a = true;
        uc.setAdministrator(b);
      }
    }
    if (activeBox.isVisible()) {
      b = activeBox.isSelected();
      if (b.compareTo(active) != 0) {
        a = true;
        uc.setActive(b);
      }
    }
    if (!original.getUserName().equals(value)) a = true;
    // if admin
    if (MetadataViewerAgent.isAdministrator()) a = true;
    if (a) {
      Map<ExperimenterData, UserCredentials> m = new HashMap<ExperimenterData, UserCredentials>();
      m.put(original, uc);
      AdminObject object = new AdminObject(g, m, AdminObject.UPDATE_EXPERIMENTER);
      return object;
    }
    return original; // newOne;
  }
Exemplo n.º 12
0
  /**
   * Builds the panel hosting the user's details.
   *
   * @return See above.
   */
  private JPanel buildContentPanel() {
    ExperimenterData user = (ExperimenterData) model.getRefObject();
    boolean editable = model.isUserOwner(user);
    if (!editable) editable = model.isGroupLeader() || MetadataViewerAgent.isAdministrator();
    details = EditorUtil.convertExperimenter(user);
    JPanel content = new JPanel();
    content.setBorder(BorderFactory.createTitledBorder("Profile"));
    content.setBackground(UIUtilities.BACKGROUND_COLOR);
    Entry entry;
    Iterator i = details.entrySet().iterator();
    JComponent label;
    JTextField area;
    String key, value;
    content.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 2, 2, 0);
    // Add log in name but cannot edit.
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.REMAINDER; // end row
    c.fill = GridBagConstraints.HORIZONTAL;
    content.add(userPicture, c);
    c.gridy++;
    c.gridx = 0;
    label = EditorUtil.getLabel(EditorUtil.DISPLAY_NAME, true);
    label.setBackground(UIUtilities.BACKGROUND_COLOR);
    c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
    c.fill = GridBagConstraints.NONE; // reset to default
    c.weightx = 0.0;
    content.add(label, c);
    c.gridx++;
    content.add(Box.createHorizontalStrut(5), c);
    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER; // end row
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    loginArea.setText(user.getUserName());
    loginArea.getDocument().addDocumentListener(this);
    content.add(loginArea, c);
    while (i.hasNext()) {
      ++c.gridy;
      c.gridx = 0;
      entry = (Entry) i.next();
      key = (String) entry.getKey();
      value = (String) entry.getValue();
      label = EditorUtil.getLabel(key, false);
      area = new JTextField(value);
      area.setBackground(UIUtilities.BACKGROUND_COLOR);
      area.setEditable(editable);
      area.setEnabled(editable);
      if (editable) area.getDocument().addDocumentListener(this);
      items.put(key, area);
      label.setBackground(UIUtilities.BACKGROUND_COLOR);
      c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
      c.fill = GridBagConstraints.NONE; // reset to default
      c.weightx = 0.0;
      content.add(label, c);
      c.gridx++;
      content.add(Box.createHorizontalStrut(5), c);
      c.gridx++;
      c.gridwidth = GridBagConstraints.REMAINDER; // end row
      c.fill = GridBagConstraints.HORIZONTAL;
      c.weightx = 1.0;
      content.add(area, c);
    }
    c.gridx = 0;
    c.gridy++;
    label = EditorUtil.getLabel(EditorUtil.DEFAULT_GROUP, false);
    c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
    c.fill = GridBagConstraints.NONE; // reset to default
    c.weightx = 0.0;
    content.add(label, c);
    c.gridx++;
    content.add(Box.createHorizontalStrut(5), c);
    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER; // end row
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    content.add(groupLabel, c);
    c.gridy++;
    content.add(permissionsPane, c);

    // content.add(groups, c);

    c.gridx = 0;
    c.gridy++;
    label = EditorUtil.getLabel(EditorUtil.GROUP_OWNER, false);
    c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
    c.fill = GridBagConstraints.NONE; // reset to default
    c.weightx = 0.0;
    content.add(label, c);
    c.gridx++;
    content.add(Box.createHorizontalStrut(5), c);
    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER; // end row
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    content.add(ownerBox, c);
    if (activeBox.isVisible()) {
      c.gridx = 0;
      c.gridy++;
      label = EditorUtil.getLabel(EditorUtil.ACTIVE, false);
      c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
      c.fill = GridBagConstraints.NONE; // reset to default
      c.weightx = 0.0;
      content.add(label, c);
      c.gridx++;
      content.add(Box.createHorizontalStrut(5), c);
      c.gridx++;
      c.gridwidth = GridBagConstraints.REMAINDER; // end row
      c.fill = GridBagConstraints.HORIZONTAL;
      c.weightx = 1.0;
      content.add(activeBox, c);
    }
    if (adminBox.isVisible()) {
      c.gridx = 0;
      c.gridy++;
      label = EditorUtil.getLabel(EditorUtil.ADMINISTRATOR, false);
      c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
      c.fill = GridBagConstraints.NONE; // reset to default
      c.weightx = 0.0;
      content.add(label, c);
      c.gridx++;
      content.add(Box.createHorizontalStrut(5), c);
      c.gridx++;
      c.gridwidth = GridBagConstraints.REMAINDER; // end row
      c.fill = GridBagConstraints.HORIZONTAL;
      c.weightx = 1.0;
      content.add(adminBox, c);
    }
    c.gridx = 0;
    c.gridy++;
    content.add(Box.createHorizontalStrut(10), c);
    c.gridy++;
    label = UIUtilities.setTextFont(EditorUtil.MANDATORY_DESCRIPTION, Font.ITALIC);
    label.setForeground(UIUtilities.REQUIRED_FIELDS_COLOR);
    c.weightx = 0.0;
    content.add(label, c);
    return content;
  }
Exemplo n.º 13
0
  /** Initializes the components composing this display. */
  private void initComponents() {
    admin = false;
    active = false;
    groupOwner = false;

    userPicture = new UserProfileCanvas();
    userPicture.setBackground(UIUtilities.BACKGROUND_COLOR);
    userPicture.setToolTipText("Click to upload your picture.");
    IconManager icons = IconManager.getInstance();
    userPicture.setImage(icons.getImageIcon(IconManager.USER_PHOTO_32).getImage());
    loginArea = new JTextField();
    boolean a = MetadataViewerAgent.isAdministrator();
    loginArea.setEnabled(a);
    loginArea.setEditable(a);
    adminBox = new JCheckBox();
    adminBox.setVisible(false);
    adminBox.setBackground(UIUtilities.BACKGROUND_COLOR);
    ownerBox = new JCheckBox();
    ownerBox.setBackground(UIUtilities.BACKGROUND_COLOR);
    activeBox = new JCheckBox();
    activeBox.setBackground(UIUtilities.BACKGROUND_COLOR);
    activeBox.setVisible(false);
    passwordButton = new JButton("Change password");
    passwordButton.setEnabled(false);
    passwordButton.setBackground(UIUtilities.BACKGROUND_COLOR);
    passwordButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            changePassword();
          }
        });
    manageButton = new JButton("Group");
    manageButton.setEnabled(false);
    manageButton.setBackground(UIUtilities.BACKGROUND_COLOR);
    manageButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            manageGroup();
          }
        });
    passwordNew = new JPasswordField();
    passwordNew.setBackground(UIUtilities.BACKGROUND_COLOR);
    passwordConfirm = new JPasswordField();
    passwordConfirm.setBackground(UIUtilities.BACKGROUND_COLOR);
    oldPassword = new JPasswordField();
    oldPassword.setBackground(UIUtilities.BACKGROUND_COLOR);
    items = new HashMap<String, JTextField>();
    ExperimenterData user = (ExperimenterData) model.getRefObject();
    GroupData defaultGroup = user.getDefaultGroup();

    permissionsPane =
        new PermissionsPane(defaultGroup.getPermissions(), UIUtilities.BACKGROUND_COLOR);
    permissionsPane.disablePermissions();
    groupLabel = new JLabel(defaultGroup.getName());
    groupLabel.setBackground(UIUtilities.BACKGROUND_COLOR);

    long groupID = defaultGroup.getId();
    boolean owner = false;
    /*
    if (defaultGroup.getLeaders() != null)
    	owner = setGroupOwner(defaultGroup);
    else {
    	GroupData g = model.loadGroup(groupID);
    	if (g != null)
    		owner = setGroupOwner(g);
    }
    */
    Object parentRootObject = model.getParentRootObject();
    if (parentRootObject instanceof GroupData) {
      owner = setGroupOwner((GroupData) parentRootObject);
    }
    // Build the array for box.
    /*
    Iterator i = userGroups.iterator();
    GroupData g;

    List<GroupData> validGroups = new ArrayList<GroupData>();
    while (i.hasNext()) {
    	g = (GroupData) i.next();
    	if (model.isValidGroup(g))
    		validGroups.add(g);
    }
    groupData = new GroupData[validGroups.size()];
    admin = false;
    active = false;
    int selectedIndex = 0;
    int index = 0;
    i = validGroups.iterator();
    boolean owner = false;
    while (i.hasNext()) {
    	g = (GroupData) i.next();
    	groupData[index] = g;
    	if (g.getId() == groupID) {
    		if (g.getLeaders() != null) {
    			owner = setGroupOwner(g);
    			originalIndex = index;
    		}
    	}
    	index++;
    }
    selectedIndex = originalIndex;
    groups = EditorUtil.createComboBox(groupData, 0);
    groups.setEnabled(false);
    groups.setRenderer(new GroupsRenderer());
    if (groupData.length != 0)
    	groups.setSelectedIndex(selectedIndex);
    */

    if (MetadataViewerAgent.isAdministrator()) {
      // Check that the user is not the one currently logged.
      oldPassword.setVisible(false);
      owner = true;
      adminBox.setVisible(true);
      activeBox.setVisible(true);
      adminBox.addChangeListener(this);
      active = user.isActive();
      activeBox.setSelected(active);
      activeBox.setEnabled(!model.isSelf());
      activeBox.addChangeListener(this);
      // indicate if the user is an administrator.a
      admin = isUserAdministrator();
      adminBox.setSelected(admin);
      ownerBox.addChangeListener(this);
      // admin = false;
      // Now check if the user is the last administrator
    } else {
      ownerBox.setEnabled(false);
      passwordConfirm
          .getDocument()
          .addDocumentListener(
              new DocumentListener() {

                /**
                 * Allows the user to interact with the password controls depending on the value
                 * entered.
                 *
                 * @see DocumentListener#removeUpdate(DocumentEvent)
                 */
                public void removeUpdate(DocumentEvent e) {
                  handlePasswordEntered();
                }

                /**
                 * Allows the user to interact with the password controls depending on the value
                 * entered.
                 *
                 * @see DocumentListener#insertUpdate(DocumentEvent)
                 */
                public void insertUpdate(DocumentEvent e) {
                  handlePasswordEntered();
                }

                /**
                 * Required by the {@link DocumentListener} I/F but no-operation implementation in
                 * our case.
                 *
                 * @see DocumentListener#changedUpdate(DocumentEvent)
                 */
                public void changedUpdate(DocumentEvent e) {}
              });
    }
    passwordNew
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {

              /**
               * Allows the user to interact with the password controls depending on the value
               * entered.
               *
               * @see DocumentListener#removeUpdate(DocumentEvent)
               */
              public void removeUpdate(DocumentEvent e) {
                handlePasswordEntered();
              }

              /**
               * Allows the user to interact with the password controls depending on the value
               * entered.
               *
               * @see DocumentListener#insertUpdate(DocumentEvent)
               */
              public void insertUpdate(DocumentEvent e) {
                handlePasswordEntered();
              }

              /**
               * Required by the {@link DocumentListener} I/F but no-operation implementation in our
               * case.
               *
               * @see DocumentListener#changedUpdate(DocumentEvent)
               */
              public void changedUpdate(DocumentEvent e) {}
            });
    ExperimenterData logUser = MetadataViewerAgent.getUserDetails();
    if (user.getId() == logUser.getId()) {
      userPicture.addMouseListener(
          new MouseAdapter() {

            /** Brings up a chooser to load the user image. */
            public void mouseReleased(MouseEvent e) {
              uploadPicture();
            }
          });
    }
  }