Class DragEndEvent<T extends Component>

    • Constructor Detail

      • DragEndEvent

        public DragEndEvent​(T source,
                            boolean fromClient,
                            @EventData("event.dataTransfer.dropEffect")
                            String dropEffect)
        Creates a drag end event.
        Parameters:
        source - Component that was dragged.
        fromClient - true if the event originated from the client side, false otherwise
        dropEffect - Drop effect from DataTransfer.dropEffect object.
    • Method Detail

      • getDropEffect

        public DropEffect getDropEffect()
        Get drop effect of the dragend event. The value will be in priority order: the desired action set by the drop target, effectAllowed parameter of the drag source and modifier keys the user presses. NOTE: there are some browser specific differences to this - Chrome does not change the drop effect based on modifier keys but only what the drop target sets.

        If the drop is not successful, the value will be NONE.

        In case the desired drop effect is MOVE, the data being dragged should be removed from the source.

        Returns:
        The DataTransfer.dropEffect parameter of the client side dragend event.
        See Also:
        DragSource.setEffectAllowed(EffectAllowed), DropTarget.setDropEffect(DropEffect)
      • isSuccessful

        public boolean isSuccessful()
        Returns whether the drop event succesful or was it cancelled or didn't succeed. This is a shorthand for dropEffect != NONE. NOTE: For Edge, Safari and IE11 this method will always report false due to bugs in the browsers!
        Returns:
        true if the drop event succeeded, false otherwise.
        Since:
        2.1
      • getComponent

        public T getComponent()
        Returns the drag source component where the dragend event occurred.
        Returns:
        Component which was dragged.