X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fworkers%2FAlignCalcWorker.java;h=c9dbba6ec9494f0785532bab2f3631b6b7ad3ba4;hb=8eb35a7bab22595255245c5136dd780816b98f26;hp=19a92fb7140ace2499ee48cb525fb108c33fa6f3;hpb=fcd5e2c2998725ebbea42d08f02eaf13206f7585;p=jalview.git
diff --git a/src/jalview/workers/AlignCalcWorker.java b/src/jalview/workers/AlignCalcWorker.java
index 19a92fb..c9dbba6 100644
--- a/src/jalview/workers/AlignCalcWorker.java
+++ b/src/jalview/workers/AlignCalcWorker.java
@@ -1,5 +1,19 @@
-/**
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ *
+ * 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 .
*/
package jalview.workers;
@@ -10,11 +24,13 @@ import jalview.api.AlignCalcWorkerI;
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
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
{
@@ -22,32 +38,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
+ */
+ @Override
+ public void removeOurAnnotation()
+ {
+ if (ourAnnots != null && alignViewport != null)
+ {
+ 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
}