com.vaadin.client.ui.dd.VDragEvent.getCurrentGwtEvent() - java examples

Here are the examples of the java api com.vaadin.client.ui.dd.VDragEvent.getCurrentGwtEvent() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

21 Examples 7

17 View Complete Implementation : VDDFormLayout.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * Returns the horizontal location within the cell when hoovering over the
 * cell. By default the cell is devided into three parts: left,center,right
 * with the ratios 10%,80%,10%;
 *
 * @param rowElement
 *            The row
 * @param event
 *            The drag event
 * @return The horizontal drop location
 */
protected VerticalDropLocation getVerticalDropLocation(Element rowElement, VDragEvent event) {
    return VDragDropUtil.getVerticalDropLocation((com.google.gwt.user.client.Element) rowElement, Util.getTouchOrMouseClientY(event.getCurrentGwtEvent()), cellTopBottomDropRatio);
}

16 View Complete Implementation : VDDCssLayout.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * Returns the horizontal location within the cell when hoovering over the
 * cell. By default the cell is devided into three parts: left,center,right
 * with the ratios 10%,80%,10%;
 *
 * @param container
 *            The widget container
 * @param event
 *            The drag event
 * @return The horizontal drop location
 */
protected VerticalDropLocation getVerticalDropLocation(Widget container, VDragEvent event) {
    return VDragDropUtil.getVerticalDropLocation(container.getElement(), Util.getTouchOrMouseClientY(event.getCurrentGwtEvent()), verticalDropRatio);
}

16 View Complete Implementation : VDDCssLayout.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * Returns the horizontal location within the cell when hoovering over the
 * cell. By default the cell is devided into three parts: left,center,right
 * with the ratios 10%,80%,10%;
 *
 * @param container
 *            The widget container
 * @param event
 *            The drag event
 * @return The horizontal drop location
 */
protected HorizontalDropLocation getHorizontalDropLocation(Widget container, VDragEvent event) {
    return VDragDropUtil.getHorizontalDropLocation(container.getElement(), Util.getTouchOrMouseClientX(event.getCurrentGwtEvent()), horizontalDropRatio);
}

16 View Complete Implementation : VDDVerticalLayout.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * Returns the horizontal location within the cell when hovering over the
 * cell. By default the cell is divided into three parts: left,center,right
 * with the ratios 10%,80%,10%;
 *
 * @param container
 *            The widget container
 * @param event
 *            The drag event
 * @return The horizontal drop location
 */
protected VerticalDropLocation getVerticalDropLocation(Widget container, VDragEvent event) {
    return VDragDropUtil.getVerticalDropLocation(container.getElement(), Util.getTouchOrMouseClientY(event.getCurrentGwtEvent()), cellTopBottomDropRatio);
}

15 View Complete Implementation : VDDHorizontalLayout.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * Returns the horizontal location within the cell when hoovering over the
 * cell. By default the cell is devided into three parts: left,center,right
 * with the ratios 10%,80%,10%;
 *
 * @param container
 *            The widget container
 * @param event
 *            The drag event
 * @return The horizontal drop location
 */
protected HorizontalDropLocation getHorizontalDropLocation(Widget container, VDragEvent event) {
    return VDragDropUtil.getHorizontalDropLocation(container.getElement(), Util.getTouchOrMouseClientX(event.getCurrentGwtEvent()), cellLeftRightDropRatio);
}

15 View Complete Implementation : VDDHorizontalLayoutDropHandler.java
Copyright Apache License 2.0
Author : cuba-platform
@Override
public boolean drop(VDragEvent drag) {
    // Un-emphasis any selections
    getLayout().emphasis(null, null);
    // Update the details
    Widget slot = getSlot(drag.getElementOver(), drag.getCurrentGwtEvent());
    getLayout().updateDragDetails(slot, drag);
    return getLayout().postDropHook(drag) && super.drop(drag);
}

