KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > frontend > templateone > form > CmsFieldItem


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/frontend/templateone/form/CmsFieldItem.java,v $
3  * Date : $Date: 2005/06/23 11:11:54 $
4  * Version: $Revision: 1.7 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.frontend.templateone.form;
33
34 /**
35  * Represents a single input field item object.<p>
36  *
37  * This object is needed to create checkboxes, radio buttons and selectboxes
38  * and represents an item for these types.<p>
39  *
40  * @author Andreas Zahner
41  *
42  * @version $Revision: 1.7 $
43  *
44  * @since 6.0.0
45  */

46 public class CmsFieldItem {
47
48     private boolean m_isSelected;
49     private String JavaDoc m_label;
50     private String JavaDoc m_value;
51
52     /**
53      * Empty constructor creates an empty field item.<p>
54      */

55     public CmsFieldItem() {
56
57         m_label = "";
58         m_isSelected = false;
59         m_value = "";
60     }
61
62     /**
63      * Constructor that creates an initialized field item.<p>
64      *
65      * @param value the value of the field item
66      * @param label the label of the field item
67      * @param isSelected true if the current item is selected, otherwise false
68      */

69     public CmsFieldItem(String JavaDoc value, String JavaDoc label, boolean isSelected) {
70
71         m_label = label;
72         m_isSelected = isSelected;
73         m_value = value;
74     }
75
76     /**
77      * Returns the label text of the field item.<p>
78      *
79      * @return the label text of the field item
80      */

81     public String JavaDoc getLabel() {
82
83         return m_label;
84     }
85
86     /**
87      * Returns the value of the field item.<p>
88      *
89      * @return the value of the field item
90      */

91     public String JavaDoc getValue() {
92
93         return m_value;
94     }
95
96     /**
97      * Returns if the current item is selected or not.<p>
98      *
99      * @return true if the current item is selected, otherwise false
100      */

101     public boolean isSelected() {
102
103         return m_isSelected;
104     }
105
106     /**
107      * Sets the label text of the field item.<p>
108      *
109      * @param label the description text of the field item
110      */

111     protected void setLabel(String JavaDoc label) {
112
113         m_label = label;
114     }
115
116     /**
117      * Sets if the current item is selected or not.<p>
118      *
119      * @param isSelected true if the current item is selected, otherwise false
120      */

121     protected void setSelected(boolean isSelected) {
122
123         m_isSelected = isSelected;
124     }
125
126     /**
127      * Sets the value of the field item.<p>
128      *
129      * @param value the value of the field item
130      */

131     protected void setValue(String JavaDoc value) {
132
133         m_value = value;
134     }
135 }
136
Popular Tags