X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FSequenceRenderer.java;h=34ad21754979de8bff50d769fc0e2b55a52a703d;hb=ae3fad8019274ca3ab1258a480ba15dd9adac1e9;hp=684701ec0440f1e6dd4fe9045f8bd7d05670f215;hpb=aebfd3e1071a70f850b5ef051f9c70bd5e027706;p=jalview.git diff --git a/src/jalview/appletgui/SequenceRenderer.java b/src/jalview/appletgui/SequenceRenderer.java index 684701e..34ad217 100755 --- a/src/jalview/appletgui/SequenceRenderer.java +++ b/src/jalview/appletgui/SequenceRenderer.java @@ -85,8 +85,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer // TODO replace 8 or so code duplications with calls to this method // (refactored as needed) return resColourFinder.getResidueColour(av.getShowBoxes(), - av.getResidueShading(), - allGroups, seq, position, finder); + av.getResidueShading(), allGroups, seq, position, finder); } public Color findSequenceColour(SequenceI seq, int i) @@ -120,8 +119,8 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer int length = seq.getLength(); int curStart = -1; - int curWidth = av.getCharWidth(), avCharWidth = av.getCharWidth(), avCharHeight = av - .getCharHeight(); + int curWidth = av.getCharWidth(), avCharWidth = av.getCharWidth(), + avCharHeight = av.getCharHeight(); Color resBoxColour = Color.white; Color tempColour = null; @@ -137,8 +136,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer if (currentSequenceGroup.getDisplayBoxes()) { resBoxColour = resColourFinder.getBoxColour( - currentSequenceGroup.getGroupColourScheme(), seq, - i); + currentSequenceGroup.getGroupColourScheme(), seq, i); } } else if (av.getShowBoxes()) @@ -276,8 +274,8 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer } charOffset = (avCharWidth - fm.charWidth(s)) / 2; - graphics.drawString(String.valueOf(s), charOffset + avCharWidth - * (i - start), y1); + graphics.drawString(String.valueOf(s), + charOffset + avCharWidth * (i - start), y1); } } @@ -300,35 +298,40 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer // currentSequenceGroup.getConsensus() char conschar = (usesrep) ? (currentGroup == null || position < currentGroup.getStartRes() - || position > currentGroup.getEndRes() ? av.getAlignment() - .getSeqrep().getCharAt(position) - : (currentGroup.getSeqrep() != null ? currentGroup.getSeqrep() - .getCharAt(position) : av.getAlignment().getSeqrep() - .getCharAt(position))) + || position > currentGroup.getEndRes() + ? av.getAlignment().getSeqrep().getCharAt(position) + : (currentGroup.getSeqrep() != null + ? currentGroup.getSeqrep().getCharAt(position) + : av.getAlignment().getSeqrep() + .getCharAt(position))) : (currentGroup != null && currentGroup.getConsensus() != null && position >= currentGroup.getStartRes() - && position <= currentGroup.getEndRes() && currentGroup - .getConsensus().annotations.length > position) ? currentGroup - .getConsensus().annotations[position].displayCharacter - .charAt(0) - : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter - .charAt(0); + && position <= currentGroup.getEndRes() + && currentGroup + .getConsensus().annotations.length > position) + ? currentGroup + .getConsensus().annotations[position].displayCharacter + .charAt(0) + : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter + .charAt(0); if (!jalview.util.Comparison.isGap(conschar) - && (sequenceChar == conschar || sequenceChar + CHAR_TO_UPPER == conschar)) + && (sequenceChar == conschar + || sequenceChar + CHAR_TO_UPPER == conschar)) { sequenceChar = conservedChar; } return sequenceChar; } - public void drawHighlightedText(SequenceI seq, int start, int end, - int x1, int y1) + public void drawHighlightedText(SequenceI seq, int start, int end, int x1, + int y1) { int avCharWidth = av.getCharWidth(), avCharHeight = av.getCharHeight(); int pady = avCharHeight / 5; int charOffset = 0; graphics.setColor(Color.black); - graphics.fillRect(x1, y1, avCharWidth * (end - start + 1), avCharHeight); + graphics.fillRect(x1, y1, avCharWidth * (end - start + 1), + avCharHeight); graphics.setColor(Color.white); char s = '~'; @@ -343,13 +346,14 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer } charOffset = (avCharWidth - fm.charWidth(s)) / 2; - graphics.drawString(String.valueOf(s), charOffset + x1 - + avCharWidth * (i - start), y1 + avCharHeight - pady); + graphics.drawString(String.valueOf(s), + charOffset + x1 + avCharWidth * (i - start), + y1 + avCharHeight - pady); } } } - public void drawCursor(SequenceI seq, int res, int x1, int y1) + public void drawCursor(Graphics graphics, char s, int x1, int y1) { int pady = av.getCharHeight() / 5; int charOffset = 0; @@ -359,7 +363,6 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer graphics.setColor(Color.white); - char s = seq.getCharAt(res); if (av.validCharWidth) {