use of edu.stanford.bmir.protege.web.shared.place.ProjectViewPlace in project webprotege by protegeproject.
the class PerspectiveSwitcherPresenter method getCurrentPlacePerspectiveId.
private Optional<PerspectiveId> getCurrentPlacePerspectiveId() {
Place currentPlace = placeController.getWhere();
if (!(currentPlace instanceof ProjectViewPlace)) {
return Optional.empty();
}
ProjectViewPlace projectViewPlace = (ProjectViewPlace) currentPlace;
PerspectiveId currentPlacePerspective = projectViewPlace.getPerspectiveId();
return Optional.of(currentPlacePerspective);
}
use of edu.stanford.bmir.protege.web.shared.place.ProjectViewPlace in project webprotege by protegeproject.
the class PerspectiveSwitcherPresenter method goToPlaceForPerspective.
private void goToPlaceForPerspective(PerspectiveId perspectiveId) {
Place currentPlace = placeController.getWhere();
GWT.log("[PerspectiveSwitcherPresenter] Current Place: " + currentPlace);
if (!(currentPlace instanceof ProjectViewPlace)) {
return;
}
ProjectViewPlace projectPerspectivePlace = (ProjectViewPlace) currentPlace;
// Preserve the selection for the current perspective.
// (This could be optional. Previously, we carried selection over)
perspective2Selection.put(projectPerspectivePlace.getPerspectiveId(), projectPerspectivePlace.getItemSelection());
ItemSelection previousSelection = perspective2Selection.get(perspectiveId);
ProjectViewPlace.Builder builder = projectPerspectivePlace.builder();
builder.withPerspectiveId(perspectiveId);
if (previousSelection != null) {
// Restore the selection
builder.clearSelection();
builder.withSelectedItems(previousSelection);
}
ProjectViewPlace nextPlace = builder.build();
placeController.goTo(nextPlace);
}
use of edu.stanford.bmir.protege.web.shared.place.ProjectViewPlace in project webprotege by protegeproject.
the class PlaceUrl method getProjectUrl.
/**
* Get the Url for the specified project.
* @param projectId The project whose Url will be returned.
* @return A string representing the Url.
*/
@Nonnull
public String getProjectUrl(@Nonnull ProjectId projectId) {
ProjectViewPlace place = new ProjectViewPlace(projectId, mapper.getDefaultPerspectiveId(), ItemSelection.empty());
String projectPlaceFragment = getProjectPlaceFragment(place);
return createUrl(projectPlaceFragment);
}
use of edu.stanford.bmir.protege.web.shared.place.ProjectViewPlace in project webprotege by protegeproject.
the class PlaceUrl method getEntityUrl.
/**
* Gets the Url for the specified entity in the specified project.
* @param projectId The project.
* @param entity The entity.
* @return A string representing the Url.
*/
@Nonnull
public String getEntityUrl(@Nonnull ProjectId projectId, @Nonnull OWLEntity entity) {
ProjectViewPlace place = new ProjectViewPlace(projectId, mapper.getPerspectiveId(entity.getEntityType()), ItemSelection.builder().addEntity(entity).build());
String projectPlaceFragment = getProjectPlaceFragment(place);
return createUrl(projectPlaceFragment);
}
use of edu.stanford.bmir.protege.web.shared.place.ProjectViewPlace in project webprotege by protegeproject.
the class LoadProjectInNewWindowRequestHandlerImpl method handleOpenInNewWindow.
private void handleOpenInNewWindow(final ProjectId projectId, final PerspectiveId perspectiveId) {
String token = placeHistoryMapper.getToken(new ProjectViewPlace(projectId, perspectiveId, ItemSelection.empty()));
GWT.log("[LoadProjectInNewWindowRequestHandlerImpl] Token: " + token);
String location = Window.Location.createUrlBuilder().setHash(token).buildString();
GWT.log("[LoadProjectInNewWindowRequestHandlerImpl] Location: " + location);
Window.open(location, "_blank", "");
}
Aggregations