Class 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 Detail

      • 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:
        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 a DragSource.
        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
    • 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.