KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
19  * Button ctrl class, used as factory for generating buttons
20  */

21 public class Button extends XoplonCtrl {
22   public static final String JavaDoc NODENAME = "button";
23
24   public static boolean isButton(Element JavaDoc elem) {
25     return elem.getNodeName().equals(NODENAME);
26   }
27   
28   public static Element JavaDoc createButton(Document JavaDoc doc, String JavaDoc id, String JavaDoc label) {
29     Element JavaDoc retVal = XoplonCtrl.createCtrl(doc, NODENAME);
30     XoplonCtrl.setId(retVal, id);
31     XoplonCtrl.setLabel(retVal, label);
32     return retVal;
33   }
34
35   public static Element JavaDoc addButton(Element JavaDoc parent, String JavaDoc id, String JavaDoc label) {
36     Element JavaDoc retVal = createButton(parent.getOwnerDocument(), id, label);
37     parent.appendChild(retVal);
38     return retVal;
39   }
40 }
41
Popular Tags