X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fviewmodel%2FAlignmentViewport.java;h=9de0b9467f3830b4b1a3d85384f11f1d968c8ea0;hb=725dd79ff4976e8e30a638a6f7dfa45eea818d57;hp=8dcd1b3220a6225714eebd235c2eca5cd977b583;hpb=74f21ca6ca8fa17d53708e457d191e15904f8310;p=jalview.git diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 8dcd1b3..9de0b94 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -1931,18 +1931,31 @@ public abstract class AlignmentViewport { if (!alignment.isNucleotide()) { - initConservation(); - initQuality(); + if (showConservation && conservation == null) + { + initConservation(); + } + if (showQuality && quality == null) + { + initQuality(); + } } else { - initRNAStructure(); + if (showConsensus && alignment.hasRNAStructure() + && strucConsensus == null) + { + initRNAStructure(); + } + } + if (showConsensus) + { + initConsensus(); + } + if (showOccupancy) + { + initOccupancy(); } - consensus = new AlignmentAnnotation("Consensus", - MessageManager.getString("label.consensus_descr"), - new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH); - initConsensus(consensus); - initGapCounts(); initComplementConsensus(); } @@ -1988,84 +2001,76 @@ public abstract class AlignmentViewport return false; } + @Override + public void initConsensus() + { + consensus = new AlignmentAnnotation("Consensus", + MessageManager.getString("label.consensus_descr"), + new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH); + initConsensus(consensus); + } + private void initConsensus(AlignmentAnnotation aa) { - aa.hasText = true; - aa.autoCalculated = true; + consensus = new AlignmentAnnotation("Consensus", + MessageManager.getString("label.consensus_descr"), + new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH); + consensus.hasText = true; + consensus.autoCalculated = true; if (showConsensus) { - alignment.addAnnotation(aa); + alignment.addAnnotation(consensus); } } - // these should be extracted from the view model - style and settings for - // derived annotation - private void initGapCounts() + @Override + public void initOccupancy() { - if (showOccupancy) - { - gapcounts = new AlignmentAnnotation("Occupancy", - MessageManager.getString("label.occupancy_descr"), - new Annotation[1], 0f, alignment.getHeight(), - AlignmentAnnotation.BAR_GRAPH); - gapcounts.hasText = true; - gapcounts.autoCalculated = true; - gapcounts.scaleColLabel = true; - gapcounts.graph = AlignmentAnnotation.BAR_GRAPH; + gapcounts = new AlignmentAnnotation("Occupancy", + MessageManager.getString("label.occupancy_descr"), + new Annotation[1], 0f, alignment.getHeight(), + AlignmentAnnotation.BAR_GRAPH); + gapcounts.hasText = true; + gapcounts.autoCalculated = true; + gapcounts.scaleColLabel = true; + gapcounts.graph = AlignmentAnnotation.BAR_GRAPH; - alignment.addAnnotation(gapcounts); - } + alignment.addAnnotation(gapcounts); } - private void initConservation() + @Override + public void initConservation() { - if (showConservation) - { - if (conservation == null) - { - conservation = new AlignmentAnnotation("Conservation", - MessageManager.formatMessage("label.conservation_descr", - getConsPercGaps()), - new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH); - conservation.hasText = true; - conservation.autoCalculated = true; - alignment.addAnnotation(conservation); - } - } + conservation = new AlignmentAnnotation("Conservation", + MessageManager.formatMessage("label.conservation_descr", + getConsPercGaps()), + new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH); + conservation.hasText = true; + conservation.autoCalculated = true; + alignment.addAnnotation(conservation); } - private void initQuality() + @Override + public void initQuality() { - if (showQuality) - { - if (quality == null) - { - quality = new AlignmentAnnotation("Quality", - MessageManager.getString("label.quality_descr"), - new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH); - quality.hasText = true; - quality.autoCalculated = true; - alignment.addAnnotation(quality); - } - } + quality = new AlignmentAnnotation("Quality", + MessageManager.getString("label.quality_descr"), + new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH); + quality.hasText = true; + quality.autoCalculated = true; + alignment.addAnnotation(quality); } - private void initRNAStructure() + @Override + public void initRNAStructure() { - if (alignment.hasRNAStructure() && strucConsensus == null) - { - strucConsensus = new AlignmentAnnotation("StrucConsensus", - MessageManager.getString("label.strucconsensus_descr"), - new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH); - strucConsensus.hasText = true; - strucConsensus.autoCalculated = true; - - if (showConsensus) - { - alignment.addAnnotation(strucConsensus); - } - } + strucConsensus = new AlignmentAnnotation("StrucConsensus", + MessageManager.getString("label.strucconsensus_descr"), + new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH); + strucConsensus.hasText = true; + strucConsensus.autoCalculated = true; + alignment.addAnnotation(strucConsensus); } /*