X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fworkers%2FAlignmentAnnotationFactory.java;fp=src%2Fjalview%2Fworkers%2FAlignmentAnnotationFactory.java;h=f804a19c16ba0c53466db6234bb72c56d2262e87;hb=refs%2Fheads%2Ffeatures%2FJAL-2068groovyAnnotationWorker;hp=520b232f8102695f28af0636d03b96c02e58f79d;hpb=5fec3766a492c59beafb74aca7272a90a7516130;p=jalview.git diff --git a/src/jalview/workers/AlignmentAnnotationFactory.java b/src/jalview/workers/AlignmentAnnotationFactory.java index 520b232..f804a19 100644 --- a/src/jalview/workers/AlignmentAnnotationFactory.java +++ b/src/jalview/workers/AlignmentAnnotationFactory.java @@ -1,5 +1,7 @@ package jalview.workers; +import jalview.api.AlignViewportI; +import jalview.api.AlignmentViewPanel; import jalview.bin.Jalview; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.Annotation; @@ -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: * */ @@ -28,9 +30,13 @@ public class AlignmentAnnotationFactory */ public static void newCalculator(FeatureCounterI counter) { - if (Jalview.getCurrentAlignFrame() != null) + // TODO need an interface for AlignFrame by which to access + // its AlignViewportI and AlignmentViewPanel + AlignFrame currentAlignFrame = Jalview.getCurrentAlignFrame() ; + if (currentAlignFrame != null) { - newCalculator(Jalview.getCurrentAlignFrame(), counter); + newCalculator(currentAlignFrame.getViewport(), currentAlignFrame + .getAlignPanels().get(0), 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 (Jalview.getCurrentAlignFrame() != null) + // TODO need an interface for AlignFrame by which to access + // its AlignViewportI and AlignmentViewPanel + AlignFrame currentAlignFrame = Jalview.getCurrentAlignFrame() ; + if (currentAlignFrame != null) { - newCalculator(Jalview.getCurrentAlignFrame(), calculator); + newCalculator(currentAlignFrame.getViewport(), currentAlignFrame + .getAlignPanels().get(0), calculator); } else { @@ -74,15 +85,16 @@ 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, + public static void newCalculator(AlignViewportI viewport, + AlignmentViewPanel panel, AnnotationProviderI calculator) { - new AnnotationWorker(af, calculator); + new AnnotationWorker(viewport, panel, calculator); } /**