当前位置: 首页>>代码示例>>Java>>正文


Java SimpleEventBus类代码示例

本文整理汇总了Java中com.google.gwt.event.shared.SimpleEventBus的典型用法代码示例。如果您正苦于以下问题:Java SimpleEventBus类的具体用法?Java SimpleEventBus怎么用?Java SimpleEventBus使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SimpleEventBus类属于com.google.gwt.event.shared包,在下文中一共展示了SimpleEventBus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setup

import com.google.gwt.event.shared.SimpleEventBus; //导入依赖的package包/类
@Before
public void setup() {
    GwtMockito.useProviderForType(SimpleEventBus.class,
                                  new FakeProvider() {
                                      @Override
                                      public Object getFake(Class aClass) {
                                          return simpleEventBus;
                                      }
                                  });

    ctx = mock(ModalConfigurationContext.class);
    cleanupPlaceRequest = mock(Command.class);
    editScreen = spy(new EditScreenFake(ctx,
                                        cleanupPlaceRequest));

    when(editScreen.addHiddenHandler(Mockito.any(ModalHiddenHandler.class))).thenAnswer(new Answer() {
        public Object answer(InvocationOnMock aInvocation) throws Throwable {
            modalHiddenHandler = (ModalHiddenHandler) aInvocation.getArguments()[0];
            return null;
        }
    });

    editScreen.realAddHiddenHandler();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:EditScreenTest.java

示例2: failureTest

import com.google.gwt.event.shared.SimpleEventBus; //导入依赖的package包/类
@Test
public void failureTest() {
    eventBus = new SimpleEventBus();
    connectionFailedHandler = Mockito.mock(ConnectionFailedHandler.class);
    dispatcher = Mockito.spy(new TestDispatcher(connectionFailedHandler, eventBus));
    dispatcher.setStatusIndicator(Mockito.mock(AsyncStatusIndicator.class));

    Mockito.when(connectionFailedHandler.startRecover()).thenReturn(true);

    SuccessCallback<GetDescStoreResult> callback = Mockito.mock(SuccessCallback.class);

    dispatcher.execute(new GetDescStore(), callback);

    ArgumentCaptor<IneAsyncCallback> asyncCallbackCaptor = ArgumentCaptor
        .forClass(IneAsyncCallback.class);
    Mockito
        .verify(dispatcher)
        .doExecute(Mockito.any(Action.class), asyncCallbackCaptor.capture());
    asyncCallbackCaptor.getValue().onFailure(new StatusCodeException(0, ""));

    dispatcher.onEvent(new ConnectionEvent(false));
    asyncCallbackCaptor.getValue().onSuccess(result);

    Mockito.verify(callback).onSuccess(result);

}
 
开发者ID:inepex,项目名称:ineform,代码行数:27,代码来源:IneDispatchBaseTest.java

示例3: onModuleLoad

import com.google.gwt.event.shared.SimpleEventBus; //导入依赖的package包/类
@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);
}
 
开发者ID:google,项目名称:gwteventbinder,代码行数:24,代码来源:SampleEntryPoint.java

示例4: configure

import com.google.gwt.event.shared.SimpleEventBus; //导入依赖的package包/类
@Override
protected void configure() {

    /*
     * bind both versions of EventBus to the same single instance of the SimpleEventBus
     */
    bind(SimpleEventBus.class).in(Singleton.class);
    bind(EventBus.class).to(SimpleEventBus.class);
    bind(com.google.gwt.event.shared.EventBus.class).to(SimpleEventBus.class);

    /* navigation */
    bind(Historian.class).to(DefaultHistorian.class).in(Singleton.class);
    bind(AppPlaceHistoryMapper.class).in(Singleton.class);
    bind(PlaceHistoryMapper.class).to(AppPlaceHistoryMapper.class);
    bind(PrefixedPlaceHistoryMapper.class).to(AppPlaceHistoryMapper.class);
    bind(PlaceController.class).to(PlaceControllerEx.class).in(Singleton.class);
    bind(ActivityMapper.class).to(Level9ActivityMapper.class).in(Singleton.class);

    /* set scope of views */
    bind(Level9ApplicationView.class).to(Level9ApplicationViewImpl.class).in(Singleton.class);
    bind(Level9GameView.class).to(Level9GameViewImpl.class).in(Singleton.class);

    /* choose desktop implementation */
    bind(ApplicationActivity.class).to(Level9ApplicationActivity.class);
}
 
