Package com.google.web.bindery.event.shared

Examples of com.google.web.bindery.event.shared.SimpleEventBus.fireEvent()


    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
View Full Code Here


    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

    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);
  }

  public void testEventBinder_unbindEventHandlers() {
View Full Code Here

    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);
View Full Code Here

    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);
View Full Code Here

    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);
View Full Code Here

    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);
View Full Code Here

    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

    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

    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);
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.