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

The following examples show how to use com.google.gwt.event.shared.SimpleEventBus. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SampleEntryPoint.java    From gwteventbinder with Apache License 2.0 6 votes vote down vote up
@Override
public void onModuleLoad() {
  // Create the object graph - a real application would use Gin
  SimpleEventBus eventBus = new SimpleEventBus();

  SidebarPresenter sidebarPresenter = new SidebarPresenter(eventBus);
  Button sidebarView = new Button("Contacts");
  sidebarView.getElement().getStyle().setFloat(Style.Float.LEFT);
  sidebarView.getElement().getStyle().setMarginRight(20, Unit.PX);
  sidebarPresenter.setView(sidebarView);
  RootPanel.get().add(sidebarView);

  ContactsPresenter contactsPresenter = new ContactsPresenter(eventBus);
  VerticalPanel contactsView = new VerticalPanel();
  contactsPresenter.setView(contactsView);
  RootPanel.get().add(contactsView);

  // Start listening for events in the presenter
  contactsPresenter.start();

  // Eagerly bind the server proxy
  ServerProxy server = new ServerProxy(eventBus);
}
 
Example #2
Source File: CollectionGinModule.java    From gwt-boot-samples with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
	// Bind the SimpleEventBus as Singleton
	bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);

	// Bind ServicePreparator
	bind(ServicePreparator.class).to(RestServicePreparator.class)
			.in(Singleton.class);

	// Bind client for RestyGWT
	bind(PersonClient.class).to(RestPersonClient.class).in(Singleton.class);
}
 
Example #3
Source File: DemoGwtMockWebAppGinModule.java    From demo-gwt-springboot with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
	// Bind the SimpleEventBus as Singleton
	bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);

       // Bind ServicePreparator
       bind(ServicePreparator.class).to(MockServicePreparator.class).in(Singleton.class);

       // Using the mocks
	bind(PersonClient.class).to(MockPersonClient.class).in(Singleton.class);
       bind(UserClient.class).to(MockUserClient.class).in(Singleton.class);
}
 
Example #4
Source File: DemoGwtGinModule.java    From demo-gwt-springboot with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
	// Bind the SimpleEventBus as Singleton
	bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);

	// Bind ServicePreparator
       bind(ServicePreparator.class).to(RestServicePreparator.class).in(Singleton.class);

	// Using the real RestyGwt
	bind(PersonClient.class).to(RestPersonClient.class).in(Singleton.class);
	bind(UserClient.class).to(RestUserClient.class).in(Singleton.class);
}
 
Example #5
Source File: ValidatorMixin.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiates a new abstract validator mixin.
 *
 * @param inputWidget  the input widget
 * @param errorHandler the error handler
 */
public ValidatorMixin(W inputWidget, ErrorHandler errorHandler) {
    this.inputWidget = inputWidget;
    this.errorHandler = errorHandler;
    eventBus = new SimpleEventBus();

    setupValueChangeValidation();
}
 
Example #6
Source File: ProxyAndAnonymousClassSerializationGwtTest.java    From gwt-jackson with Apache License 2.0 5 votes vote down vote up
public void testSerializationProxy() {
    TestRequestFactory requestFactory = GWT.create( TestRequestFactory.class );
    requestFactory.initialize( new SimpleEventBus() );

    ServiceContext serviceContext = requestFactory.serviceContext();
    RfBeanProxy proxy = serviceContext.create( RfBeanProxy.class );
    proxy.setId( 54 );
    proxy.setName( "Toto" );

    RfBeanProxyWriter writer = GWT.create( RfBeanProxyWriter.class );
    String json = writer.write( proxy );
    assertEquals( "{\"id\":54,\"name\":\"Toto\"}", json );
}
 
Example #7
Source File: ApplicationCacheTest.java    From gwt-appcache with Apache License 2.0 5 votes vote down vote up
@Test
public void registryTest()
{
  assertNull( ApplicationCache.getApplicationCacheIfSupported() );
  ApplicationCache.register( new TestApplicationCache( new SimpleEventBus() ) );
  assertNotNull( ApplicationCache.getApplicationCacheIfSupported() );
  final ApplicationCache applicationCache = ApplicationCache.getApplicationCacheIfSupported();
  assertTrue( ApplicationCache.deregister( applicationCache ) );
  assertNull( ApplicationCache.getApplicationCacheIfSupported() );
  assertFalse( ApplicationCache.deregister( applicationCache ) );
}
 
Example #8
Source File: MainController.java    From lumongo with Apache License 2.0 4 votes vote down vote up
private MainController() {
	eventBus = new SimpleEventBus();
	placeController = new PlaceController(eventBus);
}