* Sorts annotations and repaints the alignment
*/
@Override
- protected void sortAnnotations()
+ public void sortAnnotations()
{
alignPanel.sortAnnotations();
alignPanel.paintAlignment(false, false);
}
+ /**
+ * Sets the flag for whether auto-calculated annotations should be shown above
+ * other annotations. If the given value is the same as the current setting,
+ * simply returns false. Otherwise updates the setting, and returns true. If
+ * annotation sort order is currently set to 'Custom', this is changed to
+ * 'None', because 'Custom' ordering ignores all sort options.
+ */
@Override
- protected boolean setShowAutoCalculatedAbove(
- boolean showAutoCalculatedAbove)
+ public boolean setShowAutoCalculatedAbove(boolean b)
{
- if (viewport.isShowAutocalculatedAbove() != showAutoCalculatedAbove)
+ if (viewport.isShowAutocalculatedAbove() != b)
{
- viewport.setShowAutocalculatedAbove(showAutoCalculatedAbove);
+ viewport.setShowAutocalculatedAbove(b);
/*
* change CUSTOM annotation ordering to NONE
package jalview.gui;
import jalview.analysis.AnnotationSorter;
+import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.bin.Cache;
}
/**
- * Sorts annotations according to currently selected preference
+ * Sorts annotations according to currently selected preferences. Does nothing
+ * if currently set to 'Custom' (manual) ordering.
*/
void sortAnnotations()
{
- final AnnotationSorter sorter = new AnnotationSorter(getAlignment(),
- av.isShowAutocalculatedAbove());
- sorter.sort(getAlignment().getAlignmentAnnotation(),
- av.getSortAnnotationsBy());
+ SequenceAnnotationOrder sortBy = av.getSortAnnotationsBy();
+ if (sortBy != SequenceAnnotationOrder.CUSTOM)
+ {
+ final AnnotationSorter sorter = new AnnotationSorter(getAlignment(),
+ av.isShowAutocalculatedAbove());
+ sorter.sort(getAlignment().getAlignmentAnnotation(), sortBy);
+ }
}
/**
import static jalview.math.RotatableMatrix.Axis.Y;
import static jalview.math.RotatableMatrix.Axis.Z;
+import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
import jalview.analysis.Conservation;
import jalview.analysis.PCA;
import jalview.analysis.scoremodels.ScoreModels;
view.setRenderGaps(av.isRenderGaps());
view.setShowAnnotation(av.isShowAnnotation());
view.setShowBoxes(av.getShowBoxes());
+ view.setShowAutocalcAbove(av.isShowAutocalculatedAbove());
+ view.setSortAnnotationsBy(av.getSortAnnotationsBy().name());
view.setShowColourText(av.getColourText());
view.setShowFullId(av.getShowJVSuffix());
view.setRightAlignIds(av.isRightAlignIds());
viewport.setColourText(safeBoolean(view.isShowColourText()));
- viewport
- .setConservationSelected(
- safeBoolean(view.isConservationSelected()));
+ viewport.setConservationSelected(
+ safeBoolean(view.isConservationSelected()));
viewport.setIncrement(safeInt(view.getConsThreshold()));
viewport.setShowJVSuffix(safeBoolean(view.isShowFullId()));
viewport.setRightAlignIds(safeBoolean(view.isRightAlignIds()));
viewport.setWrapAlignment(safeBoolean(view.isWrapAlignment()));
viewport.setShowAnnotation(safeBoolean(view.isShowAnnotation()));
- viewport.setShowBoxes(safeBoolean(view.isShowBoxes()));
+ Boolean autocalcFirst = view.isShowAutocalcAbove();
+ if (autocalcFirst != null)
+ {
+ af.setShowAutoCalculatedAbove(autocalcFirst.booleanValue());
+ }
+ String sortBy = view.getSortAnnotationsBy();
+ if (sortBy != null)
+ {
+ try
+ {
+ viewport.setSortAnnotationsBy(
+ SequenceAnnotationOrder.valueOf(sortBy));
+ } catch (IllegalArgumentException e)
+ {
+ Cache.log.error(
+ "Invalid annotation sort specifier in project: " + sortBy);
+ }
+ }
+ viewport.setShowBoxes(safeBoolean(view.isShowBoxes()));
viewport.setShowText(safeBoolean(view.isShowText()));
-
viewport.setTextColour(new Color(safeInt(view.getTextCol1())));
viewport.setTextColour2(new Color(safeInt(view.getTextCol2())));
viewport.setThresholdTextColour(safeInt(view.getTextColThreshold()));
// recompute any autoannotation
af.alignPanel.updateAnnotation(false, true);
reorderAutoannotation(af, al, autoAlan);
+ af.sortAnnotations();
af.alignPanel.alignmentChanged();
}
else