package jalview.workers;
+import jalview.api.AlignmentViewPanel;
import jalview.bin.Jalview;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.Annotation;
* 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>
*/
* @param counter
* provider of feature counts per alignment position
*/
- public static void newCalculator(FeatureCounterI counter)
+ public static void newCalculator(FeatureSetCounterI counter)
{
- if (Jalview.getCurrentAlignFrame() != null)
- {
- newCalculator(Jalview.getCurrentAlignFrame(), counter);
- }
- else
+ AlignmentViewPanel currentAlignFrame = Jalview.getCurrentAlignFrame().alignPanel;
+ if (currentAlignFrame == null)
{
System.err
.println("Can't register calculator as no alignment window has focus");
+ return;
}
- }
-
- /**
- * Constructs and registers a new alignment annotation worker
- *
- * @param af
- * the AlignFrame for which the annotation is to be calculated
- * @param counter
- * provider of feature counts per alignment position
- */
- public static void newCalculator(AlignFrame af, FeatureCounterI counter)
- {
- new ColumnCounterWorker(af, counter);
+ new ColumnCounterSetWorker(currentAlignFrame.getAlignViewport(),
+ currentAlignFrame, counter);
}
/**
*/
public static void newCalculator(AnnotationProviderI calculator)
{
- if (Jalview.getCurrentAlignFrame() != null)
+ AlignFrame currentAlignFrame = Jalview.getCurrentAlignFrame();
+ if (currentAlignFrame != null)
{
- newCalculator(Jalview.getCurrentAlignFrame(), calculator);
+ new AnnotationWorker(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 calculator
- * provider of AlignmentAnnotation for the alignment
- */
- public static void newCalculator(AlignFrame af,
- AnnotationProviderI calculator)
- {
- new AnnotationWorker(af, calculator);
- }
-
- /**
* Factory method to construct an Annotation object
*
* @param displayChar