X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationPanel.java;h=0f6901d018a510e3ae4909f71daa407de87f297a;hb=dd74fc4938723fe5ec48d4e5fdcfbe58ac42a48d;hp=844c1abfaa242c082fa7ad624df27783e2bd4421;hpb=c5443fe79c3846608bdaad1e548ba80ca65317ac;p=jalview.git diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 844c1ab..0f6901d 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -108,7 +108,6 @@ public class AnnotationPanel extends JPanel implements MouseListener, public int adjustPanelHeight() { // setHeight of panels - image = null; AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); int height = 0; @@ -168,6 +167,15 @@ public class AnnotationPanel extends JPanel implements MouseListener, AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); Annotation[] anot = aa[activeRow].annotations; + if (anot.length < av.getColumnSelection().getMax()) + { + Annotation[] temp = new Annotation[av.getColumnSelection().getMax()+2 ]; + System.arraycopy(anot, 0, temp, 0, anot.length); + anot = temp; + aa[activeRow].annotations = anot; + } + + if (evt.getActionCommand().equals(REMOVE)) { for (int i = 0; i < av.getColumnSelection().size(); i++) @@ -280,7 +288,6 @@ public class AnnotationPanel extends JPanel implements MouseListener, public void mousePressed(MouseEvent evt) { - AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); if(aa==null) return; @@ -350,6 +357,9 @@ public class AnnotationPanel extends JPanel implements MouseListener, int res = (evt.getX() / av.getCharWidth()) + av.getStartRes(); + if(av.hasHiddenColumns) + res = av.getColumnSelection().adjustForHiddenColumns(res); + min = res; max = res; @@ -431,6 +441,9 @@ public class AnnotationPanel extends JPanel implements MouseListener, int res = (evt.getX() / av.getCharWidth()) + av.getStartRes(); + if(av.hasHiddenColumns) + res = av.getColumnSelection().adjustForHiddenColumns(res); + SequenceGroup sg = av.getSelectionGroup(); if (res < min) @@ -488,6 +501,7 @@ public class AnnotationPanel extends JPanel implements MouseListener, if (aa == null) { + this.setToolTipText(null); return; } @@ -509,12 +523,20 @@ public class AnnotationPanel extends JPanel implements MouseListener, } } + if(row==-1) + { + this.setToolTipText(null); + return; + } + int res = (evt.getX() / av.getCharWidth()) + av.getStartRes(); if(av.hasHiddenColumns) res = av.getColumnSelection().adjustForHiddenColumns(res); - if (row > -1 && res -1 + && res < (int) aa[row].annotations.length) { if(aa[row].graphGroup>-1) { @@ -530,18 +552,23 @@ public class AnnotationPanel extends JPanel implements MouseListener, this.setToolTipText(tip.toString() + ""); } } - else if(aa[row].annotations[res] != null) + else if(aa[row].annotations[res] != null + && aa[row].annotations[res].description!=null) this.setToolTipText(aa[row].annotations[res].description); if(aa[row].annotations[res]!=null) { StringBuffer text = new StringBuffer("Sequence position " + - (res + 1) + " " + - aa[row].annotations[res].description); + (res + 1)); + + if (aa[row].annotations[res].description != null) + text.append(" " + aa[row].annotations[res].description); ap.alignFrame.statusBar.setText(text.toString()); } } + else + this.setToolTipText(null); } /** @@ -654,6 +681,10 @@ public class AnnotationPanel extends JPanel implements MouseListener, { if(av.updatingConsensus || av.updatingConservation) { + if(image==null) + { + return; + } //We'll keep a record of the old image, //and draw a faded image until the calculation //has completed @@ -745,7 +776,7 @@ public class AnnotationPanel extends JPanel implements MouseListener, } } - if (av.updatingConsensus && aa[i].label.equals("Consensus")) + if (av.updatingConsensus && aa[i]==av.consensus) { y += av.charHeight; @@ -1022,7 +1053,6 @@ public class AnnotationPanel extends JPanel implements MouseListener, default: g.setColor(Color.gray); - if(!av.wrapAlignment || endRes==av.endRes) g.fillRect(lastSSX, y + 6 + iconOffset, (x*av.charWidth) - lastSSX, 2);