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);
});
}
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();
}
});
}
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);
}
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);
});
});
}
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);
});
}
Aggregations