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;
* such as Groovy) to 'register and forget' an alignment annotation calculator. <br>
* Currently supports two flavours of calculator:
* <ul>
- * <li>a 'feature counter' which can count any desired property derivable from
+ * <li>a simple 'feature counter' which counts any desired score derivable from
* residue value and any sequence features at each position of the alignment</li>
- * <li>a 'general purpose' calculator which computes one more complete
+ * <li>a 'general purpose' calculator which computes one or more complete
* AlignmentAnnotation objects</li>
* </ul>
*/
*/
public static void newCalculator(FeatureCounterI counter)
{
- 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(), counter);
+ newCalculator(currentAlignFrame.getViewport(), currentAlignFrame
+ .getAlignPanels().get(0), counter);
}
else
{
/**
* 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);
}
/**
*/
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
{
/**
* 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);
}
/**