com.vaadin.client.connectors.grid.

Class GridDropTargetConnector

    • Constructor Detail

      • GridDropTargetConnector

        public GridDropTargetConnector()
    • Method Detail

      • extend

        protected void extend​(ServerConnector target)

        Description copied from class: AbstractExtensionConnector

        Called when the extension is attached to its parent. This method is only called once as an extension cannot be moved from one parent to another.

        Overrides:

        extend in class DropTargetExtensionConnector

        Parameters:

        target - The connector this extension extends

      • isDropAllowedByCriteriaScript

        protected boolean isDropAllowedByCriteriaScript​(com.google.gwt.dom.client.NativeEvent event)

        Description copied from class: DropTargetExtensionConnector

        Checks if a criteria script exists and, if yes, executes it. This method is protected, so subclasses as e.g. GridDropTargetConnector can override it to add additional script parameters.

        Overrides:

        isDropAllowedByCriteriaScript in class DropTargetExtensionConnector

        Parameters:

        event - browser event (dragEnter, dragOver, drop) that should be evaluated by the criteria script

        Returns:

        true if no script was given or if the script returned true, false otherwise.

      • isDroppingOnRowsPossible

        protected boolean isDroppingOnRowsPossible()

        Inspects whether the current drop would happen on the whole grid instead of specific row as the drop target. This is based on used drop mode, whether dropping on sorted grid rows is allowed (determined on server side and automatically updated to drop mode) and whether the grid is empty.

        Returns:

        true when the drop target is the whole grid, or false when it is one of the rows

      • sendDropEventToServer

        protected void sendDropEventToServer​(List<String> types,
                                             Map<String,​String> data,
                                             String dropEffect,
                                             com.google.gwt.dom.client.NativeEvent dropEvent)

        Description copied from class: DropTargetExtensionConnector

        Initiates a server RPC for the drop event.

        Overrides:

        sendDropEventToServer in class DropTargetExtensionConnector

        Parameters:

        types - List of data types from DataTransfer.types object.

        data - Map containing all types and corresponding data from the DataTransfer object.

        dropEffect - The desired drop effect.

      • getRowData

        protected elemental.json.JsonObject getRowData​(com.google.gwt.dom.client.TableRowElement row)

        Get the row data as json object for the given row.

        Parameters:

        row - table row element

        Returns:

        row data as json object for the given row

      • getDropLocation

        protected DropLocation getDropLocation​(com.google.gwt.dom.client.Element target,
                                               com.google.gwt.dom.client.NativeEvent event)

        Returns the location of the event within the row.

        Parameters:

        target - drop target element

        event - drop event

        Returns:

        the drop location to use

      • onDragEnter

        protected void onDragEnter​(elemental.events.Event event)

        Description copied from class: DropTargetExtensionConnector

        Event handler for the dragenter event.

        Override this method in case custom handling for the dragstart event is required. If the drop is allowed, the event should prevent default.

        Overrides:

        onDragEnter in class DropTargetExtensionConnector

        Parameters:

        event - browser event to be handled

      • addDragOverStyle

        protected void addDragOverStyle​(com.google.gwt.dom.client.NativeEvent event)

        Description copied from class: DropTargetExtensionConnector

        Add class that indicates that the component is a target while data is being dragged over it.

        This is triggered on dragenter and dragover events pending if the drop is possible. The drop is possible if the drop effect for the target and source do match and the drop criteria script evaluates to true or is not set.

        Overrides:

        addDragOverStyle in class DropTargetExtensionConnector

        Parameters:

        event - the dragenter or dragover event that triggered the indication.

      • removeDragOverStyle

        protected void removeDragOverStyle​(com.google.gwt.dom.client.NativeEvent event)

        Description copied from class: DropTargetExtensionConnector

        Remove the drag over indicator class name from the target element.

        This is triggered on drop, dragleave and dragover events pending on whether the drop has happened or if it is not possible. The drop is not possible if the drop effect for the source and target don't match or if there is a drop criteria script that evaluates to false.

        Overrides:

        removeDragOverStyle in class DropTargetExtensionConnector

        Parameters:

        event - the event that triggered the removal of the indicator

      • getTargetElement

        protected com.google.gwt.dom.client.Element getTargetElement​(com.google.gwt.dom.client.Element source)

        Gets the target element for a dragover or drop event.

        Parameters:

        source - the event target of the event

        Returns:

        the element that should be handled as the target of the event