X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationPanel.java;h=e1193c92505d13694f6348c8478de23b5b0c9952;hb=afe4b88500a5d61bc8d312909cfdde2b7cdd53df;hp=f01d7be2b06f0d698c99e376d7b98db1b178fa79;hpb=f047ab25cc45bfc9d130f67d2c56a940751d9c91;p=jalview.git
diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java
index f01d7be..e1193c9 100755
--- a/src/jalview/gui/AnnotationPanel.java
+++ b/src/jalview/gui/AnnotationPanel.java
@@ -631,7 +631,13 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
return false;
}
int yOffset = rowIndex[1];
-
+ AlignmentAnnotation[] allAnnotation = av.getAlignment()
+ .getAlignmentAnnotation();
+ if (allAnnotation == null || rowIndex[0] < 0
+ || rowIndex[0] >= allAnnotation.length)
+ {
+ return false;
+ }
AlignmentAnnotation clicked = av.getAlignment()
.getAlignmentAnnotation()[rowIndex[0]];
if (clicked.graph != AlignmentAnnotation.CONTACT_MAP)
@@ -1084,13 +1090,14 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
if (forFromX != null && forToX != null)
{
- // FIXME will need two ContactGeometry objects when handling contact matrices with differing numbers of rows at each
+ // FIXME will need two ContactGeometry objects when handling contact
+ // matrices with differing numbers of rows at each
// column
ContactGeometry xcgeom = new ContactGeometry(forFromX,
cma.graphHeight);
- ContactGeometry.contactInterval lastXci = xcgeom
- .mapFor(rowIndex[1]);
- ContactGeometry.contactInterval cXci = xcgeom.mapFor(rowIndex[1] + deltaY);
+ ContactGeometry.contactInterval lastXci = xcgeom.mapFor(rowIndex[1]);
+ ContactGeometry.contactInterval cXci = xcgeom
+ .mapFor(rowIndex[1] + deltaY);
// mark rectangular region formed by drag
jalview.bin.Console.trace("Matrix Selection from last(" + fromXc
@@ -1116,7 +1123,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
// }
// else
{
- av.getColumnSelection().addElement(c-1);
+ av.getColumnSelection().addElement(c - 1);
}
}
}
@@ -1228,7 +1235,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
{
row = i;
res[0] = row;
- res[1] = yPos-lheight;
+ res[1] = yPos - lheight;
break;
}
}
@@ -1282,7 +1289,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
// TODO abstract tooltip generator so different implementations can be built
if (ann.graph == AlignmentAnnotation.CONTACT_MAP)
{
- if (rowAndOffset>=ann.graphHeight)
+ if (rowAndOffset >= ann.graphHeight)
{
return null;
}
@@ -1293,9 +1300,10 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
ContactGeometry.contactInterval ci = cgeom.mapFor(rowAndOffset);
ContactRange cr = clist.getRangeFor(ci.cStart, ci.cEnd);
StringBuilder tooltipb = new StringBuilder();
- tooltipb.append("Contact from ")
- .append(clist.getPosition()).append(", [").append(ci.cStart).append(" - ").append(ci.cEnd).append("]").append("
Mean:");
- Format.appendPercentage(tooltipb, (float)cr.getMean(),2);
+ tooltipb.append("Contact from ").append(clist.getPosition())
+ .append(", [").append(ci.cStart).append(" - ")
+ .append(ci.cEnd).append("]").append("
Mean:");
+ Format.appendPercentage(tooltipb, (float) cr.getMean(), 2);
tooltip = tooltipb.toString();
int col = ann.sequenceRef.findPosition(column);
int[][] highlightPos;
@@ -1633,7 +1641,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
&& (fadedImage == null || fadedImage.getWidth() != imgWidth
|| fadedImage.getHeight() != image.getHeight()))
{
- // jalview.bin.Console.errPrintln("redraw faded image ("+(fadedImage==null ?
+ // jalview.bin.Console.errPrintln("redraw faded image
+ // ("+(fadedImage==null ?
// "null image" : "") + " lastGood="+lastImageGood+")");
fadedImage = new BufferedImage(imgWidth, image.getHeight(),
BufferedImage.TYPE_INT_RGB);