开发者ID:pillingworthz,项目名称:ifictionary,代码行数:26,代码来源:Level9InjectorModule.java

示例5: configure

import com.google.gwt.event.shared.SimpleEventBus; //导入依赖的package包/类
@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);
}
 
开发者ID:interseroh,项目名称:demo-gwt-springboot,代码行数:13,代码来源:DemoGwtMockWebAppGinModule.java

示例6: configure

import com.google.gwt.event.shared.SimpleEventBus; //导入依赖的package包/类
@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);
}
 
开发者ID:interseroh,项目名称:demo-gwt-springboot,代码行数:13,代码来源:DemoGwtWebAppGinModule.java

示例7: ValidatorMixin

import com.google.gwt.event.shared.SimpleEventBus; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:GwtMaterialDesign,项目名称:gwt-material,代码行数:14,代码来源:ValidatorMixin.java

示例8: registryTest

import com.google.gwt.event.shared.SimpleEventBus; //导入依赖的package包/类
@Test
public void registryTest()
{
  assertNull( OnlineIndicator.getOnlineIndicatorIfSupported() );
  OnlineIndicator.register( new TestOnlineIndicator( new SimpleEventBus() ) );
  assertNotNull( OnlineIndicator.getOnlineIndicatorIfSupported() );
  final OnlineIndicator onlineIndicator = OnlineIndicator.getOnlineIndicatorIfSupported();
  assertTrue( OnlineIndicator.deregister( onlineIndicator ) );
  assertNull( OnlineIndicator.getOnlineIndicatorIfSupported() );
  assertFalse( OnlineIndicator.deregister( onlineIndicator ) );
}
 
开发者ID:realityforge,项目名称:gwt-online,代码行数:12,代码来源:OnlineIndicatorTest.java

示例9: testInitialization

