本文整理汇总了Java中com.google.gwt.event.dom.client.DropEvent类的典型用法代码示例。如果您正苦于以下问题:Java DropEvent类的具体用法?Java DropEvent怎么用?Java DropEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DropEvent类属于com.google.gwt.event.dom.client包,在下文中一共展示了DropEvent类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldExtractObjectWhenJsonIsValid
import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
@Test
public void shouldExtractObjectWhenJsonIsValid() throws Exception {
DropEvent dropEvent = Mockito.mock(DropEvent.class);
String json = "some json";
when(dropEvent.getData("json")).thenReturn(json);
when(overlayTypesParser.isValidJSON(json)).thenReturn(true);
NativeDragDataObject nativeDragData = Mockito.mock(NativeDragDataObject.class);
when(overlayTypesParser.get(json)).thenReturn(nativeDragData);
Optional<DragDataObject> extracted = dataObjectFromEventExtractor.extractDroppedObjectFromEvent(dropEvent);
verify(dropEvent).stopPropagation();
verify(dropEvent).preventDefault();
assertThat(extracted.get()).isEqualTo(nativeDragData);
}
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:19,代码来源:DragDataObjectFromEventExtractorJUnitTest.java
示例2: shouldReturnAbsentWhenJsonIsNotValid
import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
@Test
public void shouldReturnAbsentWhenJsonIsNotValid() throws Exception {
DropEvent dropEvent = Mockito.mock(DropEvent.class);
String json = "some json";
when(dropEvent.getData("json")).thenReturn(json);
when(overlayTypesParser.isValidJSON(json)).thenReturn(false);
NativeDragDataObject nativeDragData = Mockito.mock(NativeDragDataObject.class);
when(overlayTypesParser.get(json)).thenReturn(nativeDragData);
Optional<DragDataObject> extracted = dataObjectFromEventExtractor.extractDroppedObjectFromEvent(dropEvent);
verify(dropEvent).stopPropagation();
verify(dropEvent).preventDefault();
assertThat(extracted.isPresent()).isEqualTo(false);
}
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:19,代码来源:DragDataObjectFromEventExtractorJUnitTest.java
示例3: shouldExtractDataFromEventAndInformSourcelistManager
import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
@Test
public void shouldExtractDataFromEventAndInformSourcelistManager() throws Exception {
DropEvent event = Mockito.mock(DropEvent.class);
DragDataObject dragDataObject = Mockito.mock(DragDataObject.class);
Optional<DragDataObject> optionalDragData = Optional.fromNullable(dragDataObject);
when(dragDataObjectFromEventExtractor.extractDroppedObjectFromEvent(event)).thenReturn(optionalDragData);
String itemId = "itemId";
when(dragDataObject.getItemId()).thenReturn(itemId);
String sourceId = "sourceId";
when(dragDataObject.getSourceId()).thenReturn(sourceId);
dropHandler.onDrop(event);
verify(sourceListManagerAdapter).dragEnd(itemId, sourceId);
}
示例4: extractDroppedObjectFromEvent
import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
public Optional<DragDataObject> extractDroppedObjectFromEvent(DropEvent dropEvent) {
String jsonObject = dropEvent.getData("json");
Optional<DragDataObject> dragData;
if (overlayTypesParser.isValidJSON(jsonObject)) {
NativeDragDataObject nativeDragData = overlayTypesParser.get(jsonObject);
DragDataObject dragDataObject = nativeDragData;
dragData = Optional.fromNullable(dragDataObject);
} else {
dragData = Optional.absent();
}
dropEvent.stopPropagation();
dropEvent.preventDefault();
return dragData;
}
示例5: onDrop
import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
@Override
public void onDrop(DropEvent event) {
Optional<DragDataObject> objectFromEvent = dragDataObjectFromEventExtractor.extractDroppedObjectFromEvent(event);
if (objectFromEvent.isPresent()) {
informSourceListManagerAboutDrop(objectFromEvent.get());
}
}
示例6: onDrop
import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
@Override
public void onDrop(DropEvent event) {
Optional<DragDataObject> objectFromEvent = objectFromEventExtractor.extractDroppedObjectFromEvent(event);
if (objectFromEvent.isPresent()) {
DragDataObject dataObject = objectFromEvent.get();
sourceListPresenter.onDropEvent(dataObject.getItemId(), dataObject.getSourceId());
}
}
示例7: addDomHandlerOnObjectDrop
import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
public void addDomHandlerOnObjectDrop(final GapDropHandler dragGapDropHandler) {
droppable.addDropHandler(new DropHandler() {
@Override
public void onDrop(DropEvent event) {
Optional<DragDataObject> objectFromEvent = dataObjectFromEventExtractor.extractDroppedObjectFromEvent(event);
if (objectFromEvent.isPresent()) {
dragGapDropHandler.onDrop(objectFromEvent.get());
}
}
});
}
示例8: shouldHandleDropAsOnBlur
import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
@Test
public void shouldHandleDropAsOnBlur() {
// given
DropEvent event = mock(DropEvent.class);
// when
testObj.bind(droppableObject, presenterHandler);
testObj.onDrop(event);
// then
verify(presenterHandler).onBlur(Matchers.any(BlurEvent.class));
}
示例9: onDrop
import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
@Override
public void onDrop(DropEvent event) {
BlurEvent noopBlurEvent = new BlurEvent() {
};
callBlurHandler(noopBlurEvent);
}
示例10: addDropHandler
import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
public HandlerRegistration addDropHandler(DropHandler handler) {
return addBitlessDomHandler(handler, DropEvent.getType());
}
示例11: addDropHandler
import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
/**
*
*/
@Override
public HandlerRegistration addDropHandler(DropHandler handler) {
return addBitlessDomHandler(handler, DropEvent.getType());
}
示例12: addDropHandler
import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
@Override
public com.google.gwt.event.shared.HandlerRegistration addDropHandler(DropHandler handler) {
return this.addBitlessDomHandler(handler, DropEvent.getType());
}
示例13: addDropHandler
import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
@Override
public HandlerRegistration addDropHandler(DropHandler handler) {
return this.addBitlessDomHandler(handler, DropEvent.getType());
}