15 View Complete Implementation : VDDHorizontalLayoutDropHandler.java
Copyright Apache License 2.0
Author : cuba-platform
@Override
public void dragEnter(VDragEvent drag) {
    super.dragEnter(drag);
    Slot slot = getSlot(drag.getElementOver(), drag.getCurrentGwtEvent());
    if (slot != null) {
        getLayout().updateDragDetails(slot, drag);
    } else {
        getLayout().updateDragDetails(getLayout(), drag);
    }
    getLayout().postEnterHook(drag);
}

15 View Complete Implementation : VDDHorizontalLayoutDropHandler.java
Copyright Apache License 2.0
Author : cuba-platform
@Override
public void dragOver(VDragEvent drag) {
    // Remove any emphasis
    getLayout().emphasis(null, null);
    Slot slot = getSlot(drag.getElementOver(), drag.getCurrentGwtEvent());
    if (slot != null) {
        getLayout().updateDragDetails(slot, drag);
    } else {
        getLayout().updateDragDetails(getLayout(), drag);
    }
    getLayout().postOverHook(drag);
    // Validate the drop
    validate(new VAcceptCallback() {

        public void accepted(VDragEvent event) {
            Slot slot = getSlot(event.getElementOver(), event.getCurrentGwtEvent());
            if (slot != null) {
                getLayout().emphasis(slot, event);
            } else {
                getLayout().emphasis(getLayout(), event);
            }
        }
    }, drag);
}

15 View Complete Implementation : VDDVerticalLayoutDropHandler.java
Copyright Apache License 2.0
Author : cuba-platform
@Override
public void dragOver(VDragEvent drag) {
    // Remove any emphasis
    getLayout().emphasis(null, null);
    // Update the dropdetails so we can validate the drop
    Slot slot = getSlot(drag.getElementOver(), drag.getCurrentGwtEvent());
    if (slot != null) {
        getLayout().updateDragDetails(slot, drag);
    } else {
        getLayout().updateDragDetails(getLayout(), drag);
    }
    getLayout().postOverHook(drag);
    // Validate the drop
    validate(new VAcceptCallback() {

        public void accepted(VDragEvent event) {
            Slot slot = getSlot(event.getElementOver(), event.getCurrentGwtEvent());
            if (slot != null) {
                getLayout().emphasis(slot, event);
            } else {
                getLayout().emphasis(getLayout(), event);
            }
        }
    }, drag);
}

14 View Complete Implementation : VDDHorizontalLayout.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * Updates the drop details while dragging. This is needed to ensure client
 * side criterias can validate the drop location.
 *
 * @param widget
 *            The container which we are hovering over
 * @param event
 *            The drag event
 */
protected void updateDragDetails(Widget widget, VDragEvent event) {
    if (widget == null) {
        return;
    }
    /*
         * The horizontal position within the cell{
         */
    event.getDropDetails().put(Constants.DROP_DETAIL_HORIZONTAL_DROP_LOCATION, getHorizontalDropLocation(widget, event));
    /*
         * The index over which the drag is. Can be used by a client side
         * criteria to verify that a drag is over a certain index.
         */
    int index = -1;
    if (widget instanceof Slot) {
        WidgetCollection captionsAndSlots = getChildren();
        index = VDragDropUtil.findSlotIndex(captionsAndSlots, (Slot) widget);
    }
    event.getDropDetails().put(Constants.DROP_DETAIL_TO, index);
    // Add mouse event details
    MouseEventDetails details = MouseEventDetailsBuilder.buildMouseEventDetails(event.getCurrentGwtEvent(), getElement());
    event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize());
}

14 View Complete Implementation : VDDVerticalLayout.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * Updates the drop details while dragging. This is needed to ensure client
 * side criterias can validate the drop location.
 *
 * @param widget
 *            The container which we are hovering over
 * @param event
 *            The drag event
 */
