Search in sources :

Example 1 with EntityHierarchyNode

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

the class DeleteEntityPresenter method start.

/**
 * Start the deletion of the entities represented by the selected nodes in the specified tree.
 * @param treeWidget The tree.
 */
public void start(@Nonnull TreeWidget<EntityHierarchyNode, OWLEntity> treeWidget) {
    final Optional<EntityHierarchyNode> currentSelection = treeWidget.getFirstSelectedUserObject();
    currentSelection.ifPresent(sel -> {
        OWLEntity entity = sel.getEntity();
        String browserText = sel.getBrowserText();
        MessageBox.showConfirmBox(getDeleteConfirmationTitle(entity), getDeleteConfirmationMessage(entity, browserText), CANCEL, DELETE, () -> deleteEntity(entity, treeWidget), CANCEL);
    });
}
Also used : EntityHierarchyNode(edu.stanford.bmir.protege.web.shared.hierarchy.EntityHierarchyNode) OWLEntity(org.semanticweb.owlapi.model.OWLEntity)

Example 2 with EntityHierarchyNode

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

the class EntityHierarchyDropHandler method handleDrop.

@Override
public void handleDrop(@Nonnull Path<EntityHierarchyNode> nodePath, @Nonnull Path<EntityHierarchyNode> targetPath, @Nonnull DropType dropType, @Nonnull DropEndHandler dropEndHandler) {
    GWT.log("[EntityHierarchyDropHandler] handleDrop. From: " + nodePath + " To: " + nodePath);
    if (!hierarchyId.isPresent()) {
        dropEndHandler.handleDropCancelled();
        return;
    }
    if (nodePath.isEmpty()) {
        dropEndHandler.handleDropCancelled();
        return;
    }
    if (nodePath.getLast().map(EntityHierarchyNode::getEntity).map(OWLObject::isTopEntity).orElse(false)) {
        dropEndHandler.handleDropCancelled();
        return;
    }
    // Don't drop on self
    if (targetPath.getLast().equals(nodePath.getLast())) {
        dropEndHandler.handleDropCancelled();
        return;
    }
    dispatchServiceManager.execute(new MoveHierarchyNodeAction(projectId, hierarchyId.get(), nodePath, targetPath, dropType), moveResult -> {
        if (moveResult.isMoved()) {
            dropEndHandler.handleDropComplete();
        } else {
            dropEndHandler.handleDropCancelled();
        }
    });
}
Also used : MoveHierarchyNodeAction(edu.stanford.bmir.protege.web.shared.hierarchy.MoveHierarchyNodeAction) EntityHierarchyNode(edu.stanford.bmir.protege.web.shared.hierarchy.EntityHierarchyNode)

Example 3 with EntityHierarchyNode

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

the class EntityHierarchyNodeUpdater method updateWatches.

private void updateWatches(EntityHierarchyNode node, Set<Watch> updatedWatches) {
    if (model == null) {
        throw createHierarchyModelIsNullException();
    }
    EntityHierarchyNode updatedNode = new EntityHierarchyNode(node.getEntity(), node.getBrowserText(), node.isDeprecated(), updatedWatches, node.getOpenCommentCount(), node.getTags());
    model.updateNode(updatedNode);
}
Also used : EntityHierarchyNode(edu.stanford.bmir.protege.web.shared.hierarchy.EntityHierarchyNode)

Example 4 with EntityHierarchyNode

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

the class EntityHierarchyNodeUpdater method handleDiscussionThreadStatusChanged.

private void handleDiscussionThreadStatusChanged(DiscussionThreadStatusChangedEvent event) {
    if (model == null) {
        throw createHierarchyModelIsNullException();
    }
    event.getEntity().ifPresent(entity -> {
        model.getHierarchyNode(entity).ifPresent(node -> {
            EntityHierarchyNode updatedNode = new EntityHierarchyNode(node.getEntity(), node.getBrowserText(), node.isDeprecated(), node.getWatches(), event.getOpenCommentsCountForEntity(), node.getTags());
            model.updateNode(updatedNode);
        });
    });
}
Also used : EntityHierarchyNode(edu.stanford.bmir.protege.web.shared.hierarchy.EntityHierarchyNode)

Example 5 with EntityHierarchyNode

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

the class EntityHierarchyNodeUpdater method handleBrowserTextChanged.

private void handleBrowserTextChanged(BrowserTextChangedEvent event) {
    if (model == null) {
        throw createHierarchyModelIsNullException();
    }
    model.getHierarchyNode(event.getEntity()).ifPresent(node -> {
        EntityHierarchyNode updatedNode = new EntityHierarchyNode(node.getEntity(), event.getNewBrowserText(), node.isDeprecated(), node.getWatches(), node.getOpenCommentCount(), node.getTags());
        model.updateNode(updatedNode);
    });
}
Also used : EntityHierarchyNode(edu.stanford.bmir.protege.web.shared.hierarchy.EntityHierarchyNode)

Aggregations

EntityHierarchyNode (edu.stanford.bmir.protege.web.shared.hierarchy.EntityHierarchyNode)9 OWLEntity (org.semanticweb.owlapi.model.OWLEntity)2 AccessManager (edu.stanford.bmir.protege.web.server.access.AccessManager)1 AbstractProjectActionHandler (edu.stanford.bmir.protege.web.server.dispatch.AbstractProjectActionHandler)1 ExecutionContext (edu.stanford.bmir.protege.web.server.dispatch.ExecutionContext)1 DeprecatedEntityChecker (edu.stanford.bmir.protege.web.server.mansyntax.render.DeprecatedEntityChecker)1 BuiltInAction (edu.stanford.bmir.protege.web.shared.access.BuiltInAction)1 VIEW_PROJECT (edu.stanford.bmir.protege.web.shared.access.BuiltInAction.VIEW_PROJECT)1 GetHierarchyChildrenAction (edu.stanford.bmir.protege.web.shared.hierarchy.GetHierarchyChildrenAction)1 GetHierarchyChildrenResult (edu.stanford.bmir.protege.web.shared.hierarchy.GetHierarchyChildrenResult)1 HierarchyId (edu.stanford.bmir.protege.web.shared.hierarchy.HierarchyId)1 MoveHierarchyNodeAction (edu.stanford.bmir.protege.web.shared.hierarchy.MoveHierarchyNodeAction)1 GraphNode (edu.stanford.protege.gwt.graphtree.shared.graph.GraphNode)1 SuccessorMap (edu.stanford.protege.gwt.graphtree.shared.graph.SuccessorMap)1 Comparator.comparing (java.util.Comparator.comparing)1 Optional (java.util.Optional)1 Nonnull (javax.annotation.Nonnull)1 Nullable (javax.annotation.Nullable)1 Inject (javax.inject.Inject)1