import javax.swing.JPanel;
+import jalview.api.SequenceRenderer;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.SearchResultsI;
{
this.av = ap.av;
fr = new FeatureRenderer(ap);
- seqRdr = new SequenceRenderer(av);
+ seqRdr = new jalview.gui.SequenceRenderer(av);
setLayout(new BorderLayout());
PaintRefresher.Register(this, av.getSequenceSetId());
setBackground(Color.white);
/** @j2sNative xxi = this.img */
gg.translate(transX, transY);
- drawPanel(gg, startRes, endRes, startSeq, endSeq, 0);
+ drawPanel(seqRdr, gg, startRes, endRes, startSeq, endSeq, 0);
gg.translate(-transX, -transY);
gg.dispose();
if (av.getWrapAlignment())
{
- drawWrappedPanel(gg, getWidth(), getHeight(), ranges.getStartRes());
+ drawWrappedPanel(seqRdr, gg, getWidth(), getHeight(), ranges.getStartRes());
}
else
{
- drawPanel(gg, startRes, endRes, startSeq, endSeq, 0);
+ drawPanel(seqRdr,gg, startRes, endRes, startSeq, endSeq, 0);
}
drawSelectionGroup(gg, startRes, endRes, startSeq, endSeq);
public void drawPanelForPrinting(Graphics g1, int startRes, int endRes,
int startSeq, int endSeq)
{
- drawPanel(g1, startRes, endRes, startSeq, endSeq, 0);
+ SequenceRenderer localSeqR = new jalview.gui.SequenceRenderer(av);
+ drawPanel(localSeqR,g1, startRes, endRes, startSeq, endSeq, 0);
drawSelectionGroup((Graphics2D) g1, startRes, endRes, startSeq, endSeq);
}
public void drawWrappedPanelForPrinting(Graphics g, int canvasWidth,
int canvasHeight, int startRes)
{
- drawWrappedPanel(g, canvasWidth, canvasHeight, startRes);
+ SequenceRenderer localSeqR = new jalview.gui.SequenceRenderer(av);
+ drawWrappedPanel(localSeqR, g, canvasWidth, canvasHeight, startRes);
SequenceGroup group = av.getSelectionGroup();
if (group != null)
* @param startColumn
* the first column (0...) of the alignment to draw
*/
- public void drawWrappedPanel(Graphics g, int canvasWidth,
+ public void drawWrappedPanel(SequenceRenderer seqRdr, Graphics g, int canvasWidth,
int canvasHeight, final int startColumn)
{
int wrappedWidthInResidues = calculateWrappedGeometry(canvasWidth,
{
int endColumn = Math.min(maxWidth,
start + wrappedWidthInResidues - 1);
- drawWrappedWidth(g, ypos, start, endColumn, canvasHeight);
+ drawWrappedWidth(seqRdr, g, ypos, start, endColumn, canvasHeight);
ypos += wrappedRepeatHeightPx;
start += wrappedWidthInResidues;
currentWidth++;
* @param endColumn
* @param canvasHeight
*/
- protected void drawWrappedWidth(Graphics g, final int ypos,
+ protected void drawWrappedWidth(SequenceRenderer seqRdr, Graphics g, final int ypos,
final int startColumn, final int endColumn,
final int canvasHeight)
{
g.fillRect(0, ypos, (endx - startColumn + 1) * charWidth,
wrappedRepeatHeightPx);
- drawPanel(g, startColumn, endx, 0, av.getAlignment().getHeight() - 1,
+ drawPanel(seqRdr, g, startColumn, endx, 0, av.getAlignment().getHeight() - 1,
ypos);
int cHeight = av.getAlignment().getHeight() * av.getCharHeight();
* are hidden column markers in the visible region, then each sub-region
* between the markers is drawn separately, followed by the hidden column
* marker.
+ * @param localSeqR - sequence renderer implementation - when null, uses the one used for rendering interactive GUI
*
* @param g1
* the graphics context, positioned at the first residue to be drawn
* @param yOffset
* vertical offset at which to draw (for wrapped alignments)
*/
- public void drawPanel(Graphics g1, final int startRes, final int endRes,
+ public void drawPanel(SequenceRenderer localSeqR, Graphics g1, final int startRes, final int endRes,
final int startSeq, final int endSeq, final int yOffset)
{
int charHeight = av.getCharHeight();
int charWidth = av.getCharWidth();
+ if (localSeqR==null)
+ {
+ localSeqR = seqRdr;
+ }
if (!av.hasHiddenColumns())
{
- draw(g1, startRes, endRes, startSeq, endSeq, yOffset);
+ draw(localSeqR, g1, startRes, endRes, startSeq, endSeq, yOffset);
}
else
{
*/
g1.translate(screenY * charWidth, 0);
- draw(g1, blockStart, blockEnd, startSeq, endSeq, yOffset);
+ draw(localSeqR, g1, blockStart, blockEnd, startSeq, endSeq, yOffset);
/*
* draw the downline of the hidden column marker (ScalePanel draws the
/**
* Draws a region of the visible alignment
+ * @param seqRdr
*
* @param g1
* @param startRes
* @param yOffset
* vertical offset at which to draw (for wrapped alignments)
*/
- private void draw(Graphics g, int startRes, int endRes, int startSeq,
+ private void draw(SequenceRenderer seqRdr, Graphics g, int startRes, int endRes, int startSeq,
int endSeq, int offset)
{
int charHeight = av.getCharHeight();
int transY = (firstSeq - ranges.getStartSeq()) * av.getCharHeight();
Graphics gg = img.getGraphics();
gg.translate(transX, transY);
- drawPanel(gg, firstCol, lastCol, firstSeq, lastSeq, 0);
+ drawPanel(seqRdr, gg, firstCol, lastCol, firstSeq, lastSeq, 0);
gg.translate(-transX, -transY);
gg.dispose();
}
if (scrollX < 0)
{
int startRes = ranges.getStartRes();
- drawWrappedWidth(gg, wrappedSpaceAboveAlignment, startRes,
+ drawWrappedWidth(seqRdr,gg, wrappedSpaceAboveAlignment, startRes,
startRes - scrollX - 1, getHeight());
}
else
wrappedRepeatHeightPx);
gg.translate(-xOffset, 0);
- drawWrappedWidth(gg, ypos, startRes, endRes, canvasHeight);
+ drawWrappedWidth(seqRdr, gg, ypos, startRes, endRes, canvasHeight);
}
if (startRes < ranges.getVisibleAlignmentWidth())
{
- drawWrappedWidth(gg, ypos, startRes, endRes, canvasHeight);
+ drawWrappedWidth(seqRdr, gg, ypos, startRes, endRes, canvasHeight);
}
/*
{
matchFound = true;
gg.translate(transX, transY);
- drawPanel(gg, displayColumn, displayColumn, seqNo, seqNo,
+ drawPanel(seqRdr,gg, displayColumn, displayColumn, seqNo, seqNo,
yOffset);
gg.translate(-transX, -transY);
}