Module org.apache.wicket.extensions
Class AjaxFileDropBehavior
java.lang.Object
org.apache.wicket.behavior.Behavior
org.apache.wicket.behavior.AbstractAjaxBehavior
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
org.apache.wicket.ajax.AjaxEventBehavior
org.apache.wicket.extensions.ajax.AjaxFileDropBehavior
- All Implemented Interfaces:
Serializable,IComponentAwareEventSink,IRequestListener,IComponentAwareHeaderContributor,org.apache.wicket.util.io.IClusterable
Uploads files from a drop event.
- Author:
- Andrew Kondratev, svenmeier
- See Also:
-
Field Summary
FieldsFields inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
INDICATOR -
Constructor Summary
ConstructorsConstructorDescriptionListen for 'dragover' and 'drop' events and prevent them, only 'drop' will initiate an Ajax request. -
Method Summary
Modifier and TypeMethodDescriptionlongGets maximum count of filesorg.apache.wicket.util.lang.Bytesorg.apache.wicket.util.lang.Bytesprotected voidonError(AjaxRequestTarget target, org.apache.commons.fileupload2.core.FileUploadException fux) Hook method called to handle any error during uploading of the file.protected voidonEvent(AjaxRequestTarget target) protected voidonFileUpload(AjaxRequestTarget target, List<FileUpload> files) Hook method called after a file was uploaded.voidrenderHead(Component component, IHeaderResponse response) voidsetFileCountMax(long fileCountMax) Sets maximum amount of files in upload request.voidsetFileMaxSize(org.apache.wicket.util.lang.Bytes fileMaxSize) Set an optional maximum size per file.voidsetMaxSize(org.apache.wicket.util.lang.Bytes maxSize) Set the maximum upload size.protected voidupdateAjaxAttributes(AjaxRequestAttributes attributes) Methods inherited from class org.apache.wicket.ajax.AjaxEventBehavior
getEvent, onEvent, respondMethods inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
findIndicatorId, getAttributes, getCallbackFunction, getCallbackFunctionBody, getCallbackScript, getCallbackScript, onBind, onMethodMismatch, onRequest, postprocessConfiguration, renderAjaxAttributes, renderAjaxAttributesMethods inherited from class org.apache.wicket.behavior.AbstractAjaxBehavior
afterRender, bind, getCallbackUrl, getComponent, onComponentRendered, onComponentTag, onComponentTag, onUnbind, unbindMethods inherited from class org.apache.wicket.behavior.Behavior
beforeRender, canCallListener, detach, getStatelessHint, isEnabled, isTemporary, onAttribute, onConfigure, onEvent, onException, onRemove, onTagMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.wicket.IRequestListener
rendersPage
-
Field Details
-
DRAG_OVER_CLASS_KEY
-
-
Constructor Details
-
AjaxFileDropBehavior
public AjaxFileDropBehavior()Listen for 'dragover' and 'drop' events and prevent them, only 'drop' will initiate an Ajax request.
-
-
Method Details
-
renderHead
- Specified by:
renderHeadin interfaceIComponentAwareHeaderContributor- Overrides:
renderHeadin classAjaxEventBehavior
-
updateAjaxAttributes
- Overrides:
updateAjaxAttributesin classAjaxEventBehavior
-
onEvent
- Specified by:
onEventin classAjaxEventBehavior
-
getMaxSize
-
setMaxSize
Set the maximum upload size.- Parameters:
maxSize- maximum size, must not be null
-
getFileMaxSize
-
setFileMaxSize
Set an optional maximum size per file.- Parameters:
fileMaxSize- maximum size for each uploaded file
-
getFileCountMax
Gets maximum count of files- Returns:
-
setFileCountMax
Sets maximum amount of files in upload request.- Parameters:
fileCountMax-
-
onFileUpload
Hook method called after a file was uploaded.Note:
onError(AjaxRequestTarget, FileUploadException)is called instead when uploading failed- Parameters:
target- the current request handlerfiles- uploaded files
-
onError
protected void onError(AjaxRequestTarget target, org.apache.commons.fileupload2.core.FileUploadException fux) Hook method called to handle any error during uploading of the file.Default implementation re-throws the exception.
- Parameters:
target- the current request handlerfux- the error that occurred
-