From 46958f5817535a83e22714a1dbd0df8236af1b9c Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Tue, 4 Jul 2023 13:33:15 +0200 Subject: [PATCH] JAL-4199 Update gui handler for annotation tasks --- .../ws2/gui/AnnotationServiceGuiHandler.java | 34 +++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/jalview/ws2/gui/AnnotationServiceGuiHandler.java b/src/jalview/ws2/gui/AnnotationServiceGuiHandler.java index 32bc4b1..a0f7a63 100644 --- a/src/jalview/ws2/gui/AnnotationServiceGuiHandler.java +++ b/src/jalview/ws2/gui/AnnotationServiceGuiHandler.java @@ -2,10 +2,13 @@ package jalview.ws2.gui; import java.util.List; +import jalview.api.FeatureColourI; +import jalview.datamodel.features.FeatureMatcherSetI; import jalview.gui.AlignFrame; import jalview.gui.AlignmentPanel; import jalview.gui.IProgressIndicator; import jalview.gui.IProgressIndicatorHandler; +import jalview.schemes.FeatureSettingsAdapter; import jalview.ws2.actions.annotation.AnnotationAction; import jalview.ws2.actions.annotation.AnnotationResult; import jalview.ws2.actions.api.JobI; @@ -76,14 +79,37 @@ public class AnnotationServiceGuiHandler } @Override - public void taskCompleted(TaskI source, AnnotationResult result) + public void taskCompleted(TaskI source, final AnnotationResult result) { if (result == null) return; - if (result.getTransferFeatures() && alignFrame.alignPanel == alignPanel) + if (result.getTransferFeatures()) { - alignFrame.getViewport().setShowSequenceFeatures(true); - alignFrame.setMenusForViewport(); + alignFrame.getViewport().applyFeaturesStyle(new FeatureSettingsAdapter() + { + @Override + public FeatureColourI getFeatureColour(String type) + { + return result.getFeatureColours().get(type); + } + + @Override + public FeatureMatcherSetI getFeatureFilters(String type) + { + return result.getFeatureFilters().get(type); + } + + @Override + public boolean isFeatureDisplayed(String type) + { + return result.getFeatureColours().containsKey(type); + } + }); + if (alignFrame.alignPanel == alignPanel) + { + alignFrame.getViewport().setShowSequenceFeatures(true); + alignFrame.setMenusForViewport(); + } } alignPanel.adjustAnnotationHeight(); } -- 1.7.10.2