KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > modules > admin > users > GroupListCellRenderer


1 /*
2 Copyright (c) 2003 eInnovation Inc. All rights reserved
3
4 This library is free software; you can redistribute it and/or modify it under the terms
5 of the GNU Lesser General Public License as published by the Free Software Foundation;
6 either version 2.1 of the License, or (at your option) any later version.
7
8 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the GNU Lesser General Public License for more details.
11 */

12
13 package com.openedit.modules.admin.users;
14
15 import org.dom4j.DocumentFactory;
16 import org.dom4j.Element;
17 import org.dom4j.Namespace;
18 import org.dom4j.QName;
19
20 import com.openedit.users.Group;
21 import com.openedit.webui.list.WebList;
22 import com.openedit.webui.list.WebListCellRenderer;
23
24
25 /**
26  * This renderer renders <code>{@link Group}</code>s.
27  *
28  * @author Eric Galluzzo
29  */

30 public class GroupListCellRenderer implements WebListCellRenderer
31 {
32     public static final Namespace GROUP_NAMESPACE = DocumentFactory.getInstance().createNamespace(
33             "group", "http://www.wspublisher.com/xmlns/Group");
34     public static final QName GROUP_QNAME = DocumentFactory.getInstance().createQName(
35             "group", GROUP_NAMESPACE);
36     public static final QName NAME_QNAME = DocumentFactory.getInstance().createQName(
37             "name", GROUP_NAMESPACE);
38
39     /**
40      * Constructor for GroupListCellRenderer.
41      */

42     public GroupListCellRenderer()
43     {
44         super();
45     }
46
47     /* (non-Javadoc)
48      * @see WebListCellRenderer#getListCellElement(WebList, Object, DocumentFactory)
49      */

50     public Element getListCellElement(WebList inList, Object JavaDoc inValue, DocumentFactory inFactory)
51     {
52         Element elem = inFactory.createElement(GROUP_QNAME);
53         Group group = (Group) inValue;
54         Element nameElem = DocumentFactory.getInstance().createElement(NAME_QNAME);
55         nameElem.setText(group.getName());
56         elem.add(nameElem);
57
58         return elem;
59     }
60 }
61
Popular Tags