public class GridDropTargetConnector extends DropTargetExtensionConnector
GridDropTarget.STYLE_SUFFIX_DRAG_BOTTOM, STYLE_SUFFIX_DRAG_CENTER, STYLE_SUFFIX_DRAG_TOP, STYLE_SUFFIX_DROPTARGET| Constructor and Description |
|---|
GridDropTargetConnector() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addDragOverStyle(com.google.gwt.dom.client.NativeEvent event)
Add class that indicates that the component is a target while data is
being dragged over it.
|
protected void |
extend(ServerConnector target)
Called when the extension is attached to its parent.
|
protected DropLocation |
getDropLocation(com.google.gwt.dom.client.Element target,
com.google.gwt.dom.client.NativeEvent event)
Returns the location of the event within the row.
|
protected com.google.gwt.dom.client.Element |
getDropTargetElement()
Finds the drop target element within the widget.
|
protected elemental.json.JsonObject |
getRowData(com.google.gwt.dom.client.TableRowElement row)
Get the row data as json object for the given row.
|
GridDropTargetState |
getState()
Returns the shared state object for this connector.
|
protected com.google.gwt.dom.client.Element |
getTargetElement(com.google.gwt.dom.client.Element source)
Gets the target element for a dragover or drop event.
|
protected boolean |
isDropAllowedByCriteriaScript(com.google.gwt.dom.client.NativeEvent event)
Checks if a criteria script exists and, if yes, executes it.
|
protected boolean |
isDroppingOnRowsPossible()
Inspects whether the current drop would happen on the whole grid instead
of specific row as the drop target.
|
protected void |
onDragEnter(elemental.events.Event event)
Event handler for the
dragenter event. |
protected void |
removeDragOverStyle(com.google.gwt.dom.client.NativeEvent event)
Remove the drag over indicator class name from the target element.
|
protected void |
sendDropEventToServer(List<String> types,
Map<String,String> data,
String dropEffect,
com.google.gwt.dom.client.NativeEvent dropEvent)
Initiates a server RPC for the drop event.
|
addDropTargetStyle, onDragLeave, onDragOver, onDrop, onUnregister, removeDropTargetStylesetParentaddStateChangeHandler, addStateChangeHandler, createState, doInit, ensureHandlerManager, fireEvent, forceStateChange, getChildren, getConnection, getConnectorId, getParent, getResourceUrl, getRpcImplementations, getRpcProxy, getStateType, getTag, hasEventListener, init, isEnabled, onStateChanged, registerRpc, removeStateChangeHandler, removeStateChangeHandler, setChildren, setTag, unregisterRpc, updateEnabledStateprotected void extend(ServerConnector target)
AbstractExtensionConnectorextend in class DropTargetExtensionConnectortarget - The connector this extension extendsprotected boolean isDropAllowedByCriteriaScript(com.google.gwt.dom.client.NativeEvent event)
DropTargetExtensionConnectorisDropAllowedByCriteriaScript in class DropTargetExtensionConnectorevent - browser event (dragEnter, dragOver, drop) that should be
evaluated by the criteria scripttrue if no script was given or if the script returned
true, false otherwise.protected boolean isDroppingOnRowsPossible()
true when the drop target is the whole grid, or
false when it is one of the rowsprotected void sendDropEventToServer(List<String> types, Map<String,String> data, String dropEffect, com.google.gwt.dom.client.NativeEvent dropEvent)
DropTargetExtensionConnectorsendDropEventToServer in class DropTargetExtensionConnectortypes - List of data types from DataTransfer.types object.data - Map containing all types and corresponding data from the
DataTransfer object.dropEffect - The desired drop effect.protected elemental.json.JsonObject getRowData(com.google.gwt.dom.client.TableRowElement row)
row - table row elementprotected DropLocation getDropLocation(com.google.gwt.dom.client.Element target, com.google.gwt.dom.client.NativeEvent event)
target - drop target elementevent - drop eventprotected void onDragEnter(elemental.events.Event event)
DropTargetExtensionConnectordragenter event.
Override this method in case custom handling for the dragstart event is required. If the drop is allowed, the event should prevent default.
onDragEnter in class DropTargetExtensionConnectorevent - browser event to be handledprotected void addDragOverStyle(com.google.gwt.dom.client.NativeEvent event)
DropTargetExtensionConnector
This is triggered on dragenter and
dragover events pending if the drop is
possible. The drop is possible if the drop effect for the target and
source do match and the drop criteria script evaluates to true or is not
set.
addDragOverStyle in class DropTargetExtensionConnectorevent - the dragenter or dragover event that triggered the indication.protected void removeDragOverStyle(com.google.gwt.dom.client.NativeEvent event)
DropTargetExtensionConnector
This is triggered on drop,
dragleave and dragover events pending on whether the drop has happened or if it is not
possible. The drop is not possible if the drop effect for the source and
target don't match or if there is a drop criteria script that evaluates
to false.
removeDragOverStyle in class DropTargetExtensionConnectorevent - the event that triggered the removal of the indicatorprotected com.google.gwt.dom.client.Element getTargetElement(com.google.gwt.dom.client.Element source)
source - the event target of the eventprotected com.google.gwt.dom.client.Element getDropTargetElement()
DropTargetExtensionConnectorgetDropTargetElement in class DropTargetExtensionConnectorpublic GridDropTargetState getState()
AbstractConnectorgetState in interface ServerConnectorgetState in class DropTargetExtensionConnectorCopyright © 2021 Vaadin Ltd. All rights reserved.