X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fviewmodel%2FAlignmentViewport.java;h=268633f9b2655db3b9dd0660eb1b1d1d05e8a561;hb=eef6f42415b504bf81da34c93139fe49f560062a;hp=9e02ff18a57ffd280d76ca1bd8b58cba6009d8b9;hpb=0664dcf0200c56c708e7e5972d2e0b1a4c4211c2;p=jalview.git diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 9e02ff1..268633f 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -81,6 +81,29 @@ import java.util.Map; public abstract class AlignmentViewport implements AlignViewportI, CommandListener, VamsasSource { + /** + * An enum for auto-calculated annotations, with constants for the + * annotation's label, and the key for the property to show it or not + */ + public enum AutoAnnotation + { + CONSERVATION("Conservation", "SHOW_CONSERVATION"), + QUALITY("Quality", "SHOW_QUALITY"), + CONSENSUS("Consensus", "SHOW_IDENTITY"), + CDNA_CONSENSUS("cDNA Consensus", null), + STRUCTURE_CONSENSUS("StrucConsensus", null), + OCCUPANCY("Occupancy", "SHOW_OCCUPANCY"); + + public final String label; + public final String preferenceKey; + + private AutoAnnotation(String lbl, String prefKey) + { + this.label = lbl; + this.preferenceKey = prefKey; + } + } + protected ViewportRanges ranges; protected ViewStyleI viewStyle = new ViewStyle(); @@ -1938,7 +1961,7 @@ public abstract class AlignmentViewport { initRNAStructure(); } - consensus = new AlignmentAnnotation("Consensus", + consensus = new AlignmentAnnotation(AutoAnnotation.CONSENSUS.label, MessageManager.getString("label.consensus_descr"), new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH); initConsensus(consensus); @@ -1975,7 +1998,8 @@ public abstract class AlignmentViewport } if (doConsensus) { - complementConsensus = new AlignmentAnnotation("cDNA Consensus", + complementConsensus = new AlignmentAnnotation( + AutoAnnotation.CDNA_CONSENSUS.label, MessageManager .getString("label.complement_consensus_descr"), new Annotation[1], 0f, 100f, @@ -1999,13 +2023,11 @@ public abstract class AlignmentViewport } } - // these should be extracted from the view model - style and settings for - // derived annotation private void initGapCounts() { if (showOccupancy) { - gapcounts = new AlignmentAnnotation("Occupancy", + gapcounts = new AlignmentAnnotation(AutoAnnotation.OCCUPANCY.label, MessageManager.getString("label.occupancy_descr"), new Annotation[1], 0f, alignment.getHeight(), AlignmentAnnotation.BAR_GRAPH); @@ -2024,7 +2046,8 @@ public abstract class AlignmentViewport { if (conservation == null) { - conservation = new AlignmentAnnotation("Conservation", + conservation = new AlignmentAnnotation( + AutoAnnotation.CONSERVATION.label, MessageManager.formatMessage("label.conservation_descr", getConsPercGaps()), new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH); @@ -2041,7 +2064,7 @@ public abstract class AlignmentViewport { if (quality == null) { - quality = new AlignmentAnnotation("Quality", + quality = new AlignmentAnnotation(AutoAnnotation.QUALITY.label, MessageManager.getString("label.quality_descr"), new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH); quality.hasText = true; @@ -2055,7 +2078,8 @@ public abstract class AlignmentViewport { if (alignment.hasRNAStructure() && strucConsensus == null) { - strucConsensus = new AlignmentAnnotation("StrucConsensus", + strucConsensus = new AlignmentAnnotation( + AutoAnnotation.STRUCTURE_CONSENSUS.label, MessageManager.getString("label.strucconsensus_descr"), new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH); strucConsensus.hasText = true; @@ -2683,11 +2707,13 @@ public abstract class AlignmentViewport this.sortAnnotationsBy = sortAnnotationsBy; } + @Override public boolean isShowAutocalculatedAbove() { return showAutocalculatedAbove; } + @Override public void setShowAutocalculatedAbove(boolean showAutocalculatedAbove) { this.showAutocalculatedAbove = showAutocalculatedAbove;