org.barracudamvc.core.forms
Interface FormElement

All Superinterfaces:
Comparable
All Known Implementing Classes:
CheckboxFormElement, DefaultFormElement, GroupFormElement, SelectFormElement, TextAreaFormElement, UploadElement, UploadLinkElement

public interface FormElement
extends Comparable

This interfaces defines the methods a class needs to implement to act as a FormElement.

A FormElement defines how an element in a FormMap should be mapped to a first class java object. There are several key pieces of information required:

Once we have this information, we basically have enough data to map a String value in the data source to a first class Java object in the element.

Note that you can optionally specify a Format object, which will be used by FormUtil.repopulate() and FormUtil.formatForOutput() to render the form value in a manner that will be fit for human consumption (as well as subsequent form reparsing).

Also note that all of the setters have been modified to return a reference to the FormElement. This makes it possible to chain your calls on a single line, like this:

new DefaultFormElement(...).setName("foo").setDefaultVal("blah")


Method Summary
 boolean allowMultiples()
           
 Object getDefaultVal()
           
 Format getFormat()
           
 String getKey()
           
 String getName()
           
 Object getOrigVal()
           
 FormMap getParentForm()
           
 ParseException getParseException()
           
 FormType getType()
           
 Object getVal()
           
 Object getVal(Object dflt)
           
 FormValidator getValidator()
           
 Object[] getVals()
           
 Object[] getVals(Object[] dflt)
           
 FormElement setAllowMultiples(boolean val)
           
 FormElement setDefaultVal(Object defaultVal)
           
 FormElement setFormat(Format iformat)
           
 FormElement setKey(String key)
           
 FormElement setName(String name)
           
 FormElement setOrigVal(Object iorigVal)
           
 FormElement setParentForm(FormMap iparent)
           
 FormElement setParseException(ParseException pe)
           
 FormElement setType(FormType type)
           
 FormElement setVal(Object ival)
           
 FormElement setValidator(FormValidator validator)
           
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

setKey

FormElement setKey(String key)

getKey

String getKey()

setName

FormElement setName(String name)

getName

String getName()

setType

FormElement setType(FormType type)

getType

FormType getType()

setDefaultVal

FormElement setDefaultVal(Object defaultVal)

getDefaultVal

Object getDefaultVal()

setAllowMultiples

FormElement setAllowMultiples(boolean val)

allowMultiples

boolean allowMultiples()

setValidator

FormElement setValidator(FormValidator validator)

getValidator

FormValidator getValidator()

setOrigVal

FormElement setOrigVal(Object iorigVal)

getOrigVal

Object getOrigVal()

setVal

FormElement setVal(Object ival)

getVal

Object getVal()

getVal

Object getVal(Object dflt)

getVals

Object[] getVals()

getVals

Object[] getVals(Object[] dflt)

setParseException

FormElement setParseException(ParseException pe)

getParseException

ParseException getParseException()

setFormat

FormElement setFormat(Format iformat)

getFormat

Format getFormat()

setParentForm

FormElement setParentForm(FormMap iparent)

getParentForm

FormMap getParentForm()


Copyright © 2006 BarracudaMVC.org All Rights Reserved.