Search in sources :

Example 1 with EventBus

use of com.google.web.bindery.event.shared.EventBus in project activityinfo by bedatadriven.

the class AppEntryPoint method onModuleLoad.

@Override
public void onModuleLoad() {
    LOGGER.info("user.agent = " + System.getProperty("user.agent"));
    LOGGER.info("gxt.user.agent = " + System.getProperty("gxt.user.agent"));
    LOGGER.info("gxt.device = " + System.getProperty("gxt.device"));
    Icons.INSTANCE.ensureInjected();
    AppCache appCache = new AppCache();
    AppCacheMonitor3 monitor = new AppCacheMonitor3(appCache);
    monitor.start();
    EventBus eventBus = new SimpleEventBus();
    PlaceController placeController = new PlaceController(eventBus);
    ConnectionListener connectionListener = new ConnectionListener();
    connectionListener.start();
    ActivityInfoClientAsync client = new ActivityInfoClientAsyncImpl(findServerUrl());
    HttpStore httpStore = new HttpStore(connectionListener.getOnline(), client, Scheduler.get());
    OfflineStore offlineStore = new OfflineStore(httpStore, IDBFactoryImpl.create());
    FormStore formStore = new FormStoreImpl(httpStore, offlineStore, Scheduler.get());
    LocalStorage storage = LocalStorage.create();
    Viewport viewport = new Viewport();
    AppFrame appFrame = new AppFrame(appCache, httpStore, offlineStore);
    ActivityMapper activityMapper = new AppActivityMapper(formStore, storage);
    ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
    activityManager.setDisplay(appFrame.getDisplayWidget());
    AppPlaceHistoryMapper historyMapper = new AppPlaceHistoryMapper();
    PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(placeController, eventBus, DEFAULT_PLACE);
    // Start synchronizer...
    RecordSynchronizer synchronizer = new RecordSynchronizer(httpStore, offlineStore);
    viewport.add(appFrame);
    RootLayoutPanel.get().add(viewport);
    historyHandler.handleCurrentHistory();
}
Also used : FormStoreImpl(org.activityinfo.ui.client.store.FormStoreImpl) OfflineStore(org.activityinfo.ui.client.store.offline.OfflineStore) PlaceController(com.google.gwt.place.shared.PlaceController) Viewport(com.sencha.gxt.widget.core.client.container.Viewport) SimpleEventBus(com.google.web.bindery.event.shared.SimpleEventBus) EventBus(com.google.web.bindery.event.shared.EventBus) ConnectionListener(org.activityinfo.ui.client.store.http.ConnectionListener) ActivityInfoClientAsyncImpl(org.activityinfo.api.client.ActivityInfoClientAsyncImpl) ActivityManager(com.google.gwt.activity.shared.ActivityManager) PlaceHistoryHandler(com.google.gwt.place.shared.PlaceHistoryHandler) RecordSynchronizer(org.activityinfo.ui.client.store.offline.RecordSynchronizer) ActivityMapper(com.google.gwt.activity.shared.ActivityMapper) LocalStorage(org.activityinfo.storage.LocalStorage) SimpleEventBus(com.google.web.bindery.event.shared.SimpleEventBus) HttpStore(org.activityinfo.ui.client.store.http.HttpStore) AppFrame(org.activityinfo.ui.client.chrome.AppFrame) FormStore(org.activityinfo.ui.client.store.FormStore) ActivityInfoClientAsync(org.activityinfo.api.client.ActivityInfoClientAsync)

Example 2 with EventBus

use of com.google.web.bindery.event.shared.EventBus in project webprotege by protegeproject.

the class LoggedInUser_TestCase method setUp.

@Before
public void setUp() {
    when(otherUserDetails.getUserId()).thenReturn(otherUserId);
    when(otherUserInSession.getUserDetails()).thenReturn(otherUserDetails);
    when(guestUserInSession.getUserDetails()).thenReturn(UserDetails.getGuestUserDetails());
    EventBus eventBus = new SimpleEventBus();
    loggedInUser = new LoggedInUser(eventBus);
    eventBus.addHandler(ON_USER_LOGGED_IN, userLoggedInHandler);
    eventBus.addHandler(ON_USER_LOGGED_OUT, userLoggedOutHandler);
}
Also used : SimpleEventBus(com.google.gwt.event.shared.SimpleEventBus) EventBus(com.google.web.bindery.event.shared.EventBus) SimpleEventBus(com.google.gwt.event.shared.SimpleEventBus) Before(org.junit.Before)

