1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.taxeditor.user.view;
|
12
|
|
13
|
import org.eclipse.jface.viewers.ITableLabelProvider;
|
14
|
import org.eclipse.jface.viewers.LabelProvider;
|
15
|
import org.eclipse.swt.graphics.Image;
|
16
|
|
17
|
import eu.etaxonomy.cdm.model.agent.Person;
|
18
|
import eu.etaxonomy.cdm.model.common.User;
|
19
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
20
|
|
21
|
/**
|
22
|
* <p>UserManagerLabelProvider class.</p>
|
23
|
*
|
24
|
* @author n.hoffmann
|
25
|
* @created 01.07.2009
|
26
|
* @version 1.0
|
27
|
*/
|
28
|
public class UserManagerLabelProvider extends LabelProvider implements ITableLabelProvider {
|
29
|
|
30
|
/** {@inheritDoc} */
|
31
|
public Image getColumnImage(Object element, int columnIndex) {
|
32
|
return null;
|
33
|
}
|
34
|
|
35
|
/** {@inheritDoc} */
|
36
|
public String getColumnText(Object element, int columnIndex) {
|
37
|
User user = (User) element;
|
38
|
|
39
|
User authenticatedUser = CdmStore.getLoginManager().getAuthenticatedUser();
|
40
|
|
41
|
switch(columnIndex){
|
42
|
case 0:
|
43
|
return user.equals(authenticatedUser) ? "*" : "";
|
44
|
case 1:
|
45
|
return user.getUsername();
|
46
|
case 2:
|
47
|
return user.isEnabled() ? "Yes" : "No";
|
48
|
case 3:
|
49
|
return user.isAccountNonLocked() ? "No" : "Yes";
|
50
|
case 4:
|
51
|
Person person = user.getPerson();
|
52
|
if (person != null){
|
53
|
return person.getTitleCache();
|
54
|
}
|
55
|
case 5:
|
56
|
return user.getEmailAddress();
|
57
|
|
58
|
}
|
59
|
|
60
|
return "-";
|
61
|
}
|
62
|
|
63
|
}
|