當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。