-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to implement hierarchy filtering
- Changed all hierarchy related actions to use hierarchy descriptors
- Loading branch information
1 parent
0915cd3
commit aa0e0d0
Showing
42 changed files
with
531 additions
and
573 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...rc/main/java/edu/stanford/bmir/protege/web/client/hierarchy/ConfigureHierarchyAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package edu.stanford.bmir.protege.web.client.hierarchy; | ||
|
||
import com.google.auto.factory.AutoFactory; | ||
import com.google.auto.factory.Provided; | ||
import com.google.gwt.user.client.Window; | ||
import edu.stanford.bmir.protege.web.client.Messages; | ||
import edu.stanford.bmir.protege.web.client.action.AbstractUiAction; | ||
import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager; | ||
import edu.stanford.bmir.protege.web.shared.dispatch.DispatchService; | ||
import edu.stanford.bmir.protege.web.shared.entity.EntityNode; | ||
import edu.stanford.bmir.protege.web.shared.hierarchy.AddNamedHierarchyAction; | ||
import edu.stanford.bmir.protege.web.shared.hierarchy.HierarchyId; | ||
import edu.stanford.bmir.protege.web.shared.inject.ProjectSingleton; | ||
import edu.stanford.bmir.protege.web.shared.lang.LanguageMap; | ||
import edu.stanford.bmir.protege.web.shared.project.ProjectId; | ||
import edu.stanford.protege.gwt.graphtree.client.TreeWidget; | ||
import edu.stanford.protege.gwt.graphtree.shared.tree.impl.GraphTreeNodeModel; | ||
import org.semanticweb.owlapi.model.OWLClass; | ||
import org.semanticweb.owlapi.model.OWLEntity; | ||
|
||
import javax.inject.Inject; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
@AutoFactory | ||
public class ConfigureHierarchyAction extends AbstractUiAction { | ||
|
||
private final TreeWidget<EntityNode, OWLEntity> treeWidget; | ||
|
||
private final EntityHierarchyModel model; | ||
|
||
private final DispatchServiceManager dispatch; | ||
|
||
private final ProjectId projectId; | ||
|
||
public ConfigureHierarchyAction(@Provided Messages messages, | ||
TreeWidget<EntityNode, OWLEntity> treeWidget, | ||
EntityHierarchyModel model, | ||
@Provided DispatchServiceManager dispatch, | ||
@Provided ProjectId projectId) { | ||
super(messages.hierarchy_configure()); | ||
this.treeWidget = treeWidget; | ||
this.model = model; | ||
this.dispatch = dispatch; | ||
this.projectId = projectId; | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
Set<OWLClass> sel = treeWidget.getSelectedKeys() | ||
.stream() | ||
.filter(e -> e.isOWLClass()) | ||
.map(e -> e.asOWLClass()) | ||
.collect(Collectors.toSet()); | ||
HierarchyDescriptor hierarchyDescriptor; | ||
if(sel.isEmpty()) { | ||
hierarchyDescriptor = ClassHierarchyDescriptor.get(); | ||
} | ||
else { | ||
hierarchyDescriptor = ClassHierarchyDescriptor.get(sel); | ||
} | ||
dispatch.execute(AddNamedHierarchyAction.get(projectId, LanguageMap.of("en", "Class hierarchy fragment"), | ||
LanguageMap.empty(), | ||
hierarchyDescriptor), | ||
result -> { | ||
model.setHierarchyDescriptor(hierarchyDescriptor); | ||
treeWidget.setModel(GraphTreeNodeModel.create(model, EntityNode::getEntity)); | ||
}); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.