org.barracudamvc.core.forms
Interface FormElement

All Superinterfaces:
Comparable
All Known Implementing Classes:
DefaultFormElement

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

public FormElement setKey(String key)

getKey

public String getKey()

setName

public FormElement setName(String name)

getName

public String getName()

setType

public FormElement setType(FormType type)

getType

public FormType getType()

setDefaultVal

public FormElement setDefaultVal(Object defaultVal)

getDefaultVal

public Object getDefaultVal()

setAllowMultiples

public FormElement setAllowMultiples(boolean val)

allowMultiples

public boolean allowMultiples()

setValidator

public FormElement setValidator(FormValidator validator)

getValidator

public FormValidator getValidator()

setOrigVal

public FormElement setOrigVal(Object iorigVal)

getOrigVal

public Object getOrigVal()

setVal

public FormElement setVal(Object ival)

getVal

public Object getVal()

getVal

public Object getVal(Object dflt)

getVals

public Object[] getVals()

getVals

public Object[] getVals(Object[] dflt)

setParseException

public FormElement setParseException(ParseException pe)

getParseException

public ParseException getParseException()

setFormat

public FormElement setFormat(Format iformat)

getFormat

public Format getFormat()

setParentForm

public FormElement setParentForm(FormMap iparent)

getParentForm

public FormMap getParentForm()


Copyright © 2004 BarracudaMVC.org All Rights Reserved.