Class DndUtil
- java.lang.Object
-
- com.vaadin.flow.component.dnd.internal.DndUtil
-
public class DndUtil extends Object
Internal class for drag and drop related utility methods. This class is not meant for external usage and can be removed at any point.- Since:
- 2.0
- Author:
- Vaadin Ltd
-
-
Field Summary
Fields Modifier and Type Field Description static StringDND_CONNECTORResource path for importing dnd connector.static StringDRAG_SOURCE_DATA_KEYKey for storing server side drag data for aDragSource.static StringDROP_EFFECT_ELEMENT_PROPERTYProperty name for storing theDropEffecton element level.static StringDROP_TARGET_ACTIVE_PROPERTYProperty name for storing drop target activity data for an element.static StringEFFECT_ALLOWED_ELEMENT_PROPERTYProperty name for storing theEffectAllowedon element level.static StringEND_LISTENER_REGISTRATION_KEYKey for storing an internal drag end listener registration for aDragSource.static StringSTART_LISTENER_REGISTRATION_KEYKey for storing an internal drag start listener registration for aDragSource.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddMobileDndPolyfillIfNeeded(Component component)Adds the mobile dnd polyfills when a iOS device is used.static voidreportUsage()Reports DnD feature usage from mixin interfaces.static <T extends Component>
voidupdateDragSourceActivation(DragSource<T> dragSource)Triggers drag source activation method in JS connector once when the component has been attached.static <T extends Component>
voidupdateDropTargetActivation(DropTarget<T> dropTarget)Triggers drop target activation method in JS connector once when the component has been attached.
-
-
-
Field Detail
-
DND_CONNECTOR
public static final String DND_CONNECTOR
Resource path for importing dnd connector.- See Also:
- Constant Field Values
-
EFFECT_ALLOWED_ELEMENT_PROPERTY
public static final String EFFECT_ALLOWED_ELEMENT_PROPERTY
Property name for storing theEffectAllowedon element level.- See Also:
- Constant Field Values
-
DRAG_SOURCE_DATA_KEY
public static final String DRAG_SOURCE_DATA_KEY
Key for storing server side drag data for aDragSource.- See Also:
- Constant Field Values
-
START_LISTENER_REGISTRATION_KEY
public static final String START_LISTENER_REGISTRATION_KEY
Key for storing an internal drag start listener registration for aDragSource.- See Also:
- Constant Field Values
-
END_LISTENER_REGISTRATION_KEY
public static final String END_LISTENER_REGISTRATION_KEY
Key for storing an internal drag end listener registration for aDragSource.- See Also:
- Constant Field Values
-
DROP_TARGET_ACTIVE_PROPERTY
public static final String DROP_TARGET_ACTIVE_PROPERTY
Property name for storing drop target activity data for an element.- See Also:
- Constant Field Values
-
DROP_EFFECT_ELEMENT_PROPERTY
public static final String DROP_EFFECT_ELEMENT_PROPERTY
Property name for storing theDropEffecton element level.- See Also:
- Constant Field Values
-
-
Method Detail
-
addMobileDndPolyfillIfNeeded
public static void addMobileDndPolyfillIfNeeded(Component component)
Adds the mobile dnd polyfills when a iOS device is used. Calling this is NOOP for non-iOS devices. The polyfills are only loaded once per page.- Parameters:
component- the component using dnd
-
updateDragSourceActivation
public static <T extends Component> void updateDragSourceActivation(DragSource<T> dragSource)
Triggers drag source activation method in JS connector once when the component has been attached.- Type Parameters:
T- the type of the drag source component- Parameters:
dragSource- the drag source to update active status on
-
updateDropTargetActivation
public static <T extends Component> void updateDropTargetActivation(DropTarget<T> dropTarget)
Triggers drop target activation method in JS connector once when the component has been attached. Will make sure the activation in JS is done again when the component is detached and attached again, because otherwise the element will not be a drop target again.- Type Parameters:
T- the type of the drop target component- Parameters:
dropTarget- the drop target to update active status on
-
reportUsage
public static void reportUsage()
Reports DnD feature usage from mixin interfaces.
-
-