Examples of SimpleEventBus


Examples of com.google.gwt.event.shared.SimpleEventBus

public class DefaultApplicationEventBus implements ApplicationEventBus {

    private final ResettableEventBus eventBus;

    public DefaultApplicationEventBus() {
        eventBus = new ResettableEventBus(new SimpleEventBus());
    }
View Full Code Here

Examples of com.google.gwt.event.shared.SimpleEventBus

    activateLast();
    ensureHandlers().fireEvent(new UnregisterEvent<Widget>(widget));
  }

  SimpleEventBus ensureHandlers() {
    return eventBus == null ? eventBus = new SimpleEventBus() : eventBus;
  }
View Full Code Here

Examples of com.google.gwt.event.shared.SimpleEventBus

  protected void setLastLoadConfig(C lastLoadConfig) {
    this.lastLoadConfig = lastLoadConfig;
  }

  SimpleEventBus ensureHandler() {
    return eventBus == null ? eventBus = new SimpleEventBus() : eventBus;
  }
View Full Code Here

Examples of com.google.gwt.event.shared.SimpleEventBus

    ensureHandlers().fireEvent(new LiveGridViewUpdateEvent(liveStoreOffset, viewIndex, totalCount, rowCount));
  }

  SimpleEventBus ensureHandlers() {
    return eventBus == null ? eventBus = new SimpleEventBus() : eventBus;
  }
View Full Code Here

Examples of com.google.gwt.event.shared.SimpleEventBus

   * Instantiates the eventBus if not already instantiated.
   *
   * @return the eventBus
   */
  SimpleEventBus ensureHandlers() {
    return eventBus == null ? eventBus = new SimpleEventBus() : eventBus;
  }
View Full Code Here

Examples of com.google.web.bindery.event.shared.SimpleEventBus

  public String getModuleName() {
    return "com.google.web.bindery.event.EventBinder";
  }

  public void testEventBinder() {
    EventBus eventBus = new SimpleEventBus();
    TestPresenter presenter = new TestPresenter();
    TestPresenter.MyEventBinder binder = GWT.create(TestPresenter.MyEventBinder.class);
    binder.bindEventHandlers(presenter, eventBus);

    // Test one event
    assertEquals(0, presenter.firstEventsHandled);
    eventBus.fireEvent(new FirstEvent());
    assertEquals(1, presenter.firstEventsHandled);
    assertEquals(1, presenter.firstEventsWithoutParameterHandled);
    assertEquals(1, presenter.firstAndSecondEventsHandled);

    // Test another event twice
    assertEquals(0, presenter.secondEventsHandled);
    eventBus.fireEvent(new SecondEvent());
    eventBus.fireEvent(new SecondEvent());
    assertEquals(2, presenter.secondEventsHandled);
    assertEquals(3, presenter.firstAndSecondEventsHandled);
  }
View Full Code Here

Examples of com.google.web.bindery.event.shared.SimpleEventBus

    assertEquals(2, presenter.secondEventsHandled);
    assertEquals(3, presenter.firstAndSecondEventsHandled);
  }

  public void testEventBinder_unbindEventHandlers() {
    EventBus eventBus = new SimpleEventBus();
    TestPresenter presenter = new TestPresenter();
    TestPresenter.MyEventBinder binder = GWT.create(TestPresenter.MyEventBinder.class);
    HandlerRegistration registration = binder.bindEventHandlers(presenter, eventBus);
    assertEquals(0, presenter.firstEventsHandled);
    assertEquals(0, presenter.firstEventsWithoutParameterHandled);
    assertEquals(0, presenter.secondEventsHandled);

    // Before unregistering
    eventBus.fireEvent(new FirstEvent());
    eventBus.fireEvent(new SecondEvent());
    assertEquals(1, presenter.firstEventsHandled);
    assertEquals(1, presenter.firstEventsWithoutParameterHandled);
    assertEquals(1, presenter.secondEventsHandled);
    assertEquals(2, presenter.firstAndSecondEventsHandled);

    // After unregistering
    registration.removeHandler();
    eventBus.fireEvent(new FirstEvent());
    eventBus.fireEvent(new SecondEvent());
    assertEquals(1, presenter.firstEventsHandled);
    assertEquals(1, presenter.firstEventsWithoutParameterHandled);
    assertEquals(1, presenter.secondEventsHandled);
    assertEquals(2, presenter.firstAndSecondEventsHandled);

    // After re-registering
    binder.bindEventHandlers(presenter, eventBus);
    eventBus.fireEvent(new FirstEvent());
    eventBus.fireEvent(new SecondEvent());
    assertEquals(2, presenter.firstEventsHandled);
    assertEquals(2, presenter.firstEventsWithoutParameterHandled);
    assertEquals(2, presenter.secondEventsHandled);
    assertEquals(4, presenter.firstAndSecondEventsHandled);
  }
View Full Code Here

Examples of com.google.web.bindery.event.shared.SimpleEventBus

    eventBus.fireEvent(new FirstEvent());
    assertEquals(1, presenter.firstEventsHandled);
  }

  public void testEventBinder_withHandlersInSuperclass() {
    EventBus eventBus = new SimpleEventBus();
    SubPresenter presenter = new SubPresenter();
    SubPresenter.MyEventBinder binder = GWT.create(SubPresenter.MyEventBinder.class);
    binder.bindEventHandlers(presenter, eventBus);

    eventBus.fireEvent(new FirstEvent());
    eventBus.fireEvent(new SecondEvent());
    eventBus.fireEvent(new ThirdEvent());

    // FirstEvent has a handler in both classes, so it should be handled twice
    assertEquals(1, presenter.firstEventsHandled);
    assertEquals(1, presenter.firstEventsWithoutParameterHandled);
    assertEquals(1, presenter.subclassFirstEventsHandled);
View Full Code Here

Examples of com.google.web.bindery.event.shared.SimpleEventBus

    private final NavigationDelegate navigationDelegate;

    @Inject
    public InteractionCoordinator(Dialog dialog, StatementContext parentContext, NavigationDelegate navigationDelegate) {
        this.dialog = dialog;
        this.bus = new SimpleEventBus();
        this.navigationDelegate = navigationDelegate;
        this.dialogState = new DialogState(dialog, parentContext, this);

        // coordinator handles all events except presentation & system events
        bus.addHandler(InteractionEvent.TYPE, this);
View Full Code Here

Examples of com.google.web.bindery.event.shared.SimpleEventBus

    private final NavigationDelegate navigationDelegate;

    @Inject
    public InteractionCoordinator(Dialog dialog, StatementContext parentContext, NavigationDelegate navigationDelegate) {
        this.dialog = dialog;
        this.bus = new SimpleEventBus();
        this.navigationDelegate = navigationDelegate;
        this.dialogState = new DialogState(dialog, parentContext, this);

        // coordinator handles all events except presentation & system events
        bus.addHandler(InteractionEvent.TYPE, this);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.