net.sf.colle.forms
Interface FormElement

All Known Implementing Classes:
FormList, FormSet, Structure, Text

public interface FormElement

The interfase that all form elements derive from. Created: 10 Jul 2001

Version:
$Revision: 1.1 $, $Date: 2003/06/26 18:11:41 $
Author:
Jeremy Miller

Field Summary
static String ERROR_INVALID
           
static String ERROR_REQUIRED
           
static String UNKNOWN
           
static String VALID
           
 
Method Summary
 Object getApplicationElement()
          Returns the application object that corresponds to this form object.
 String getErrorCode()
          Returns the error code of the element.
 String getName()
          Returns the name of the the form element.
 String getPath()
          Returns the path to the form element.
 void map(org.jdom.Element pxElement)
          Write out the the element into the DOM tree.
 void service(HttpServletRequest pxRequest, org.jdom.Element pxOldValue)
          Process the returning HTTP request.
 void setErrorCode(String psCode)
          Sets the error code.
 void setToDefault(boolean pbRecursive)
          Return value to the default settings.
 int validate(boolean pbRecursive)
          validate the element.
 

Field Detail

VALID

public static final String VALID
See Also:
Constant Field Values

ERROR_REQUIRED

public static final String ERROR_REQUIRED
See Also:
Constant Field Values

ERROR_INVALID

public static final String ERROR_INVALID
See Also:
Constant Field Values

UNKNOWN

public static final String UNKNOWN
See Also:
Constant Field Values
Method Detail

getErrorCode

public String getErrorCode()
Returns the error code of the element. Validation must be performed before calling this method or no error codes will be returned.

Returns:
error code

getName

public String getName()
Returns the name of the the form element.

Returns:
the name

getPath

public String getPath()
Returns the path to the form element. This path uniquely identifies the data object in the DOM tree and when the object is returned through the form.

Returns:
the name

getApplicationElement

public Object getApplicationElement()
Returns the application object that corresponds to this form object.


map

public void map(org.jdom.Element pxElement)
Write out the the element into the DOM tree. Care must be taken to *NOT* validate the form element in this method and to only report validation errors if validate has been called.

Parameters:
pxElement - parent element to add new elements onto

service

public void service(HttpServletRequest pxRequest,
                    org.jdom.Element pxOldValue)
Process the returning HTTP request.

Parameters:
pxRequest - http request to fetch data from
pxOldValue - form element details when the form was sent to the user

setErrorCode

public void setErrorCode(String psCode)
Sets the error code. JSP's may do this to display an error found outside of built-in validation.

Parameters:
psCode - error code

setToDefault

public void setToDefault(boolean pbRecursive)
Return value to the default settings.

Parameters:
pbRecursive - on true set child elements

validate

public int validate(boolean pbRecursive)
validate the element.

Parameters:
pbRecursive - on true check child elements
Returns:
error count