com.vaadin.client.ui.dd.

Class VDragAndDropManager

  • @Deprecated
    public class VDragAndDropManager
    extends Object
    Deprecated.

    Helper class to manage the state of drag and drop event on Vaadin client side. Can be used to implement most of the drag and drop operation automatically via cross-browser event preview method or just as a helper when implementing own low level drag and drop operation (like with HTML5 api).

    Singleton. Only one drag and drop operation can be active anyways. Use get() to get instance. TODO cancel drag and drop if more than one touches !?

    Author:

    Vaadin Ltd

    • Field Detail

      • ACTIVE_DRAG_SOURCE_STYLENAME

        public static final String ACTIVE_DRAG_SOURCE_STYLENAME
        Deprecated.

        Style name for the active drag source.

        See Also:

        Constant Field Values

      • MINIMUM_DISTANCE_TO_START_DRAG

        public static final int MINIMUM_DISTANCE_TO_START_DRAG
        Deprecated.

        #13381, #14796. The drag only actually starts when the mouse move or touch move event is more than 3 pixel away.

        See Also:

        Constant Field Values

    • Constructor Detail

      • VDragAndDropManager

        protected VDragAndDropManager()
        Deprecated.

        Singleton.

    • Method Detail

      • getCurrentDropHandler

        public VDropHandler getCurrentDropHandler()
        Deprecated.

        Returns the current drop handler.

        Returns:

        current drop handler, or null if one doesn't exist

      • setCurrentDropHandler

        public void setCurrentDropHandler​(VDropHandler currentDropHandler)
        Deprecated.

        If drag and drop operation is not handled by VDragAndDropManagers internal handler, this can be used to update current VDropHandler .

        Parameters:

        currentDropHandler - the current drop handler

      • get

        public static VDragAndDropManager get()
        Deprecated.

        Returns the current drag and drop manager instance. If one doesn't exist yet, it's created.

        Returns:

        the current drag and drop manager

      • startDrag

        public VDragEvent startDrag​(VTransferable transferable,
                                    com.google.gwt.dom.client.NativeEvent startEvent,
                                    boolean handleDragEvents)
        Deprecated.

        This method is used to start Vaadin client side drag and drop operation. Operation may be started by virtually any Widget.

        Cancels possible existing drag. TODO figure out if this is always a bug if one is active. Maybe a good and cheap lifesaver thought.

        If possible, method automatically detects current VDropHandler and fires VDropHandler.dragEnter(VDragEvent) event on it.

        May also be used to control the drag and drop operation. If this option is used, VDropHandler is searched on mouse events and appropriate methods on it called automatically.

        Parameters:

        transferable - the VTransferable instance that represents the original dragged element

        startEvent - the native event that starts the drag

        handleDragEvents - if true, VDragAndDropManager handles the drag and drop operation GWT event preview.

        Returns:

        the drag event

      • updateDragImagePosition

        protected void updateDragImagePosition​(com.google.gwt.dom.client.NativeEvent gwtEvent,
                                               com.google.gwt.dom.client.Element dragImage)
        Deprecated.

        Updates drag image position.

        Parameters:

        gwtEvent - the event whose coordinates should be used

        dragImage - the image to position

      • findDragTarget

        protected VDropHandler findDragTarget​(com.google.gwt.dom.client.Element element)
        Deprecated.

        First seeks the widget from this element, then iterates widgets until one implement HasDropHandler. Returns DropHandler from that.

        Parameters:

        element - the topmost element that is a potential drag target

        Returns:

        the drop handler from the given element or its closest ancestor that has one, or null if there is no such thing

      • endDrag

        public void endDrag()
        Deprecated.

        Drag is ended (drop happened) on current drop handler. Calls drop method on current drop handler and does appropriate cleanup.

      • interruptDrag

        public void interruptDrag()
        Deprecated.

        The drag and drop operation is ended, but drop did not happen. If operation is currently on a drop handler, its dragLeave method is called and appropriate cleanup happens.

      • visitServer

        public void visitServer​(VDragEventServerCallback acceptCallback)
        Deprecated.

        Visits server during drag and drop procedure. Transferable and event type is given to server side counterpart of DropHandler. If another server visit is started before the current is received, the current is just dropped. TODO consider if callback should have interrupted() method for cleanup.

        Parameters:

        acceptCallback - the callback that should handle the matching server response when it arrives

      • handleServerResponse

        public void handleServerResponse​(ValueMap valueMap)
        Deprecated.

        Handle the server response for drag and drop.

        Parameters:

        valueMap - DnD value map from the response

      • getEventHandleStrategy

        protected DDEventHandleStrategy getEventHandleStrategy()
        Deprecated.

        Returns DnD strategy to handle native preview events used by the manager. Subclasses can override this method to return custom strategy or use GWT deferred binding.

        Returns:

        internal DnD native preview event handler

      • getCurrentDragApplicationConnection

        protected ApplicationConnection getCurrentDragApplicationConnection()
        Deprecated.

        Returns the application connection for the current drag source. If there is no current drag source, returns null instead.

        Returns:

        the application connection, or null if not found

      • executeWhenReady

        public void executeWhenReady​(com.google.gwt.user.client.Command command)
        Deprecated.

        Method to execute commands when all existing dd related tasks are completed (some may require server visit).

        Using this method may be handy if criterion that uses lazy initialization are used. Check

        TODO Optimization: consider if we actually only need to keep the last command in queue here.

        Parameters:

        command - the command to execute