当前位置: 首页>>代码示例>>Java>>正文


Java DropEvent类代码示例

本文整理汇总了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);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:19,代码来源:SourceListConnectedDropHandlerTest.java

示例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;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:16,代码来源:DragDataObjectFromEventExtractor.java

示例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());
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:8,代码来源:SourceListConnectedDropHandler.java

示例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());
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:9,代码来源:SourceListViewDropHandler.java

示例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());
            }
        }
    });
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:12,代码来源:TextEntryGapModulePresenterBase.java

示例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));
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:13,代码来源:TextBoxChangeHandlerJUnitTest.java

示例9: onDrop

import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
@Override
public void onDrop(DropEvent event) {
    BlurEvent noopBlurEvent = new BlurEvent() {
    };
    callBlurHandler(noopBlurEvent);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:7,代码来源:TextBoxChangeHandler.java

示例10: addDropHandler

import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
public HandlerRegistration addDropHandler(DropHandler handler) {
  return addBitlessDomHandler(handler, DropEvent.getType());
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:4,代码来源:HandlerPanel.java

示例11: addDropHandler

import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
/**
* 
*/
 @Override
   public HandlerRegistration addDropHandler(DropHandler handler) {
       return addBitlessDomHandler(handler, DropEvent.getType());
   }
 
开发者ID:akjava,项目名称:gwthtml5apps,代码行数:8,代码来源:DropDockRootPanel.java

示例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());
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:5,代码来源:AbstractInput.java

示例13: addDropHandler

import com.google.gwt.event.dom.client.DropEvent; //导入依赖的package包/类
@Override
public HandlerRegistration addDropHandler(DropHandler handler) {
	return this.addBitlessDomHandler(handler, DropEvent.getType());
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:5,代码来源:ListItem.java


注:本文中的com.google.gwt.event.dom.client.DropEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。