public final class VDragDropUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static com.vaadin.client.ui.dd.VTransferable |
createLayoutTransferableFromMouseDown(com.google.gwt.dom.client.NativeEvent event,
com.google.gwt.user.client.ui.Widget root,
com.google.gwt.user.client.ui.Widget target)
Creates a transferable from a mouse down event.
|
static int |
findSlotIndex(com.google.gwt.user.client.ui.WidgetCollection children,
com.vaadin.client.ui.orderedlayout.Slot slot)
Finds a slots index in a collection of slots and captions
|
static com.vaadin.shared.ui.dd.HorizontalDropLocation |
getHorizontalDropLocation(com.google.gwt.dom.client.Element element,
int clientX,
double leftRightRatio)
Get the horizontal drop location in an ordered layout
|
static com.vaadin.client.ui.orderedlayout.VAbstractOrderedLayout |
getSlotLayout(com.vaadin.client.ui.orderedlayout.Slot slot)
Returns the parent layout that the slot belongs to
|
static com.google.gwt.user.client.ui.Widget |
getTransferableWidget(com.google.gwt.user.client.ui.Widget w) |
static com.vaadin.shared.ui.dd.VerticalDropLocation |
getVerticalDropLocation(com.google.gwt.dom.client.Element element,
int clientY,
double topBottomRatio)
Get the vertical drop location in a ordered layout
|
static com.vaadin.shared.ui.dd.VerticalDropLocation |
getVerticalDropLocation(com.google.gwt.dom.client.Element element,
int offsetHeight,
int clientY,
double topBottomRatio)
Get the vertical drop location in a ordered layout
|
static boolean |
isCaption(com.google.gwt.user.client.ui.Widget w)
Resolve if widget is a Vaadin Caption
|
static boolean |
isCaptionOrCaptionless(com.google.gwt.user.client.ui.Widget w)
Does the same as
isCaption(Widget) but also returns true for
Vaadin widgets that do not have a caption like Button and
Link |
static boolean |
isDraggingEnabled(com.vaadin.client.ComponentConnector layout,
com.google.gwt.user.client.ui.Widget w)
Is dragging enabled for a component container
|
static void |
listenToStateChangeEvents(com.vaadin.client.ui.AbstractConnector connector,
com.google.gwt.user.client.ui.Widget widget)
Adds a listener for listening for changes to
DragAndDropAwareState 's. |
static int |
measureMarginLeft(com.google.gwt.dom.client.Element element)
Measures the left margin of an element
|
static int |
measureMarginTop(com.google.gwt.dom.client.Element element)
Measures the top margin of an element
|
static com.vaadin.client.UIDL |
removeDragDropCriteraFromUIDL(com.vaadin.client.UIDL uidl)
Removes the Drag and drop fake paintable from an UIDL
|
static void |
updateDropHandlerFromUIDL(com.vaadin.client.UIDL uidl,
com.vaadin.client.ComponentConnector connector,
VDDAbstractDropHandler dropHandler) |
public static com.vaadin.shared.ui.dd.VerticalDropLocation getVerticalDropLocation(com.google.gwt.dom.client.Element element, int clientY, double topBottomRatio)
element
- The target element or cellclientY
- The client y-coordinatetopBottomRatio
- The ratio how the cell has been dividedpublic static com.vaadin.shared.ui.dd.VerticalDropLocation getVerticalDropLocation(com.google.gwt.dom.client.Element element, int offsetHeight, int clientY, double topBottomRatio)
element
- The target element or celloffsetHeight
- The height of the cellclientY
- The width of the celltopBottomRatio
- The ratio of the cellpublic static com.vaadin.shared.ui.dd.HorizontalDropLocation getHorizontalDropLocation(com.google.gwt.dom.client.Element element, int clientX, double leftRightRatio)
element
- The target element or cellclientX
- The x-coordinate of the dropleftRightRatio
- The ratio of how the cell has been dividedpublic static com.vaadin.client.ui.dd.VTransferable createLayoutTransferableFromMouseDown(com.google.gwt.dom.client.NativeEvent event, com.google.gwt.user.client.ui.Widget root, com.google.gwt.user.client.ui.Widget target)
event
- The mouse down eventroot
- The root layout from where the component is draggedpublic static boolean isCaption(com.google.gwt.user.client.ui.Widget w)
w
- Widget to checkpublic static boolean isCaptionOrCaptionless(com.google.gwt.user.client.ui.Widget w)
isCaption(Widget)
but also returns true for
Vaadin widgets that do not have a caption like Button
and
Link
w
- The widget to checkpublic static com.google.gwt.user.client.ui.Widget getTransferableWidget(com.google.gwt.user.client.ui.Widget w)
public static boolean isDraggingEnabled(com.vaadin.client.ComponentConnector layout, com.google.gwt.user.client.ui.Widget w)
layout
- The component container to checkpublic static com.vaadin.client.UIDL removeDragDropCriteraFromUIDL(com.vaadin.client.UIDL uidl)
uidl
- The uidl which contains a dragdrop paintable (-ac)public static int measureMarginLeft(com.google.gwt.dom.client.Element element)
element
- The element to measurepublic static int measureMarginTop(com.google.gwt.dom.client.Element element)
element
- The element to measurepublic static void listenToStateChangeEvents(com.vaadin.client.ui.AbstractConnector connector, com.google.gwt.user.client.ui.Widget widget)
DragAndDropAwareState
's.
Preferrable add this to a layout connector's init() method.
connector
- The connector to attach to.widget
- The layout widget returned by Connector.getWidget()public static void updateDropHandlerFromUIDL(com.vaadin.client.UIDL uidl, com.vaadin.client.ComponentConnector connector, VDDAbstractDropHandler dropHandler)
public static com.vaadin.client.ui.orderedlayout.VAbstractOrderedLayout getSlotLayout(com.vaadin.client.ui.orderedlayout.Slot slot)
slot
- the slotpublic static int findSlotIndex(com.google.gwt.user.client.ui.WidgetCollection children, com.vaadin.client.ui.orderedlayout.Slot slot)
children
- the children.slot
- the slot to find.