Search in sources :

Example 1 with HasProjectId

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

the class EditProjectTagsUIActionHandler method handleEditProjectTags.

public void handleEditProjectTags() {
    Place currentPlace = placeController.getWhere();
    if (!(currentPlace instanceof HasProjectId)) {
        return;
    }
    ProjectId projectId = ((HasProjectId) currentPlace).getProjectId();
    ProjectTagsPlace projectTagsPlace = new ProjectTagsPlace(projectId, Optional.of(currentPlace));
    placeController.goTo(projectTagsPlace);
}
Also used : HasProjectId(edu.stanford.bmir.protege.web.shared.project.HasProjectId) ProjectTagsPlace(edu.stanford.bmir.protege.web.shared.place.ProjectTagsPlace) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) HasProjectId(edu.stanford.bmir.protege.web.shared.project.HasProjectId) Place(com.google.gwt.place.shared.Place) ProjectTagsPlace(edu.stanford.bmir.protege.web.shared.place.ProjectTagsPlace)

Example 2 with HasProjectId

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

the class DispatchServiceExecutorImpl method setTemporaryThreadName.

/**
 * Sets the name of a thread so that it contains details of the action (and target project) being executed
 * @param thread The thread.
 * @param action The action.
 * @param projectId The optional project id.
 */
private static void setTemporaryThreadName(@Nonnull Thread thread, @Nonnull Action<?> action, @Nullable ProjectId projectId) {
    String tempThreadName;
    final ProjectId targetProjectId;
    if (projectId != null) {
        targetProjectId = projectId;
    } else if (action instanceof HasProjectId) {
        targetProjectId = ((HasProjectId) action).getProjectId();
    } else {
        targetProjectId = null;
    }
    if (targetProjectId == null) {
        tempThreadName = String.format("[DispatchService] %s", action.getClass().getSimpleName());
    } else {
        tempThreadName = String.format("[DispatchService] %s %s", action.getClass().getSimpleName(), targetProjectId);
    }
    thread.setName(tempThreadName);
}
Also used : HasProjectId(edu.stanford.bmir.protege.web.shared.project.HasProjectId) HasProjectId(edu.stanford.bmir.protege.web.shared.project.HasProjectId) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId)

Example 3 with HasProjectId

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

the class ActiveProjectManagerImpl method getActiveProjectId.

@Nonnull
@Override
public Optional<ProjectId> getActiveProjectId() {
    Place place = placeController.getWhere();
    if (!(place instanceof HasProjectId)) {
        return Optional.empty();
    }
    HasProjectId projectViewPlace = (HasProjectId) place;
    return Optional.of(projectViewPlace.getProjectId());
}
Also used : HasProjectId(edu.stanford.bmir.protege.web.shared.project.HasProjectId) Place(com.google.gwt.place.shared.Place) Nonnull(javax.annotation.Nonnull)

Example 4 with HasProjectId

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

the class DispatchServiceManager method execute.

@SuppressWarnings("unchecked")
public <A extends Action<R>, R extends Result> void execute(A action, final DispatchServiceCallback<R> callback) {
    callback.handleSubmittedForExecution();
    if (action instanceof HasProjectId) {
        ProjectId projectId = ((HasProjectId) action).getProjectId();
        ResultCache resultCache = getResultCache(projectId, eventBus);
        Optional<R> result = resultCache.getCachedResult(action);
        if (result.isPresent()) {
            callback.onSuccess(result.get());
            return;
        }
    }
    requestCount++;
    GWT.log("[Dispatch] Executing action " + requestCount + "    " + action.getClass().getSimpleName());
    async.executeAction(action, new AsyncCallbackProxy(action, callback));
}
Also used : HasProjectId(edu.stanford.bmir.protege.web.shared.project.HasProjectId) ResultCache(edu.stanford.bmir.protege.web.client.dispatch.cache.ResultCache) HasProjectId(edu.stanford.bmir.protege.web.shared.project.HasProjectId) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId)

Example 5 with HasProjectId

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

the class EditProjectPrefixDeclarationsHandlerImpl method handleEditProjectPrefixes.

@Override
public void handleEditProjectPrefixes() {
    Place currentPlace = placeController.getWhere();
    if (currentPlace instanceof HasProjectId) {
        ProjectId projectId = ((HasProjectId) currentPlace).getProjectId();
        ProjectPrefixDeclarationsPlace prefixesPlace = new ProjectPrefixDeclarationsPlace(projectId, Optional.ofNullable(currentPlace));
        placeController.goTo(prefixesPlace);
    }
}
Also used : HasProjectId(edu.stanford.bmir.protege.web.shared.project.HasProjectId) ProjectPrefixDeclarationsPlace(edu.stanford.bmir.protege.web.shared.place.ProjectPrefixDeclarationsPlace) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) HasProjectId(edu.stanford.bmir.protege.web.shared.project.HasProjectId) Place(com.google.gwt.place.shared.Place) ProjectPrefixDeclarationsPlace(edu.stanford.bmir.protege.web.shared.place.ProjectPrefixDeclarationsPlace)

Aggregations

HasProjectId (edu.stanford.bmir.protege.web.shared.project.HasProjectId)5 ProjectId (edu.stanford.bmir.protege.web.shared.project.ProjectId)4 Place (com.google.gwt.place.shared.Place)3 ResultCache (edu.stanford.bmir.protege.web.client.dispatch.cache.ResultCache)1 ProjectPrefixDeclarationsPlace (edu.stanford.bmir.protege.web.shared.place.ProjectPrefixDeclarationsPlace)1 ProjectTagsPlace (edu.stanford.bmir.protege.web.shared.place.ProjectTagsPlace)1 Nonnull (javax.annotation.Nonnull)1