2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3 * Copyright (C) 2014 The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.workers;
21 import java.util.List;
23 import jalview.api.AlignCalcManagerI;
24 import jalview.api.AlignCalcWorkerI;
25 import jalview.api.AlignViewportI;
26 import jalview.api.AlignmentViewPanel;
27 import jalview.datamodel.AlignmentAnnotation;
28 import jalview.datamodel.AlignmentI;
31 * Base class for alignment calculation workers
36 public abstract class AlignCalcWorker implements AlignCalcWorkerI
39 * manager and data source for calculations
41 protected AlignViewportI alignViewport;
43 protected AlignCalcManagerI calcMan;
45 protected AlignmentViewPanel ap;
47 protected List<AlignmentAnnotation> ourAnnots = null;
49 public AlignCalcWorker(AlignViewportI alignViewport,
50 AlignmentViewPanel alignPanel)
52 this.alignViewport = alignViewport;
53 calcMan = alignViewport.getCalcManager();
57 protected void abortAndDestroy()
61 calcMan.workerComplete(this);
69 public boolean involves(AlignmentAnnotation i)
71 return ourAnnots != null && ourAnnots.contains(i);
75 * permanently remove from the alignment all annotation rows managed by this
79 public void removeOurAnnotation()
81 if (ourAnnots != null && alignViewport != null)
83 AlignmentI alignment = alignViewport.getAlignment();
84 synchronized (ourAnnots)
86 for (AlignmentAnnotation aa : ourAnnots)
88 alignment.deleteAnnotation(aa, true);
93 // TODO: allow GUI to query workers associated with annotation to add items to
94 // annotation label panel popup menu