use of edu.stanford.bmir.protege.web.client.projectsettings.ProjectSettingsActivity in project webprotege by protegeproject.
the class WebProtegeActivityMapper method getActivity.
public Activity getActivity(final Place place) {
GWT.log("[WebProtegeActivityMapper] Map place: " + place);
if (shouldRedirectToLogin(place)) {
GWT.log("[WebProtegeActivityMapper] User is not logged in. Redirecting to login.");
loginPresenter.setNextPlace(place);
Scheduler.get().scheduleFinally(() -> placeController.goTo(new LoginPlace(place)));
return new LoginActivity(loginPresenter);
}
if (place instanceof ApplicationSettingsPlace) {
return new AdminActivity(applicationSettingsPresenter);
}
if (place instanceof ProjectSettingsPlace) {
ProjectSettingsPlace projectSettingsPlace = (ProjectSettingsPlace) place;
ClientProjectComponent projectComponent = applicationComponent.getClientProjectComponent(new ClientProjectModule(projectSettingsPlace.getProjectId()));
return new ProjectSettingsActivity(projectComponent.getProjectSettingsPresenter(), projectSettingsPlace.getNextPlace());
}
if (place instanceof ProjectPrefixDeclarationsPlace) {
ProjectPrefixDeclarationsPlace projectPrefixDeclarationsPlace = (ProjectPrefixDeclarationsPlace) place;
ClientProjectComponent projectComponent = applicationComponent.getClientProjectComponent(new ClientProjectModule(projectPrefixDeclarationsPlace.getProjectId()));
return new ProjectPrefixDeclarationsActivity(projectPrefixDeclarationsPlace.getProjectId(), projectComponent.getProjectPrefixesPresenter());
}
if (place instanceof ProjectTagsPlace) {
ProjectTagsPlace projectTagsPlace = (ProjectTagsPlace) place;
ClientProjectComponent projectComponent = applicationComponent.getClientProjectComponent(new ClientProjectModule(projectTagsPlace.getProjectId()));
return new ProjectTagsActivity(projectTagsPlace.getProjectId(), projectComponent.getProjectTagsPresenter(), projectTagsPlace.getNextPlace());
}
if (place instanceof LoginPlace) {
if (!loggedInUserProvider.getCurrentUserId().isGuest()) {
Scheduler.get().scheduleFinally(() -> placeController.goTo(new ProjectListPlace()));
} else {
LoginPlace loginPlace = (LoginPlace) place;
Optional<Place> continueTo = loginPlace.getContinueTo();
if (continueTo.isPresent()) {
loginPresenter.setNextPlace(continueTo.get());
} else {
loginPresenter.setNextPlace(new ProjectListPlace());
}
return new LoginActivity(loginPresenter);
}
}
if (place instanceof SignUpPlace) {
SignUpPlace signUpPlace = (SignUpPlace) place;
Optional<Place> continueTo = signUpPlace.getContinueTo();
continueTo.ifPresent(signUpPresenter::setContinueTo);
return new SignUpActivity(signUpPresenter);
}
if (place instanceof ProjectListPlace) {
return new ProjectListActivity(projectManagerPresenter);
}
if (place instanceof ProjectViewPlace) {
ProjectViewPlace projectViewPlace = (ProjectViewPlace) place;
ProjectPresenter presenter = getProjectPresenter(projectViewPlace);
lastProjectPresenter = Optional.of(presenter);
lastUser = Optional.of(loggedInUserProvider.getCurrentUserId());
return new ProjectViewActivity(presenter, projectViewPlace);
}
if (place instanceof SharingSettingsPlace) {
SharingSettingsPlace sharingSettingsPlace = (SharingSettingsPlace) place;
ProjectId projectId = sharingSettingsPlace.getProjectId();
ClientProjectComponent projectComponent = applicationComponent.getClientProjectComponent(new ClientProjectModule(projectId));
SharingSettingsPresenter presenter = projectComponent.getSharingSettingsPresenter();
return new SharingSettingsActivity(presenter, sharingSettingsPlace);
}
if (place instanceof CollectionViewPlace) {
CollectionViewPlace collectionViewPlace = (CollectionViewPlace) place;
CollectionPresenter collectionPresenter = getCollectionPresenter(collectionViewPlace);
// lastUser = Optional.of(loggedInUserProvider.getCurrentUserId());
return new CollectionViewActivity(collectionPresenter, collectionViewPlace);
}
return null;
}
Aggregations