KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > convert > CheckBoxConverter


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.convert;
14
15 import java.util.Map JavaDoc;
16
17 import org.w3c.dom.Element JavaDoc;
18
19 import com.tonbeller.wcf.ui.CheckBox;
20
21 /**
22  * Created on 14.11.2002
23  *
24  * @author av
25  */

26 public class CheckBoxConverter extends BooleanConverter {
27
28   /**
29    * @see com.tonbeller.wcf.convert.BooleanConverter#isSelected(Element, Map)
30    */

31   public int isSelected(Element JavaDoc elem, Map JavaDoc params) {
32     
33     // disabled = true? return
34
if (CheckBox.isDisabled(elem))
35       return UNKNOWN;
36
37     // was the form submitted at all?
38
String JavaDoc id = CheckBox.getId(elem);
39     Object JavaDoc inputAvailable = params.get(id + ".valid");
40     if (inputAvailable == null)
41       return UNKNOWN;
42     
43     Object JavaDoc value = params.get(id);
44     if (value == null)
45       return FALSE;
46     return TRUE;
47   }
48
49 }
50
Popular Tags