T
- Type of the component to be extended.public class FileDropTarget<T extends AbstractComponent> extends DropTargetExtension<T>
Dropped files are handled in the FileDropHandler
given in the
constructor. The file details are first sent to the handler, which can then
decide which files to upload to server by setting a StreamVariable
with Html5File.setStreamVariable(StreamVariable)
.
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
Constructor and Description |
---|
FileDropTarget(T target,
FileDropHandler<T> fileDropHandler)
Extends
target component and makes it a file drop target. |
Modifier and Type | Method and Description |
---|---|
T |
getParent()
Returns the component this extension is attached to.
|
protected FileDropTargetState |
getState()
Returns the shared state for this connector.
|
protected FileDropTargetState |
getState(boolean markAsDirty)
Returns the shared state for this connector.
|
protected void |
onDrop(Map<String,FileParameters> fileParams)
Invoked when a file or files have been dropped on client side.
|
addDropListener, attach, getDropCriteriaScript, getDropEffect, onDrop, registerDropTargetRpc, setDropCriteria, setDropCriteriaScript, setDropCriterion, setDropCriterion, setDropCriterion, setDropEffect
extend, getSupportedParentType, remove, setParent
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, beforeClientResponse, createState, detach, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isConnectorEnabled, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, getUI, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
getConnectorId
public FileDropTarget(T target, FileDropHandler<T> fileDropHandler)
target
component and makes it a file drop target. A file
drop handler needs to be added to handle the file drop event.target
- Component to be extended.fileDropHandler
- File drop handler that handles the file drop event.FileDropEvent
protected void onDrop(Map<String,FileParameters> fileParams)
FileDropEvent
.fileParams
- map from file ids to actual file detailsprotected FileDropTargetState getState()
AbstractClientConnector
As a side effect, marks the connector dirty so any changes done to the
state will be sent to the client. Use getState(false)
to avoid
marking the connector as dirty.
getState
in class DropTargetExtension<T extends AbstractComponent>
protected FileDropTargetState getState(boolean markAsDirty)
AbstractClientConnector
getState
in class DropTargetExtension<T extends AbstractComponent>
markAsDirty
- true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()
public T getParent()
getParent
in interface ClientConnector
getParent
in interface Connector
getParent
in class DropTargetExtension<T extends AbstractComponent>
Copyright © 2018 Vaadin Ltd. All rights reserved.