private void addDragStartHandlerToItem(DraggableObject<FlowPanel> draggableObject) { draggableObject.addDragStartHandler(new DragStartHandler() { @Override public void onDragStart(DragStartEvent event) { touchController.setTouchReservation(true); event.getDataTransfer().setDragImage(itemWrapper.getElement(), 0, 0); dragStartHandlerOptional.get().onDragStart(event); } }); }
@Override public void onDragStart(DragStartEvent event) { sourceListManagerAdapter.dragStart(); DragDataObject dataObject = overlayTypesParser.<NativeDragDataObject>get(); dataObject.setItemId(itemIdWrapper.getInstance()); dataObject.setSourceId(moduleIdentifier); event.setData("json", dataObject.toJSON()); }
private void addDragStartHandler() { draggable.addDragStartHandler(new DragStartHandler() { @Override public void onDragStart(DragStartEvent event) { scormScrollPanel.lockScroll(); touchController.setTouchReservation(true); getElement().addClassName(styleNames.QP_DRAGGED_DRAG()); event.getDataTransfer().setDragImage(getElement(), 0, 0); sourceListView.onDragEvent(DragDropEventTypes.DRAG_START, SourceListViewItem.this, event); } }); }
@Test public void shouldInformSourcelistManagerAndExtendEventDataOnDragStart() throws Exception { DragStartEvent event = Mockito.mock(DragStartEvent.class); NativeDragDataObject dragDataObject = Mockito.mock(NativeDragDataObject.class); when(overlayTypesParser.get()).thenReturn(dragDataObject); String jsonString = "jsonString"; when(dragDataObject.toJSON()).thenReturn(jsonString); dragHandler.onDragStart(event); verify(sourcelistManagerAdapter).dragStart(); InOrder inOrder = Mockito.inOrder(overlayTypesParser, dragDataObject); inOrder.verify(overlayTypesParser) .get(); inOrder.verify(dragDataObject) .setItemId(itemIdWrapper.getInstance()); inOrder.verify(dragDataObject) .setSourceId(moduleIdentifier); }
public void disableDragAndDrop() { this.dndEnabled = false; // Prevent from dragging title element around if (noDragHandler == null) { noDragHandler = this.addDomHandler(new DragStartHandler() { @Override public void onDragStart(DragStartEvent event) { event.preventDefault(); } }, DragStartEvent.getType()); } }
/** * Handles "drag-start" events inside the element named "root". */ @UiHandler({"root"}) void onDragStart(DragStartEvent event, Element parent, Context context) { // Save the ID of the TaskProxy. DataTransfer dataTransfer = event.getDataTransfer(); dataTransfer.setData("text", String.valueOf(context.getIndex())); // Set the image. dataTransfer.setDragImage(parent, 25, 15); }
public HandlerRegistration addDragStartHandler(DragStartHandler handler) { return addBitlessDomHandler(handler, DragStartEvent.getType()); }
@Override public com.google.gwt.event.shared.HandlerRegistration addDragStartHandler(DragStartHandler handler) { return this.addBitlessDomHandler(handler, DragStartEvent.getType()); }
@Override public HandlerRegistration addDragStartHandler(DragStartHandler handler) { return this.addBitlessDomHandler(handler, DragStartEvent.getType()); }
public void addDragStartHandler(DragStartHandler handler) { addBitlessDomHandler(handler, DragStartEvent.getType()); }