@Test public void dragEndHandlerTest() { DragEndHandler endHandler = mock(DragEndHandler.class); ArgumentCaptor<DragEndEventWrapper> captor = ArgumentCaptor.forClass(DragEndEventWrapper.class); when(draggableWidget.addDragStopHandler(Matchers.any(DragStopEventHandler.class))).then(new Answer<HandlerRegistration>() { @Override public HandlerRegistration answer(InvocationOnMock invocation) throws Throwable { stopHandler = (DragStopEventHandler) invocation.getArguments()[0]; return null; } }); doNothing().when(instance).setData(Matchers.anyString(), Matchers.anyString()); doReturn(null).when(instance).getData(Matchers.anyString()); instance.wrap(endHandler); stopHandler.onDragStop(mock(DragStopEvent.class)); verify(endHandler).onDragEnd(captor.capture()); DragEndEventWrapper 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 addDragEndHandlerToItem(DraggableObject<FlowPanel> draggableObject) { draggableObject.addDragEndHandler(new DragEndHandler() { @Override public void onDragEnd(DragEndEvent event) { removeDraggableStyleFromItem(); dragEndHandler.onDragEnd(event); } }); }
private void addDragEndHandler() { draggable.addDragEndHandler(new DragEndHandler() { @Override public void onDragEnd(DragEndEvent event) { scormScrollPanel.unlockScroll(); getElement().removeClassName(styleNames.QP_DRAGGED_DRAG()); sourceListView.onDragEvent(DragDropEventTypes.DRAG_END, SourceListViewItem.this, event); } }); }
public HandlerRegistration wrap(final DragEndHandler dragHandlers) { HandlerRegistration addDragStartHandler = draggableWidget.addDragStopHandler(new DragStopEventHandler() { @Override public void onDragStop(DragStopEvent event) { dragHandlers.onDragEnd(new DragEndEventWrapper(DragStartEndHandlerWrapper.this)); } }); return addDragStartHandler; }
@Override public void setDragEndHandler(final DragEndHandler dragEndHandler) { this.dragEndHandler = dragEndHandler; }
@Test public void wrapDragEndHandlerTest() { DragEndHandler endHandler = mock(DragEndHandler.class); instance.wrap(endHandler); verify(draggableWidget).addDragStopHandler(Matchers.any(DragStopEventHandler.class)); }
public HandlerRegistration addDragEndHandler(DragEndHandler handler) { return addBitlessDomHandler(handler, DragEndEvent.getType()); }
@Override public com.google.gwt.event.shared.HandlerRegistration addDragEndHandler(DragEndHandler handler) { return this.addBitlessDomHandler(handler, DragEndEvent.getType()); }
@Override public HandlerRegistration addDragEndHandler(DragEndHandler handler) { return this.addBitlessDomHandler(handler, DragEndEvent.getType()); }
void setDragEndHandler(DragEndHandler dragEndHandler);
public HandlerRegistration addDragEndHandler(DragEndHandler handler);