Clover icon

Coverage Report

  1. Project Clover database Thu Dec 4 2025 16:11:35 GMT
  2. Package jalview.ws2.gui

File AnnotationServiceGuiHandler.java

 

Coverage histogram

../../../img/srcFileCovDistChart0.png
60% of files have more coverage

Code metrics

6
21
9
1
99
86
12
0.57
2.33
9
1.33

Classes

Class Line # Actions
AnnotationServiceGuiHandler 15 21 12
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package jalview.ws2.gui;
2   
3    import jalview.api.FeatureColourI;
4    import jalview.datamodel.features.FeatureMatcherSetI;
5    import jalview.gui.AlignFrame;
6    import jalview.gui.AlignmentPanel;
7    import jalview.gui.IProgressIndicator;
8    import jalview.gui.IProgressIndicatorHandler;
9    import jalview.schemes.FeatureSettingsAdapter;
10    import jalview.util.MathUtils;
11    import jalview.ws2.actions.annotation.AlignCalcWorkerAdapter;
12    import jalview.ws2.actions.annotation.AnnotationAction;
13    import jalview.ws2.actions.annotation.AnnotationResult;
14   
 
15    public class AnnotationServiceGuiHandler
16    implements AlignCalcWorkerAdapter.WorkerListener
17    {
18    private final long progressId = MathUtils.getUID();
19   
20    private final AlignFrame alignFrame;
21   
22    private final AlignmentPanel alignPanel;
23   
24    private final IProgressIndicator progressIndicator;
25   
26    private final AnnotationAction action;
27   
 
28  0 toggle public AnnotationServiceGuiHandler(AnnotationAction action, AlignFrame frame)
29    {
30  0 this.alignFrame = frame;
31  0 this.alignPanel = frame.alignPanel;
32  0 this.progressIndicator = frame;
33  0 this.action = action;
34    }
35   
 
36  0 toggle @Override
37    public void workerStarted(AlignCalcWorkerAdapter source)
38    {
39  0 progressIndicator.addProgressBar(progressId, action.getFullName());
40  0 progressIndicator.registerHandler(progressId,
41    new IProgressIndicatorHandler()
42    {
 
43  0 toggle @Override
44    public boolean cancelActivity(long id)
45    {
46  0 source.cancel();
47  0 return true;
48    }
49   
 
50  0 toggle @Override
51    public boolean canCancel()
52    {
53  0 return true;
54    }
55    });
56    }
57   
 
58  0 toggle @Override
59    public void workerStopped(AlignCalcWorkerAdapter source)
60    {
61  0 progressIndicator.removeProgressBar(progressId);
62    }
63   
 
64  0 toggle @Override
65    public void workerHasResult(AlignCalcWorkerAdapter source, final AnnotationResult result)
66    {
67  0 if (result == null)
68  0 return;
69  0 if (result.getHasFeatures())
70    {
71  0 alignFrame.getViewport().applyFeaturesStyle(new FeatureSettingsAdapter()
72    {
 
73  0 toggle @Override
74    public FeatureColourI getFeatureColour(String type)
75    {
76  0 return result.getFeatureColours().get(type);
77    }
78   
 
79  0 toggle @Override
80    public FeatureMatcherSetI getFeatureFilters(String type)
81    {
82  0 return result.getFeatureFilters().get(type);
83    }
84   
 
85  0 toggle @Override
86    public boolean isFeatureDisplayed(String type)
87    {
88  0 return result.getFeatureColours().containsKey(type);
89    }
90    });
91  0 if (alignFrame.alignPanel == alignPanel)
92    {
93  0 alignFrame.getViewport().setShowSequenceFeatures(true);
94  0 alignFrame.setMenusForViewport();
95    }
96    }
97  0 alignPanel.adjustAnnotationHeight();
98    }
99    }