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
,IClusterable
Uploads files from a drop event.
- Author:
- Andrew Kondratev, svenmeier
- See Also:
-
Field Summary
Fields inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
INDICATOR
-
Constructor Summary
ConstructorDescriptionListen for 'dragover' and 'drop' events and prevent them, only 'drop' will initiate an Ajax request. -
Method Summary
Modifier and TypeMethodDescriptionlong
Gets maximum count of filesprotected void
onError
(AjaxRequestTarget target, org.apache.commons.fileupload2.core.FileUploadException fux) Hook method called to handle any error during uploading of the file.protected void
onEvent
(AjaxRequestTarget target) Listener method for the ajax eventprotected void
onFileUpload
(AjaxRequestTarget target, List<FileUpload> files) Hook method called after a file was uploaded.void
renderHead
(Component component, IHeaderResponse response) Render to the web response whatever the component wants to contribute to the head section.void
setFileCountMax
(long fileCountMax) Sets maximum amount of files in upload request.void
setFileMaxSize
(Bytes fileMaxSize) Set an optional maximum size per file.void
setMaxSize
(Bytes maxSize) Set the maximum upload size.protected void
updateAjaxAttributes
(AjaxRequestAttributes attributes) Gives a chance to the specializations to modify the attributes.Methods inherited from class org.apache.wicket.ajax.AjaxEventBehavior
getEvent, onEvent, respond
Methods inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
findIndicatorId, getAttributes, getCallbackFunction, getCallbackFunctionBody, getCallbackScript, getCallbackScript, onBind, onMethodMismatch, onRequest, postprocessConfiguration, renderAjaxAttributes, renderAjaxAttributes
Methods inherited from class org.apache.wicket.behavior.AbstractAjaxBehavior
afterRender, bind, getCallbackUrl, getComponent, onComponentRendered, onComponentTag, onComponentTag, onUnbind, unbind
Methods inherited from class org.apache.wicket.behavior.Behavior
beforeRender, canCallListener, detach, getStatelessHint, isEnabled, isTemporary, onAttribute, onConfigure, onEvent, onException, onRemove, onTag
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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
Description copied from class:Behavior
Render to the web response whatever the component wants to contribute to the head section.- Specified by:
renderHead
in interfaceIComponentAwareHeaderContributor
- Overrides:
renderHead
in classAjaxEventBehavior
- Parameters:
component
- component which is contributing to the response. This parameter is here to give the component as the context for component-awares implementing this interfaceresponse
- Response object- See Also:
-
updateAjaxAttributes
Description copied from class:AbstractDefaultAjaxBehavior
Gives a chance to the specializations to modify the attributes.- Overrides:
updateAjaxAttributes
in classAjaxEventBehavior
-
onEvent
Description copied from class:AjaxEventBehavior
Listener method for the ajax event- Specified by:
onEvent
in classAjaxEventBehavior
- Parameters:
target
- the current request handler
-
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
-