List of usage examples for com.vaadin.client Util getTouchOrMouseClientX
@Deprecated public static int getTouchOrMouseClientX(NativeEvent event)
From source file:fi.jasoft.draganddrop.client.DragAndDropConnector.java
License:Apache License
private static void updateDragImagePosition(NativeEvent event) { if (dragElement != null) { Style style = dragElement.getStyle(); int clientY = Util.getTouchOrMouseClientY(event); int clientX = Util.getTouchOrMouseClientX(event); style.setTop(clientY, Unit.PX);/*w w w . j a v a 2s . c om*/ style.setLeft(clientX, Unit.PX); } }
From source file:org.semanticsoft.vaaclipse.widgets.client.ui.stackwidget.VStackWidget.java
License:Open Source License
/** * Updates the drop details while dragging. This is needed to ensure client * side criterias can validate the drop location. * // w ww . j a va2 s . c om * @param widget * The container which we are hovering over * @param event * The drag event */ @Override public void updateDropDetails(VDragEvent event) { if (!updateRegion(event)) return; Element element = event.getElementOver(); Widget targetWidget = Util.findWidget(element, null); //-- if (tabBar.getElement().isOrHasChild(element)) { if (targetWidget == 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(targetWidget)); // Add drop location HorizontalDropLocation location = VDragDropUtil.getHorizontalDropLocation(element, Util.getTouchOrMouseClientX(event.getCurrentGwtEvent()), getTabLeftRightDropRatio()); 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()); }