T - Type of the Grid bean.public class GridDropTarget<T> extends DropTargetExtension<Grid<T>>
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener| Constructor and Description |
|---|
GridDropTarget(Grid<T> target,
DropMode dropMode)
Extends a Grid and makes it's rows drop targets for HTML5 drag and drop.
|
| Modifier and Type | Method and Description |
|---|---|
Registration |
addGridDropListener(GridDropListener<T> listener)
Attaches drop listener for the current drop target.
|
DropMode |
getDropMode()
Gets the drop mode of this drop target.
|
int |
getDropThreshold()
Gets the threshold between drop locations from the top and the bottom of
the row.
|
protected GridDropTargetState |
getState()
Returns the shared state for this connector.
|
protected GridDropTargetState |
getState(boolean markAsDirty)
Returns the shared state for this connector.
|
protected void |
registerDropTargetRpc()
Registers the server side RPC methods invoked from client side on
drop event. |
void |
setDropMode(DropMode dropMode)
Sets the drop mode of this drop target.
|
void |
setDropThreshold(int threshold)
Sets the threshold between drop locations from the top and the bottom of
a row in pixels.
|
addDropListener, attach, getDropCriteriaScript, getDropEffect, getParent, onDrop, setDropCriteria, setDropCriteriaScript, setDropCriterion, setDropCriterion, setDropCriterion, setDropEffectextend, getSupportedParentType, remove, setParentaddAttachListener, 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, updateDiffstateclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitaddAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, getUI, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandlergetConnectorIdpublic GridDropTarget(Grid<T> target, DropMode dropMode)
target - Grid to be extended.dropMode - Drop mode that describes the allowed drop locations within the
Grid's row.GridDropEvent.getDropLocation()public void setDropMode(DropMode dropMode)
Note that when using DropMode.ON_TOP, and the grid is either
empty or has empty space after the last row, the drop can still happen on
the empty space, and the GridDropEvent.getDropTargetRow() will
return an empty optional.
When using DropMode.BETWEEN or
DropMode.ON_TOP_OR_BETWEEN, and there is at least one row in the
grid, any drop after the last row in the grid will get the last row as
the GridDropEvent.getDropTargetRow(). If there are no rows in the
grid, then it will return an empty optional.
dropMode - Drop mode that describes the allowed drop locations within the
Grid's row.GridDropEvent.getDropLocation()public DropMode getDropMode()
public Registration addGridDropListener(GridDropListener<T> listener)
GridDropListener.drop(GridDropEvent) is called when drop event
happens on the client side.listener - Listener to handle drop event.public void setDropThreshold(int threshold)
Dropping an element
threshold pixels from the top of a row results in a
drop event with DropLocation.ABOVEthreshold pixels from the bottom of a row results in a
drop event with DropLocation.BELOWDropLocation.ON_TOPDropMode.ON_TOP_OR_BETWEEN.
Default is 5 pixels.
threshold - The threshold from the top and bottom of the row in pixels.public int getDropThreshold()
protected void registerDropTargetRpc()
DropTargetExtensiondrop event.
Override this method if you need to have a custom RPC interface for
transmitting the drop event with more data. If just need to do additional
things before firing the drop event, then you should override
DropTargetExtension.onDrop(List, Map, DropEffect, MouseEventDetails) instead.
registerDropTargetRpc in class DropTargetExtension<Grid<T>>protected GridDropTargetState 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<Grid<T>>protected GridDropTargetState getState(boolean markAsDirty)
AbstractClientConnectorgetState in class DropTargetExtension<Grid<T>>markAsDirty - true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()Copyright © 2017 Vaadin Ltd. All rights reserved.