Search in sources :

Example 1 with ResetPerspectiveLayoutResult

use of edu.stanford.bmir.protege.web.shared.perspective.ResetPerspectiveLayoutResult in project webprotege by protegeproject.

the class ResetPerspectiveLayoutActionHandler method execute.

@Nonnull
@Override
public ResetPerspectiveLayoutResult execute(@Nonnull ResetPerspectiveLayoutAction action, @Nonnull ExecutionContext executionContext) {
    ProjectId projectId = action.getProjectId();
    PerspectiveId perspectiveId = action.getPerspectiveId();
    PerspectiveLayout defaultLayout = store.getPerspectiveLayout(projectId, perspectiveId);
    // Only reset the perspective if there is a default for it
    UserId userId = executionContext.getUserId();
    if (defaultLayout.getRootNode().isPresent()) {
        store.clearPerspectiveLayout(projectId, userId, perspectiveId);
    }
    PerspectiveLayout perspectiveLayout = store.getPerspectiveLayout(projectId, userId, perspectiveId);
    return new ResetPerspectiveLayoutResult(perspectiveLayout);
}
Also used : UserId(edu.stanford.bmir.protege.web.shared.user.UserId) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) PerspectiveId(edu.stanford.bmir.protege.web.shared.perspective.PerspectiveId) PerspectiveLayout(edu.stanford.bmir.protege.web.shared.perspective.PerspectiveLayout) ResetPerspectiveLayoutResult(edu.stanford.bmir.protege.web.shared.perspective.ResetPerspectiveLayoutResult) Nonnull(javax.annotation.Nonnull)

Aggregations

PerspectiveId (edu.stanford.bmir.protege.web.shared.perspective.PerspectiveId)1 PerspectiveLayout (edu.stanford.bmir.protege.web.shared.perspective.PerspectiveLayout)1 ResetPerspectiveLayoutResult (edu.stanford.bmir.protege.web.shared.perspective.ResetPerspectiveLayoutResult)1 ProjectId (edu.stanford.bmir.protege.web.shared.project.ProjectId)1 UserId (edu.stanford.bmir.protege.web.shared.user.UserId)1 Nonnull (javax.annotation.Nonnull)1