net.sf.colle.forms
Class Structure

java.lang.Object
  extended bynet.sf.colle.forms.Structure
All Implemented Interfaces:
FormElement
Direct Known Subclasses:
Form

public class Structure
extends Object
implements FormElement

This class defines a grouping of form elements. Created: 10 Jul 2001

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

Field Summary
 
Fields inherited from interface net.sf.colle.forms.FormElement
ERROR_INVALID, ERROR_REQUIRED, UNKNOWN, VALID
 
Constructor Summary
Structure(String psName, Object pxApplicationElement, FormElement pxParent)
          Create a new structure element.
 
Method Summary
 void add(FormElement pxElement)
          Appends the specified element to the end of this list.
 Object getApplicationElement()
          Returns the application object that corresponds to this form object.
 FormElement getElement(String psName)
          Returns a form element by it's name.
 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)
          Maps the element into a DOM document.
protected  org.jdom.Element mapImpl(org.jdom.Element pxElement)
           
 void service(HttpServletRequest pxRequest, org.jdom.Element pxOldValue)
          Process the returing 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Structure

public Structure(String psName,
                 Object pxApplicationElement,
                 FormElement pxParent)
Create a new structure element.

Parameters:
psName - name of element
pxParent - path to the parent in the xml tree
Method Detail

add

public void add(FormElement pxElement)
Appends the specified element to the end of this list.

Parameters:
pxElement - element to be data

map

public void map(org.jdom.Element pxElement)
Maps the element into a DOM document.

Specified by:
map in interface FormElement
Parameters:
pxElement - parent element to add new elements onto

getElement

public FormElement getElement(String psName)
Returns a form element by it's name.

Parameters:
psName - name of form element
Returns:
FormElement found

getErrorCode

public String getErrorCode()
Returns the error code of the element

Specified by:
getErrorCode in interface FormElement
Returns:
error code

getName

public String getName()
Description copied from interface: FormElement
Returns the name of the the form element.

Specified by:
getName in interface FormElement
Returns:
the name
See Also:
FormElement

getApplicationElement

public Object getApplicationElement()
Description copied from interface: FormElement
Returns the application object that corresponds to this form object.

Specified by:
getApplicationElement in interface FormElement
See Also:
FormElement

getPath

public String getPath()
Description copied from interface: FormElement
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.

Specified by:
getPath in interface FormElement
Returns:
the name
See Also:
FormElement

service

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

Specified by:
service in interface FormElement
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)
Description copied from interface: FormElement
Sets the error code. JSP's may do this to display an error found outside of built-in validation.

Specified by:
setErrorCode in interface FormElement
Parameters:
psCode - error code
See Also:
FormElement

setToDefault

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

Specified by:
setToDefault in interface FormElement
Parameters:
pbRecursive - on true set child elements

validate

public int validate(boolean pbRecursive)
validate the element.

Specified by:
validate in interface FormElement
Parameters:
pbRecursive - on true check child elements
Returns:
error count

mapImpl

protected org.jdom.Element mapImpl(org.jdom.Element pxElement)