當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。