本文整理汇总了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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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 ) );
}
示例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);
}
示例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);
}
示例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);
}
示例12: IneDispatchMock
import com.google.gwt.event.shared.SimpleEventBus; //导入依赖的package包/类
private IneDispatchMock() {
super(
new DispatchAsyncMock(),
new SilentStatusIndicator(),
new SimpleEventBus(),
new DefaultFailedHandler());
}
示例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));
}
示例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);
}
示例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;
}