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 Details

    • DND_CONNECTOR

      public static final String DND_CONNECTOR
      Resource path for importing dnd connector.
      See Also:
    • EFFECT_ALLOWED_ELEMENT_PROPERTY

      public static final String EFFECT_ALLOWED_ELEMENT_PROPERTY
      Property name for storing the EffectAllowed on element level.
      See Also:
    • DRAG_SOURCE_DATA_KEY

      public static final String DRAG_SOURCE_DATA_KEY
      Key for storing server side drag data for a DragSource.
      See Also:
    • START_LISTENER_REGISTRATION_KEY

      public static final String START_LISTENER_REGISTRATION_KEY
      Key for storing an internal drag start listener registration for a DragSource.
      See Also:
    • END_LISTENER_REGISTRATION_KEY

      public static final String END_LISTENER_REGISTRATION_KEY
      Key for storing an internal drag end listener registration for a DragSource.
      See Also:
    • 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:
    • DROP_EFFECT_ELEMENT_PROPERTY

      public static final String DROP_EFFECT_ELEMENT_PROPERTY
      Property name for storing the DropEffect on element level.
      See Also:
  • Method Details

    • 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.