public class DropTargetExtensionConnector extends AbstractExtensionConnector
DropTargetExtension.| Modifier and Type | Field and Description |
|---|---|
protected static String |
STYLE_SUFFIX_DRAG_BOTTOM
Style name suffix for dragging data over the bottom part of the drop
target.
|
protected static String |
STYLE_SUFFIX_DRAG_CENTER
Style name suffix for dragging data over the center of the drop target.
|
protected static String |
STYLE_SUFFIX_DRAG_TOP
Style name suffix for dragging data over the top part of the drop target.
|
protected static String |
STYLE_SUFFIX_DROPTARGET
Style name suffix for indicating that the element is drop target.
|
| Constructor and Description |
|---|
DropTargetExtensionConnector() |
| 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 |
addDropTargetStyle()
Add class name for the drop target element indicating that data can be
dropped onto it.
|
protected void |
extend(ServerConnector target)
Called when the extension is attached to its parent.
|
protected com.google.gwt.dom.client.Element |
getDropTargetElement()
Finds the drop target element within the widget.
|
DropTargetState |
getState()
Returns the shared state object for this connector.
|
protected boolean |
isDropAllowedByCriteriaScript(com.google.gwt.dom.client.NativeEvent event)
Checks if a criteria script exists and, if yes, executes it.
|
protected void |
onDragEnter(elemental.events.Event event)
Event handler for the
dragenter event. |
protected void |
onDragLeave(elemental.events.Event event)
Event handler for the
dragleave event. |
protected void |
onDragOver(elemental.events.Event event)
Event handler for the
dragover event. |
protected void |
onDrop(elemental.events.Event event)
Event handler for the
drop event. |
void |
onUnregister()
Event called when connector has been unregistered.
|
protected void |
removeDragOverStyle(com.google.gwt.dom.client.NativeEvent event)
Remove the drag over indicator class name from the target element.
|
protected void |
removeDropTargetStyle()
Remove class name from the drop target element indication that data can
be dropped onto it.
|
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.
|
setParentaddStateChangeHandler, 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 static final String STYLE_SUFFIX_DRAG_CENTER
protected static final String STYLE_SUFFIX_DRAG_TOP
protected static final String STYLE_SUFFIX_DRAG_BOTTOM
protected static final String STYLE_SUFFIX_DROPTARGET
protected void extend(ServerConnector target)
AbstractExtensionConnectorextend in class AbstractExtensionConnectortarget - The connector this extension extendspublic void onUnregister()
ServerConnectoronUnregister in interface ServerConnectoronUnregister in class AbstractConnectorprotected com.google.gwt.dom.client.Element getDropTargetElement()
protected void onDragEnter(elemental.events.Event event)
dragenter event.
Override this method in case custom handling for the dragstart event is required. If the drop is allowed, the event should prevent default.
event - browser event to be handledprotected void onDragOver(elemental.events.Event event)
dragover event.
Override this method in case custom handling for the dragover event is required. If the drop is allowed, the event should prevent default.
event - browser event to be handledprotected void onDragLeave(elemental.events.Event event)
dragleave event.
Override this method in case custom handling for the dragleave event is required.
event - browser event to be handledprotected void onDrop(elemental.events.Event event)
drop event.
Override this method in case custom handling for the drop event is required. If the drop is allowed, the event should prevent default.
event - browser event to be handledprotected boolean isDropAllowedByCriteriaScript(com.google.gwt.dom.client.NativeEvent event)
event - 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 void sendDropEventToServer(List<String> types, Map<String,String> data, String dropEffect, com.google.gwt.dom.client.NativeEvent dropEvent)
types - 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 void addDropTargetStyle()
[primaryStyleName]-droptarget
The added class name is update automatically by the framework when the
primary style name changes.protected void removeDropTargetStyle()
protected void addDragOverStyle(com.google.gwt.dom.client.NativeEvent event)
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.
event - the dragenter or dragover event that triggered the indication.protected void removeDragOverStyle(com.google.gwt.dom.client.NativeEvent event)
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.
event - the event that triggered the removal of the indicatorpublic DropTargetState getState()
AbstractConnectorgetState in interface ServerConnectorgetState in class AbstractConnectorCopyright © 2021 Vaadin Ltd. All rights reserved.