X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fworkers%2FAlignmentAnnotationFactory.java;h=9c9ea830301ff0b83b53a6953142ed9556faec41;hb=853624fb32058cccc544ae7d13af6ad4b0800b6c;hp=37f3ca504f8601eb51cdbf4bbb1c4142108c65e6;hpb=32cb25af86f1710205b6fdca0df00aed0a0211bb;p=jalview.git
diff --git a/src/jalview/workers/AlignmentAnnotationFactory.java b/src/jalview/workers/AlignmentAnnotationFactory.java
index 37f3ca5..9c9ea83 100644
--- a/src/jalview/workers/AlignmentAnnotationFactory.java
+++ b/src/jalview/workers/AlignmentAnnotationFactory.java
@@ -1,9 +1,11 @@
package jalview.workers;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.bin.Jalview;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.Annotation;
import jalview.gui.AlignFrame;
-import jalview.gui.Desktop;
import java.awt.Color;
@@ -12,9 +14,9 @@ import java.awt.Color;
* such as Groovy) to 'register and forget' an alignment annotation calculator.
* Currently supports two flavours of calculator:
*
- * - a 'feature counter' which can count any desired property derivable from
+ *
- a simple 'feature counter' which counts any desired score derivable from
* residue value and any sequence features at each position of the alignment
- * - a 'general purpose' calculator which computes one more complete
+ *
- a 'general purpose' calculator which computes one or more complete
* AlignmentAnnotation objects
*
*/
@@ -28,9 +30,13 @@ public class AlignmentAnnotationFactory
*/
public static void newCalculator(FeatureCounterI counter)
{
- if (Desktop.getCurrentAlignFrame() != null)
+ // TODO need an interface for AlignFrame by which to access
+ // its AlignViewportI and AlignmentViewPanel
+ AlignmentViewPanel currentAlignFrame = Jalview.getCurrentAlignFrame().alignPanel;
+ if (currentAlignFrame != null)
{
- newCalculator(Desktop.getCurrentAlignFrame(), counter);
+ newCalculator(currentAlignFrame.getAlignViewport(),
+ currentAlignFrame, counter);
}
else
{
@@ -42,14 +48,15 @@ public class AlignmentAnnotationFactory
/**
* Constructs and registers a new alignment annotation worker
*
- * @param af
- * the AlignFrame for which the annotation is to be calculated
+ * @param viewport
+ * @param panel
* @param counter
* provider of feature counts per alignment position
*/
- public static void newCalculator(AlignFrame af, FeatureCounterI counter)
+ public static void newCalculator(AlignViewportI viewport,
+ AlignmentViewPanel panel, FeatureCounterI counter)
{
- new ColumnCounterWorker(af, counter);
+ new ColumnCounterWorker(viewport, panel, counter);
}
/**
@@ -60,9 +67,13 @@ public class AlignmentAnnotationFactory
*/
public static void newCalculator(AnnotationProviderI calculator)
{
- if (Desktop.getCurrentAlignFrame() != null)
+ // TODO need an interface for AlignFrame by which to access
+ // its AlignViewportI and AlignmentViewPanel
+ AlignFrame currentAlignFrame = Jalview.getCurrentAlignFrame();
+ if (currentAlignFrame != null)
{
- newCalculator(Desktop.getCurrentAlignFrame(), calculator);
+ newCalculator(currentAlignFrame.getViewport(), currentAlignFrame
+ .getAlignPanels().get(0), calculator);
}
else
{
@@ -74,15 +85,15 @@ public class AlignmentAnnotationFactory
/**
* Constructs and registers a new alignment annotation worker
*
- * @param af
- * the AlignFrame for which the annotation is to be calculated
+ * @param viewport
+ * @param panel
* @param calculator
* provider of AlignmentAnnotation for the alignment
*/
- public static void newCalculator(AlignFrame af,
- AnnotationProviderI calculator)
+ public static void newCalculator(AlignViewportI viewport,
+ AlignmentViewPanel panel, AnnotationProviderI calculator)
{
- new AnnotationWorker(af, calculator);
+ new AnnotationWorker(viewport, panel, calculator);
}
/**