@Test public void dragStartHandlerTest() { DragStartHandler dragStartHandler = mock(DragStartHandler.class); ArgumentCaptor<DragStartEventWrapper> captor = ArgumentCaptor.forClass(DragStartEventWrapper.class); when(draggableWidget.addDragStartHandler(Matchers.any(DragStartEventHandler.class))).then(new Answer<HandlerRegistration>() { @Override public HandlerRegistration answer(InvocationOnMock invocation) throws Throwable { startHandler = (DragStartEventHandler) invocation.getArguments()[0]; return null; } }); doNothing().when(instance).setData(Matchers.anyString(), Matchers.anyString()); doReturn(null).when(instance).getData(Matchers.anyString()); instance.wrap(dragStartHandler); startHandler.onDragStart(Mockito.mock(DragStartEvent.class)); verify(dragStartHandler).onDragStart(captor.capture()); DragStartEventWrapper event = captor.getValue(); event.setData("text", "text"); event.getData("text"); verify(instance).setData(Matchers.eq("text"), Matchers.eq("text")); verify(instance).getData(Matchers.eq("text")); }
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); } }); }
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); } }); }
public HandlerRegistration wrap(final DragStartHandler dragHandlers) { HandlerRegistration addDragStartHandler = draggableWidget.addDragStartHandler(new DragStartEventHandler() { @Override public void onDragStart(DragStartEvent event) { dragHandlers.onDragStart(new DragStartEventWrapper(DragStartEndHandlerWrapper.this)); } }); return addDragStartHandler; }
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()); } }
@Override public void setDragStartHandler(DragStartHandler dragStartHandler) { dragStartHandlerOptional = Optional.fromNullable(dragStartHandler); }
@Test public void wrapDragStartHandlerTest() { DragStartHandler startHandler = mock(DragStartHandler.class); instance.wrap(startHandler); verify(draggableWidget).addDragStartHandler(Matchers.any(DragStartEventHandler.class)); }
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()); }
void setDragStartHandler(DragStartHandler dragGapStartDragHandler);
public HandlerRegistration addDragStartHandler(DragStartHandler handler);