protected void updateDragDetails(Widget widget, VDragEvent event) {
    if (widget == null) {
        return;
    }
    /*
         * The horizontal position within the cell{
         */
    event.getDropDetails().put(Constants.DROP_DETAIL_VERTICAL_DROP_LOCATION, getVerticalDropLocation(widget, event));
    /*
         * The index over which the drag is. Can be used by a client side
         * criteria to verify that a drag is over a certain index.
         */
    int index = -1;
    if (widget instanceof Slot) {
        WidgetCollection captionsAndSlots = getChildren();
        index = VDragDropUtil.findSlotIndex(captionsAndSlots, (Slot) widget);
    }
    event.getDropDetails().put(Constants.DROP_DETAIL_TO, index);
    // Add mouse event details
    MouseEventDetails details = MouseEventDetailsBuilder.buildMouseEventDetails(event.getCurrentGwtEvent(), getElement());
    event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize());
}

13 View Complete Implementation : VDDTabSheet.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * Emphasisizes a container element
 *
 * @param element
 */
protected void emphasis(Element element, VDragEvent event) {
    boolean internalDrag = event.getTransferable().getDragSource() == this;
    if (tabBar.getElement().isOrHasChild(element)) {
        Widget w = Util.findWidget(element, null);
        if (w == tabBar && !internalDrag) {
            // Over spacer
            Element spacerContent = spacer.getChild(0).cast();
            spacerContent.appendChild(newTab);
            currentlyEmphasised = element;
        } else if (w instanceof VCaption) {
            // Over a tab
            HorizontalDropLocation location = VDragDropUtil.getHorizontalDropLocation(DOM.asOld(element), Util.getTouchOrMouseClientX(event.getCurrentGwtEvent()), tabLeftRightDropRatio);
            if (location == HorizontalDropLocation.LEFT) {
                int index = getTabPosition(w);
                if (index == 0) {
                    currentlyEmphasised = tabBar.getWidget(0).getElement().getFirstChildElement().cast();
                    currentlyEmphasised.addClreplacedName(CLreplacedNAME_NEW_TAB_LEFT);
                } else {
                    Widget prevTab = tabBar.getWidget(index - 1);
                    currentlyEmphasised = prevTab.getElement();
                    currentlyEmphasised.addClreplacedName(CLreplacedNAME_NEW_TAB_RIGHT);
                }
            } else if (location == HorizontalDropLocation.RIGHT) {
                int index = getTabPosition(w);
                currentlyEmphasised = tabBar.getWidget(index).getElement();
                currentlyEmphasised.addClreplacedName(CLreplacedNAME_NEW_TAB_RIGHT);
            } else {
                int index = getTabPosition(w);
                currentlyEmphasised = tabBar.getWidget(index).getElement();
                currentlyEmphasised.addClreplacedName(CLreplacedNAME_NEW_TAB_CENTER);
            }
        }
    }
}

12 View Complete Implementation : VDDFormLayout.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * Updates the drop details while dragging. This is needed to ensure client
 * side criterias can validate the drop location.
 *
 * @param widget
 *            The container which we are hovering over
 * @param event
 *            The drag event
 */
protected void updateDragDetails(Widget widget, VDragEvent event) {
    /*
         * The horizontal position within the cell
         */
    event.getDropDetails().put(Constants.DROP_DETAIL_VERTICAL_DROP_LOCATION, getVerticalDropLocation(VDDFormLayout.getRowFromChildElement(widget.getElement(), VDDFormLayout.this.getElement()), event));
    /*
         * The index over which the drag is. Can be used by a client side
         * criteria to verify that a drag is over a certain index.
         */
    event.getDropDetails().put(Constants.DROP_DETAIL_TO, "-1");
    for (int i = 0; i < table.getRowCount(); i++) {
        Widget w = table.getWidget(i, COLUMN_WIDGET);
        if (widget.equals(w)) {
            event.getDropDetails().put(Constants.DROP_DETAIL_TO, i);
        }
    }
    /*
         * Add Clreplacedname of component over the drag. This can be used by a a
         * client side criteria to verify that a drag is over a specific clreplaced
         * of component.
         */
    String clreplacedName = widget.getClreplaced().getName();
    event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLreplaced, clreplacedName);
    // Add mouse event details
    MouseEventDetails details = MouseEventDetailsBuilder.buildMouseEventDetails(event.getCurrentGwtEvent(), getElement());
    event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize());
}

