KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > ui > ImgButton


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.ui;
14
15 import org.w3c.dom.Document JavaDoc;
16 import org.w3c.dom.Element JavaDoc;
17
18 import com.tonbeller.wcf.utils.XoplonNS;
19
20 /**
21  * Button ctrl class, used as factory for generating buttons
22  */

23 public class ImgButton extends XoplonCtrl {
24   public static final String JavaDoc NODENAME = "imgButton";
25
26   public static boolean isImgButton(Element JavaDoc elem) {
27     return elem.getNodeName().equals(NODENAME);
28   }
29   
30   public static Element JavaDoc createImgButton(Document JavaDoc doc, String JavaDoc id, String JavaDoc src) {
31     Element JavaDoc elem = XoplonCtrl.createCtrl(doc, NODENAME);
32     XoplonCtrl.setId(elem, id);
33     XoplonNS.setAttribute(elem, "src", src);
34     return elem;
35   }
36
37   public static Element JavaDoc addButton(Element JavaDoc parent, String JavaDoc id, String JavaDoc src) {
38     Element JavaDoc elem = createImgButton(parent.getOwnerDocument(), id, src);
39     parent.appendChild(elem);
40     return elem;
41   }
42   
43 }
44
Popular Tags