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


Java HandlerRegistration类代码示例

本文整理汇总了Java中com.google.web.bindery.event.shared.HandlerRegistration的典型用法代码示例。如果您正苦于以下问题:Java HandlerRegistration类的具体用法?Java HandlerRegistration怎么用?Java HandlerRegistration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HandlerRegistration类属于com.google.web.bindery.event.shared包,在下文中一共展示了HandlerRegistration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureSwipe

import com.google.web.bindery.event.shared.HandlerRegistration; //导入依赖的package包/类
private void configureSwipe() {
    if (isSwipeDisabled()) {
        for (HandlerRegistration registration : touchHandlers) {
            registration.removeHandler();
        }
        touchHandlers.clear();
        setVisiblePageCount(1);
    } else {
        RootPanel rootPanel = rootPanelDelegate.getRootPanel();
        HasTouchHandlers touchHandler = touchRecognitionFactory.getTouchRecognition(rootPanel, false);
        touchHandlers.add(touchHandler.addTouchHandler(multiPageTouchHandler, TouchEvent.getType(TouchTypes.TOUCH_START)));
        touchHandlers.add(touchHandler.addTouchHandler(multiPageTouchHandler, TouchEvent.getType(TouchTypes.TOUCH_MOVE)));
        touchHandlers.add(touchHandler.addTouchHandler(multiPageTouchHandler, TouchEvent.getType(TouchTypes.TOUCH_END)));
        setVisiblePageCount(3);
    }
    panelsCache.setSwipeType(swipeType.get());
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:18,代码来源:MultiPageController.java

示例2: removeHandler

import com.google.web.bindery.event.shared.HandlerRegistration; //导入依赖的package包/类
@Test
public void removeHandler() {
    prepare();
    // handler globalny
    HandlerRegistration asyncRegistration = eventsBus.addAsyncHandler(PlayerEvent.getType(PlayerEventTypes.CREATE_MEDIA_WRAPPER), eventHandler);
    // handler na scope
    HandlerRegistration registration = eventsBus
            .addHandler(PlayerEvent.getType(PlayerEventTypes.CREATE_MEDIA_WRAPPER), scopeEventHandler, new CurrentPageScope(0));
    eventsBus.fireEvent(playerEvent);
    Mockito.verify(eventHandler, Mockito.times(1)).onPlayerEvent(playerEvent);
    Mockito.verify(scopeEventHandler, Mockito.times(1)).onPlayerEvent(playerEvent);
    asyncRegistration.removeHandler();
    registration.removeHandler();
    eventsBus.fireEvent(playerEvent);
    Mockito.verify(eventHandler, Mockito.times(1)).onPlayerEvent(playerEvent);
    Mockito.verify(scopeEventHandler, Mockito.times(1)).onPlayerEvent(playerEvent);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:18,代码来源:EventBusJUnitTest.java

示例3: dragStartHandlerTest

import com.google.web.bindery.event.shared.HandlerRegistration; //导入依赖的package包/类
@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"));
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:23,代码来源:DragStartEndHandlerWrapperTest.java

示例4: dragEndHandlerTest

import com.google.web.bindery.event.shared.HandlerRegistration; //导入依赖的package包/类
@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"));

}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:24,代码来源:DragStartEndHandlerWrapperTest.java

示例5: addConnectivityHandler

import com.google.web.bindery.event.shared.HandlerRegistration; //导入依赖的package包/类
@Override
public final HandlerRegistration addConnectivityHandler(final ConnectivityEvent.Handler handler) {
	EventListener el = new EventListener() {
		@Override
		public void onBrowserEvent(Event event) {
			handler.onConnectivity((ConnectivityEventJsoImpl) event.cast());
		}
	};
	
	final HandlerRegistration hr1 = register(this, "online", el);
	final HandlerRegistration hr2 = register(this, "offline", el);
	
	return new HandlerRegistration() {
		
		@Override
		public void removeHandler() {
			hr1.removeHandler();
			hr2.removeHandler();
		}
	};
}
 
开发者ID:metteo,项目名称:gwt-worker,代码行数:22,代码来源:AbstractWorkerScopeJsoImpl.java

示例6: initialize

import com.google.web.bindery.event.shared.HandlerRegistration; //导入依赖的package包/类
/**
     * Initialize this place history handler.
     * @return a registration object to de-register the handler
     */
    public HandlerRegistration initialize(final PlaceManager placeManager,
                                          final EventBus eventBus,
                                          final PlaceRequest defaultPlaceRequest) {
        this.placeManager = placeManager;
        this.defaultPlaceRequest = defaultPlaceRequest;

        final HandlerRegistration historyReg =
                historian.addValueChangeHandler(event -> {
                    //Temporarily disabled until https://issues.jboss.org/browse/AF-523 is ready
//                    handleHistoryToken(event.getValue());
                });

        return () -> {
            PlaceHistoryHandler.this.defaultPlaceRequest = DefaultPlaceRequest.NOWHERE;
            PlaceHistoryHandler.this.placeManager = null;
            historyReg.removeHandler();
        };
    }
 
开发者ID:kiegroup,项目名称:appformer,代码行数:23,代码来源:PlaceHistoryHandler.java

示例7: addDirtyHandler

import com.google.web.bindery.event.shared.HandlerRegistration; //导入依赖的package包/类
@Override
public HandlerRegistration addDirtyHandler(Handler handler) {
	if (this.clickHandlerRegistration == null) {
		this.clickHandlerRegistration = this.addDomHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				if (!InputBoolean.this.eventTargetsLabelOrChild(event)) {
					InputBoolean.this.setInputValue(!InputBoolean.this.getInputValue());
				}
				DirtyEvent.fire(InputBoolean.this);
				ValueChangeEvent.fire(InputBoolean.this, InputBoolean.this.getInputValue());
			}
		}, ClickEvent.getType());
	}
	return super.addDirtyHandler(handler);
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:17,代码来源:InputBoolean.java