import com.google.gwt.event.shared.SimpleEventBus; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testInitialization() {

  // Test setup
  ProjectRpcAsync mockProjService = EasyMock.createMock(ProjectRpcAsync.class);
  ComponentsView mockView = EasyMock.createMock(ComponentsView.class);
  SimpleEventBus mockEventBus = EasyMock.createMock(SimpleEventBus.class);
  UserRpcAsync securityService = EasyMock.createMock(UserRpcAsync.class);
  DataRpcAsync dataService = EasyMock.createMock(DataRpcAsync.class);

  List<Component> components = new ArrayList<Component>();
  List<Signoff> signoffs = new ArrayList<Signoff>();
  Collection<String> labels = Lists.newArrayList();

  Project parentProject = new Project();
  parentProject.setProjectId(42L);

  // Verify this initialization sequence
  securityService.hasEditAccess(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
  EasyMockUtils.setLastAsyncCallbackSuccessWithResult(true);
  mockProjService.getProjectComponents(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
  EasyMockUtils.setLastAsyncCallbackSuccessWithResult(components);
  dataService.getSignoffsByType(EasyMock.eq(42L), EasyMock.eq(AccElementType.COMPONENT),
      EasyMock.isA(AsyncCallback.class));
  EasyMockUtils.setLastAsyncCallbackSuccessWithResult(signoffs);
  mockProjService.getLabels(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
  EasyMockUtils.setLastAsyncCallbackSuccessWithResult(labels);
  mockView.enableEditing();
  mockView.setPresenter((Presenter) EasyMock.anyObject());
  mockView.setProjectComponents(components);
  mockView.setSignoffs(signoffs);
  mockView.setProjectLabels(labels);
  EasyMock.replay(mockView, mockProjService, securityService, dataService);

  ComponentsPresenter testPresenter = new ComponentsPresenter(
      parentProject, mockProjService, securityService, dataService, mockView,
      mockEventBus);

  EasyMock.verify(mockView, mockProjService, securityService, dataService);
}
 
开发者ID:rodion-goritskov,项目名称:test-analytics-ng,代码行数:41,代码来源:ComponentsPresenterTest.java

示例10: testInitialization

import com.google.gwt.event.shared.SimpleEventBus; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testInitialization() {

  // Test setup
  ProjectRpcAsync mockProjService = EasyMock.createMock(ProjectRpcAsync.class);
  AttributesView mockView = EasyMock.createMock(AttributesView.class);
  UserRpcAsync securityService = EasyMock.createMock(UserRpcAsync.class);
  DataRpcAsync dataService = EasyMock.createMock(DataRpcAsync.class);

  ArrayList<Attribute> attributes = Lists.newArrayList();
  ArrayList<Signoff> signoffs = Lists.newArrayList();
  Collection<String> labels = Lists.newArrayList();

  Project parentProject = new Project();
  parentProject.setProjectId(42L);

  // Verify this initialization sequence
  securityService.hasEditAccess(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
  EasyMockUtils.setLastAsyncCallbackSuccessWithResult(true);
  mockProjService.getProjectAttributes(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
  EasyMockUtils.setLastAsyncCallbackSuccessWithResult(attributes);
  mockProjService.getLabels(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
  EasyMockUtils.setLastAsyncCallbackSuccessWithResult(labels);

  dataService.getSignoffsByType(EasyMock.eq(42L), EasyMock.eq(AccElementType.ATTRIBUTE),
      EasyMock.isA(AsyncCallback.class));
  EasyMockUtils.setLastAsyncCallbackSuccessWithResult(signoffs);
  mockView.setPresenter((AttributesView.Presenter) EasyMock.anyObject());
  mockView.enableEditing();
  mockView.setProjectAttributes(attributes);
  mockView.setSignoffs(signoffs);
  mockView.setProjectLabels(labels);

  EasyMock.replay(mockView, mockProjService, securityService, dataService);

  AttributesPresenter testPresenter = new AttributesPresenter(parentProject, mockProjService,
      securityService, dataService, mockView, new SimpleEventBus());

  EasyMock.verify(mockView, mockProjService, securityService, dataService);
}
 
开发者ID:rodion-goritskov,项目名称:test-analytics-ng,代码行数:41,代码来源:AttributesPresenterTest.java

示例11: testAttributeAddedEventOnInitialization

import com.google.gwt.event.shared.SimpleEventBus; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testAttributeAddedEventOnInitialization() {
  ProjectRpcAsync mockProjService = EasyMock.createMock(ProjectRpcAsync.class);
  AttributesView mockView = EasyMock.createMock(AttributesView.class);
  // Since HandlerManager is a concrete type, must import 'org.easymock.EasyMock'
  SimpleEventBus mockEventBus = EasyMock.createMock(SimpleEventBus.class);
  UserRpcAsync securityService = EasyMock.createMock(UserRpcAsync.class);
  DataRpcAsync dataService = EasyMock.createMock(DataRpcAsync.class);

  ArrayList<Attribute> attributes = new ArrayList<Attribute>();
  Attribute att = new Attribute();
  att.setAttributeId(42L);
  attributes.add(att);
  ArrayList<Signoff> signoffs = new ArrayList<Signoff>();
  Collection<String> labels = Lists.newArrayList();

  Project parentProject = new Project();
  parentProject.setProjectId(42L);

  securityService.hasEditAccess(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
  EasyMockUtils.setLastAsyncCallbackSuccessWithResult(true);
  mockProjService.getProjectAttributes(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
  EasyMockUtils.setLastAsyncCallbackSuccessWithResult(attributes);
  dataService.getSignoffsByType(EasyMock.eq(42L), EasyMock.eq(AccElementType.ATTRIBUTE),
      EasyMock.isA(AsyncCallback.class));
  EasyMockUtils.setLastAsyncCallbackSuccessWithResult(signoffs);
  mockProjService.getLabels(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
  EasyMockUtils.setLastAsyncCallbackSuccessWithResult(labels);
  EasyMock.replay(mockEventBus, mockProjService, securityService, dataService);

  AttributesPresenter testPresenter = new AttributesPresenter(
      parentProject, mockProjService, securityService, dataService, mockView,
      mockEventBus);

  EasyMock.verify(mockEventBus, mockProjService, securityService, dataService);
}
 
开发者ID:rodion-goritskov,项目名称:test-analytics-ng,代码行数:37,代码来源:AttributesPresenterTest.java

示例12: IneDispatchMock

import com.google.gwt.event.shared.SimpleEventBus; //导入依赖的package包/类
private IneDispatchMock() {
    super(
        new DispatchAsyncMock(),
        new SilentStatusIndicator(),
        new SimpleEventBus(),
        new DefaultFailedHandler());
}
 
开发者ID:inepex,项目名称:ineform,代码行数:8,代码来源:DispatchMock.java

示例13: configure

import com.google.gwt.event.shared.SimpleEventBus; //导入依赖的package包/类
@Override
protected void configure() {
    bind(ObjectFinder.class).to(ActionBasedObjectFinder.class);

    bind(HistoryProvider.class).in(Singleton.class);
    bind(IneDispatch.class).in(Singleton.class);
    bind(PushedEventProvider.class).in(Singleton.class);
    bind(DateProvider.class).to(CETDateProviderSrv.class).in(Singleton.class);

    bind(EventBus.class).to(SimpleEventBus.class);
    bind(DescriptorStore.class).to(ClientDescriptorStore.class).in(Singleton.class);

    bind(FormContext.class);

    bind(FormWidgetFactory.class).to(DefaultFormWidgetFactory.class).in(Singleton.class);
    bind(FormUnitFactory.class).to(DefaultFormUnitFactory.class).in(Singleton.class);
    bind(PanelWidgetFactory.class).to(DefaultPanelWidgetFactory.class).in(Singleton.class);

    bind(AsyncStatusIndicator.class).to(DummyStatusIndicator.class).in(Singleton.class);
    bind(ValueRangeProvider.class).to(ServerSideValueRangeProvider.class).in(Singleton.class);
    bind(RequestBuilderFactory.class).to(GwtRequestBuilderFactory.class).in(Singleton.class);

    install(
        new FactoryModuleBuilder()
            .implement(IneForm.class, Names.named("simple"), IneForm.class)
            .implement(IneForm.class, Names.named("saveCancel"), SaveCancelForm.class)
            .implement(IneForm.class, Names.named("wizard"), WizardForm.class)
            .implement(IneForm.class, Names.named("search"), SearchForm.class)
            .build(FormFactory.class));

    install(
        new FactoryModuleBuilder()
            .implement(IneDataConnector.class, ServerSideDataConnector.class)
            .build(DataConnectorFactory.class));

    install(
        new FactoryModuleBuilder()
            .implement(
                DataManipulator.class,
                Names.named("rowCommand"),
                RowCommandDataManipulator.class)
            .implement(
                DataManipulator.class,
                Names.named("singleSelect"),
                SingleSelectDataManipulator.class)
            .build(ManipulatorFactory.class));

}
 
开发者ID:inepex,项目名称:ineform,代码行数:49,代码来源:TestIneFormClientGuiceModule.java

示例14: Navigation

import com.google.gwt.event.shared.SimpleEventBus; //导入依赖的package包/类
public Navigation() {
    initWidget(uiBinder.createAndBindUi(this));
    m_handlerManager = new SimpleEventBus();
    m_allHosts.setValue(true);
    m_allHosts.setVisible(false);
    m_singleHost.setVisible(false);
    m_hostList.setVisible(false);
    
    m_allLocations.setValue(true);
    m_allLocations.setVisible(false);
    m_singleLocation.setVisible(false);
    m_locationList.setVisible(false);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:14,代码来源:Navigation.java

示例15: SuggestionComboboxPresenter

import com.google.gwt.event.shared.SimpleEventBus; //导入依赖的package包/类
public SuggestionComboboxPresenter(SimpleEventBus eventBus, SuggestionComboboxView<NodeDetail> view, NodeService nodeService) {
    m_eventBus = eventBus;
    m_view = view;
    m_view.setPresenter(this);
    
    m_nodeService = nodeService;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:8,代码来源:SuggestionComboboxPresenter.java


注:本文中的com.google.gwt.event.shared.SimpleEventBus类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。