]>
git.argeo.org Git - gpl/argeo-slc.git/blob - UserAdminAbstractLP.java
29873db2fa9d626a525cf701cbe9c42a75fc5600
1 package org
.argeo
.cms
.e4
.users
.providers
;
3 import javax
.naming
.InvalidNameException
;
4 import javax
.naming
.ldap
.LdapName
;
6 import org
.argeo
.cms
.auth
.UserAdminUtils
;
7 import org
.argeo
.cms
.swt
.CmsException
;
8 import org
.eclipse
.jface
.resource
.JFaceResources
;
9 import org
.eclipse
.jface
.viewers
.ColumnLabelProvider
;
10 import org
.eclipse
.swt
.SWT
;
11 import org
.eclipse
.swt
.graphics
.Font
;
12 import org
.eclipse
.swt
.widgets
.Display
;
13 import org
.osgi
.service
.useradmin
.User
;
16 * Utility class that add font modifications to a column label provider
17 * depending on the given user properties
19 public abstract class UserAdminAbstractLP
extends ColumnLabelProvider
{
20 private static final long serialVersionUID
= 137336765024922368L;
22 // private Font italic;
26 public Font
getFont(Object element
) {
29 LdapName selfUserName
= UserAdminUtils
.getCurrentUserLdapName();
30 String userName
= ((User
) element
).getName();
31 LdapName userLdapName
= new LdapName(userName
);
32 if (userLdapName
.equals(selfUserName
)) {
34 bold
= JFaceResources
.getFontRegistry()
35 .defaultFontDescriptor().setStyle(SWT
.BOLD
)
36 .createFont(Display
.getCurrent());
39 } catch (InvalidNameException e
) {
40 throw new CmsException("cannot parse dn for " + element
, e
);
44 // Node userProfile = (Node) elem;
45 // if (!userProfile.getProperty(ARGEO_ENABLED).getBoolean())
49 // return super.getFont(element);
53 public String
getText(Object element
) {
54 User user
= (User
) element
;
58 public void setDisplay(Display display
) {
59 // italic = JFaceResources.getFontRegistry().defaultFontDescriptor()
60 // .setStyle(SWT.ITALIC).createFont(display);
61 bold
= JFaceResources
.getFontRegistry().defaultFontDescriptor()
62 .setStyle(SWT
.BOLD
).createFont(Display
.getCurrent());
65 public abstract String
getText(User user
);