X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FIdCanvas.java;h=f7f1b203b5f237c149edfcad4bb7dc4e677b2693;hb=7bc213bae5828287329a3490faba291706599b03;hp=3c3c52c896d2cfabc41ddeb24582c2a34e8d645b;hpb=588042b69abf8e60bcc950b24c283933c7dd422f;p=jalview.git diff --git a/src/jalview/appletgui/IdCanvas.java b/src/jalview/appletgui/IdCanvas.java index 3c3c52c..f7f1b20 100755 --- a/src/jalview/appletgui/IdCanvas.java +++ b/src/jalview/appletgui/IdCanvas.java @@ -21,7 +21,6 @@ package jalview.appletgui; import java.awt.*; -import jalview.analysis.*; import jalview.datamodel.*; public class IdCanvas @@ -44,7 +43,7 @@ public class IdCanvas { setLayout(null); this.av = av; - PaintRefresher.Register(this); + PaintRefresher.Register(this, av.alignment); } public void drawIdString(Graphics gg, SequenceI s, int i, int starty, @@ -55,34 +54,29 @@ public class IdCanvas if (searchResults != null && searchResults.contains(s)) { gg.setColor(Color.black); - gg.fillRect(0, AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos, + gg.fillRect(0, ((i - starty) * charHeight) + ypos, getSize().width, charHeight); gg.setColor(Color.white); } else if (av.getSelectionGroup() != null && - av.getSelectionGroup().sequences.contains(s)) + av.getSelectionGroup().getSequences(false).contains(s)) { gg.setColor(Color.lightGray); - gg.fillRect(0, AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos, + gg.fillRect(0, ((i - starty) * charHeight) + ypos, getSize().width, charHeight); gg.setColor(Color.white); } else { gg.setColor(s.getColor()); - gg.fillRect(0, AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos, + gg.fillRect(0, ((i - starty) * charHeight) + ypos, getSize().width, charHeight); gg.setColor(Color.black); } - String string = s.getName(); - if (av.getShowFullId()) - { - string = s.getDisplayId(); - } - gg.drawString(string, 0, - AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos + + gg.drawString( s.getDisplayId(av.getShowJVSuffix()), 0, + ((i - starty) * charHeight) + ypos + charHeight - (charHeight / 5)); } @@ -177,23 +171,50 @@ public class IdCanvas { Color currentColor = Color.white; Color currentTextColor = Color.black; + Font italic = new Font(av.getFont().getName(), Font.ITALIC, + av.getFont().getSize()); if (av.getWrapAlignment()) { + int annotationHeight = 0; + AnnotationLabels labels = null; - int rowSize = av.getEndRes() - av.getStartRes(); - // Draw the rest of the panels - - for (int ypos = 2 * av.charHeight, row = av.startRes; - ypos <= getSize().height && row < av.alignment.getWidth(); - ypos += av.chunkHeight, row += rowSize) + if(av.showAnnotation) { - for (int i = starty; i < av.alignment.getHeight(); i++) + AnnotationPanel ap = new AnnotationPanel(av); + annotationHeight = ap.adjustPanelHeight(); + labels = new AnnotationLabels(av); + } + + int hgap = av.charHeight; + if (av.scaleAboveWrapped) + hgap += av.charHeight; + + int cHeight = av.getAlignment().getHeight() * av.charHeight + + hgap + + annotationHeight; + + int rowSize = av.getEndRes() - av.getStartRes(); + + // Draw the rest of the panels + for (int ypos = hgap, row = av.startRes; + (ypos <= getSize().height) && (row < av.alignment.getWidth()); + ypos += cHeight, row += rowSize) { - SequenceI s = av.alignment.getSequenceAt(i); - drawIdString(gg, s, i, 0, ypos); + for (int i = starty; i < av.alignment.getHeight(); i++) + { + SequenceI s = av.alignment.getSequenceAt(i); + gg.setFont(italic); + drawIdString(gg, s, i, 0, ypos); + } + + if(labels!=null) + { + gg.translate(0, ypos+(av.getAlignment().getHeight() * av.charHeight)); + labels.drawComponent(gg, getSize().width); + gg.translate(0, -ypos-(av.getAlignment().getHeight() * av.charHeight)); + } } - } } else @@ -213,7 +234,7 @@ public class IdCanvas } else if (av.getSelectionGroup() != null && - av.getSelectionGroup().sequences.contains(av.alignment. + av.getSelectionGroup().getSequences(false).contains(av.alignment. getSequenceAt(i))) { currentColor = Color.lightGray; @@ -228,18 +249,15 @@ public class IdCanvas gg.setColor(currentColor); gg.fillRect(0, - AlignmentUtil.getPixelHeight(starty, i, av.charHeight), + ((i - starty) * av.charHeight), getSize().width, av.charHeight); gg.setColor(currentTextColor); - String string = av.alignment.getSequenceAt(i).getName(); - if (av.getShowFullId()) - { - string = av.alignment.getSequenceAt(i).getDisplayId(); - } - gg.drawString(string, 0, - AlignmentUtil.getPixelHeight(starty, i, av.charHeight) + + + gg.drawString(av.alignment.getSequenceAt(i) + .getDisplayId(av.getShowJVSuffix()), 0, + ((i - starty) * av.charHeight) + av.charHeight - (av.charHeight / 5)); }