Search in sources :

Example 1 with ProjectViewPlace

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);
}
Also used : ProjectViewPlace(edu.stanford.bmir.protege.web.shared.place.ProjectViewPlace) PerspectiveId(edu.stanford.bmir.protege.web.shared.perspective.PerspectiveId) ProjectViewPlace(edu.stanford.bmir.protege.web.shared.place.ProjectViewPlace) Place(com.google.gwt.place.shared.Place)

Example 2 with ProjectViewPlace

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);
}
Also used : ProjectViewPlace(edu.stanford.bmir.protege.web.shared.place.ProjectViewPlace) ProjectViewPlace(edu.stanford.bmir.protege.web.shared.place.ProjectViewPlace) Place(com.google.gwt.place.shared.Place) ItemSelection(edu.stanford.bmir.protege.web.shared.place.ItemSelection)

Example 3 with ProjectViewPlace

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);
}
Also used : ProjectViewPlace(edu.stanford.bmir.protege.web.shared.place.ProjectViewPlace) Nonnull(javax.annotation.Nonnull)

Example 4 with ProjectViewPlace

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);
}
Also used : ProjectViewPlace(edu.stanford.bmir.protege.web.shared.place.ProjectViewPlace) Nonnull(javax.annotation.Nonnull)

Example 5 with ProjectViewPlace

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", "");
}
Also used : ProjectViewPlace(edu.stanford.bmir.protege.web.shared.place.ProjectViewPlace)

Aggregations

ProjectViewPlace (edu.stanford.bmir.protege.web.shared.place.ProjectViewPlace)5 Place (com.google.gwt.place.shared.Place)2 Nonnull (javax.annotation.Nonnull)2 PerspectiveId (edu.stanford.bmir.protege.web.shared.perspective.PerspectiveId)1 ItemSelection (edu.stanford.bmir.protege.web.shared.place.ItemSelection)1