List of usage examples for com.vaadin.shared MouseEventDetails serialize
public String serialize()
From source file:com.haulmont.cuba.web.widgets.client.addons.dragdroplayouts.ui.verticalsplitpanel.VDDVerticalSplitPanel.java
License:Apache License
/** * Updates the drop details while dragging. This is needed to ensure client * side criterias can validate the drop location. * // www .ja va 2 s . com * @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_CLASS, content.getClass().getName()); } else { event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLASS, this.getClass().getName()); } // Add mouse event details MouseEventDetails details = MouseEventDetailsBuilder.buildMouseEventDetails(event.getCurrentGwtEvent(), getElement()); event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT, details.serialize()); }
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 .jav a 2 s . c o m*/ * @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()); }