11 View Complete Implementation : VDDAccordion.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * Updates the drop details while dragging. This is needed to ensure client
 * side criterias can validate the drop location.
 *
 * @param event
 *            The drag event
 */
protected void updateDragDetails(VDragEvent event) {
    if (event.getElementOver() == null) {
        return;
    }
    StackItem tab = WidgetUtil.findWidget(event.getElementOver(), StackItem.clreplaced);
    if (tab != null && getElement().isOrHasChild(tab.getElement())) {
        Map<String, Object> dropDetails = event.getDropDetails();
        int index = getTabPosition(tab);
        dropDetails.put(Constants.DROP_DETAIL_TO, index);
        VerticalDropLocation location = getDropLocation(tab, event);
        dropDetails.put(Constants.DROP_DETAIL_VERTICAL_DROP_LOCATION, location);
        MouseEventDetails details = MouseEventDetailsBuilder.buildMouseEventDetails(event.getCurrentGwtEvent(), getElement());
        dropDetails.put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize());
    }
}

10 View Complete Implementation : VDDCssLayout.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * Updates the drop details while dragging. This is needed to ensure client
 * side criterias can validate the drop location.
 *
 * @param event
 *            The drag event
 */
protected void updateDragDetails(VDragEvent event) {
    Element over = event.getElementOver();
    if (placeHolderElement.isOrHasChild(over)) {
        // Dragging over the placeholder
        return;
    }
    Widget widget = (Widget) Util.findWidget(over, null);
    if (widget == null) {
        // Null check
        return;
    }
    int offset = 0;
    int index = -1;
    for (int i = 0; i < getElement().getChildCount(); i++) {
        Element child = getElement().getChild(i).cast();
        if (child.isOrHasChild(placeHolderElement)) {
            offset--;
        } else if (child.isOrHasChild(widget.getElement())) {
            index = i + offset;
            break;
        }
    }
    event.getDropDetails().put(Constants.DROP_DETAIL_TO, index);
    /*
         * The horizontal position within the cell
         */
    event.getDropDetails().put(Constants.DROP_DETAIL_HORIZONTAL_DROP_LOCATION, getHorizontalDropLocation(widget, event));
    /*
         * The vertical position within the cell
         */
    event.getDropDetails().put(Constants.DROP_DETAIL_VERTICAL_DROP_LOCATION, getVerticalDropLocation(widget, event));
    // Add mouse event details
    MouseEventDetails details = MouseEventDetailsBuilder.buildMouseEventDetails(event.getCurrentGwtEvent(), getElement());
    event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize());
}

9 View Complete Implementation : VDDGridLayout.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * Updates the drop details while dragging
 *
 * @param event
 *            The drag event
 */
public void updateDragDetails(VDragEvent event) {
    CellDetails cd = getCellDetails(event);
    if (cd != null) {
        Map<String, Object> ddetails = event.getDropDetails();
        // Add row
        ddetails.put(Constants.DROP_DETAIL_ROW, Integer.valueOf(cd.row));
        // Add column
        ddetails.put(Constants.DROP_DETAIL_COLUMN, Integer.valueOf(cd.column));
        // Add horizontal position
        HorizontalDropLocation hl = getHorizontalDropLocation(cd, event);
        ddetails.put(Constants.DROP_DETAIL_HORIZONTAL_DROP_LOCATION, hl);
        // Add vertical position
        VerticalDropLocation vl = getVerticalDropLocation(cd, event);
        ddetails.put(Constants.DROP_DETAIL_VERTICAL_DROP_LOCATION, vl);
        // Check if the cell we are hovering over has content
        Cell cell = getCell(cd.row, cd.column);
        ddetails.put(Constants.DROP_DETAIL_EMPTY_CELL, cell != null);
        // Get clreplaced information from child
        if (cell != null && cell.slot != null) {
            ComponentConnector child = cell.slot.getChild();
            if (child != null) {
                String clreplacedName = child.getWidget().getClreplaced().getName();
                ddetails.put(Constants.DROP_DETAIL_OVER_CLreplaced, clreplacedName);
            } else {
                ddetails.put(Constants.DROP_DETAIL_OVER_CLreplaced, VDDGridLayout.this.getClreplaced().getName());
            }
        } else {
            ddetails.put(Constants.DROP_DETAIL_OVER_CLreplaced, VDDGridLayout.this.getClreplaced().getName());
        }
        // Add mouse event details
        MouseEventDetails details = MouseEventDetailsBuilder.buildMouseEventDetails(event.getCurrentGwtEvent(), getElement());
        event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize());
    }
}

