X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fworkers%2FAlignCalcWorker.java;h=6bdf1c23ed827b20fac66cbd82a10ee49cdc4940;hb=17e77c3f2949a0729322b4a8d907f3f34b6a9914;hp=f1b30194df3c1ec5050c1172309bfe4b35dde2ad;hpb=42ec35a792d480c73027da6e7fc617146850ce44;p=jalview.git diff --git a/src/jalview/workers/AlignCalcWorker.java b/src/jalview/workers/AlignCalcWorker.java index f1b3019..6bdf1c2 100644 --- a/src/jalview/workers/AlignCalcWorker.java +++ b/src/jalview/workers/AlignCalcWorker.java @@ -1,10 +1,25 @@ -/** +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9) + * Copyright (C) 2015 The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.workers; -import java.util.List; - import jalview.api.AlignCalcManagerI; import jalview.api.AlignCalcWorkerI; import jalview.api.AlignViewportI; @@ -12,10 +27,13 @@ import jalview.api.AlignmentViewPanel; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; +import java.util.List; + /** - * Base class for alignment calculation workers + * Base class for alignment calculation workers + * * @author jimp - * + * */ public abstract class AlignCalcWorker implements AlignCalcWorkerI { @@ -23,49 +41,58 @@ public abstract class AlignCalcWorker implements AlignCalcWorkerI * manager and data source for calculations */ protected AlignViewportI alignViewport; + protected AlignCalcManagerI calcMan; + protected AlignmentViewPanel ap; - protected List ourAnnots=null; - + + protected List ourAnnots = null; + public AlignCalcWorker(AlignViewportI alignViewport, AlignmentViewPanel alignPanel) { this.alignViewport = alignViewport; - calcMan=alignViewport.getCalcManager(); - ap = alignPanel; + calcMan = alignViewport.getCalcManager(); + ap = alignPanel; } + protected void abortAndDestroy() { - if (calcMan!=null) { + if (calcMan != null) + { calcMan.workerComplete(this); } - alignViewport=null; - calcMan=null; - ap=null; - + alignViewport = null; + calcMan = null; + ap = null; + } + public boolean involves(AlignmentAnnotation i) { - return ourAnnots!=null && ourAnnots.contains(i); + return ourAnnots != null && ourAnnots.contains(i); } /** - * permanently remove from the alignment all annotation rows managed by this worker + * permanently remove from the alignment all annotation rows managed by this + * worker */ @Override public void removeOurAnnotation() { - if (ourAnnots!=null && alignViewport!=null) + if (ourAnnots != null && alignViewport != null) { - AlignmentI alignment=alignViewport.getAlignment(); - synchronized (ourAnnots) { - for (AlignmentAnnotation aa:ourAnnots) + AlignmentI alignment = alignViewport.getAlignment(); + synchronized (ourAnnots) + { + for (AlignmentAnnotation aa : ourAnnots) { alignment.deleteAnnotation(aa, true); } } } } - // TODO: allow GUI to query workers associated with annotation to add items to annotation label panel popup menu + // TODO: allow GUI to query workers associated with annotation to add items to + // annotation label panel popup menu }