Example 3 with EventBus

use of com.google.web.bindery.event.shared.EventBus in project webprotege by protegeproject.

the class OWLEntityDescriptionBrowserPortletPresenter method startPortlet.

@Override
public void startPortlet(PortletUi portletUi, WebProtegeEventBus eventBus) {
    portletUi.setWidget(new ScrollPanel(html));
    eventBus.addProjectEventHandler(getProjectId(), CLASS_FRAME_CHANGED, event -> handleEntityChange(event.getEntity()));
    eventBus.addProjectEventHandler(getProjectId(), ObjectPropertyFrameChangedEvent.TYPE, event -> handleEntityChange(event.getEntity()));
    eventBus.addProjectEventHandler(getProjectId(), DataPropertyFrameChangedEvent.TYPE, (DataPropertyFrameChangedEventHandler) event -> handleEntityChange(event.getEntity()));
    eventBus.addProjectEventHandler(getProjectId(), AnnotationPropertyFrameChangedEvent.TYPE, event -> handleEntityChange(event.getEntity()));
    eventBus.addProjectEventHandler(getProjectId(), NamedIndividualFrameChangedEvent.TYPE, event -> handleEntityChange(event.getEntity()));
    eventBus.addProjectEventHandler(getProjectId(), AnnotationPropertyFrameChangedEvent.TYPE, event -> handleEntityChange(event.getEntity()));
    handleAfterSetEntity(getSelectedEntity());
}
Also used : GetEntityRenderingAction(edu.stanford.bmir.protege.web.shared.renderer.GetEntityRenderingAction) CLASS_FRAME_CHANGED(edu.stanford.bmir.protege.web.shared.event.ClassFrameChangedEvent.CLASS_FRAME_CHANGED) EventBus(com.google.web.bindery.event.shared.EventBus) SelectionModel(edu.stanford.bmir.protege.web.shared.selection.SelectionModel) HTML(com.google.gwt.user.client.ui.HTML) Inject(javax.inject.Inject) PortletUi(edu.stanford.bmir.protege.web.client.portlet.PortletUi) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel) DispatchServiceManager(edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager) edu.stanford.bmir.protege.web.shared.event(edu.stanford.bmir.protege.web.shared.event) OWLEntity(org.semanticweb.owlapi.model.OWLEntity) Optional(java.util.Optional) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) AbstractWebProtegePortletPresenter(edu.stanford.bmir.protege.web.client.portlet.AbstractWebProtegePortletPresenter) Portlet(edu.stanford.webprotege.shared.annotations.Portlet) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Aggregations

EventBus (com.google.web.bindery.event.shared.EventBus)3 ActivityManager (com.google.gwt.activity.shared.ActivityManager)1 ActivityMapper (com.google.gwt.activity.shared.ActivityMapper)1 SimpleEventBus (com.google.gwt.event.shared.SimpleEventBus)1 PlaceController (com.google.gwt.place.shared.PlaceController)1 PlaceHistoryHandler (com.google.gwt.place.shared.PlaceHistoryHandler)1 HTML (com.google.gwt.user.client.ui.HTML)1 ScrollPanel (com.google.gwt.user.client.ui.ScrollPanel)1 SimpleEventBus (com.google.web.bindery.event.shared.SimpleEventBus)1 Viewport (com.sencha.gxt.widget.core.client.container.Viewport)1 DispatchServiceManager (edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager)1 AbstractWebProtegePortletPresenter (edu.stanford.bmir.protege.web.client.portlet.AbstractWebProtegePortletPresenter)1 PortletUi (edu.stanford.bmir.protege.web.client.portlet.PortletUi)1 edu.stanford.bmir.protege.web.shared.event (edu.stanford.bmir.protege.web.shared.event)1 CLASS_FRAME_CHANGED (edu.stanford.bmir.protege.web.shared.event.ClassFrameChangedEvent.CLASS_FRAME_CHANGED)1 ProjectId (edu.stanford.bmir.protege.web.shared.project.ProjectId)1 GetEntityRenderingAction (edu.stanford.bmir.protege.web.shared.renderer.GetEntityRenderingAction)1 SelectionModel (edu.stanford.bmir.protege.web.shared.selection.SelectionModel)1 Portlet (edu.stanford.webprotege.shared.annotations.Portlet)1 Optional (java.util.Optional)1