KickJava   Java API By Example, From Geeks To Geeks.

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


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-item" with attribute "name"
22  *
23  * @author av
24  */

25 public class DefaultItemElementRenderer implements ItemElementRenderer {
26   private String JavaDoc elementName = "cat-item";
27
28   /**
29    * Constructor for DefaultItemElementRenderer.
30    */

31   public DefaultItemElementRenderer() {
32     super();
33   }
34
35   public Element JavaDoc render(RequestContext context, Document JavaDoc factory, Category cat, Item item) {
36     Element JavaDoc elem = factory.createElement(elementName);
37     elem.setAttribute("name", item.getLabel());
38     return elem;
39   }
40
41   public String JavaDoc getElementName() {
42     return elementName;
43   }
44
45   public void setElementName(String JavaDoc elementName) {
46     this.elementName = elementName;
47   }
48   
49   public void startRendering(RequestContext context) {
50   }
51
52   public void stopRendering() {
53   }
54   public void categoryModelChanged(CategoryModelChangeEvent event) {
55   }
56   public void request(RequestContext context) throws Exception JavaDoc {
57   }
58 }
59
Popular Tags