Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
soimugeoWB committed May 31, 2024
1 parent 1e88d9c commit 7f00a49
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import edu.stanford.bmir.protege.web.client.progress.BusyView;
import edu.stanford.bmir.protege.web.client.tag.ProjectTagsStyleManager;
import edu.stanford.bmir.protege.web.client.topbar.TopBarPresenter;
import edu.stanford.bmir.protege.web.client.user.LoggedInUserProvider;
import edu.stanford.bmir.protege.web.shared.HasDispose;
import edu.stanford.bmir.protege.web.shared.dispatch.actions.GetUserInfoAction;
import edu.stanford.bmir.protege.web.shared.dispatch.actions.TranslateEventListAction;
import edu.stanford.bmir.protege.web.shared.event.GetProjectEventsResult;
import edu.stanford.bmir.protege.web.shared.event.LargeNumberOfChangesEvent;
Expand Down Expand Up @@ -107,17 +109,17 @@ public void start(@Nonnull AcceptsOneWidget container,
busyView.setMessage("Loading project. Please wait.");
container.setWidget(busyView);
permissionScreener.checkPermission(VIEW_PROJECT.getActionId(),
container,
() -> displayProject(container, eventBus, place));
container,
() -> displayProject(container, eventBus, place));
}

private void displayProject(@Nonnull AcceptsOneWidget container,
@Nonnull EventBus eventBus,
@Nonnull ProjectViewPlace place) {
dispatchServiceManager.execute(new LoadProjectAction(projectId),
result -> handleProjectLoaded(container, eventBus, place));
result -> handleProjectLoaded(container, eventBus, place));
dispatchServiceManager.execute(new GetUserInfoAction(), r -> {
subscribeToWebsocket(projectId.getId(), r.getToken(), this.loggedInUserProvider.getCurrentUserId().getUserName());
subscribeToWebsocket(projectId.getId(), r.getToken(), r.getWebsocketUrl(), this.loggedInUserProvider.getCurrentUserId().getUserName());

});

Expand All @@ -128,14 +130,14 @@ private void handleProjectLoaded(@Nonnull AcceptsOneWidget container, @Nonnull E
topBarPresenter.start(view.getTopBarContainer(), eventBus, place);
linkBarPresenter.start(view.getPerspectiveLinkBarViewContainer(), eventBus, place);
perspectivePresenter.start(view.getPerspectiveViewContainer(), eventBus, place);
// eventPollingManager.start();
// eventPollingManager.start();
eventBus.addHandlerToSource(LargeNumberOfChangesEvent.LARGE_NUMBER_OF_CHANGES,
projectId,
largeNumberOfChangesHandler);
projectId,
largeNumberOfChangesHandler);
container.setWidget(view);

dispatchServiceManager.execute(GetProjectTagsAction.create(projectId),
r -> projectTagsStyleManager.setProjectTags(r.getTags(), view));
r -> projectTagsStyleManager.setProjectTags(r.getTags(), view));
dispatchServiceManager.executeCurrentBatch();
}

Expand All @@ -158,6 +160,7 @@ public void dispatchEventsFromWebsocket(String data) {
dispatchServiceManager.execute(TranslateEventListAction.create(data), (GetProjectEventsResult result) -> eventPollingManager.dispatchEvents(result.getEvents()));

}

public native void subscribeToWebsocket(String projectId, String token, String websocketUrl, String userId)/*-{
try {
var that = this;
Expand Down

0 comments on commit 7f00a49

Please sign in to comment.