2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import java.awt.BorderLayout;
24 import java.awt.Color;
25 import java.awt.Container;
26 import java.awt.Dimension;
28 import java.awt.FontMetrics;
29 import java.awt.Graphics;
30 import java.awt.Graphics2D;
31 import java.awt.event.AdjustmentEvent;
32 import java.awt.event.AdjustmentListener;
33 import java.awt.event.ComponentAdapter;
34 import java.awt.event.ComponentEvent;
35 import java.awt.print.PageFormat;
36 import java.awt.print.Printable;
37 import java.awt.print.PrinterException;
38 import java.beans.PropertyChangeEvent;
39 import java.beans.PropertyChangeListener;
41 import java.io.FileWriter;
42 import java.io.PrintWriter;
43 import java.util.List;
45 import javax.swing.SwingUtilities;
47 import jalview.analysis.AnnotationSorter;
48 import jalview.api.AlignViewportI;
49 import jalview.api.AlignmentViewPanel;
50 import jalview.bin.Cache;
51 import jalview.bin.Jalview;
52 import jalview.datamodel.AlignmentI;
53 import jalview.datamodel.HiddenColumns;
54 import jalview.datamodel.SearchResultsI;
55 import jalview.datamodel.SequenceFeature;
56 import jalview.datamodel.SequenceGroup;
57 import jalview.datamodel.SequenceI;
58 import jalview.gui.ImageExporter.ImageWriterI;
59 import jalview.io.HTMLOutput;
60 import jalview.jbgui.GAlignmentPanel;
61 import jalview.math.AlignmentDimension;
62 import jalview.schemes.ResidueProperties;
63 import jalview.structure.StructureSelectionManager;
64 import jalview.util.Comparison;
65 import jalview.util.ImageMaker;
66 import jalview.util.MessageManager;
67 import jalview.viewmodel.AlignmentViewport;
68 import jalview.viewmodel.ViewportListenerI;
69 import jalview.viewmodel.ViewportRanges;
75 * @version $Revision: 1.161 $
77 @SuppressWarnings("serial")
78 public class AlignmentPanel extends GAlignmentPanel implements
79 AdjustmentListener, Printable, AlignmentViewPanel, ViewportListenerI
82 * spare space in pixels between sequence id and alignment panel
84 private static final int ID_WIDTH_PADDING = 4;
86 public AlignViewport av;
88 OverviewPanel overviewPanel;
90 private SeqPanel seqPanel;
92 private IdPanel idPanel;
94 IdwidthAdjuster idwidthAdjuster;
96 public AlignFrame alignFrame;
98 private ScalePanel scalePanel;
100 private AnnotationPanel annotationPanel;
102 private AnnotationLabels alabels;
104 private int hextent = 0;
106 private int vextent = 0;
109 * Flag set while scrolling to follow complementary cDNA/protein scroll. When
110 * false, suppresses invoking the same method recursively.
112 private boolean scrollComplementaryPanel = true;
114 private PropertyChangeListener propertyChangeListener;
116 private CalculationChooser calculationDialog;
119 * Creates a new AlignmentPanel object.
124 public AlignmentPanel(AlignFrame af, final AlignViewport av)
126 setName("AligmentPanel");
127 // setBackground(Color.white); // BH 2019
130 setSeqPanel(new SeqPanel(av, this));
131 setIdPanel(new IdPanel(av, this));
133 setScalePanel(new ScalePanel(av, this));
135 idPanelHolder.add(getIdPanel(), BorderLayout.CENTER);
136 idwidthAdjuster = new IdwidthAdjuster(this);
137 idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER);
139 setAnnotationPanel(new AnnotationPanel(this));
140 setAlabels(new AnnotationLabels(this));
142 annotationScroller.setViewportView(getAnnotationPanel());
143 annotationSpaceFillerHolder.add(getAlabels(), BorderLayout.CENTER);
145 scalePanelHolder.add(getScalePanel(), BorderLayout.CENTER);
146 seqPanelHolder.add(getSeqPanel(), BorderLayout.CENTER);
148 setScrollValues(0, 0);
150 hscroll.addAdjustmentListener(this);
151 vscroll.addAdjustmentListener(this);
153 addComponentListener(new ComponentAdapter()
156 public void componentResized(ComponentEvent evt)
158 // reset the viewport ranges when the alignment panel is resized
159 // in particular, this initialises the end residue value when Jalview
161 ViewportRanges ranges = av.getRanges();
162 if (av.getWrapAlignment())
164 int widthInRes = getSeqPanel().seqCanvas.getWrappedCanvasWidth(
165 getSeqPanel().seqCanvas.getWidth());
166 ranges.setViewportWidth(widthInRes);
170 int widthInRes = getSeqPanel().seqCanvas.getWidth()
172 int heightInSeq = getSeqPanel().seqCanvas.getHeight()
173 / av.getCharHeight();
175 ranges.setViewportWidth(widthInRes);
176 ranges.setViewportHeight(heightInSeq);
183 final AlignmentPanel ap = this;
184 propertyChangeListener = new PropertyChangeListener()
187 public void propertyChange(PropertyChangeEvent evt)
189 switch (evt.getPropertyName()) {
190 case AlignmentViewport.PROPERTY_SEQUENCE:
191 updateScrollBarsFromRanges();
192 if (annotationPanel != null)
193 annotationPanel.paintImmediately(0, 0, getWidth(), getHeight());
195 case AlignmentViewport.PROPERTY_ALIGNMENT:
196 updateScrollBarsFromRanges();
197 PaintRefresher.Refresh(ap, av.getSequenceSetId(), true, true);
203 av.addPropertyChangeListener(propertyChangeListener);
205 av.getRanges().addPropertyChangeListener(this);
207 adjustAnnotationHeight();
212 public AlignViewportI getAlignViewport()
217 public void alignmentChanged()
219 av.alignmentChanged(this);
221 if (getCalculationDialog() != null)
223 getCalculationDialog().validateCalcTypes();
226 alignFrame.updateEditMenuBar();
228 // no idea if we need to update structure
229 paintAlignment(true, true);
236 public void fontChanged()
238 // set idCanvas bufferedImage to null
239 // to prevent drawing old image
240 FontMetrics fm = getFontMetrics(av.getFont());
242 scalePanelHolder.setPreferredSize(
243 new Dimension(10, av.getCharHeight() + fm.getDescent()));
244 idSpaceFillerPanel1.setPreferredSize(
245 new Dimension(10, av.getCharHeight() + fm.getDescent()));
246 idwidthAdjuster.invalidate();
247 scalePanelHolder.invalidate();
248 // BH 2018 getIdPanel().getIdCanvas().gg = null;
249 getSeqPanel().seqCanvas.img = null;
250 getAnnotationPanel().adjustPanelHeight();
252 Dimension d = calculateIdWidth();
253 getIdPanel().getIdCanvas().setPreferredSize(d);
254 hscrollFillerPanel.setPreferredSize(d);
260 * Calculates the width of the alignment labels based on the displayed names
261 * and any bounds on label width set in preferences. The calculated width is
262 * also set as a property of the viewport.
264 * @return Dimension giving the maximum width of the alignment label panel
265 * that should be used.
267 public Dimension calculateIdWidth()
269 int oldWidth = av.getIdWidth();
271 // calculate sensible default width when no preference is available
273 if (av.getIdWidth() < 0)
275 int maxWidth = getMaxWidth();
276 d = calculateIdWidth(maxWidth);
277 av.setIdWidth(d.width);
282 d.width = av.getIdWidth();
287 * fudge: if desired width has changed, update layout
288 * (see also paintComponent - updates layout on a repaint)
290 if (d.width != oldWidth)
292 idPanelHolder.setPreferredSize(d);
298 public int getMaxWidth()
300 int afwidth = (alignFrame != null ? alignFrame.getWidth() : 300);
301 int idWidth = Math.min(afwidth - 200, 2 * afwidth / 3);
302 return Math.max(IdwidthAdjuster.MIN_ID_WIDTH, idWidth);
306 * Calculate the width of the alignment labels based on the displayed names
307 * and any bounds on label width set in preferences.
310 * -1 or maximum width allowed for IdWidth
311 * @return Dimension giving the maximum width of the alignment label panel
312 * that should be used.
314 public Dimension calculateIdWidth(int maxwidth)
316 Container c = this;// new Container();
317 FontMetrics fm = c.getFontMetrics(
318 new Font(av.font.getName(), Font.ITALIC, av.font.getSize()));
320 AlignmentI al = av.getAlignment();
324 boolean withSuffix = av.getShowJVSuffix();
326 while ((i < al.getHeight()) && (al.getSequenceAt(i) != null))
328 SequenceI s = al.getSequenceAt(i);
329 String id = s.getDisplayId(withSuffix);
330 int stringWidth = fm.stringWidth(id);
331 idWidth = Math.max(idWidth, stringWidth);
335 // Also check annotation label widths
338 if (al.getAlignmentAnnotation() != null)
340 fm = c.getFontMetrics(getAlabels().getFont());
342 while (i < al.getAlignmentAnnotation().length)
344 String label = al.getAlignmentAnnotation()[i].label;
345 int stringWidth = fm.stringWidth(label);
346 idWidth = Math.max(idWidth, stringWidth);
351 int w = maxwidth < 0 ? idWidth : Math.min(maxwidth, idWidth);
352 w += ID_WIDTH_PADDING;
354 return new Dimension(w, 12);
358 * Highlight the given results on the alignment
361 public void highlightSearchResults(SearchResultsI results)
363 boolean scrolled = scrollToPosition(results, 0, false);
365 boolean fastPaint = !(scrolled && av.getWrapAlignment());
367 getSeqPanel().seqCanvas.highlightSearchResults(results, fastPaint);
371 * Scroll the view to show the position of the highlighted region in results
374 * @param searchResults
377 public boolean scrollToPosition(SearchResultsI searchResults)
379 return scrollToPosition(searchResults, 0, false);
383 * Scrolls the view (if necessary) to show the position of the first
384 * highlighted region in results (if any). Answers true if the view was
385 * scrolled, or false if no matched region was found, or it is already
389 * @param verticalOffset
390 * if greater than zero, allows scrolling to a position below the
391 * first displayed sequence
393 * if true, try to centre the search results horizontally in the view
396 protected boolean scrollToPosition(SearchResultsI results,
397 int verticalOffset, boolean centre)
399 int startv, endv, starts, ends;
400 ViewportRanges ranges = av.getRanges();
402 if (results == null || results.isEmpty() || av == null
403 || av.getAlignment() == null)
407 int seqIndex = av.getAlignment().findIndex(results);
412 SequenceI seq = av.getAlignment().getSequenceAt(seqIndex);
414 int[] r = results.getResults(seq, 0, av.getAlignment().getWidth());
423 * To centre results, scroll to positions half the visible width
424 * left/right of the start/end positions
428 int offset = (ranges.getEndRes() - ranges.getStartRes() + 1) / 2 - 1;
429 start = Math.max(start - offset, 0);
430 end = end + offset - 1;
436 if (end == seq.getEnd())
441 if (av.hasHiddenColumns())
443 HiddenColumns hidden = av.getAlignment().getHiddenColumns();
444 start = hidden.absoluteToVisibleColumn(start);
445 end = hidden.absoluteToVisibleColumn(end);
448 if (!hidden.isVisible(r[0]))
450 // don't scroll - position isn't visible
457 * allow for offset of target sequence (actually scroll to one above it)
459 seqIndex = Math.max(0, seqIndex - verticalOffset);
460 boolean scrollNeeded = true;
462 if (!av.getWrapAlignment())
464 if ((startv = ranges.getStartRes()) >= start)
467 * Scroll left to make start of search results visible
469 setScrollValues(start, seqIndex);
471 else if ((endv = ranges.getEndRes()) <= end)
474 * Scroll right to make end of search results visible
476 setScrollValues(startv + end - endv, seqIndex);
478 else if ((starts = ranges.getStartSeq()) > seqIndex)
481 * Scroll up to make start of search results visible
483 setScrollValues(ranges.getStartRes(), seqIndex);
485 else if ((ends = ranges.getEndSeq()) <= seqIndex)
488 * Scroll down to make end of search results visible
490 setScrollValues(ranges.getStartRes(), starts + seqIndex - ends + 1);
493 * Else results are already visible - no need to scroll
495 scrollNeeded = false;
499 scrollNeeded = ranges.scrollToWrappedVisible(start);
502 paintAlignment(false, false);
510 * @return DOCUMENT ME!
512 public OverviewPanel getOverviewPanel()
514 return overviewPanel;
523 public void setOverviewPanel(OverviewPanel op)
531 * Hide or show annotation panel
534 public void setAnnotationVisible(boolean b)
536 if (!av.getWrapAlignment())
538 annotationSpaceFillerHolder.setVisible(b);
539 annotationScroller.setVisible(b);
545 * automatically adjust annotation panel height for new annotation whilst
546 * ensuring the alignment is still visible.
549 public void adjustAnnotationHeight()
551 // TODO: display vertical annotation scrollbar if necessary
552 // this is called after loading new annotation onto alignment
553 if (alignFrame.getHeight() == 0)
555 System.out.println("NEEDS FIXING");
557 validateAnnotationDimensions(true);
559 // TODO: many places call this method and also paintAlignment with various
560 // different settings. this means multiple redraws are triggered...
561 paintAlignment(true, av.needToUpdateStructureViews());
565 * calculate the annotation dimensions and refresh slider values accordingly.
566 * need to do repaints/notifys afterwards.
568 protected void validateAnnotationDimensions(boolean adjustPanelHeight)
570 // BH 2018.04.18 comment: addNotify() is not appropriate here. We
571 // are not changing ancestors, and keyboard action listeners do
572 // not need to be reset, and most importantly, we can't be sure we are actually
573 // connected to resources.
575 // addNotify() is a very expensive operation,
576 // requiring a full re-layout of all parents and children.
578 // Note in JComponent:
580 // This method is called by the toolkit internally and should
581 // not be called directly by programs.
583 // I note that addNotify() is called in several areas of Jalview.
585 int annotationHeight = getAnnotationPanel().adjustPanelHeight();
586 annotationHeight = getAnnotationPanel()
587 .adjustForAlignFrame(adjustPanelHeight, annotationHeight);
591 annotationScroller.setPreferredSize(
592 new Dimension(annotationScroller.getWidth(), annotationHeight));
594 Dimension e = idPanel.getSize();
595 alabels.setSize(new Dimension(e.width, annotationHeight));
597 annotationSpaceFillerHolder.setPreferredSize(new Dimension(
598 annotationSpaceFillerHolder.getWidth(), annotationHeight));
599 annotationScroller.validate();
600 annotationScroller.addNotify();
604 * update alignment layout for viewport settings
609 public void updateLayout()
611 // BH 2020.06.09 avoid negative values for SequencePanel and SeqCanvas dimensions
612 // if (getTopLevelAncestor() == null)
617 ViewportRanges ranges = av.getRanges();
619 setAnnotationVisible(av.isShowAnnotation());
620 boolean wrap = av.getWrapAlignment();
621 ranges.setStartSeq(0);
622 scalePanelHolder.setVisible(!wrap);
623 hscroll.setVisible(!wrap);
624 idwidthAdjuster.setVisible(!wrap);
628 annotationScroller.setVisible(false);
629 annotationSpaceFillerHolder.setVisible(false);
631 else if (av.isShowAnnotation())
633 annotationScroller.setVisible(true);
634 annotationSpaceFillerHolder.setVisible(true);
635 validateAnnotationDimensions(false);
638 int canvasWidth = getSeqPanel().seqCanvas.getWidth();
640 { // may not yet be laid out
643 int widthInRes = getSeqPanel().seqCanvas
644 .getWrappedCanvasWidth(canvasWidth);
645 ranges.setViewportWidth(widthInRes);
649 int widthInRes = (canvasWidth / av.getCharWidth());
650 int heightInSeq = (getSeqPanel().seqCanvas.getHeight()
651 / av.getCharHeight());
653 ranges.setViewportWidth(widthInRes);
654 ranges.setViewportHeight(heightInSeq);
658 idSpaceFillerPanel1.setVisible(!wrap);
660 // System.out.println("ap dim = " + getSize());
662 // these values will go negative if getSize() returns (0,0):
664 // System.out.println("seqpan dim = " + getSeqPanel().getSize());
665 // System.out.println("seqcan dim = " + getSeqPanel().seqCanvas.getSize());
671 * Adjust row/column scrollers to show a visible position in the alignment.
674 * visible column to scroll to
676 * visible row to scroll to
679 public void setScrollValues(int x, int y)
682 if (av == null || av.getAlignment() == null)
687 if (av.getWrapAlignment())
689 setScrollingForWrappedPanel(x);
693 int width = av.getAlignment().getVisibleWidth();
694 int height = av.getAlignment().getHeight();
696 hextent = Math.min(getSeqPanel().seqCanvas.getWidth() / av.getCharWidth(), width);
697 vextent = Math.min(getSeqPanel().seqCanvas.getHeight() / av.getCharHeight(), height);
699 x = Math.max(0, Math.min(x, width - hextent));
700 y = Math.max(0, Math.min(y, height - vextent));
703 updateScrollBars(x, y, width, height);
707 private void updateScrollBars(int x, int y, int width, int height)
709 hscroll.setValues(x, hextent, 0, width);
710 vscroll.setValues(y, vextent, 0, height);
714 * Respond to adjustment event when horizontal or vertical scrollbar is
718 * adjustment event encoding whether hscroll or vscroll changed
721 public void adjustmentValueChanged(AdjustmentEvent evt)
723 if (av.getWrapAlignment())
725 adjustScrollingWrapped(evt);
729 if (evt.getSource() == hscroll)
731 if (!updateRanges(hscroll.getValue(), Integer.MIN_VALUE))
734 else if (evt.getSource() == vscroll)
736 if (!updateRanges(Integer.MIN_VALUE, vscroll.getValue()))
742 private boolean updateRanges(int x, int y)
744 ViewportRanges ranges = av.getRanges();
745 boolean isChanged = false;
746 if (x != Integer.MIN_VALUE)
748 int oldX = ranges.getStartRes();
749 int oldwidth = ranges.getViewportWidth();
750 int width = getSeqPanel().seqCanvas.getWidth() / av.getCharWidth();
752 // if we're scrolling to the position we're already at, stop
753 // this prevents infinite recursion of events when the scroll/viewport
754 // ranges values are the same
755 if (width > 0 && (x != oldX || width != oldwidth))
757 ranges.setViewportStartAndWidth(x, width);
761 if (y != Integer.MIN_VALUE)
763 int oldY = ranges.getStartSeq();
764 int oldheight = ranges.getViewportHeight();
765 int height = getSeqPanel().seqCanvas.getHeight() / av.getCharHeight();
767 // if we're scrolling to the position we're already at, stop
768 // this prevents infinite recursion of events when the scroll/viewport
769 // ranges values are the same
770 if (height > 0 && (y != oldY || height != oldheight))
772 ranges.setViewportStartAndHeight(y, height);
780 * Responds to a scroll change by setting the start position of the viewport.
785 protected void adjustScrollingWrapped(AdjustmentEvent evt)
787 if (evt.getSource() == hscroll)
789 return; // no horizontal scroll when wrapped
791 final ViewportRanges ranges = av.getRanges();
793 if (evt.getSource() == vscroll)
795 int newY = vscroll.getValue();
798 * if we're scrolling to the position we're already at, stop
799 * this prevents infinite recursion of events when the scroll/viewport
800 * ranges values are the same
802 int oldX = ranges.getStartRes();
803 int oldY = ranges.getWrappedScrollPosition(oldX);
811 * limit page up/down to one width's worth of positions
813 int rowSize = ranges.getViewportWidth();
814 int newX = newY > oldY ? oldX + rowSize : oldX - rowSize;
815 ranges.setViewportStartAndWidth(Math.max(0, newX), rowSize);
820 // This is only called if file loaded is a jar file that
821 // was wrapped when saved and user has wrap alignment true
822 // as preference setting
823 SwingUtilities.invokeLater(new Runnable()
828 // When updating scrolling to use ViewportChange events, this code
829 // could not be validated and it is not clear if it is now being
830 // called. Log warning here in case it is called and unforeseen
833 "Unexpected path through code: Wrapped jar file opened with wrap alignment set in preferences");
835 // scroll to start of panel
836 ranges.setStartRes(0);
837 ranges.setStartSeq(0);
845 * @see jalview.api.AlignmentViewPanel#paintAlignment(boolean)
848 public void paintAlignment(boolean updateOverview,
849 boolean updateStructures)
851 final AnnotationSorter sorter = new AnnotationSorter(getAlignment(),
852 av.isShowAutocalculatedAbove());
853 sorter.sort(getAlignment().getAlignmentAnnotation(),
854 av.getSortAnnotationsBy());
856 if (updateStructures)
858 av.getStructureSelectionManager().sequenceColoursChanged(this);
862 alignFrame.repaint();
863 if (overviewPanel != null)
865 overviewPanel.updateOverviewImage();
868 invalidate(); // needed so that the id width adjuster works correctly
874 public void paintComponent(Graphics g)
877 invalidate(); // needed so that the id width adjuster works correctly
879 Dimension d = getIdPanel().getIdCanvas().getPreferredSize();
880 idPanelHolder.setPreferredSize(d);
881 hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12));
883 validate(); // needed so that the id width adjuster works correctly
886 * set scroll bar positions - tried to remove but necessary for split panel to resize correctly
887 * though I still think this call should be elsewhere.
889 ViewportRanges ranges = av.getRanges();
890 // setScrollValues(ranges.getStartRes(), ranges.getStartSeq());
891 super.paintComponent(g);
895 * Set vertical scroll bar position, and number of increments, for wrapped
898 * @param topLeftColumn
899 * the column position at top left (0..)
901 private void setScrollingForWrappedPanel(int topLeftColumn)
903 ViewportRanges ranges = av.getRanges();
904 int scrollPosition = ranges.getWrappedScrollPosition(topLeftColumn);
905 int maxScroll = ranges.getWrappedMaxScroll(topLeftColumn);
908 * a scrollbar's value can be set to at most (maximum-extent)
909 * so we add extent (1) to the maxScroll value
911 vscroll.setUnitIncrement(1);
912 vscroll.setValues(scrollPosition, 1, 0, maxScroll + 1);
925 * @return DOCUMENT ME!
927 * @throws PrinterException
931 public int print(Graphics pg, PageFormat pf, int pi)
932 throws PrinterException
934 pg.translate((int) pf.getImageableX(), (int) pf.getImageableY());
936 int pwidth = (int) pf.getImageableWidth();
937 int pheight = (int) pf.getImageableHeight();
939 if (av.getWrapAlignment())
941 return printWrappedAlignment(pwidth, pheight, pi, pg);
945 return printUnwrapped(pwidth, pheight, pi, pg, pg);
950 * Draws the alignment image, including sequence ids, sequences, and
951 * annotation labels and annotations if shown, on either one or two Graphics
961 * the graphics context for sequence ids and annotation labels
962 * @param alignmentGraphics
963 * the graphics context for sequences and annotations (may or may not
964 * be the same context as idGraphics)
966 * @throws PrinterException
968 public int printUnwrapped(int pageWidth, int pageHeight, int pageIndex,
969 Graphics idGraphics, Graphics alignmentGraphics)
970 throws PrinterException
972 final int idWidth = getVisibleIdWidth(false);
975 * Get the horizontal offset to where we draw the sequences.
976 * This is idWidth if using a single Graphics context, else zero.
978 final int alignmentGraphicsOffset = idGraphics != alignmentGraphics ? 0
981 FontMetrics fm = getFontMetrics(av.getFont());
982 final int charHeight = av.getCharHeight();
983 final int scaleHeight = charHeight + fm.getDescent();
985 idGraphics.setColor(Color.white);
986 idGraphics.fillRect(0, 0, pageWidth, pageHeight);
987 idGraphics.setFont(av.getFont());
990 * How many sequences and residues can we fit on a printable page?
992 final int totalRes = (pageWidth - idWidth) / av.getCharWidth();
994 final int totalSeq = (pageHeight - scaleHeight) / charHeight - 1;
996 final int alignmentWidth = av.getAlignment().getVisibleWidth();
997 int pagesWide = (alignmentWidth / totalRes) + 1;
999 final int startRes = (pageIndex % pagesWide) * totalRes;
1000 final int endRes = Math.min(startRes + totalRes - 1,
1001 alignmentWidth - 1);
1003 final int startSeq = (pageIndex / pagesWide) * totalSeq;
1004 final int alignmentHeight = av.getAlignment().getHeight();
1005 final int endSeq = Math.min(startSeq + totalSeq, alignmentHeight);
1007 int pagesHigh = ((alignmentHeight / totalSeq) + 1) * pageHeight;
1009 if (av.isShowAnnotation())
1011 pagesHigh += getAnnotationPanel().adjustPanelHeight() + 3;
1014 pagesHigh /= pageHeight;
1016 if (pageIndex >= (pagesWide * pagesHigh))
1018 return Printable.NO_SUCH_PAGE;
1020 final int alignmentDrawnHeight = (endSeq - startSeq) * charHeight + 3;
1023 * draw the Scale at horizontal offset, then reset to top left (0, 0)
1025 alignmentGraphics.translate(alignmentGraphicsOffset, 0);
1026 getScalePanel().drawScale(alignmentGraphics, startRes, endRes,
1027 pageWidth - idWidth, scaleHeight);
1028 alignmentGraphics.translate(-alignmentGraphicsOffset, 0);
1031 * Draw the sequence ids, offset for scale height,
1032 * then reset to top left (0, 0)
1034 idGraphics.translate(0, scaleHeight);
1035 IdCanvas idCanvas = getIdPanel().getIdCanvas();
1036 List<SequenceI> selection = av.getSelectionGroup() == null ? null
1037 : av.getSelectionGroup().getSequences(null);
1038 idCanvas.drawIds((Graphics2D) idGraphics, av, startSeq, endSeq - 1,
1041 idGraphics.setFont(av.getFont());
1042 idGraphics.translate(0, -scaleHeight);
1045 * draw the sequences, offset for scale height, and id width (if using a
1046 * single graphics context), then reset to (0, scale height)
1048 alignmentGraphics.translate(alignmentGraphicsOffset, scaleHeight);
1049 getSeqPanel().seqCanvas.drawPanelForPrinting(alignmentGraphics,
1050 startRes, endRes, startSeq, endSeq - 1);
1051 alignmentGraphics.translate(-alignmentGraphicsOffset, 0);
1053 if (av.isShowAnnotation() && (endSeq == alignmentHeight))
1056 * draw annotation labels; drawComponent() translates by
1057 * getScrollOffset(), so compensate for that first;
1058 * then reset to (0, scale height)
1060 int offset = getAlabels().getScrollOffset();
1061 idGraphics.translate(0, -offset);
1062 idGraphics.translate(0, alignmentDrawnHeight);
1063 getAlabels().drawComponent(idGraphics, idWidth);
1064 idGraphics.translate(0, -alignmentDrawnHeight);
1067 * draw the annotations starting at
1068 * (idOffset, alignmentHeight) from (0, scaleHeight)
1070 alignmentGraphics.translate(alignmentGraphicsOffset,
1071 alignmentDrawnHeight);
1072 getAnnotationPanel().renderer.drawComponent(getAnnotationPanel(), av,
1073 alignmentGraphics, -1, startRes, endRes + 1);
1076 return Printable.PAGE_EXISTS;
1080 * Prints one page of an alignment in wrapped mode. Returns
1081 * Printable.PAGE_EXISTS (0) if a page was drawn, or Printable.NO_SUCH_PAGE if
1082 * no page could be drawn (page number out of range).
1092 * @throws PrinterException
1094 public int printWrappedAlignment(int pageWidth, int pageHeight,
1095 int pageNumber, Graphics g) throws PrinterException
1097 getSeqPanel().seqCanvas.calculateWrappedGeometry();
1098 int annotationHeight = 0;
1099 if (av.isShowAnnotation())
1101 annotationHeight = getAnnotationPanel().adjustPanelHeight();
1104 int hgap = av.getCharHeight();
1105 if (av.getScaleAboveWrapped())
1107 hgap += av.getCharHeight();
1110 int cHeight = av.getAlignment().getHeight() * av.getCharHeight() + hgap
1113 int idWidth = getVisibleIdWidth(false);
1115 int maxwidth = av.getAlignment().getVisibleWidth();
1117 int resWidth = getSeqPanel().seqCanvas
1118 .getWrappedCanvasWidth(pageWidth - idWidth);
1119 av.getRanges().setViewportStartAndWidth(0, resWidth);
1121 int totalHeight = cHeight * (maxwidth / resWidth + 1);
1123 g.setColor(Color.white);
1124 g.fillRect(0, 0, pageWidth, pageHeight);
1125 g.setFont(av.getFont());
1126 g.setColor(Color.black);
1129 * method: print the whole wrapped alignment, but with a clip region that
1130 * is restricted to the requested page; this supports selective print of
1131 * single pages or ranges, (at the cost of repeated processing in the
1132 * 'normal' case, when all pages are printed)
1134 g.translate(0, -pageNumber * pageHeight);
1136 g.setClip(0, pageNumber * pageHeight, pageWidth, pageHeight);
1139 * draw sequence ids and annotation labels (if shown)
1141 IdCanvas idCanvas = getIdPanel().getIdCanvas();
1142 idCanvas.drawIdsWrapped((Graphics2D) g, av, 0, totalHeight);
1144 g.translate(idWidth, 0);
1146 getSeqPanel().seqCanvas.drawWrappedPanelForPrinting(g,
1147 pageWidth - idWidth, totalHeight, 0);
1149 if ((pageNumber * pageHeight) < totalHeight)
1151 return Printable.PAGE_EXISTS;
1155 return Printable.NO_SUCH_PAGE;
1160 * get current sequence ID panel width, or nominal value if panel were to be
1161 * displayed using default settings
1165 public int getVisibleIdWidth()
1167 return getVisibleIdWidth(true);
1171 * get current sequence ID panel width, or nominal value if panel were to be
1172 * displayed using default settings
1175 * indicate if the Id width for onscreen or offscreen display should
1179 protected int getVisibleIdWidth(boolean onscreen)
1181 // see if rendering offscreen - check preferences and calc width accordingly
1182 if (!onscreen && Cache.getDefault("FIGURE_AUTOIDWIDTH", false))
1184 return calculateIdWidth(-1).width;
1186 Integer idwidth = onscreen ? null
1187 : Cache.getIntegerProperty("FIGURE_FIXEDIDWIDTH");
1188 if (idwidth != null)
1190 return idwidth.intValue() + ID_WIDTH_PADDING;
1193 int w = getIdPanel().getWidth();
1194 return (w > 0 ? w : calculateIdWidth().width);
1198 * Builds an image of the alignment of the specified type (EPS/PNG/SVG) and
1199 * writes it to the specified file
1204 void makeAlignmentImage(ImageMaker.TYPE type, File file)
1206 final int borderBottomOffset = 5;
1208 AlignmentDimension aDimension = getAlignmentDimension();
1209 // todo use a lambda function in place of callback here?
1210 ImageWriterI writer = new ImageWriterI()
1213 public void exportImage(Graphics graphics) throws Exception
1215 if (av.getWrapAlignment())
1217 printWrappedAlignment(aDimension.getWidth(),
1218 aDimension.getHeight() + borderBottomOffset, 0, graphics);
1222 printUnwrapped(aDimension.getWidth(), aDimension.getHeight(), 0,
1223 graphics, graphics);
1228 String fileTitle = alignFrame.getTitle();
1229 ImageExporter exporter = new ImageExporter(writer, alignFrame, type,
1231 int imageWidth = aDimension.getWidth();
1232 int imageHeight = aDimension.getHeight() + borderBottomOffset;
1233 String of = MessageManager.getString("label.alignment");
1234 exporter.doExport(file, this, imageWidth, imageHeight, of);
1238 * Calculates and returns a suitable width and height (in pixels) for an
1243 public AlignmentDimension getAlignmentDimension()
1245 int maxwidth = av.getAlignment().getVisibleWidth();
1247 int height = ((av.getAlignment().getHeight() + 1) * av.getCharHeight())
1248 + getScalePanel().getHeight();
1249 int width = getVisibleIdWidth(false) + (maxwidth * av.getCharWidth());
1251 if (av.getWrapAlignment())
1253 height = getWrappedHeight();
1254 if (Jalview.isHeadlessMode())
1256 // need to obtain default alignment width and then add in any
1257 // additional allowance for id margin
1258 // this duplicates the calculation in getWrappedHeight but adjusts for
1260 width = alignFrame.getWidth() - vscroll.getPreferredSize().width
1261 - alignFrame.getInsets().left - alignFrame.getInsets().right
1262 - getVisibleIdWidth() + getVisibleIdWidth(false);
1266 width = getSeqPanel().getWidth() + getVisibleIdWidth(false);
1270 else if (av.isShowAnnotation())
1272 height += getAnnotationPanel().adjustPanelHeight() + 3;
1274 return new AlignmentDimension(width, height);
1278 public void makePNGImageMap(File imgMapFile, String imageName)
1280 // /////ONLY WORKS WITH NON WRAPPED ALIGNMENTS
1281 // ////////////////////////////////////////////
1282 int idWidth = getVisibleIdWidth(false);
1283 FontMetrics fm = getFontMetrics(av.getFont());
1284 int scaleHeight = av.getCharHeight() + fm.getDescent();
1287 // ////////////////////////////////
1288 if (imgMapFile != null)
1292 int sSize = av.getAlignment().getHeight();
1293 int alwidth = av.getAlignment().getWidth();
1294 PrintWriter out = new PrintWriter(new FileWriter(imgMapFile));
1295 out.println(HTMLOutput.getImageMapHTML());
1296 out.println("<img src=\"" + imageName
1297 + "\" border=\"0\" usemap=\"#Map\" >"
1298 + "<map name=\"Map\">");
1300 for (int s = 0; s < sSize; s++)
1302 int sy = s * av.getCharHeight() + scaleHeight;
1304 SequenceI seq = av.getAlignment().getSequenceAt(s);
1305 SequenceGroup[] groups = av.getAlignment().findAllGroups(seq);
1306 for (int column = 0; column < alwidth; column++)
1308 StringBuilder text = new StringBuilder(512);
1309 String triplet = null;
1310 if (av.getAlignment().isNucleotide())
1312 triplet = ResidueProperties.nucleotideName
1313 .get(seq.getCharAt(column) + "");
1317 triplet = ResidueProperties.aa2Triplet
1318 .get(seq.getCharAt(column) + "");
1321 if (triplet == null)
1326 int seqPos = seq.findPosition(column);
1327 int gSize = groups.length;
1328 for (int g = 0; g < gSize; g++)
1330 if (text.length() < 1)
1332 text.append("<area shape=\"rect\" coords=\"")
1333 .append((idWidth + column * av.getCharWidth()))
1334 .append(",").append(sy).append(",")
1336 + (column + 1) * av.getCharWidth()))
1337 .append(",").append((av.getCharHeight() + sy))
1338 .append("\"").append(" onMouseOver=\"toolTip('")
1339 .append(seqPos).append(" ").append(triplet);
1342 if (groups[g].getStartRes() < column
1343 && groups[g].getEndRes() > column)
1345 text.append("<br><em>").append(groups[g].getName())
1350 if (text.length() < 1)
1352 text.append("<area shape=\"rect\" coords=\"")
1353 .append((idWidth + column * av.getCharWidth()))
1354 .append(",").append(sy).append(",")
1355 .append((idWidth + (column + 1) * av.getCharWidth()))
1356 .append(",").append((av.getCharHeight() + sy))
1357 .append("\"").append(" onMouseOver=\"toolTip('")
1358 .append(seqPos).append(" ").append(triplet);
1360 if (!Comparison.isGap(seq.getCharAt(column)))
1362 List<SequenceFeature> features = seq.findFeatures(column,
1364 for (SequenceFeature sf : features)
1366 if (sf.isContactFeature())
1368 text.append("<br>").append(sf.getType()).append(" ")
1369 .append(sf.getBegin()).append(":")
1370 .append(sf.getEnd());
1374 text.append("<br>");
1375 text.append(sf.getType());
1376 String description = sf.getDescription();
1377 if (description != null
1378 && !sf.getType().equals(description))
1380 description = description.replace("\"", """);
1381 text.append(" ").append(description);
1384 String status = sf.getStatus();
1385 if (status != null && !"".equals(status))
1387 text.append(" (").append(status).append(")");
1390 if (text.length() > 1)
1392 text.append("')\"; onMouseOut=\"toolTip()\"; href=\"#\">");
1393 out.println(text.toString());
1398 out.println("</map></body></html>");
1401 } catch (Exception ex)
1403 ex.printStackTrace();
1405 } // /////////END OF IMAGE MAP
1410 * Answers the height of the entire alignment in pixels, assuming it is in
1415 int getWrappedHeight()
1417 int seqPanelWidth = getSeqPanel().seqCanvas.getWidth();
1419 if (System.getProperty("java.awt.headless") != null
1420 && System.getProperty("java.awt.headless").equals("true"))
1422 seqPanelWidth = alignFrame.getWidth() - getVisibleIdWidth()
1423 - vscroll.getPreferredSize().width
1424 - alignFrame.getInsets().left - alignFrame.getInsets().right;
1427 int chunkWidth = getSeqPanel().seqCanvas
1428 .getWrappedCanvasWidth(seqPanelWidth);
1430 int hgap = av.getCharHeight();
1431 if (av.getScaleAboveWrapped())
1433 hgap += av.getCharHeight();
1436 int annotationHeight = 0;
1437 if (av.isShowAnnotation())
1439 hgap += SeqCanvas.SEQS_ANNOTATION_GAP;
1440 annotationHeight = getAnnotationPanel().adjustPanelHeight();
1443 int cHeight = av.getAlignment().getHeight() * av.getCharHeight() + hgap
1446 int maxwidth = av.getAlignment().getWidth();
1447 if (av.hasHiddenColumns())
1449 maxwidth = av.getAlignment().getHiddenColumns()
1450 .absoluteToVisibleColumn(maxwidth) - 1;
1453 int height = ((maxwidth / chunkWidth) + 1) * cHeight;
1459 * close the panel - deregisters all listeners and nulls any references to
1462 public void closePanel()
1464 PaintRefresher.RemoveComponent(getSeqPanel().seqCanvas);
1465 PaintRefresher.RemoveComponent(getIdPanel().getIdCanvas());
1466 PaintRefresher.RemoveComponent(this);
1471 * try to ensure references are nulled
1473 if (annotationPanel != null)
1475 annotationPanel.dispose();
1476 annotationPanel = null;
1481 av.removePropertyChangeListener(propertyChangeListener);
1482 propertyChangeListener = null;
1483 StructureSelectionManager ssm = av.getStructureSelectionManager();
1484 ssm.removeStructureViewerListener(getSeqPanel(), null);
1485 ssm.removeSelectionListener(getSeqPanel());
1486 ssm.removeCommandListener(av);
1487 ssm.removeStructureViewerListener(getSeqPanel(), null);
1488 ssm.removeSelectionListener(getSeqPanel());
1494 if (Cache.log.isDebugEnabled())
1496 Cache.log.warn("Closing alignment panel which is already closed.");
1502 * Close any open dialogs that would be orphaned when this one is closed
1504 protected void closeChildFrames()
1506 if (overviewPanel != null)
1508 overviewPanel.dispose();
1509 overviewPanel = null;
1511 if (calculationDialog != null)
1513 calculationDialog.closeFrame();
1514 calculationDialog = null;
1519 * hides or shows dynamic annotation rows based on groups and av state flags
1521 public void updateAnnotation()
1523 updateAnnotation(false, false);
1526 public void updateAnnotation(boolean applyGlobalSettings)
1528 updateAnnotation(applyGlobalSettings, false);
1531 public void updateAnnotation(boolean applyGlobalSettings,
1532 boolean preserveNewGroupSettings)
1534 av.updateGroupAnnotationSettings(applyGlobalSettings,
1535 preserveNewGroupSettings);
1536 adjustAnnotationHeight();
1540 public AlignmentI getAlignment()
1542 return av == null ? null : av.getAlignment();
1546 public String getViewName()
1548 return av.getViewName();
1552 * Make/Unmake this alignment panel the current input focus
1556 public void setSelected(boolean b)
1560 if (alignFrame.getSplitViewContainer() != null)
1563 * bring enclosing SplitFrame to front first if there is one
1565 ((SplitFrame) alignFrame.getSplitViewContainer()).setSelected(b);
1567 alignFrame.setSelected(b);
1568 } catch (Exception ex)
1574 alignFrame.setDisplayedView(this);
1579 public StructureSelectionManager getStructureSelectionManager()
1581 return av.getStructureSelectionManager();
1585 public void raiseOOMWarning(String string, OutOfMemoryError error)
1587 new OOMWarning(string, error, this);
1591 public jalview.api.FeatureRenderer cloneFeatureRenderer()
1594 return new FeatureRenderer(this);
1598 public jalview.api.FeatureRenderer getFeatureRenderer()
1600 return seqPanel.seqCanvas.getFeatureRenderer();
1603 public void updateFeatureRenderer(
1604 jalview.renderer.seqfeatures.FeatureRenderer fr)
1606 fr.transferSettings(getSeqPanel().seqCanvas.getFeatureRenderer());
1609 public void updateFeatureRendererFrom(jalview.api.FeatureRenderer fr)
1611 if (getSeqPanel().seqCanvas.getFeatureRenderer() != null)
1613 getSeqPanel().seqCanvas.getFeatureRenderer().transferSettings(fr);
1617 public ScalePanel getScalePanel()
1622 public void setScalePanel(ScalePanel scalePanel)
1624 this.scalePanel = scalePanel;
1627 public SeqPanel getSeqPanel()
1632 public void setSeqPanel(SeqPanel seqPanel)
1634 this.seqPanel = seqPanel;
1637 public AnnotationPanel getAnnotationPanel()
1639 return annotationPanel;
1642 public void setAnnotationPanel(AnnotationPanel annotationPanel)
1644 this.annotationPanel = annotationPanel;
1647 public AnnotationLabels getAlabels()
1652 public void setAlabels(AnnotationLabels alabels)
1654 this.alabels = alabels;
1657 public IdPanel getIdPanel()
1662 public void setIdPanel(IdPanel idPanel)
1664 this.idPanel = idPanel;
1668 * Follow a scrolling change in the (cDNA/Protein) complementary alignment.
1669 * The aim is to keep the two alignments 'lined up' on their centre columns.
1672 * holds mapped region(s) of this alignment that we are scrolling
1673 * 'to'; may be modified for sequence offset by this method
1674 * @param verticalOffset
1675 * the number of visible sequences to show above the mapped region
1677 protected void scrollToCentre(SearchResultsI sr, int verticalOffset)
1679 scrollToPosition(sr, verticalOffset, true);
1683 * Set a flag to say do not scroll any (cDNA/protein) complement.
1687 protected void setToScrollComplementPanel(boolean b)
1689 this.scrollComplementaryPanel = b;
1693 * Get whether to scroll complement panel
1695 * @return true if cDNA/protein complement panels should be scrolled
1697 protected boolean isSetToScrollComplementPanel()
1699 return this.scrollComplementaryPanel;
1705 * @adjustHeight if true, try to recalculate panel height for visible
1708 protected void refresh(boolean adjustHeight)
1710 validateAnnotationDimensions(adjustHeight);
1714 // sort, repaint, update overview
1715 paintAlignment(true, false);
1719 // lightweight repaint
1726 * Property change event fired when a change is made to the viewport ranges
1727 * object associated with this alignment panel's viewport
1729 public void propertyChange(PropertyChangeEvent evt)
1731 // update this panel's scroll values based on the new viewport ranges values
1732 updateScrollBarsFromRanges();
1734 // now update any complementary alignment (its viewport ranges object
1735 // is different so does not get automatically updated)
1736 if (isSetToScrollComplementPanel())
1738 setToScrollComplementPanel(false);
1739 av.scrollComplementaryAlignment();
1740 setToScrollComplementPanel(true);
1744 void updateScrollBarsFromRanges()
1746 ViewportRanges ranges = av.getRanges();
1747 setScrollValues(ranges.getStartRes(), ranges.getStartSeq());
1751 * Set the reference to the PCA/Tree chooser dialog for this panel. This
1752 * reference should be nulled when the dialog is closed.
1754 * @param calculationChooser
1756 public void setCalculationDialog(CalculationChooser calculationChooser)
1758 calculationDialog = calculationChooser;
1762 * Returns the reference to the PCA/Tree chooser dialog for this panel (null
1765 public CalculationChooser getCalculationDialog()
1767 return calculationDialog;
1771 * From appletgui, for JalviewJS JavaScript interface
1773 * preliminary - untested
1778 * @param scrollToNearest
1779 * @param redrawOverview
1782 public boolean scrollTo(int ostart, int end, int seqIndex,
1783 boolean scrollToNearest, boolean redrawOverview)
1785 int startv, endv, starts, ends;// , width;
1788 if (av.hasHiddenColumns())
1790 AlignmentI al = av.getAlignment();
1791 start = al.getHiddenColumns().absoluteToVisibleColumn(ostart);
1792 end = al.getHiddenColumns().absoluteToVisibleColumn(end);
1795 if (!scrollToNearest && !al.getHiddenColumns().isVisible(ostart))
1797 // don't scroll - position isn't visible
1807 ViewportRanges ranges = av.getRanges();
1808 if (!av.getWrapAlignment())
1811 * int spos=av.getStartRes(),sqpos=av.getStartSeq(); if ((startv =
1812 * av.getStartRes()) >= start) { spos=start-1; // seqIn //
1813 * setScrollValues(start - 1, seqIndex); } else if ((endv =
1814 * av.getEndRes()) <= end) { // setScrollValues(spos=startv + 1 + end -
1815 * endv, seqIndex); spos=startv + 1 + end - endv; } else if ((starts =
1816 * av.getStartSeq()) > seqIndex) { setScrollValues(av.getStartRes(),
1817 * seqIndex); } else if ((ends = av.getEndSeq()) <= seqIndex) {
1818 * setScrollValues(av.getStartRes(), starts + seqIndex - ends + 1); }
1821 // below is scrolling logic up to Jalview 2.8.2
1822 // if ((av.getStartRes() > end)
1823 // || (av.getEndRes() < start)
1824 // || ((av.getStartSeq() > seqIndex) || (av.getEndSeq() < seqIndex)))
1826 // if (start > av.getAlignment().getWidth() - hextent)
1828 // start = av.getAlignment().getWidth() - hextent;
1835 // if (seqIndex > av.getAlignment().getHeight() - vextent)
1837 // seqIndex = av.getAlignment().getHeight() - vextent;
1838 // if (seqIndex < 0)
1843 // setScrollValues(start, seqIndex);
1845 // logic copied from jalview.gui.AlignmentPanel:
1846 if ((startv = ranges.getStartRes()) >= start)
1849 * Scroll left to make start of search results visible
1851 setScrollValues(start - 1, seqIndex);
1853 else if ((endv = ranges.getEndRes()) <= end)
1856 * Scroll right to make end of search results visible
1858 setScrollValues(startv + 1 + end - endv, seqIndex);
1860 else if ((starts = ranges.getStartSeq()) > seqIndex)
1863 * Scroll up to make start of search results visible
1865 setScrollValues(ranges.getStartRes(), seqIndex);
1867 else if ((ends = ranges.getEndSeq()) <= seqIndex)
1870 * Scroll down to make end of search results visible
1872 setScrollValues(ranges.getStartRes(), starts + seqIndex - ends + 1);
1875 * Else results are already visible - no need to scroll
1880 ranges.scrollToWrappedVisible(start);
1883 paintAlignment(redrawOverview, false);
1887 private boolean holdRepaint = false;
1890 * Called by IdCanvas and SeqPanel to defer painting until after JVP loading.
1892 * @return true if holding
1894 public boolean getHoldRepaint()
1900 * Called by Jalview2xml while loading
1904 public void setHoldRepaint(boolean tf)
1906 if (holdRepaint == tf)
1918 public void repaint()
1922 // System.out.println("AP repaint holding");
1923 // Platform.stackTrace();
1929 public void selectAllSequences()
1931 selectSequences(av.getAlignment().getSequences());
1934 public void deselectAllSequences()
1938 getSeqPanel().keyboardNo1 = null;
1939 getSeqPanel().keyboardNo2 = null;
1941 av.setSelectionGroup(null);
1942 av.getColumnSelection().clear();
1943 av.setSelectionGroup(null);
1944 getIdPanel().getIdCanvas().searchResults = null;
1946 // JAL-2034 - should delegate to
1947 // alignPanel to decide if overview needs
1949 paintAlignment(false, false);
1950 PaintRefresher.Refresh(this, av.getSequenceSetId());
1953 public void selectSequences(List<SequenceI> seqs)
1955 SequenceGroup sg = new SequenceGroup(seqs);
1956 sg.setEndRes(av.getAlignment().getWidth() - 1);
1957 av.setSelectionGroup(sg);
1958 av.isSelectionGroupChanged(true);
1960 // JAL-2034 - should delegate to
1961 // alignPanel to decide if overview needs
1963 paintAlignment(false, false);
1964 PaintRefresher.Refresh(this, av.getSequenceSetId());