From 734d0e761fda32cebaae59c370c5d64e1e8c99e8 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 15 Mar 2017 16:31:28 +0000 Subject: [PATCH] JAL-2431 show cDNA consensus after New View in split frame --- src/jalview/gui/AlignFrame.java | 8 ++++++++ src/jalview/gui/AlignmentPanel.java | 22 ++++++++++++++++++++++ src/jalview/gui/AnnotationLabels.java | 26 ++------------------------ src/jalview/viewmodel/AlignmentViewport.java | 8 +++++--- 4 files changed, 37 insertions(+), 27 deletions(-) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index b5fc817..c7bce10 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -2744,6 +2744,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ newap.av.replaceMappings(viewport.getAlignment()); + /* + * start up cDNA consensus (if applicable) now mappings are in place + */ + if (newap.av.initComplementConsensus()) + { + newap.refresh(true); // adjust layout of annotations + } + newap.av.viewName = getNewViewName(viewTitle); addAlignmentPanel(newap, true); diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index e61b042..f7a1d2c 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -1875,4 +1875,26 @@ public class AlignmentPanel extends GAlignmentPanel implements { return this.dontScrollComplement; } + + /** + * Redraw sensibly. + * + * @adjustHeight if true, try to recalculate panel height for visible + * annotations + */ + protected void refresh(boolean adjustHeight) + { + validateAnnotationDimensions(adjustHeight); + addNotify(); + if (adjustHeight) + { + // sort, repaint, update overview + paintAlignment(true); + } + else + { + // lightweight repaint + repaint(); + } + } } diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 4b774d6..c9535d0 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -292,33 +292,11 @@ public class AnnotationLabels extends JPanel implements MouseListener, aa[selectedRow].scaleColLabel = !aa[selectedRow].scaleColLabel; } - refresh(fullRepaint); + ap.refresh(fullRepaint); } /** - * Redraw sensibly. - * - * @adjustHeight if true, try to recalculate panel height for visible - * annotations - */ - protected void refresh(boolean adjustHeight) - { - ap.validateAnnotationDimensions(adjustHeight); - ap.addNotify(); - if (adjustHeight) - { - // sort, repaint, update overview - ap.paintAlignment(true); - } - else - { - // lightweight repaint - ap.repaint(); - } - } - - /** * DOCUMENT ME! * * @param e @@ -420,7 +398,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, // ann.visible = false; // } // } - refresh(true); + ap.refresh(true); } }); pop.add(hideType); diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 0c470fe..6dcf26d 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -1898,10 +1898,10 @@ public abstract class AlignmentViewport implements AlignViewportI, } /** - * If this is a protein alignment and there are mappings to cDNA, add the cDNA - * consensus annotation. + * If this is a protein alignment and there are mappings to cDNA, adds the + * cDNA consensus annotation and returns true, else returns false. */ - public void initComplementConsensus() + public boolean initComplementConsensus() { if (!alignment.isNucleotide()) { @@ -1928,9 +1928,11 @@ public abstract class AlignmentViewport implements AlignViewportI, "PID for cDNA", new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH); initConsensus(complementConsensus); + return true; } } } + return false; } private void initConsensus(AlignmentAnnotation aa) -- 1.7.10.2