|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.cocoon.woody.formmodel.AbstractWidget
org.apache.cocoon.woody.formmodel.Field
public class Field
A general-purpose Widget that can hold one value. A Field widget can be associated
with a Datatype, and thus
a Field widget can be used to edit different kinds of data, such as strings,
numbers and dates. A Datatype can also have an associated SelectionList, so
that the value for the Field can be selected from a list, rather than being
entered in a textbox. The validation of the field is delegated to its associated
Datatype.
| Field Summary | |
|---|---|
protected String |
enteredValue
|
protected boolean |
needsParse
|
protected boolean |
needsValidate
|
protected SelectionList |
selectionList
|
protected ValidationError |
validationError
|
protected Object |
value
|
| Fields inherited from class org.apache.cocoon.woody.formmodel.AbstractWidget |
|---|
definition |
| Constructor Summary | |
|---|---|
Field(FieldDefinition fieldDefinition)
|
|
| 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. |
Datatype |
getDatatype()
|
FieldDefinition |
getFieldDefinition()
|
String |
getId()
Gets the id of this widget. |
ValidationError |
getValidationError()
Returns the validation error, if any. |
Object |
getValue()
Returns the value of the widget. |
boolean |
isRequired()
Returns wether this widget is required to be filled in. |
void |
readFromRequest(FormContext formContext)
Lets this widget read its data from a request. |
protected void |
readFromRequest(String newEnteredValue)
|
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)
Set a validation error on this field. |
void |
setValue(Object newValue)
Sets the value of this widget to the given object. |
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, 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, setParent |
| Field Detail |
|---|
protected SelectionList selectionList
protected String enteredValue
protected Object value
protected boolean needsParse
protected boolean needsValidate
protected ValidationError validationError
| Constructor Detail |
|---|
public Field(FieldDefinition fieldDefinition)
| Method Detail |
|---|
public final FieldDefinition getFieldDefinition()
public String getId()
AbstractWidget
getId in interface WidgetgetId in class AbstractWidgetpublic Object getValue()
Widget
getValue in interface WidgetgetValue in class AbstractWidgetpublic void setValue(Object newValue)
Widget
setValue in interface WidgetsetValue in class AbstractWidgetpublic void readFromRequest(FormContext formContext)
Widget
readFromRequest in interface Widgetprotected void readFromRequest(String newEnteredValue)
public boolean validate(FormContext formContext)
WidgetWidget.generateSaxFragment(ContentHandler, Locale) method.
validate in interface Widgetvalidate in class AbstractWidgetpublic ValidationError getValidationError()
validate(FormContext) method returned false.
getValidationError in interface ValidationErrorAwarepublic void setValidationError(ValidationError error)
setValidationError in interface ValidationErrorAwareerror - the validation errorpublic boolean isRequired()
WidgetWidget.getValue(), for some
widgets this may not make sense, those should return false here.
isRequired in interface WidgetisRequired in class AbstractWidget
public void generateSaxFragment(ContentHandler contentHandler,
Locale locale)
throws SAXException
Widget
generateSaxFragment in interface WidgetSAXException
public void generateLabel(ContentHandler contentHandler)
throws SAXException
Widget
generateLabel in interface WidgetgenerateLabel in class AbstractWidgetSAXExceptionpublic void setSelectionList(SelectionList selectionList)
setSelectionList in interface SelectableWidgetselectionList - The new selection list.public void setSelectionList(String uri)
wd:selection-list
element.
setSelectionList in interface SelectableWidgeturi - 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 SelectableWidgetmodel - 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 Datatype getDatatype()
getDatatype in interface DataWidgetpublic void broadcastEvent(WidgetEvent event)
Widget
broadcastEvent in interface WidgetbroadcastEvent in class AbstractWidget
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||