Search in sources :

Example 1 with HandlerManager

use of com.google.gwt.event.shared.HandlerManager in project opennms by OpenNMS.

the class Main method onModuleLoad.

@Override
public void onModuleLoad() {
    m_eventBus = new HandlerManager(null);
    Application application = new Application(getEventBus());
    MapPanel mapPanel = createMap(application);
    LocationStatusServiceAsync remoteService = GWT.create(LocationStatusService.class);
    RemoteEventService remoteEventService = RemoteEventServiceFactory.getInstance().getRemoteEventService();
    application.initialize(new DefaultApplicationView(application, getEventBus(), mapPanel), remoteService, remoteEventService, new DeferredCommandExecutor());
}
Also used : RemoteEventService(de.novanic.eventservice.client.event.RemoteEventService) HandlerManager(com.google.gwt.event.shared.HandlerManager)

Example 2 with HandlerManager

use of com.google.gwt.event.shared.HandlerManager in project activityinfo by bedatadriven.

the class FilterPanelSet method ensureHandlers.

private HandlerManager ensureHandlers() {
    if (manager == null) {
        manager = new HandlerManager(this);
        myRegistrations = new ArrayList<HandlerRegistration>();
        for (FilterPanel panel : panels) {
            HandlerRegistration registration = panel.addValueChangeHandler(new ValueChangeHandler<Filter>() {

                @Override
                public void onValueChange(ValueChangeEvent<Filter> event) {
                    // or indicator (reports) is selected
                    if (event.getSource() instanceof ActivityFilterPanel || event.getSource() instanceof IndicatorFilterPanel) {
                        clearAttributeAndPartnerFilters();
                    }
                    Filter value = composeFilter(new Filter(), null);
                    Log.debug("FilterPanelSet: Filter changed = " + value);
                    ValueChangeEvent.fire(FilterPanelSet.this, value);
                }
            });
            myRegistrations.add(registration);
        }
    }
    return manager;
}
Also used : HandlerRegistration(com.google.gwt.event.shared.HandlerRegistration) ActivityFilterPanel(org.activityinfo.ui.client.page.entry.ActivityFilterPanel) Filter(org.activityinfo.legacy.shared.command.Filter) HandlerManager(com.google.gwt.event.shared.HandlerManager) ActivityFilterPanel(org.activityinfo.ui.client.page.entry.ActivityFilterPanel)

Example 3 with HandlerManager

use of com.google.gwt.event.shared.HandlerManager in project lienzo-core by ahome-it.

the class Node method addEnsureHandler.

protected final <H extends EventHandler> HandlerRegistration addEnsureHandler(final Type<H> type, final H handler) {
    Objects.requireNonNull(type);
    Objects.requireNonNull(handler);
    HandlerManager hand = m_opts.getHandlerManager();
    if (null == hand) {
        hand = new HandlerManager(this);
        m_opts.setHandlerManager(hand);
    }
    ALL_EVENTS.add(type);
    return hand.addHandler(type, handler);
}
Also used : HandlerManager(com.google.gwt.event.shared.HandlerManager)

Example 4 with HandlerManager

use of com.google.gwt.event.shared.HandlerManager in project kie-wb-common by kiegroup.

the class DecisionServiceSVGShapeViewTest method testAddDividerDragHandler.

@Test
public void testAddDividerDragHandler() {
    view.addDividerDragHandler(dragHandler);
    final HandlerManager handlerManager = view.getHandlerManager();
    assertThat(handlerManager.isEventHandled(MoveDividerStartEvent.TYPE)).isTrue();
    assertThat(handlerManager.isEventHandled(MoveDividerStepEvent.TYPE)).isTrue();
    assertThat(handlerManager.isEventHandled(MoveDividerEndEvent.TYPE)).isTrue();
    assertThat(handlerManager.getHandlerCount(MoveDividerStartEvent.TYPE)).isEqualTo(1);
    assertThat(handlerManager.getHandlerCount(MoveDividerStepEvent.TYPE)).isEqualTo(1);
    assertThat(handlerManager.getHandlerCount(MoveDividerEndEvent.TYPE)).isEqualTo(1);
    handlerManager.getHandler(MoveDividerStartEvent.TYPE, 0).onMoveDividerStart(new MoveDividerStartEvent(view, nodeDragStartEvent));
    verify(dragHandler).start(any(DragEvent.class));
    handlerManager.getHandler(MoveDividerStepEvent.TYPE, 0).onMoveDividerStep(new MoveDividerStepEvent(view, nodeDragMoveEvent));
    verify(dragHandler).handle(any(DragEvent.class));
    handlerManager.getHandler(MoveDividerEndEvent.TYPE, 0).onMoveDividerEnd(new MoveDividerEndEvent(view, nodeDragEndEvent));
    verify(dragHandler).end(any(DragEvent.class));
}
Also used : DragEvent(org.kie.workbench.common.stunner.core.client.shape.view.event.DragEvent) HandlerManager(com.google.gwt.event.shared.HandlerManager) Test(org.junit.Test)

Example 5 with HandlerManager

use of com.google.gwt.event.shared.HandlerManager in project kie-wb-common by kiegroup.

the class DecisionServiceSVGShapeView method addDividerDragHandler.

public DecisionServiceSVGShapeView addDividerDragHandler(final DragHandler dragHandler) {
    final HandlerManager handlerManager = getHandlerManager();
    final HandlerRegistration dragStartRegistration = handlerManager.addHandler(MoveDividerStartEvent.TYPE, event -> dragHandler.start(buildDragEvent(event)));
    final HandlerRegistration dragStepRegistration = handlerManager.addHandler(MoveDividerStepEvent.TYPE, event -> dragHandler.handle(buildDragEvent(event)));
    final HandlerRegistration dragEndRegistration = handlerManager.addHandler(MoveDividerEndEvent.TYPE, event -> dragHandler.end(buildDragEvent(event)));
    final HandlerRegistration[] registrations = new HandlerRegistration[] { dragStartRegistration, dragStepRegistration, dragEndRegistration };
    getEventHandlerManager().addHandlersRegistration(ViewEventType.DRAG, registrations);
    return this;
}
Also used : HandlerRegistration(com.google.gwt.event.shared.HandlerRegistration) HandlerManager(com.google.gwt.event.shared.HandlerManager)

Aggregations

HandlerManager (com.google.gwt.event.shared.HandlerManager)8 HandlerRegistration (com.google.gwt.event.shared.HandlerRegistration)2 NFastStringHistogram (com.ait.tooling.nativetools.client.collection.NFastStringHistogram)1 Type (com.google.gwt.event.dom.client.DomEvent.Type)1 RemoteEventService (de.novanic.eventservice.client.event.RemoteEventService)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Filter (org.activityinfo.legacy.shared.command.Filter)1 ActivityFilterPanel (org.activityinfo.ui.client.page.entry.ActivityFilterPanel)1 Test (org.junit.Test)1 DragEvent (org.kie.workbench.common.stunner.core.client.shape.view.event.DragEvent)1