9 View Complete Implementation : VDDPanel.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * Updates the drop details while dragging. This is needed to ensure client
 * side criterias can validate the drop location.
 *
 * @param event
 *            The drag event
 */
protected void updateDragDetails(VDragEvent event) {
    Element over = event.getElementOver();
    Widget content = WidgetUtil.findWidget(over, null);
    if (content != null && content != this) {
        event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLreplaced, content.getClreplaced().getName());
    } else {
        event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLreplaced, this.getClreplaced().getName());
    }
    // Add mouse event details
    MouseEventDetails details = MouseEventDetailsBuilder.buildMouseEventDetails(event.getCurrentGwtEvent(), getElement());
    event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize());
}

7 View Complete Implementation : VDDHorizontalSplitPanel.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * Updates the drop details while dragging. This is needed to ensure client
 * side criterias can validate the drop location.
 *
 * @param event
 *            The drag event
 */
protected void updateDragDetails(VDragEvent event) {
    Element over = event.getElementOver();
    if (over == null) {
        return;
    }
    // Resolve where the drop was made
    HorizontalDropLocation location = null;
    Widget content = null;
    if (firstContainer.isOrHasChild(over)) {
        location = HorizontalDropLocation.LEFT;
        content = Util.findWidget(firstContainer, null);
    } else if (splitter.isOrHasChild(over)) {
        location = HorizontalDropLocation.CENTER;
        content = this;
    } else if (secondContainer.isOrHasChild(over)) {
        location = HorizontalDropLocation.RIGHT;
        content = Util.findWidget(secondContainer, null);
    }
    event.getDropDetails().put(Constants.DROP_DETAIL_HORIZONTAL_DROP_LOCATION, location);
    if (content != null) {
        event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLreplaced, content.getClreplaced().getName());
    } else {
        event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLreplaced, this.getClreplaced().getName());
    }
    // Add mouse event details
    MouseEventDetails details = MouseEventDetailsBuilder.buildMouseEventDetails(event.getCurrentGwtEvent(), getElement());
    event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize());
}

7 View Complete Implementation : VDDTabSheet.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * Updates the drop details while dragging. This is needed to ensure client
 * side criterias can validate the drop location.
 *
 * @param event
 *            The drag event
 */
protected void updateDragDetails(VDragEvent event) {
    Element element = event.getElementOver();
    if (element == null)
        return;
    if (tabBar.getElement().isOrHasChild(element)) {
        Widget w = Util.findWidget(element, null);
        if (w == tabBar) {
            // Ove3r the spacer
            // Add index
            event.getDropDetails().put(Constants.DROP_DETAIL_TO, tabBar.getWidgetCount() - 1);
            // Add drop location
            event.getDropDetails().put(Constants.DROP_DETAIL_HORIZONTAL_DROP_LOCATION, HorizontalDropLocation.RIGHT);
        } else {
            // Add index
            event.getDropDetails().put(Constants.DROP_DETAIL_TO, getTabPosition(w));
            // Add drop location
            HorizontalDropLocation location = VDragDropUtil.getHorizontalDropLocation(DOM.asOld(element), Util.getTouchOrMouseClientX(event.getCurrentGwtEvent()), tabLeftRightDropRatio);
            event.getDropDetails().put(Constants.DROP_DETAIL_HORIZONTAL_DROP_LOCATION, location);
        }
        // Add mouse event details
        MouseEventDetails details = MouseEventDetailsBuilder.buildMouseEventDetails(event.getCurrentGwtEvent(), getElement());
        event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize());
    }
}

