KickJava   Java API By Example, From Geeks To Geeks.

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


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 /** base class factory for ListItem, RadioButton, CheckBox */
22 public abstract class Item extends XoplonCtrl {
23
24   /** select */
25   public static void setSelected(Element JavaDoc element, boolean flag) {
26     String JavaDoc selected = flag ? "true" : "false";
27     XoplonNS.setAttribute(element, "selected", selected);
28   }
29
30   /** select */
31   public static boolean isSelected(Element JavaDoc element) {
32     boolean flag = (XoplonNS.getAttribute(element, "selected")).equals("true") ? true : false;
33     return flag;
34   }
35
36   /** factory function */
37   protected static Element JavaDoc createItem(Document JavaDoc doc, String JavaDoc type) {
38     return EditCtrl.createValueHolder(doc, type);
39   }
40   
41   /** set the items value. Type and modelReference are properties of the parent (e.g. the ListBox itself) */
42   public static void setValue(Element JavaDoc element, String JavaDoc value) {
43     XoplonNS.setAttribute(element, "value", value);
44   }
45
46   /** get the items value. Type and modelReference are properties of the parent (e.g. the ListBox itself) */
47   public static String JavaDoc getValue(Element JavaDoc element) {
48     return XoplonNS.getAttribute(element, "value");
49   }
50
51   
52 }
53
Popular Tags