|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.woody.formmodel.AbstractWidget org.apache.cocoon.woody.formmodel.MultiValueField
public class MultiValueField
A MultiValueField is mostly the same as a normal Field
, but can
hold multiple values. A MultiValueField should have a Datatype which
has a SelectionList, because the user will always select the values
from a list. A MultiValueField has no concept of "required", you should
instead use the ValueCountValidationRule to check how many items the user
has selected.
A MultiValueField also has a Datatype
associated with it. In case of MultiValueFields, this Datatype will always be an array
type, thus Datatype.isArrayType()
will
always return true, and this in return has an influence on the kind of validation rules that
can be used with the Datatype (see Datatype
description for more information).
Field Summary |
---|
Fields inherited from class org.apache.cocoon.woody.formmodel.AbstractWidget |
---|
definition |
Constructor Summary | |
---|---|
MultiValueField(MultiValueFieldDefinition definition)
|
Method Summary | |
---|---|
void |
broadcastEvent(WidgetEvent event)
Broadcast an event previously queued by this widget to its event listeners. |
void |
generateLabel(ContentHandler contentHandler)
Generates SAX events for the label of this widget. |
void |
generateSaxFragment(ContentHandler contentHandler,
Locale locale)
Generates an XML representation of this widget. |
String |
getId()
Gets the id of this widget. |
ValidationError |
getValidationError()
|
Object |
getValue()
Returns the value of the widget. |
void |
readFromRequest(FormContext formContext)
Lets this widget read its data from a request. |
void |
setSelectionList(Object model,
String valuePath,
String labelPath)
Set this field's selection list using values from an in-memory object. |
void |
setSelectionList(SelectionList selectionList)
Set this field's selection list. |
void |
setSelectionList(String uri)
Read this field's selection list from an external source. |
void |
setValidationError(ValidationError error)
|
void |
setValue(Object value)
Sets the value of this widget to the given object. |
void |
setValues(Object[] values)
|
boolean |
validate(FormContext formContext)
Validates this widget and returns the outcome. |
Methods inherited from class org.apache.cocoon.woody.formmodel.AbstractWidget |
---|
addValidator, generateItemSaxFragment, generateSaxFragment, getForm, getFullyQualifiedId, getLocation, getNamespace, getParent, getWidget, isRequired, removeValidator, setDefinition, setLocation, setParent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.cocoon.woody.formmodel.Widget |
---|
getForm, getFullyQualifiedId, getLocation, getNamespace, getParent, getWidget, isRequired, setParent |
Constructor Detail |
---|
public MultiValueField(MultiValueFieldDefinition definition)
Method Detail |
---|
public String getId()
AbstractWidget
getId
in interface Widget
getId
in class AbstractWidget
public void readFromRequest(FormContext formContext)
Widget
readFromRequest
in interface Widget
public boolean validate(FormContext formContext)
Widget
Widget.generateSaxFragment(ContentHandler, Locale)
method.
validate
in interface Widget
validate
in class AbstractWidget
public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException
Widget
generateSaxFragment
in interface Widget
SAXException
public void generateLabel(ContentHandler contentHandler) throws SAXException
Widget
generateLabel
in interface Widget
generateLabel
in class AbstractWidget
SAXException
public Object getValue()
Widget
getValue
in interface Widget
getValue
in class AbstractWidget
public void setValue(Object value)
Widget
setValue
in interface Widget
setValue
in class AbstractWidget
public void setValues(Object[] values)
public void setSelectionList(SelectionList selectionList)
setSelectionList
in interface SelectableWidget
selectionList
- The new selection list.public void setSelectionList(String uri)
wd:selection-list
element.
setSelectionList
in interface SelectableWidget
uri
- The URI of the source.public void setSelectionList(Object model, String valuePath, String labelPath)
object
parameter should point to a collection
(Java collection or array, or Javascript array) of objects. Each object
belonging to the collection should have a value property and a
label property, whose values are used to specify the value
attribute and the contents of the wd:label
child element
of every wd:item
in the list.
Access to the values of the above mentioned properties is done via XPath expressions.
setSelectionList
in interface SelectableWidget
model
- The collection used as a model for the selection list.valuePath
- An XPath expression referring to the attribute used
to populate the values of the list's items.labelPath
- An XPath expression referring to the attribute used
to populate the labels of the list's items.public void broadcastEvent(WidgetEvent event)
Widget
broadcastEvent
in interface Widget
broadcastEvent
in class AbstractWidget
public ValidationError getValidationError()
getValidationError
in interface ValidationErrorAware
public void setValidationError(ValidationError error)
setValidationError
in interface ValidationErrorAware
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |