2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ 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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.workers;
23 import java.util.List;
25 import jalview.api.AlignCalcManagerI;
26 import jalview.api.AlignCalcWorkerI;
27 import jalview.api.AlignViewportI;
28 import jalview.api.AlignmentViewPanel;
29 import jalview.datamodel.AlignmentAnnotation;
30 import jalview.datamodel.AlignmentI;
33 * Base class for alignment calculation workers
38 public abstract class AlignCalcWorker implements AlignCalcWorkerI
41 * manager and data source for calculations
43 protected AlignViewportI alignViewport;
45 protected AlignCalcManagerI calcMan;
47 protected AlignmentViewPanel ap;
49 protected List<AlignmentAnnotation> ourAnnots = null;
51 public AlignCalcWorker(AlignViewportI alignViewport,
52 AlignmentViewPanel alignPanel)
54 this.alignViewport = alignViewport;
55 calcMan = alignViewport.getCalcManager();
59 protected void abortAndDestroy()
63 calcMan.workerComplete(this);
71 public boolean involves(AlignmentAnnotation i)
73 return ourAnnots != null && ourAnnots.contains(i);
77 * permanently remove from the alignment all annotation rows managed by this
81 public void removeOurAnnotation()
83 if (ourAnnots != null && alignViewport != null)
85 AlignmentI alignment = alignViewport.getAlignment();
86 synchronized (ourAnnots)
88 for (AlignmentAnnotation aa : ourAnnots)
90 alignment.deleteAnnotation(aa, true);
95 // TODO: allow GUI to query workers associated with annotation to add items to
96 // annotation label panel popup menu