X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FIdCanvas.java;h=ac82e12a36e8925fd8478c825e4e2bfc3c05cf6d;hb=7bc226b58110fa26d9dbd3f0c78095d06909ffc3;hp=dd057a347e4a3839445d9742282026c87d63874e;hpb=da144cfa9b7997a6e8dd04ef10d55bcea3b02c71;p=jalview.git diff --git a/src/jalview/appletgui/IdCanvas.java b/src/jalview/appletgui/IdCanvas.java index dd057a3..ac82e12 100755 --- a/src/jalview/appletgui/IdCanvas.java +++ b/src/jalview/appletgui/IdCanvas.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -43,7 +43,7 @@ public class IdCanvas { setLayout(null); this.av = av; - PaintRefresher.Register(this, av.alignment); + PaintRefresher.Register(this, av.getSequenceSetId()); } public void drawIdString(Graphics gg, SequenceI s, int i, int starty, @@ -54,33 +54,34 @@ public class IdCanvas if (searchResults != null && searchResults.contains(s)) { gg.setColor(Color.black); - gg.fillRect(0, ((i - starty) * charHeight) + ypos, + gg.fillRect(0, ( (i - starty) * charHeight) + ypos, getSize().width, charHeight); gg.setColor(Color.white); } else if (av.getSelectionGroup() != null && - av.getSelectionGroup().getSequences(false).contains(s)) + av.getSelectionGroup().getSequences(null).contains(s)) { gg.setColor(Color.lightGray); - gg.fillRect(0, ((i - starty) * charHeight) + ypos, + gg.fillRect(0, ( (i - starty) * charHeight) + ypos, getSize().width, charHeight); gg.setColor(Color.white); } else { - gg.setColor(s.getColor()); - gg.fillRect(0, ((i - starty) * charHeight) + ypos, + gg.setColor(av.getSequenceColour(s)); + gg.fillRect(0, ( (i - starty) * charHeight) + ypos, getSize().width, charHeight); gg.setColor(Color.black); } - - gg.drawString( s.getDisplayId(av.getShowJVSuffix()), 0, - ((i - starty) * charHeight) + ypos + + gg.drawString(s.getDisplayId(av.getShowJVSuffix()), 0, + ( (i - starty) * charHeight) + ypos + charHeight - (charHeight / 5)); if (av.hasHiddenRows && av.showHiddenMarkers) - drawMarker(i, starty, ypos); + { + drawMarker(i, starty, ypos); + } } @@ -186,7 +187,9 @@ public class IdCanvas int alheight = av.alignment.getHeight(); if (av.hasHiddenColumns) + { maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1; + } int annotationHeight = 0; AnnotationLabels labels = null; @@ -200,7 +203,9 @@ public class IdCanvas int hgap = av.charHeight; if (av.scaleAboveWrapped) + { hgap += av.charHeight; + } int cHeight = alheight * av.charHeight + hgap @@ -220,7 +225,9 @@ public class IdCanvas setHiddenFont(i); } else + { gg.setFont(italic); + } SequenceI s = av.alignment.getSequenceAt(i); drawIdString(gg, s, i, 0, ypos); @@ -240,6 +247,7 @@ public class IdCanvas //Now draw the id strings //Now draw the id strings + SequenceI seq; for (int i = starty; i < endy; i++) { if (av.hasHiddenRows) @@ -247,23 +255,28 @@ public class IdCanvas setHiddenFont(i); } + seq = av.alignment.getSequenceAt(i); + if (seq == null) + { + continue; + } + // Selected sequence colours if ( (searchResults != null) && - searchResults.contains(av.alignment.getSequenceAt(i))) + searchResults.contains(seq)) { currentColor = Color.black; currentTextColor = Color.white; } else if ( (av.getSelectionGroup() != null) && - av.getSelectionGroup().getSequences(false).contains( - av.alignment.getSequenceAt(i))) + av.getSelectionGroup().getSequences(null).contains(seq)) { currentColor = Color.lightGray; currentTextColor = Color.black; } else { - currentColor = av.alignment.getSequenceAt(i).getColor(); + currentColor = av.getSequenceColour(seq); currentTextColor = Color.black; } @@ -274,15 +287,15 @@ public class IdCanvas gg.setColor(currentTextColor); - String string = av.alignment.getSequenceAt(i).getDisplayId(av. - getShowJVSuffix()); - - gg.drawString(string, 0, + gg.drawString(seq.getDisplayId(av.getShowJVSuffix()), + 0, ( ( (i - starty) * av.charHeight) + av.charHeight) - (av.charHeight / 5)); if (av.hasHiddenRows && av.showHiddenMarkers) + { drawMarker(i, starty, 0); + } } } } @@ -295,7 +308,7 @@ public class IdCanvas void drawMarker(int i, int starty, int yoffset) { - SequenceI [] hseqs = av.alignment.getHiddenSequences().hiddenSequences; + SequenceI[] hseqs = av.alignment.getHiddenSequences().hiddenSequences; //Use this method here instead of calling hiddenSeq adjust //3 times. int hSize = hseqs.length; @@ -307,59 +320,64 @@ public class IdCanvas boolean below = (hiddenIndex > lastIndex + 1); boolean above = (nextIndex > hiddenIndex + 1); - - - for(int j=0; j