KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > catedit > DefaultCategoryElementRenderer


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  *
11  *
12  */

13 package com.tonbeller.wcf.catedit;
14
15 import org.w3c.dom.Document JavaDoc;
16 import org.w3c.dom.Element JavaDoc;
17
18 import com.tonbeller.wcf.controller.RequestContext;
19
20 /**
21  * creates a DOM Element named "cat-catecory" with attributes "name" and "icon"
22  *
23  * @author av
24  */

25 public class DefaultCategoryElementRenderer implements CategoryElementRenderer {
26   String JavaDoc elementName = "cat-category";
27
28   /**
29    * Constructor for DefaultCategoryElementRenderer.
30    */

31   public DefaultCategoryElementRenderer() {
32     super();
33   }
34
35   /**
36    * creates a DOM Element with attributes "name" and "icon"
37    */

38   public Element JavaDoc render(RequestContext context, Document JavaDoc factory, Category cat) {
39     Element JavaDoc elem = factory.createElement(elementName);
40     elem.setAttribute("name", cat.getName());
41     elem.setAttribute("icon", cat.getIcon());
42     return elem;
43   }
44
45   /**
46    * Returns the elementName.
47    * @return String
48    */

49   public String JavaDoc getElementName() {
50     return elementName;
51   }
52
53   /**
54    * Sets the elementName.
55    * @param elementName The elementName to set
56    */

57   public void setElementName(String JavaDoc elementName) {
58     this.elementName = elementName;
59   }
60
61 }
62
Popular Tags