org.barracudamvc.contrib.dbroggisch.repopulation
Class RepopulationFormMap

java.lang.Object
  extended byorg.barracudamvc.core.forms.DefaultFormMap
      extended byorg.barracudamvc.contrib.dbroggisch.repopulation.ErrorFormMap
          extended byorg.barracudamvc.contrib.dbroggisch.repopulation.RepopulationFormMap
All Implemented Interfaces:
Contextual, FormMap, Model, StateMap, TemplateModel
Direct Known Subclasses:
XmlFormMap

public class RepopulationFormMap
extends ErrorFormMap
implements TemplateModel

The class RepopulationFormMap provides a convenient way to repopulate HTML form contents. It can be used as a TemplateModel. The values of the defined FormElements are wrapped into a BInput. The BInput sets the name of the FormElement. If a prefix has been given -- either explicit with setPrefix() or implicit by the overloaded map(..)-methods -- it will be prepended to the name.

Version:
1.0
Author:
Diez Roggisch

Field Summary
protected  List _modelChilds
           
protected  List listeners
           
protected static org.apache.log4j.Logger logger
           
protected  String modelName
          Describe variable modelName here.
protected  String prefix
          The prefix can be used to limit the
protected  ViewContext viewContext
           
 
Fields inherited from class org.barracudamvc.contrib.dbroggisch.repopulation.ErrorFormMap
ERROR_PREFIX
 
Fields inherited from class org.barracudamvc.core.forms.DefaultFormMap
defaultLoc, elements, formMapper, localLogger, statemap, validators, zloc
 
Constructor Summary
RepopulationFormMap()
           
 
Method Summary
 void addModelListener(ModelListener ml)
           
 FormElement defineElement(FormElement element)
          This defines an element to be mapped by this form, using the key from the FormElement.
 FormElement defineElement(String key, FormElement element)
          This defines an element to be mapped by this form, using a manually specified key.
 void fireModelChanged()
          Forwards the given notification event to all TemplateModelListeners that registered themselves as listeners for this template model.
 List getChildModels()
           
 Object getItem(String key)
          Describe getItem method here.
 Object getItem(TemplateDirective td)
           
 String getName()
          Describe getName method here.
 String getPrefix()
          Describe getPrefix method here.
 ViewContext getViewContext()
           
 boolean processDirective(TemplateDirective td)
           
 void removeModelListener(ModelListener ml)
           
 void setName(String name)
          Describe setName method here.
 void setPrefix(String prefix)
          Describe setPrefix method here.
 void setViewContext(ViewContext vc)
           
 
Methods inherited from class org.barracudamvc.contrib.dbroggisch.repopulation.ErrorFormMap
addErrorComponent, getErrorComponent, validate
 
Methods inherited from class org.barracudamvc.core.forms.DefaultFormMap
clearState, defineValidator, exists, getElement, getElements, getFormMapper, getLocale, getState, getStateKeys, getStateStore, getVal, getVal, getVals, getVals, map, map, mapElement, putState, removeState, setFormMapper, setLocale, setVal, validateElements, validateForm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger

prefix

protected String prefix
The prefix can be used to limit the


modelName

protected String modelName
Describe variable modelName here.


viewContext

protected ViewContext viewContext

listeners

protected List listeners

_modelChilds

protected List _modelChilds
Constructor Detail

RepopulationFormMap

public RepopulationFormMap()
Method Detail

defineElement

public FormElement defineElement(FormElement element)
Description copied from class: DefaultFormMap
This defines an element to be mapped by this form, using the key from the FormElement. You would invoke this method for each element in the form.

Specified by:
defineElement in interface FormMap
Overrides:
defineElement in class DefaultFormMap
Parameters:
element - a FormElement to be mapped by this form
Returns:
a reference to the newly defined FormElement

defineElement

public FormElement defineElement(String key,
                                 FormElement element)
Description copied from class: DefaultFormMap
This defines an element to be mapped by this form, using a manually specified key. Generally, you won't need to use this method unless you are writing some kind of framwork that maps multiple elements into a for (ie. with different variations on a name), all via the same fundamental key.

Specified by:
defineElement in interface FormMap
Overrides:
defineElement in class DefaultFormMap
Parameters:
key - a manually specified key
element - a FormElement to be mapped by this form
Returns:
a reference to the newly defined FormElement

getChildModels

public List getChildModels()

setPrefix

public void setPrefix(String prefix)
Describe setPrefix method here.

Parameters:
prefix - a String value

getPrefix

public String getPrefix()
Describe getPrefix method here.

Returns:
a String value

getItem

public Object getItem(String key)
Describe getItem method here.

Parameters:
key -
Returns:

getItem

public Object getItem(TemplateDirective td)
Specified by:
getItem in interface TemplateModel

setViewContext

public void setViewContext(ViewContext vc)
Specified by:
setViewContext in interface Contextual
Parameters:
vc -

getViewContext

public ViewContext getViewContext()
Specified by:
getViewContext in interface Contextual
Returns:

getName

public String getName()
Describe getName method here.

Specified by:
getName in interface TemplateModel
Returns:

setName

public void setName(String name)
Describe setName method here.

Parameters:
name - a String value

processDirective

public boolean processDirective(TemplateDirective td)
Specified by:
processDirective in interface TemplateModel
Parameters:
td -
Returns:

addModelListener

public void addModelListener(ModelListener ml)
Specified by:
addModelListener in interface Model
Parameters:
ml -

removeModelListener

public void removeModelListener(ModelListener ml)
Specified by:
removeModelListener in interface Model
Parameters:
ml -

fireModelChanged

public void fireModelChanged()
Forwards the given notification event to all TemplateModelListeners that registered themselves as listeners for this template model.



Copyright © 2004 BarracudaMVC.org All Rights Reserved.