KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/frontend/templateone/form/I_CmsField.java,v $
3  * Date : $Date: 2005/09/09 10:31:59 $
4  * Version: $Revision: 1.3 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (C) 2002 - 2004 Alkacon Software (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, 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 import org.opencms.i18n.CmsMessages;
35
36 import java.util.List JavaDoc;
37
38 /**
39  * Defines the methods required for form fields.<p>
40  *
41  * @author Thomas Weckert (t.weckert@alkacon.com)
42  * @version $Revision: 1.3 $
43  */

44 public interface I_CmsField {
45
46     /**
47      * Returns the list of items for select boxes, radio buttons and checkboxes.<p>
48      *
49      * The list contains CmsFieldItem objects with the following information:
50      * <ol>
51      * <li>the value of the item</li>
52      * <li>the description of the item</li>
53      * <li>the selection of the item (true or false)</li>
54      * </ol>
55      *
56      * @return the list of items for select boxes, radio buttons and checkboxes
57      */

58     List JavaDoc getItems();
59
60     /**
61      * Returns the description text of the input field.<p>
62      *
63      * @return the description text of the input field
64      */

65     String JavaDoc getLabel();
66
67     /**
68      * Returns the name of the input field.<p>
69      *
70      * @return the name of the input field
71      */

72     String JavaDoc getName();
73
74     /**
75      * Returns the type of the input field, e.g. "text" or "select".<p>
76      *
77      * @return the type of the input field
78      */

79     String JavaDoc getType();
80
81     /**
82      * Returns the regular expression that is used for validation of the field.<p>
83      *
84      * @return the regular expression that is used for validation of the field
85      */

86     String JavaDoc getValidationExpression();
87
88     /**
89      * Returns the initial value of the field.<p>
90      *
91      * @return the initial value of the field
92      */

93     String JavaDoc getValue();
94     
95     /**
96      * Returns a optional, custom error message to be displayed instead of the standard validation error message.<p>
97      *
98      * @return a custom error message for validation errors, or null
99      */

100     String JavaDoc getErrorMessage();
101
102     /**
103      * Returns if this input field is mandatory.<p>
104      *
105      * @return true if this input field is mandatory, otherwise false
106      */

107     boolean isMandatory();
108
109     /**
110      * Checks if an item list is needed for this field.<p>
111      *
112      * @return true if an item list is needed for this field, otherwise false
113      */

114     boolean needsItems();
115
116     /**
117      * Validates this field by validating it's constraints and input value.<p>
118      *
119      * @param formHandler the handler of the current form
120      * @return null in case of no error, {@link CmsFormHandler#ERROR_VALIDATION} if validation of the input value failed, {@link CmsFormHandler#ERROR_VALIDATION} if validation of the input value failed
121      */

122     String JavaDoc validate(CmsFormHandler formHandler);
123     
124     /**
125      * Builds the HTML input element for this element to be used in a frontend JSP.<p>
126      *
127      * @param formHandler the handler of the current form
128      * @param messages a resource bundle containing HTML snippets to build the HTML element
129      * @param errorKey the key of the current error message
130      *
131      * @return the HTML input element for this element to be used in a frontend JSP
132      */

133     String JavaDoc buildHtml(CmsFormHandler formHandler, CmsMessages messages, String JavaDoc errorKey);
134     
135 }
Popular Tags