Skip to content

Commit

Permalink
Fixes #80. Display options panel not responding to
Browse files Browse the repository at this point in the history
SetCurrentNetworkViewEvent.
  • Loading branch information
mikekucera committed Mar 25, 2017
1 parent fef0abc commit 6e259c3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
import org.baderlab.autoannotate.internal.model.ModelEvents;
import org.baderlab.autoannotate.internal.model.NetworkViewSet;
import org.baderlab.autoannotate.internal.ui.render.DrawClusterTask.LabelArgs;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.presentation.annotations.ShapeAnnotation;
import org.cytoscape.view.presentation.annotations.TextAnnotation;
import org.cytoscape.view.presentation.property.BasicVisualLexicon;
import org.cytoscape.work.TaskIterator;
import org.cytoscape.work.TaskManager;

Expand Down Expand Up @@ -162,6 +164,11 @@ public void handle(ModelEvents.DisplayOptionChanged event) {
}
break;
}

// Force the thumbnail view to update
CyNetworkView networkView = annotationSet.getParent().getNetworkView();
Double x = networkView.getVisualProperty(BasicVisualLexicon.NODE_Z_LOCATION); // ding ignores this property
networkView.setVisualProperty(BasicVisualLexicon.NODE_Z_LOCATION, x);
}

@Subscribe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.baderlab.autoannotate.internal.model.AnnotationSet;
import org.baderlab.autoannotate.internal.model.DisplayOptions;
import org.baderlab.autoannotate.internal.model.ModelEvents;
import org.baderlab.autoannotate.internal.model.NetworkViewSet;
import org.baderlab.autoannotate.internal.util.GBCFactory;
import org.cytoscape.application.swing.CytoPanelComponent;
import org.cytoscape.application.swing.CytoPanelName;
Expand Down Expand Up @@ -88,9 +89,16 @@ public void dispose() {
eventBus = null;
}

@Subscribe
public void handle(ModelEvents.NetworkViewSetSelected event) {
Optional<AnnotationSet> as = event.getNetworkViewSet().flatMap(NetworkViewSet::getActiveAnnotationSet);
setAnnotationSet(as);
}

@Subscribe
public void handle(ModelEvents.AnnotationSetSelected event) {
setAnnotationSet(event.getAnnotationSet());
Optional<AnnotationSet> as = event.getAnnotationSet();
setAnnotationSet(as);
}

public void setAnnotationSet(Optional<AnnotationSet> annotationSet) {
Expand Down

0 comments on commit 6e259c3

Please sign in to comment.