示例8: postConstruct

import com.google.web.bindery.event.shared.HandlerRegistration; //导入依赖的package包/类
@PostConstruct
public void postConstruct() {
    if (isSynchronizationNeeded()) { // powoduje problemy na
        // mobilnych
        // synchronizacja pomiedzy dwoma obiektami video
        HandlerRegistration addHandlerToSource = eventsBus.addHandlerToSource(MediaEvent.getType(MediaEventTypes.ON_FULL_SCREEN_OPEN),
                fullScreanMediaWrapper, this, pageScopeFactory.getCurrentPageScope());
        handlersRegistration.add(addHandlerToSource);
        addHandlerToSource = eventsBus.addHandlerToSource(MediaEvent.getType(MediaEventTypes.ON_FULL_SCREEN_EXIT), fullScreanMediaWrapper, this,
                pageScopeFactory.getCurrentPageScope());
        handlersRegistration.add(addHandlerToSource);
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:14,代码来源:MediaWrappersPair.java

示例9: removeHandler

import com.google.web.bindery.event.shared.HandlerRegistration; //导入依赖的package包/类
protected void removeHandler(MediaEventTypes mediaEventType) {
    Set<Entry<MediaEventTypes, HandlerRegistration>> handleRegistrationsEntrySet = handlerRegistrations.entrySet();
    for (Entry<MediaEventTypes, HandlerRegistration> handlerRegistrationEntry : handleRegistrationsEntrySet) {
        MediaEventTypes entryMediaEventType = handlerRegistrationEntry.getKey();
        if (entryMediaEventType.equals(mediaEventType)) {
            HandlerRegistration handlerRegistration = handlerRegistrationEntry.getValue();
            handlerRegistration.removeHandler();
        }
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:11,代码来源:AbstractHTML5MediaWrapper.java

示例10: onAttachOrDetach

import com.google.web.bindery.event.shared.HandlerRegistration; //导入依赖的package包/类
@Override
public void onAttachOrDetach(AttachEvent event) {
    if (event.isAttached()) {
        final HandlerRegistration pauseHandlerRegistration = registerPauseHandlerOnPageChange();
        this.handlerRegistration = Optional.of(pauseHandlerRegistration);
    } else {
        clearHandler();
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:10,代码来源:VideoPlayerAttachHandler.java

示例11: addTouchHandlers

import com.google.web.bindery.event.shared.HandlerRegistration; //导入依赖的package包/类
@Override
public HandlerRegistration[] addTouchHandlers(TouchHandler handler, EventType<TouchHandler, TouchTypes>... events) {
    for (EventType<TouchHandler, TouchTypes> event : events) {
        addTouchHandlers((TouchTypes) event.getType());
    }
    return addHandlers(handler, events);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:8,代码来源:TouchRecognition.java

示例12: doAddAll

import com.google.web.bindery.event.shared.HandlerRegistration; //导入依赖的package包/类
private <H extends EventHandler, T extends Enum<T>> HandlerRegistration[] doAddAll(final EventType<H, T> types[], final Object source, final H handler,
                                                                                   final boolean async, final EventScope<?> eventScope) {
    HandlerRegistration[] registrations = new HandlerRegistration[types.length];
    for (int x = 0; x < types.length; ++x) {
        registrations[x] = doAdd(types[x], source, handler, async, eventScope);
    }
    return registrations;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:9,代码来源:PlayerEventsBus.java

示例13: doAdd

import com.google.web.bindery.event.shared.HandlerRegistration; //导入依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes", "PMD"})
private <H extends EventHandler, T extends Enum<T>> HandlerRegistration doAdd(final EventType<H, T> type, final Object source, final H handler,
                                                                              final boolean async, final EventScope<?> eventScope) {
    if (type == null) {
        throw new NullPointerException("Cannot add a handler with a null type");
    }
    if (handler == null) {
        throw new NullPointerException("Cannot add a null handler");
    }

    Map<Object, Map<EventScope<?>, List<?>>> handlerMap = async ? asyncMap.get(type) : syncMap.get(type);
    if (handlerMap == null) {
        handlerMap = new HashMap<Object, Map<EventScope<?>, List<?>>>();
        if (async) {
            asyncMap.put(type, handlerMap);
        } else {
            syncMap.put(type, handlerMap);
        }
    }
    Map<EventScope<?>, List<?>> handlersScope = handlerMap.get(source);
    if (handlersScope == null) {
        handlersScope = new HashMap<EventScope<?>, List<?>>();
        handlerMap.put(source, handlersScope);
        handlersScope.put(eventScope, new ArrayList());
    }
    List handlers = handlersScope.get(eventScope);
    if (handlers == null) {
        handlers = new ArrayList();
        handlersScope.put(eventScope, handlers);
    }
    handlers.add(handler);

    return new HandlerRegistration() {
        @Override
        public void removeHandler() {
            doRemove(type, source, handler, eventScope, async);
        }
    };

}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:41,代码来源:PlayerEventsBus.java

示例14: fireDragEnterHandlerTest

import com.google.web.bindery.event.shared.HandlerRegistration; //导入依赖的package包/类
@Test
public void fireDragEnterHandlerTest() {
    when(droppableWidget.addOverDroppableHandler(Matchers.any(OverDroppableEventHandler.class))).then(new Answer<HandlerRegistration>() {
        @Override
        public HandlerRegistration answer(InvocationOnMock invocation) throws Throwable {
            droppableEventHandler = (OverDroppableEventHandler) invocation.getArguments()[0];
            return null;
        }
    });
    DragEnterHandler handler = mock(DragEnterHandler.class);
    instance.wrap(handler);
    droppableEventHandler.onOverDroppable(null);
    verify(handler).onDragEnter(Matchers.any(DragEnterEvent.class));
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:15,代码来源:DropEventsHandlerWrapperTest.java

示例15: fireDragLeaveHandlerTest

import com.google.web.bindery.event.shared.HandlerRegistration; //导入依赖的package包/类
@Test
public void fireDragLeaveHandlerTest() {
    when(droppableWidget.addOutDroppableHandler(Matchers.any(OutDroppableEventHandler.class))).then(new Answer<HandlerRegistration>() {
        @Override
        public HandlerRegistration answer(InvocationOnMock invocation) throws Throwable {
            outDroppableEventHandler = (OutDroppableEventHandler) invocation.getArguments()[0];
            return null;
        }
    });
    DragLeaveHandler handler = mock(DragLeaveHandler.class);
    instance.wrap(handler);
    outDroppableEventHandler.onOutDroppable(null);
    verify(handler).onDragLeave(Matchers.any(DragLeaveEvent.class));
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:15,代码来源:DropEventsHandlerWrapperTest.java


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