org.apache.cocoon.woody.formmodel
Class Upload

java.lang.Object
  extended by org.apache.cocoon.woody.formmodel.AbstractWidget
      extended by org.apache.cocoon.woody.formmodel.Upload
All Implemented Interfaces:
Widget, ValidationErrorAware

public class Upload
extends AbstractWidget
implements ValidationErrorAware

A file-uploading Widget. This widget gives access via Woody, to Cocoon's file upload functionality.

Version:
CVS $Id: Upload.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Upayavira, Sylvain Wallez

Field Summary
 
Fields inherited from class org.apache.cocoon.woody.formmodel.AbstractWidget
definition
 
Constructor Summary
Upload(UploadDefinition uploadDefinition)
           
 
Method Summary
 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.
 UploadDefinition getUploadDefinition()
           
 ValidationError getValidationError()
          Returns the validation error, if any.
 Object getValue()
          Returns the value of the widget.
 void readFromRequest(FormContext formContext)
          Lets this widget read its data from a request.
 void setValidationError(ValidationError error)
          Set a validation error on this field.
 void setValue(Object object)
          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, broadcastEvent, 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
 

Constructor Detail

Upload

public Upload(UploadDefinition uploadDefinition)
Method Detail

getUploadDefinition

public UploadDefinition getUploadDefinition()

getId

public String getId()
Description copied from class: AbstractWidget
Gets the id of this widget.

Specified by:
getId in interface Widget
Overrides:
getId in class AbstractWidget

getValue

public Object getValue()
Description copied from interface: Widget
Returns the value of the widget. For some widgets (notably ContainerWidgets) this may not make sense, those should then simply return null here.

Specified by:
getValue in interface Widget
Overrides:
getValue in class AbstractWidget

setValue

public void setValue(Object object)
Description copied from interface: Widget
Sets the value of this widget to the given object. Some widgets may not support this method, those should throw an runtime exception if you try to set their value anyway.

Specified by:
setValue in interface Widget
Overrides:
setValue in class AbstractWidget

readFromRequest

public void readFromRequest(FormContext formContext)
Description copied from interface: Widget
Lets this widget read its data from a request. At this point the Widget may try to convert the request parameter to its native datatype (if it is not a string), but it should not yet generate any validation errors.

Specified by:
readFromRequest in interface Widget

validate

public boolean validate(FormContext formContext)
Description copied from interface: Widget
Validates this widget and returns the outcome. Possible error messages are remembered by the widget itself and will be part of the XML produced by this widget in its Widget.generateSaxFragment(ContentHandler, Locale) method.

Specified by:
validate in interface Widget
Overrides:
validate in class AbstractWidget

getValidationError

public ValidationError getValidationError()
Returns the validation error, if any. There will always be a validation error in case the validate(FormContext) method returned false.

Specified by:
getValidationError in interface ValidationErrorAware

setValidationError

public void setValidationError(ValidationError error)
Set a validation error on this field. This allows fields to be externally marked as invalid by application logic.

Specified by:
setValidationError in interface ValidationErrorAware
Parameters:
error - the validation error

generateSaxFragment

public void generateSaxFragment(ContentHandler contentHandler,
                                Locale locale)
                         throws SAXException
Description copied from interface: Widget
Generates an XML representation of this widget. The startDocument and endDocument SAX events will not be called. It is assumed that the prefix for the Woody namespace mentioned in Constants.WI_PREFIX is already declared (by the caller or otherwise).

Specified by:
generateSaxFragment in interface Widget
Throws:
SAXException

generateLabel

public void generateLabel(ContentHandler contentHandler)
                   throws SAXException
Description copied from interface: Widget
Generates SAX events for the label of this widget. The label will not be wrapped inside another element.

Specified by:
generateLabel in interface Widget
Overrides:
generateLabel in class AbstractWidget
Throws:
SAXException


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.