Skip to content

Commit

Permalink
Update object tree if only equivalences were added or removed
Browse files Browse the repository at this point in the history
When adding OWLEquivalentClasses(:A :B) for which A and B already
appear in the asserted class hierarchy, there was no change
in the model of the tree component because no child or parent
nodes were added or removed. Consequently, the tree component did not
refresh, and the new labels A = B and B = A of the nodes A and B were
truncated.

This commit make sure that the model gets notified about the changes
of the node.

See #910 (comment)
  • Loading branch information
ykazakov committed Jun 11, 2024
1 parent 8bc0667 commit 1743a00
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
public interface OWLObjectHierarchyProviderListener<N extends OWLObject> {

/**
* Notifies the listener that the parents and or children
* of the specified node might have changed. This is usually
* Notifies the listener that the equivalent objects, parents and or
* children of the specified node might have changed. This is usually
* called in response to an add/remove axiom change.
*/
public void nodeChanged(N node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,17 +283,21 @@ public String getToolTipText(MouseEvent event) {

@SuppressWarnings("unchecked")
private void updateNode(N node) {
// This method is called when the parents or children of
// a node might have changed. We handle the following possibilities
// This method is called when the node, its parents or children
// might have changed. We handle the following possibilities
// 1) The node had a child added
// 2) The node had a child removed
// If we are displaying the node which had the child added or removed
// then we update the node

final Set<OWLObjectTreeNode<N>> treeNodes = nodeMap.get(node);

// The parents/children might have changed
// The node/parents/children might have changed
if (treeNodes != null && !treeNodes.isEmpty()) {
// The node equivalent objects might have changed
// @@TODO: use provider to check if this were the case
treeNodes.forEach(((DefaultTreeModel) getModel())::nodeChanged);

// Remove children that aren't there any more
Set<N> children = provider.getChildren(node);

Expand Down

0 comments on commit 1743a00

Please sign in to comment.