From: jprocter Date: Tue, 1 Jun 2010 11:28:57 +0000 (+0000) Subject: patches for # JAL-254 and JAL-548 X-Git-Tag: Release_2_5_1~37 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a92b8392b04de472326ae92dfc14a541924ebc6b;p=jalview.git patches for # JAL-254 and JAL-548 --- diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 59d7b97..09b7215 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -283,7 +283,8 @@ public class AlignmentPanel extends GAlignmentPanel implements } int start = r[0]; int end = r[1]; - // System.err.println("Seq : "+seqIndex+" Scroll to "+start+","+end); // DEBUG + // System.err.println("Seq : "+seqIndex+" Scroll to "+start+","+end); // + // DEBUG if (start < 0) { return false; @@ -1343,40 +1344,46 @@ public class AlignmentPanel extends GAlignmentPanel implements AlignmentAnnotation[] aan = av.alignment.getAlignmentAnnotation(); Hashtable oldrfs = new Hashtable(); - for (int an = 0; an < aan.length; an++) + if (aan != null) { - if (aan[an].autoCalculated && aan[an].groupRef != null) + for (int an = 0; an < aan.length; an++) { - oldrfs.put(aan[an].groupRef, aan[an].groupRef); - av.alignment.deleteAnnotation(aan[an]); - aan[an] = null; + if (aan[an].autoCalculated && aan[an].groupRef != null) + { + oldrfs.put(aan[an].groupRef, aan[an].groupRef); + av.alignment.deleteAnnotation(aan[an]); + aan[an] = null; + } } } SequenceGroup sg; - for (int g = 0; g < gr.size(); g++) + if (gr != null) { - updateCalcs = false; - sg = (SequenceGroup) gr.elementAt(g); - if (applyGlobalSettings || !oldrfs.containsKey(sg)) - { - // set defaults for this group's conservation/consensus - sg.setIncludeAllConsSymbols(showprf); - sg.setShowConsensusHistogram(showConsHist); - } - if (conv) - { - updateCalcs = true; - av.alignment.addAnnotation(sg.getConservationRow(), 0); - } - if (cons) - { - updateCalcs = true; - av.alignment.addAnnotation(sg.getConsensus(), 0); - } - // refresh the annotation rows - if (updateCalcs) + for (int g = 0; g < gr.size(); g++) { - sg.recalcConservation(); + updateCalcs = false; + sg = (SequenceGroup) gr.elementAt(g); + if (applyGlobalSettings || !oldrfs.containsKey(sg)) + { + // set defaults for this group's conservation/consensus + sg.setIncludeAllConsSymbols(showprf); + sg.setShowConsensusHistogram(showConsHist); + } + if (conv) + { + updateCalcs = true; + av.alignment.addAnnotation(sg.getConservationRow(), 0); + } + if (cons) + { + updateCalcs = true; + av.alignment.addAnnotation(sg.getConsensus(), 0); + } + // refresh the annotation rows + if (updateCalcs) + { + sg.recalcConservation(); + } } } oldrfs.clear(); diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 18bda61..bd46613 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -153,6 +153,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, break; } } + } else { + selectedRow = -1; } } @@ -429,7 +431,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation(); if (SwingUtilities.isLeftMouseButton(evt)) { - if (selectedRow < aa.length) + if (aa!=null && selectedRow < aa.length) { if (aa[selectedRow].groupRef != null) { diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 22977a9..4c40d2d 100755 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -2942,10 +2942,10 @@ public class Jalview2XML } af.setMenusFromViewport(af.viewport); - af.alignPanel.updateAnnotation(false); // recompute any autoannotation // TODO: we don't need to do this if the viewport is aready visible. Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(), view .getHeight()); + af.alignPanel.updateAnnotation(false); // recompute any autoannotation return af; }