including changes from cdmlib-print
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / account / user / view / UserView.java
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.account.user.view;
12
13 import java.util.List;
14
15 import org.eclipse.jface.viewers.IBaseLabelProvider;
16 import org.eclipse.jface.viewers.TableViewer;
17 import org.eclipse.jface.viewers.TableViewerColumn;
18 import org.eclipse.swt.SWT;
19 import org.eclipse.swt.widgets.Table;
20
21 import eu.etaxonomy.cdm.api.service.IUserService;
22 import eu.etaxonomy.cdm.model.common.User;
23 import eu.etaxonomy.taxeditor.account.AbstractAccountView;
24 import eu.etaxonomy.taxeditor.store.CdmStore;
25
26 /**
27 * <p>UserManagerView class.</p>
28 *
29 * @author n.hoffmann
30 * @created 01.07.2009
31 * @version 1.0
32 */
33 public class UserView extends AbstractAccountView<User>{
34
35
36 /** Constant <code>ID="eu.etaxonomy.taxeditor.store.userManage"{trunked}</code> */
37 public static String ID = "eu.etaxonomy.taxeditor.store.userManagerView";
38
39 // This will create the columns for the table
40 protected void createColumns(TableViewer viewer) {
41 Table table = viewer.getTable();
42 String[] titles = {"Active", "Name", "Enabled", "Locked", "Person", "Email"};
43 int[] bounds = { 20, 200, 50, 50, 200, 100};
44
45 for (int i = 0; i < titles.length; i++) {
46 TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
47 column.getColumn().setText(titles[i]);
48 column.getColumn().setWidth(bounds[i]);
49 column.getColumn().setResizable(true);
50 column.getColumn().setMoveable(true);
51 }
52 table.setHeaderVisible(true);
53 table.setLinesVisible(true);
54 }
55
56
57 /**
58 *
59 * @return
60 */
61 public List<User> getInput(){
62 return CdmStore.getService(IUserService.class).list(null, null, null, null, null);
63 }
64
65
66 /* (non-Javadoc)
67 * @see eu.etaxonomy.taxeditor.account.AbstractAccountView#getLabelProvider()
68 */
69 @Override
70 protected IBaseLabelProvider getLabelProvider() {
71 return new UserLabelProvider();
72 }
73
74 }