7 View Complete Implementation : VDDVerticalSplitPanel.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * Updates the drop details while dragging. This is needed to ensure client
 * side criterias can validate the drop location.
 *
 * @param event
 *            The drag event
 */
protected void updateDragDetails(VDragEvent event) {
    Element over = event.getElementOver();
    // Resolve where the drop was made
    VerticalDropLocation location = null;
    Widget content = null;
    if (firstContainer.isOrHasChild(over)) {
        location = VerticalDropLocation.TOP;
        content = Util.findWidget(firstContainer, null);
    } else if (splitter.isOrHasChild(over)) {
        location = VerticalDropLocation.MIDDLE;
        content = this;
    } else if (secondContainer.isOrHasChild(over)) {
        location = VerticalDropLocation.BOTTOM;
        content = Util.findWidget(secondContainer, null);
    }
    event.getDropDetails().put(Constants.DROP_DETAIL_VERTICAL_DROP_LOCATION, location);
    if (content != null) {
        event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLreplaced, content.getClreplaced().getName());
    } else {
        event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLreplaced, this.getClreplaced().getName());
    }
    // Add mouse event details
    MouseEventDetails details = MouseEventDetailsBuilder.buildMouseEventDetails(event.getCurrentGwtEvent(), getElement());
    event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize());
}

5 View Complete Implementation : VDDAbsoluteLayout.java
Copyright Apache License 2.0
Author : cuba-platform
protected void updateDragDetails(VDragEvent drag) {
    // Get absolute coordinates
    int absoluteLeft = drag.getCurrentGwtEvent().getClientX();
    int absoluteTop = drag.getCurrentGwtEvent().getClientY();
    drag.getDropDetails().put(Constants.DROP_DETAIL_ABSOLUTE_LEFT, absoluteLeft);
    drag.getDropDetails().put(Constants.DROP_DETAIL_ABSOLUTE_TOP, absoluteTop);
    // Get relative coordinates
    int offsetLeft = 0;
    if (drag.getDragImage() != null) {
        String offsetLeftStr = drag.getDragImage().getStyle().getMarginLeft();
        offsetLeft = Integer.parseInt(offsetLeftStr.substring(0, offsetLeftStr.length() - 2));
    }
    int relativeLeft = Util.getTouchOrMouseClientX(drag.getCurrentGwtEvent()) - canvas.getAbsoluteLeft() + offsetLeft;
    int offsetTop = 0;
    if (drag.getDragImage() != null) {
        String offsetTopStr = drag.getDragImage().getStyle().getMarginTop();
        offsetTop = Integer.parseInt(offsetTopStr.substring(0, offsetTopStr.length() - 2));
    }
    int relativeTop = Util.getTouchOrMouseClientY(drag.getCurrentGwtEvent()) - canvas.getAbsoluteTop() + offsetTop;
    drag.getDropDetails().put(Constants.DROP_DETAIL_RELATIVE_LEFT, relativeLeft);
    drag.getDropDetails().put(Constants.DROP_DETAIL_RELATIVE_TOP, relativeTop);
    // Get component size
    ComponentConnector widgetConnector = (ComponentConnector) drag.getTransferable().getData(Constants.TRANSFERABLE_DETAIL_COMPONENT);
    if (widgetConnector != null) {
        drag.getDropDetails().put(Constants.DROP_DETAIL_COMPONENT_WIDTH, widgetConnector.getWidget().getOffsetWidth());
        drag.getDropDetails().put(Constants.DROP_DETAIL_COMPONENT_HEIGHT, widgetConnector.getWidget().getOffsetHeight());
    } else {
        drag.getDropDetails().put(Constants.DROP_DETAIL_COMPONENT_WIDTH, -1);
        drag.getDropDetails().put(Constants.DROP_DETAIL_COMPONENT_HEIGHT, -1);
    }
    // Add mouse event details
    MouseEventDetails details = MouseEventDetailsBuilder.buildMouseEventDetails(drag.getCurrentGwtEvent(), getElement());
    drag.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize());
}