X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fworkers%2FAlignCalcWorker.java;h=828ea4fe16b5adbb980caabb29e86d98090a7721;hb=b57a02c25e335d033c97f8a6bacd6b54f62bd2b6;hp=f1b30194df3c1ec5050c1172309bfe4b35dde2ad;hpb=1cc81e06ac2faa5ee4b8879e9fa019956e34259f;p=jalview.git diff --git a/src/jalview/workers/AlignCalcWorker.java b/src/jalview/workers/AlignCalcWorker.java index f1b3019..828ea4f 100644 --- a/src/jalview/workers/AlignCalcWorker.java +++ b/src/jalview/workers/AlignCalcWorker.java @@ -13,9 +13,10 @@ import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; /** - * Base class for alignment calculation workers + * Base class for alignment calculation workers + * * @author jimp - * + * */ public abstract class AlignCalcWorker implements AlignCalcWorkerI { @@ -23,49 +24,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 }