From 7335eb77076ba83a2faebeaf45f0aa03407fdcd1 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 27 May 2014 16:02:12 +0100 Subject: [PATCH] JAL-1402 conditional logic to ensure annotation & label panel/canvas components not touched in validation/layout/paint routines unless layout requires them --- src/jalview/appletgui/AlignmentPanel.java | 30 ++++++++++++++++++--------- src/jalview/appletgui/AnnotationLabels.java | 7 +++++-- src/jalview/appletgui/AnnotationPanel.java | 7 +++++-- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index 7f2a943..3214e70 100644 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -433,6 +433,9 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, { annotationSpaceFillerHolder.setVisible(b); annotationPanelHolder.setVisible(b); + } else { + annotationSpaceFillerHolder.setVisible(false); + annotationPanelHolder.setVisible(false); } validate(); repaint(); @@ -512,7 +515,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, alabels.setSize(new Dimension(e.width, height)); annotationSpaceFillerHolder.setSize(new Dimension(e.width, height)); annotationPanelHolder.setSize(new Dimension(d.width, height)); - seqPanelHolder.setSize(d.width, seqandannot - height); + // seqPanelHolder.setSize(d.width, seqandannot - height); seqPanel.seqCanvas .setSize(d.width, seqPanel.seqCanvas.getSize().height); int s = apvscroll.getValue(); @@ -521,8 +524,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, s = 0; } apvscroll.setValues(s, height, 0, mheight); - annotationPanel.setScrollOffset(apvscroll.getValue()); - alabels.setScrollOffset(apvscroll.getValue()); + annotationPanel.setScrollOffset(apvscroll.getValue(), false); + alabels.setScrollOffset(apvscroll.getValue(), false); } public void setWrapAlignment(boolean wrap) @@ -544,12 +547,13 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, annotationPanelHolder.setVisible(true); annotationSpaceFillerHolder.setVisible(true); } - + idSpaceFillerPanel1.setVisible(!wrap); fontChanged(); // This is so that the scalePanel is resized correctly validate(); + sequenceHolderPanel.revalidate(); repaint(); } @@ -686,8 +690,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, if (evt == null || evt.getSource() == apvscroll) { - annotationPanel.setScrollOffset(apvscroll.getValue()); - alabels.setScrollOffset(apvscroll.getValue()); + annotationPanel.setScrollOffset(apvscroll.getValue(), false); + alabels.setScrollOffset(apvscroll.getValue(), false); // annotationPanel.image=null; // alabels.image=null; // alabels.repaint(); @@ -817,12 +821,18 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, setScrollValues(av.getStartRes(), av.getStartSeq()); } - alabels.repaint(); - seqPanel.seqCanvas.repaint(); - scalePanel.repaint(); - annotationPanel.repaint(); idPanel.idCanvas.repaint(); + if (!av.wrapAlignment) + { + if (av.showAnnotation) + { + alabels.repaint(); + annotationPanel.repaint(); + } + scalePanel.repaint(); + } + } protected Panel sequenceHolderPanel = new Panel(); diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index 7d4c38c..5900b67 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -93,10 +93,13 @@ public class AnnotationLabels extends Panel implements ActionListener, this.av = av; } - public void setScrollOffset(int y) + public void setScrollOffset(int y, boolean repaint) { scrollOffset = y; - repaint(); + if (repaint) + { + repaint(); + } } /** diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index 2704306..a343bcf 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -636,10 +636,13 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, int scrollOffset = 0; - public void setScrollOffset(int value) + public void setScrollOffset(int value, boolean repaint) { scrollOffset = value; - repaint(); + if (repaint) + { + repaint(); + } } @Override -- 1.7.10.2