|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.cocoon.forms.formmodel.AbstractWidget
org.apache.cocoon.forms.formmodel.Field
org.apache.cocoon.forms.formmodel.AggregateField
public class AggregateField
An aggregated field allows to represent one value as multiple input fields, or several values as one field. Hence this widget is a field and a container widget simultaneously.
Upon submit, it first attempts to read own value from the request, and splits over nested field widgets using a regular expression. If split fails, this will simply give a validation error. If own value was not submitted, it attempts to read values for nested field widgets, and combines theirs values using combine expression.
To validate this widget, both the validation rules of the nested widgets are checked, and those of the aggregated field themselves. The validation rules of the aggregated field can perform checks on the string as entered by the user (e.g. check its total length).
This field and nested fields can be of any supported type, as long as combine expression gives result of the correct type, and split regular expression can split string representation into parts which can be converted to the values of nested fields.
| Field Summary |
|---|
| Fields inherited from class org.apache.cocoon.forms.formmodel.Field |
|---|
enteredValue, required, selectionList, SUGGESTED_LABEL_ATTR, suggestionList, validationError, value, VALUE_DISPLAY_PARSE_ERROR, VALUE_DISPLAY_VALIDATION, VALUE_PARSE_ERROR, VALUE_PARSED, VALUE_UNPARSED, VALUE_VALIDATED, VALUE_VALIDATING, valueState |
| Fields inherited from class org.apache.cocoon.forms.formmodel.AbstractWidget |
|---|
wasValid |
| Fields inherited from interface org.apache.cocoon.forms.formmodel.Widget |
|---|
PATH_SEPARATOR |
| Constructor Summary | |
|---|---|
AggregateField(AggregateFieldDefinition definition)
|
|
| Method Summary | |
|---|---|
void |
addChild(Widget widget)
Adds a child widget. |
protected void |
addField(Field field)
|
void |
combineFields()
|
AggregateFieldDefinition |
getAggregateFieldDefinition()
|
Widget |
getChild(String id)
Concrete widgets that contain actual child widgets should override to return the actual child-widget. |
Iterator |
getChildren()
|
String |
getXMLElementName()
The XML element name used in AbstractWidget.generateSaxFragment(ContentHandler, Locale)
to produce the wrapping element for all the XML-instance-content of this Widget. |
boolean |
hasChild(String id)
Checks if there is a child widget with the given id. |
void |
initialize()
Called after widget's environment has been setup, to allow for any contextual initalization, such as looking up case widgets for union widgets. |
void |
readFromRequest(FormContext formContext)
Lets this widget read its data from a request. |
void |
setValue(Object newValue)
Sets the value of this widget. |
boolean |
validate()
Validates this widget and returns the outcome. |
| Methods inherited from class org.apache.cocoon.forms.formmodel.Field |
|---|
addValueChangedListener, applyWhitespaceTrim, broadcastEvent, generateItemSaxFragment, getDatatype, getDefinition, getFieldDefinition, getSuggestionLabel, getSuggestionList, getValidationError, getValue, getXMLElementAttributes, hasValueChangedListeners, isRequired, isSuggested, readFromRequest, removeValueChangedListener, setRequired, setSelectionList, setSelectionList, setSelectionList, setSuggestionLabel, setSuggestionList, setSuggestionList, setValidationError |
| Methods inherited from class org.apache.cocoon.forms.formmodel.AbstractWidget |
|---|
addValidator, generateDisplayData, generateLabel, generateSaxFragment, getAttribute, getCombinedState, getForm, getFullName, getId, getLocation, getName, getParent, getRequestParameterName, getState, getWidget, isValid, lookupWidget, removeAttribute, removeValidator, setAttribute, setParent, setState, toString, widgetNameChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.cocoon.forms.formmodel.Widget |
|---|
addValidator, broadcastEvent, generateLabel, generateSaxFragment, getAttribute, getCombinedState, getDefinition, getForm, getFullName, getId, getLocation, getName, getParent, getRequestParameterName, getState, getValue, getWidget, isRequired, isValid, lookupWidget, removeAttribute, removeValidator, setAttribute, setParent, setState |
| Constructor Detail |
|---|
public AggregateField(AggregateFieldDefinition definition)
| Method Detail |
|---|
public final AggregateFieldDefinition getAggregateFieldDefinition()
public void initialize()
AbstractWidget
initialize in interface Widgetinitialize in class Fieldpublic void addChild(Widget widget)
ContainerWidget
addChild in interface ContainerWidgetprotected void addField(Field field)
public boolean hasChild(String id)
ContainerWidget
hasChild in interface ContainerWidgetpublic Iterator getChildren()
getChildren in interface ContainerWidgetpublic void readFromRequest(FormContext formContext)
Widget
readFromRequest in interface WidgetreadFromRequest in class Fieldpublic void setValue(Object newValue)
Widget
Not all widgets do have a value (notably ContainerWidgets,
but this method is provided here as a convenience to ease writing and avoiding casts.
setValue in interface WidgetsetValue in class FieldnewValue - the new widget's value.public void combineFields()
public boolean validate()
WidgetWidget.generateSaxFragment(ContentHandler, Locale) method.
validate in interface Widgetvalidate in class Fieldtrue to indicate all validations were ok,
false otherwiseWidget.validate()public String getXMLElementName()
AbstractWidgetAbstractWidget.generateSaxFragment(ContentHandler, Locale)
to produce the wrapping element for all the XML-instance-content of this Widget.
getXMLElementName in class Fieldpublic Widget getChild(String id)
AbstractWidget
getChild in interface ContainerWidgetgetChild in class AbstractWidgetid - of the child-widget
null if not overriden.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||