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 jalview.analysis.AnnotationSorter;
24 import jalview.api.AlignViewportI;
25 import jalview.api.AlignmentViewPanel;
26 import jalview.bin.Cache;
27 import jalview.bin.Console;
28 import jalview.bin.Jalview;
29 import jalview.datamodel.AlignmentI;
30 import jalview.datamodel.HiddenColumns;
31 import jalview.datamodel.SearchResultsI;
32 import jalview.datamodel.SequenceFeature;
33 import jalview.datamodel.SequenceGroup;
34 import jalview.datamodel.SequenceI;
35 import jalview.gui.ImageExporter.ImageWriterI;
36 import jalview.io.HTMLOutput;
37 import jalview.jbgui.GAlignmentPanel;
38 import jalview.math.AlignmentDimension;
39 import jalview.schemes.ResidueProperties;
40 import jalview.structure.StructureSelectionManager;
41 import jalview.util.Comparison;
42 import jalview.util.ImageMaker;
43 import jalview.util.MessageManager;
44 import jalview.viewmodel.AlignmentViewport;
45 import jalview.viewmodel.ViewportListenerI;
46 import jalview.viewmodel.ViewportRanges;
48 import java.awt.BorderLayout;
49 import java.awt.Color;
50 import java.awt.Container;
51 import java.awt.Dimension;
53 import java.awt.FontMetrics;
54 import java.awt.Graphics;
55 import java.awt.Graphics2D;
56 import java.awt.event.AdjustmentEvent;
57 import java.awt.event.AdjustmentListener;
58 import java.awt.event.ComponentAdapter;
59 import java.awt.event.ComponentEvent;
60 import java.awt.print.PageFormat;
61 import java.awt.print.Printable;
62 import java.awt.print.PrinterException;
63 import java.beans.PropertyChangeEvent;
64 import java.beans.PropertyChangeListener;
66 import java.io.FileWriter;
67 import java.io.PrintWriter;
68 import java.util.List;
70 import javax.swing.SwingUtilities;
76 * @version $Revision: 1.161 $
78 @SuppressWarnings("serial")
79 public class AlignmentPanel extends GAlignmentPanel implements
80 AdjustmentListener, Printable, AlignmentViewPanel, ViewportListenerI
83 * spare space in pixels between sequence id and alignment panel
85 private static final int ID_WIDTH_PADDING = 4;
87 public AlignViewport av;
89 OverviewPanel overviewPanel;
91 private SeqPanel seqPanel;
93 private IdPanel idPanel;
95 IdwidthAdjuster idwidthAdjuster;
97 public AlignFrame alignFrame;
99 private ScalePanel scalePanel;
101 private AnnotationPanel annotationPanel;
103 private AnnotationLabels alabels;
105 private int hextent = 0;
107 private int vextent = 0;
110 * Flag set while scrolling to follow complementary cDNA/protein scroll. When
111 * false, suppresses invoking the same method recursively.
113 private boolean scrollComplementaryPanel = true;
115 private PropertyChangeListener propertyChangeListener;
117 private CalculationChooser calculationDialog;
120 * Creates a new AlignmentPanel object.
125 public AlignmentPanel(AlignFrame af, final AlignViewport av)
127 setName("AligmentPanel");
128 // setBackground(Color.white); // BH 2019
131 av.setAlignPanel(this);
132 setSeqPanel(new SeqPanel(av, this));
133 setIdPanel(new IdPanel(av, this));
135 setScalePanel(new ScalePanel(av, this));
137 idPanelHolder.add(getIdPanel(), BorderLayout.CENTER);
138 idwidthAdjuster = new IdwidthAdjuster(this);
139 idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER);
141 setAnnotationPanel(new AnnotationPanel(this));
142 setAlabels(new AnnotationLabels(this));
144 annotationScroller.setViewportView(getAnnotationPanel());
145 annotationSpaceFillerHolder.add(getAlabels(), BorderLayout.CENTER);
147 scalePanelHolder.add(getScalePanel(), BorderLayout.CENTER);
148 seqPanelHolder.add(getSeqPanel(), BorderLayout.CENTER);
150 setScrollValues(0, 0);
152 hscroll.addAdjustmentListener(this);
153 vscroll.addAdjustmentListener(this);
155 addComponentListener(new ComponentAdapter()
158 public void componentResized(ComponentEvent evt)
160 // reset the viewport ranges when the alignment panel is resized
161 // in particular, this initialises the end residue value when Jalview
163 ViewportRanges ranges = av.getRanges();
164 if (av.getWrapAlignment())
166 int widthInRes = getSeqPanel().seqCanvas.getWrappedCanvasWidth(
167 getSeqPanel().seqCanvas.getWidth());
168 ranges.setViewportWidth(widthInRes);
172 int widthInRes = getSeqPanel().seqCanvas.getWidth()
174 int heightInSeq = getSeqPanel().seqCanvas.getHeight()
175 / av.getCharHeight();
177 ranges.setViewportWidth(widthInRes);
178 ranges.setViewportHeight(heightInSeq);
185 final AlignmentPanel ap = this;
186 propertyChangeListener = new PropertyChangeListener()
189 public void propertyChange(PropertyChangeEvent evt)
191 switch (evt.getPropertyName()) {
192 case AlignmentViewport.PROPERTY_SEQUENCE:
193 updateScrollBarsFromRanges();
194 if (annotationPanel != null)
195 annotationPanel.paintImmediately(0, 0, getWidth(), getHeight());
197 case AlignmentViewport.PROPERTY_ALIGNMENT:
198 updateScrollBarsFromRanges();
199 PaintRefresher.Refresh(ap, av.getSequenceSetId(), true, true);
205 av.addPropertyChangeListener(propertyChangeListener);
207 av.getRanges().addPropertyChangeListener(this);
209 adjustAnnotationHeight();
214 public AlignViewportI getAlignViewport()
219 public void alignmentChanged()
221 av.alignmentChanged(this);
223 if (getCalculationDialog() != null)
225 getCalculationDialog().validateCalcTypes();
228 alignFrame.updateEditMenuBar();
230 // no idea if we need to update structure
231 paintAlignment(true, true);
238 public void fontChanged()
240 // set idCanvas bufferedImage to null
241 // to prevent drawing old image
242 FontMetrics fm = getFontMetrics(av.getFont());
244 scalePanelHolder.setPreferredSize(
245 new Dimension(10, av.getCharHeight() + fm.getDescent()));
246 idSpaceFillerPanel1.setPreferredSize(
247 new Dimension(10, av.getCharHeight() + fm.getDescent()));
248 idwidthAdjuster.invalidate();
249 scalePanelHolder.invalidate();
250 // BH 2018 getIdPanel().getIdCanvas().gg = null;
251 getSeqPanel().seqCanvas.img = null;
252 getAnnotationPanel().adjustPanelHeight();
254 Dimension d = calculateIdWidth();
255 getIdPanel().getIdCanvas().setPreferredSize(d);
256 hscrollFillerPanel.setPreferredSize(d);
262 * Calculates the width of the alignment labels based on the displayed names
263 * and any bounds on label width set in preferences. The calculated width is
264 * also set as a property of the viewport.
266 * @return Dimension giving the maximum width of the alignment label panel
267 * that should be used.
269 public Dimension calculateIdWidth()
271 int oldWidth = av.getIdWidth();
273 // calculate sensible default width when no preference is available
275 if (av.getIdWidth() < 0)
277 int maxWidth = getMaxWidth();
278 d = calculateIdWidth(maxWidth);
279 av.setIdWidth(d.width);
284 d.width = av.getIdWidth();
289 * fudge: if desired width has changed, update layout
290 * (see also paintComponent - updates layout on a repaint)
292 if (d.width != oldWidth)
294 idPanelHolder.setPreferredSize(d);
300 public int getMaxWidth()
302 int afwidth = (alignFrame != null ? alignFrame.getWidth() : 300);
303 int idWidth = Math.min(afwidth - 200, 2 * afwidth / 3);
304 return Math.max(IdwidthAdjuster.MIN_ID_WIDTH, idWidth);
308 * Calculate the width of the alignment labels based on the displayed names
309 * and any bounds on label width set in preferences.
312 * -1 or maximum width allowed for IdWidth
313 * @return Dimension giving the maximum width of the alignment label panel
314 * that should be used.
316 public Dimension calculateIdWidth(int maxwidth)
318 Container c = this;// new Container();
320 FontMetrics fm = c.getFontMetrics(
321 new Font(av.font.getName(), Font.ITALIC, av.font.getSize()));
323 AlignmentI al = av.getAlignment();
327 boolean withSuffix = av.getShowJVSuffix();
328 while ((i < al.getHeight()) && (al.getSequenceAt(i) != null))
330 SequenceI s = al.getSequenceAt(i);
331 String id = s.getDisplayId(withSuffix);
332 int stringWidth = fm.stringWidth(id);
333 idWidth = Math.max(idWidth, stringWidth);
337 // Also check annotation label widths
340 if (al.getAlignmentAnnotation() != null)
342 fm = c.getFontMetrics(getAlabels().getFont());
344 while (i < al.getAlignmentAnnotation().length)
346 String label = al.getAlignmentAnnotation()[i].label;
347 int stringWidth = fm.stringWidth(label);
348 idWidth = Math.max(idWidth, stringWidth);
353 int w = maxwidth < 0 ? idWidth : Math.min(maxwidth, idWidth);
354 w += ID_WIDTH_PADDING;
356 return new Dimension(w, 12);
360 * Highlight the given results on the alignment
363 public void highlightSearchResults(SearchResultsI results)
365 boolean scrolled = scrollToPosition(results, 0, false);
367 boolean fastPaint = !(scrolled && av.getWrapAlignment());
369 getSeqPanel().seqCanvas.highlightSearchResults(results, fastPaint);
373 * Scroll the view to show the position of the highlighted region in results
376 * @param searchResults
379 public boolean scrollToPosition(SearchResultsI searchResults)
381 return scrollToPosition(searchResults, 0, false);
385 * Scrolls the view (if necessary) to show the position of the first
386 * highlighted region in results (if any). Answers true if the view was
387 * scrolled, or false if no matched region was found, or it is already
391 * @param verticalOffset
392 * if greater than zero, allows scrolling to a position below the
393 * first displayed sequence
395 * if true, try to centre the search results horizontally in the view
398 protected boolean scrollToPosition(SearchResultsI results,
399 int verticalOffset, boolean centre)
401 int startv, endv, starts, ends;
402 ViewportRanges ranges = av.getRanges();
404 if (results == null || results.isEmpty() || av == null
405 || av.getAlignment() == null)
409 int seqIndex = av.getAlignment().findIndex(results);
414 SequenceI seq = av.getAlignment().getSequenceAt(seqIndex);
416 int[] r = results.getResults(seq, 0, av.getAlignment().getWidth());
425 * To centre results, scroll to positions half the visible width
426 * left/right of the start/end positions
430 int offset = (ranges.getEndRes() - ranges.getStartRes() + 1) / 2 - 1;
431 start = Math.max(start - offset, 0);
432 end = end + offset - 1;
438 if (end == seq.getEnd())
443 if (av.hasHiddenColumns())
445 HiddenColumns hidden = av.getAlignment().getHiddenColumns();
446 start = hidden.absoluteToVisibleColumn(start);
447 end = hidden.absoluteToVisibleColumn(end);
450 if (!hidden.isVisible(r[0]))
452 // don't scroll - position isn't visible
459 * allow for offset of target sequence (actually scroll to one above it)
461 seqIndex = Math.max(0, seqIndex - verticalOffset);
462 boolean scrollNeeded = true;
464 if (!av.getWrapAlignment())
466 if ((startv = ranges.getStartRes()) >= start)
469 * Scroll left to make start of search results visible
471 setScrollValues(start, seqIndex);
473 else if ((endv = ranges.getEndRes()) <= end)
476 * Scroll right to make end of search results visible
478 setScrollValues(startv + end - endv, seqIndex);
480 else if ((starts = ranges.getStartSeq()) > seqIndex)
483 * Scroll up to make start of search results visible
485 setScrollValues(ranges.getStartRes(), seqIndex);
487 else if ((ends = ranges.getEndSeq()) <= seqIndex)
490 * Scroll down to make end of search results visible
492 setScrollValues(ranges.getStartRes(), starts + seqIndex - ends + 1);
495 * Else results are already visible - no need to scroll
497 scrollNeeded = false;
501 scrollNeeded = ranges.scrollToWrappedVisible(start);
504 paintAlignment(false, false);
512 * @return DOCUMENT ME!
514 public OverviewPanel getOverviewPanel()
516 return overviewPanel;
525 public void setOverviewPanel(OverviewPanel op)
533 * Hide or show annotation panel
536 public void setAnnotationVisible(boolean b)
538 if (!av.getWrapAlignment())
540 annotationSpaceFillerHolder.setVisible(b);
541 annotationScroller.setVisible(b);
547 * automatically adjust annotation panel height for new annotation whilst
548 * ensuring the alignment is still visible.
551 public void adjustAnnotationHeight()
553 // TODO: display vertical annotation scrollbar if necessary
554 // this is called after loading new annotation onto alignment
555 if (alignFrame.getHeight() == 0)
557 System.out.println("NEEDS FIXING");
559 validateAnnotationDimensions(true);
561 // TODO: many places call this method and also paintAlignment with various
562 // different settings. this means multiple redraws are triggered...
563 paintAlignment(true, av.needToUpdateStructureViews());
567 * calculate the annotation dimensions and refresh slider values accordingly.
568 * need to do repaints/notifys afterwards.
570 protected void validateAnnotationDimensions(boolean adjustPanelHeight)
572 // BH 2018.04.18 comment: addNotify() is not appropriate here. We
573 // are not changing ancestors, and keyboard action listeners do
574 // not need to be reset, and most importantly, we can't be sure we are actually
575 // connected to resources.
577 // addNotify() is a very expensive operation,
578 // requiring a full re-layout of all parents and children.
580 // Note in JComponent:
582 // This method is called by the toolkit internally and should
583 // not be called directly by programs.
585 // I note that addNotify() is called in several areas of Jalview.
587 int annotationHeight = getAnnotationPanel().adjustPanelHeight();
588 annotationHeight = getAnnotationPanel()
589 .adjustForAlignFrame(adjustPanelHeight, annotationHeight);
593 annotationScroller.setPreferredSize(
594 new Dimension(annotationScroller.getWidth(), annotationHeight));
596 Dimension e = idPanel.getSize();
597 alabels.setSize(new Dimension(e.width, annotationHeight));
600 annotationSpaceFillerHolder.setPreferredSize(new Dimension(
601 annotationSpaceFillerHolder.getWidth(), annotationHeight));
602 annotationScroller.validate();
603 annotationScroller.addNotify();
607 * update alignment layout for viewport settings
609 public void updateLayout()
611 ViewportRanges ranges = av.getRanges();
613 setAnnotationVisible(av.isShowAnnotation());
614 boolean wrap = av.getWrapAlignment();
615 ranges.setStartSeq(0);
616 scalePanelHolder.setVisible(!wrap);
617 hscroll.setVisible(!wrap);
618 idwidthAdjuster.setVisible(!wrap);
622 annotationScroller.setVisible(false);
623 annotationSpaceFillerHolder.setVisible(false);
625 else if (av.isShowAnnotation())
627 annotationScroller.setVisible(true);
628 annotationSpaceFillerHolder.setVisible(true);
631 idSpaceFillerPanel1.setVisible(!wrap);
634 * defer dimension calculations if panel not yet added to a Window
637 if (getTopLevelAncestor() == null)
643 if (!wrap && av.isShowAnnotation())
645 validateAnnotationDimensions(false);
648 int canvasWidth = getSeqPanel().seqCanvas.getWidth();
650 { // may not yet be laid out
653 int widthInRes = getSeqPanel().seqCanvas
654 .getWrappedCanvasWidth(canvasWidth);
655 ranges.setViewportWidth(widthInRes);
659 int widthInRes = (canvasWidth / av.getCharWidth());
660 int heightInSeq = (getSeqPanel().seqCanvas.getHeight()
661 / av.getCharHeight());
663 ranges.setViewportWidth(widthInRes);
664 ranges.setViewportHeight(heightInSeq);
668 // System.out.println("ap dim = " + getSize());
669 // these values will go negative if getSize() returns (0,0):
670 // System.out.println("seqpan dim = " + getSeqPanel().getSize());
671 // System.out.println("seqcan dim = " + getSeqPanel().seqCanvas.getSize());
677 * Adjust row/column scrollers to show a visible position in the alignment.
680 * visible column to scroll to
682 * visible row to scroll to
685 public void setScrollValues(int x, int y)
688 if (av == null || av.getAlignment() == null)
693 if (av.getWrapAlignment())
695 setScrollingForWrappedPanel(x);
699 int width = av.getAlignment().getVisibleWidth();
700 int height = av.getAlignment().getHeight();
703 hextent = Math.min(getSeqPanel().seqCanvas.getWidth() / av.getCharWidth(), width);
704 vextent = Math.min(getSeqPanel().seqCanvas.getHeight() / av.getCharHeight(), height);
706 x = Math.max(0, Math.min(x, width - hextent));
707 y = Math.max(0, Math.min(y, height - vextent));
710 updateScrollBars(x, y, width, height);
714 private void updateScrollBars(int x, int y, int width, int height)
716 hscroll.setValues(x, hextent, 0, width);
717 vscroll.setValues(y, vextent, 0, height);
720 * Respond to adjustment event when horizontal or vertical scrollbar is
724 * adjustment event encoding whether hscroll or vscroll changed
727 public void adjustmentValueChanged(AdjustmentEvent evt)
729 if (av.getWrapAlignment())
731 adjustScrollingWrapped(evt);
736 if (evt.getSource() == hscroll)
738 if (!updateRanges(hscroll.getValue(), Integer.MIN_VALUE))
741 else if (evt.getSource() == vscroll)
743 if (!updateRanges(Integer.MIN_VALUE, vscroll.getValue()))
749 private boolean updateRanges(int x, int y)
751 ViewportRanges ranges = av.getRanges();
752 boolean isChanged = false;
753 if (x != Integer.MIN_VALUE)
755 int oldX = ranges.getStartRes();
756 int oldwidth = ranges.getViewportWidth();
757 int width = getSeqPanel().seqCanvas.getWidth() / av.getCharWidth();
759 // if we're scrolling to the position we're already at, stop
760 // this prevents infinite recursion of events when the scroll/viewport
761 // ranges values are the same
762 if (width > 0 && (x != oldX || width != oldwidth))
764 ranges.setViewportStartAndWidth(x, width);
768 if (y != Integer.MIN_VALUE)
770 int oldY = ranges.getStartSeq();
771 int oldheight = ranges.getViewportHeight();
772 int height = getSeqPanel().seqCanvas.getHeight() / av.getCharHeight();
774 // if we're scrolling to the position we're already at, stop
775 // this prevents infinite recursion of events when the scroll/viewport
776 // ranges values are the same
777 if (height > 0 && (y != oldY || height != oldheight))
779 ranges.setViewportStartAndHeight(y, height);
787 * Responds to a scroll change by setting the start position of the viewport.
792 protected void adjustScrollingWrapped(AdjustmentEvent evt)
794 if (evt.getSource() == hscroll)
796 return; // no horizontal scroll when wrapped
798 final ViewportRanges ranges = av.getRanges();
800 if (evt.getSource() == vscroll)
802 int newY = vscroll.getValue();
805 * if we're scrolling to the position we're already at, stop
806 * this prevents infinite recursion of events when the scroll/viewport
807 * ranges values are the same
809 int oldX = ranges.getStartRes();
810 int oldY = ranges.getWrappedScrollPosition(oldX);
818 * limit page up/down to one width's worth of positions
820 int rowSize = ranges.getViewportWidth();
821 int newX = newY > oldY ? oldX + rowSize : oldX - rowSize;
822 ranges.setViewportStartAndWidth(Math.max(0, newX), rowSize);
827 // This is only called if file loaded is a jar file that
828 // was wrapped when saved and user has wrap alignment true
829 // as preference setting
830 SwingUtilities.invokeLater(new Runnable()
835 // When updating scrolling to use ViewportChange events, this code
836 // could not be validated and it is not clear if it is now being
837 // called. Log warning here in case it is called and unforeseen
840 "Unexpected path through code: Wrapped jar file opened with wrap alignment set in preferences");
842 // scroll to start of panel
843 ranges.setStartRes(0);
844 ranges.setStartSeq(0);
852 * @see jalview.api.AlignmentViewPanel#paintAlignment(boolean)
855 public void paintAlignment(boolean updateOverview,
856 boolean updateStructures)
858 final AnnotationSorter sorter = new AnnotationSorter(getAlignment(),
859 av.isShowAutocalculatedAbove());
860 sorter.sort(getAlignment().getAlignmentAnnotation(),
861 av.getSortAnnotationsBy());
863 if (updateStructures)
865 av.getStructureSelectionManager().sequenceColoursChanged(this);
870 alignFrame.repaint();
871 if (overviewPanel != null)
873 overviewPanel.updateOverviewImage();
876 invalidate(); // needed so that the id width adjuster works correctly
882 public void paintComponent(Graphics g)
885 invalidate(); // needed so that the id width adjuster works correctly
887 Dimension d = getIdPanel().getIdCanvas().getPreferredSize();
888 idPanelHolder.setPreferredSize(d);
889 hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12));
891 validate(); // needed so that the id width adjuster works correctly
894 * set scroll bar positions - tried to remove but necessary for split panel to resize correctly
895 * though I still think this call should be elsewhere.
897 ViewportRanges ranges = av.getRanges();
898 // setScrollValues(ranges.getStartRes(), ranges.getStartSeq());
899 super.paintComponent(g);
903 * Set vertical scroll bar position, and number of increments, for wrapped
906 * @param topLeftColumn
907 * the column position at top left (0..)
909 private void setScrollingForWrappedPanel(int topLeftColumn)
911 ViewportRanges ranges = av.getRanges();
912 int scrollPosition = ranges.getWrappedScrollPosition(topLeftColumn);
913 int maxScroll = ranges.getWrappedMaxScroll(topLeftColumn);
916 * a scrollbar's value can be set to at most (maximum-extent)
917 * so we add extent (1) to the maxScroll value
919 vscroll.setUnitIncrement(1);
920 vscroll.setValues(scrollPosition, 1, 0, maxScroll + 1);
933 * @return DOCUMENT ME!
935 * @throws PrinterException
939 public int print(Graphics pg, PageFormat pf, int pi)
940 throws PrinterException
942 pg.translate((int) pf.getImageableX(), (int) pf.getImageableY());
944 int pwidth = (int) pf.getImageableWidth();
945 int pheight = (int) pf.getImageableHeight();
947 if (av.getWrapAlignment())
949 return printWrappedAlignment(pwidth, pheight, pi, pg);
953 return printUnwrapped(pwidth, pheight, pi, pg, pg);
958 * Draws the alignment image, including sequence ids, sequences, and
959 * annotation labels and annotations if shown, on either one or two Graphics
969 * the graphics context for sequence ids and annotation labels
970 * @param alignmentGraphics
971 * the graphics context for sequences and annotations (may or may not
972 * be the same context as idGraphics)
974 * @throws PrinterException
976 public int printUnwrapped(int pageWidth, int pageHeight, int pageIndex,
977 Graphics idGraphics, Graphics alignmentGraphics)
978 throws PrinterException
980 final int idWidth = getVisibleIdWidth(false);
983 * Get the horizontal offset to where we draw the sequences.
984 * This is idWidth if using a single Graphics context, else zero.
986 final int alignmentGraphicsOffset = idGraphics != alignmentGraphics ? 0
989 FontMetrics fm = getFontMetrics(av.getFont());
990 final int charHeight = av.getCharHeight();
991 final int scaleHeight = charHeight + fm.getDescent();
993 idGraphics.setColor(Color.white);
994 idGraphics.fillRect(0, 0, pageWidth, pageHeight);
995 idGraphics.setFont(av.getFont());
998 * How many sequences and residues can we fit on a printable page?
1000 final int totalRes = (pageWidth - idWidth) / av.getCharWidth();
1002 final int totalSeq = (pageHeight - scaleHeight) / charHeight - 1;
1004 final int alignmentWidth = av.getAlignment().getVisibleWidth();
1005 int pagesWide = (alignmentWidth / totalRes) + 1;
1007 final int startRes = (pageIndex % pagesWide) * totalRes;
1008 final int endRes = Math.min(startRes + totalRes - 1,
1009 alignmentWidth - 1);
1011 final int startSeq = (pageIndex / pagesWide) * totalSeq;
1012 final int alignmentHeight = av.getAlignment().getHeight();
1013 final int endSeq = Math.min(startSeq + totalSeq, alignmentHeight);
1015 int pagesHigh = ((alignmentHeight / totalSeq) + 1) * pageHeight;
1017 if (av.isShowAnnotation())
1019 pagesHigh += getAnnotationPanel().adjustPanelHeight() + 3;
1022 pagesHigh /= pageHeight;
1024 if (pageIndex >= (pagesWide * pagesHigh))
1026 return Printable.NO_SUCH_PAGE;
1028 final int alignmentDrawnHeight = (endSeq - startSeq) * charHeight + 3;
1031 * draw the Scale at horizontal offset, then reset to top left (0, 0)
1033 alignmentGraphics.translate(alignmentGraphicsOffset, 0);
1034 getScalePanel().drawScale(alignmentGraphics, startRes, endRes,
1035 pageWidth - idWidth, scaleHeight);
1036 alignmentGraphics.translate(-alignmentGraphicsOffset, 0);
1039 * Draw the sequence ids, offset for scale height,
1040 * then reset to top left (0, 0)
1042 idGraphics.translate(0, scaleHeight);
1043 IdCanvas idCanvas = getIdPanel().getIdCanvas();
1044 List<SequenceI> selection = av.getSelectionGroup() == null ? null
1045 : av.getSelectionGroup().getSequences(null);
1046 idCanvas.drawIds((Graphics2D) idGraphics, av, startSeq, endSeq - 1,
1049 idGraphics.setFont(av.getFont());
1050 idGraphics.translate(0, -scaleHeight);
1053 * draw the sequences, offset for scale height, and id width (if using a
1054 * single graphics context), then reset to (0, scale height)
1056 alignmentGraphics.translate(alignmentGraphicsOffset, scaleHeight);
1057 getSeqPanel().seqCanvas.drawPanelForPrinting(alignmentGraphics,
1058 startRes, endRes, startSeq, endSeq - 1);
1059 alignmentGraphics.translate(-alignmentGraphicsOffset, 0);
1061 if (av.isShowAnnotation() && (endSeq == alignmentHeight))
1064 * draw annotation labels; drawComponent() translates by
1065 * getScrollOffset(), so compensate for that first;
1066 * then reset to (0, scale height)
1068 int offset = getAlabels().getScrollOffset();
1069 idGraphics.translate(0, -offset);
1070 idGraphics.translate(0, alignmentDrawnHeight);
1071 getAlabels().drawComponent(idGraphics, idWidth);
1072 idGraphics.translate(0, -alignmentDrawnHeight);
1075 * draw the annotations starting at
1076 * (idOffset, alignmentHeight) from (0, scaleHeight)
1078 alignmentGraphics.translate(alignmentGraphicsOffset,
1079 alignmentDrawnHeight);
1080 getAnnotationPanel().renderer.drawComponent(getAnnotationPanel(), av,
1081 alignmentGraphics, -1, startRes, endRes + 1);
1084 return Printable.PAGE_EXISTS;
1088 * Prints one page of an alignment in wrapped mode. Returns
1089 * Printable.PAGE_EXISTS (0) if a page was drawn, or Printable.NO_SUCH_PAGE if
1090 * no page could be drawn (page number out of range).
1100 * @throws PrinterException
1102 public int printWrappedAlignment(int pageWidth, int pageHeight,
1103 int pageNumber, Graphics g) throws PrinterException
1105 getSeqPanel().seqCanvas.calculateWrappedGeometry();
1106 int annotationHeight = 0;
1107 if (av.isShowAnnotation())
1109 annotationHeight = getAnnotationPanel().adjustPanelHeight();
1112 int hgap = av.getCharHeight();
1113 if (av.getScaleAboveWrapped())
1115 hgap += av.getCharHeight();
1118 int cHeight = av.getAlignment().getHeight() * av.getCharHeight() + hgap
1121 int idWidth = getVisibleIdWidth(false);
1123 int maxwidth = av.getAlignment().getVisibleWidth();
1125 int resWidth = getSeqPanel().seqCanvas
1126 .getWrappedCanvasWidth(pageWidth - idWidth);
1127 av.getRanges().setViewportStartAndWidth(0, resWidth);
1129 int totalHeight = cHeight * (maxwidth / resWidth + 1);
1131 g.setColor(Color.white);
1132 g.fillRect(0, 0, pageWidth, pageHeight);
1133 g.setFont(av.getFont());
1134 g.setColor(Color.black);
1137 * method: print the whole wrapped alignment, but with a clip region that
1138 * is restricted to the requested page; this supports selective print of
1139 * single pages or ranges, (at the cost of repeated processing in the
1140 * 'normal' case, when all pages are printed)
1142 g.translate(0, -pageNumber * pageHeight);
1144 g.setClip(0, pageNumber * pageHeight, pageWidth, pageHeight);
1147 * draw sequence ids and annotation labels (if shown)
1149 IdCanvas idCanvas = getIdPanel().getIdCanvas();
1150 idCanvas.drawIdsWrapped((Graphics2D) g, av, 0, totalHeight);
1152 g.translate(idWidth, 0);
1154 getSeqPanel().seqCanvas.drawWrappedPanelForPrinting(g,
1155 pageWidth - idWidth, totalHeight, 0);
1157 if ((pageNumber * pageHeight) < totalHeight)
1159 return Printable.PAGE_EXISTS;
1163 return Printable.NO_SUCH_PAGE;
1168 * get current sequence ID panel width, or nominal value if panel were to be
1169 * displayed using default settings
1173 public int getVisibleIdWidth()
1175 return getVisibleIdWidth(true);
1179 * get current sequence ID panel width, or nominal value if panel were to be
1180 * displayed using default settings
1183 * indicate if the Id width for onscreen or offscreen display should
1187 protected int getVisibleIdWidth(boolean onscreen)
1189 // see if rendering offscreen - check preferences and calc width accordingly
1190 if (!onscreen && Cache.getDefault("FIGURE_AUTOIDWIDTH", false))
1192 return calculateIdWidth(-1).width;
1194 Integer idwidth = onscreen ? null
1195 : Cache.getIntegerProperty("FIGURE_FIXEDIDWIDTH");
1196 if (idwidth != null)
1198 return idwidth.intValue() + ID_WIDTH_PADDING;
1201 int w = getIdPanel().getWidth();
1202 return (w > 0 ? w : calculateIdWidth().width);
1206 * Builds an image of the alignment of the specified type (EPS/PNG/SVG) and
1207 * writes it to the specified file
1212 void makeAlignmentImage(ImageMaker.TYPE type, File file)
1214 final int borderBottomOffset = 5;
1216 AlignmentDimension aDimension = getAlignmentDimension();
1217 // todo use a lambda function in place of callback here?
1218 ImageWriterI writer = new ImageWriterI()
1221 public void exportImage(Graphics graphics) throws Exception
1223 if (av.getWrapAlignment())
1225 printWrappedAlignment(aDimension.getWidth(),
1226 aDimension.getHeight() + borderBottomOffset, 0, graphics);
1230 printUnwrapped(aDimension.getWidth(), aDimension.getHeight(), 0,
1231 graphics, graphics);
1236 String fileTitle = alignFrame.getTitle();
1237 ImageExporter exporter = new ImageExporter(writer, alignFrame, type,
1239 int imageWidth = aDimension.getWidth();
1240 int imageHeight = aDimension.getHeight() + borderBottomOffset;
1241 String of = MessageManager.getString("label.alignment");
1242 exporter.doExport(file, this, imageWidth, imageHeight, of);
1246 * Calculates and returns a suitable width and height (in pixels) for an
1251 public AlignmentDimension getAlignmentDimension()
1253 int maxwidth = av.getAlignment().getVisibleWidth();
1255 int height = ((av.getAlignment().getHeight() + 1) * av.getCharHeight())
1256 + getScalePanel().getHeight();
1257 int width = getVisibleIdWidth(false) + (maxwidth * av.getCharWidth());
1259 if (av.getWrapAlignment())
1261 height = getWrappedHeight();
1262 if (Jalview.isHeadlessMode())
1264 // need to obtain default alignment width and then add in any
1265 // additional allowance for id margin
1266 // this duplicates the calculation in getWrappedHeight but adjusts for
1268 width = alignFrame.getWidth() - vscroll.getPreferredSize().width
1269 - alignFrame.getInsets().left - alignFrame.getInsets().right
1270 - getVisibleIdWidth() + getVisibleIdWidth(false);
1274 width = getSeqPanel().getWidth() + getVisibleIdWidth(false);
1278 else if (av.isShowAnnotation())
1280 height += getAnnotationPanel().adjustPanelHeight() + 3;
1282 return new AlignmentDimension(width, height);
1286 public void makePNGImageMap(File imgMapFile, String imageName)
1288 // /////ONLY WORKS WITH NON WRAPPED ALIGNMENTS
1289 // ////////////////////////////////////////////
1290 int idWidth = getVisibleIdWidth(false);
1291 FontMetrics fm = getFontMetrics(av.getFont());
1292 int scaleHeight = av.getCharHeight() + fm.getDescent();
1295 // ////////////////////////////////
1296 if (imgMapFile != null)
1300 int sSize = av.getAlignment().getHeight();
1301 int alwidth = av.getAlignment().getWidth();
1302 PrintWriter out = new PrintWriter(new FileWriter(imgMapFile));
1303 out.println(HTMLOutput.getImageMapHTML());
1304 out.println("<img src=\"" + imageName
1305 + "\" border=\"0\" usemap=\"#Map\" >"
1306 + "<map name=\"Map\">");
1308 for (int s = 0; s < sSize; s++)
1310 int sy = s * av.getCharHeight() + scaleHeight;
1312 SequenceI seq = av.getAlignment().getSequenceAt(s);
1313 SequenceGroup[] groups = av.getAlignment().findAllGroups(seq);
1314 for (int column = 0; column < alwidth; column++)
1316 StringBuilder text = new StringBuilder(512);
1317 String triplet = null;
1318 if (av.getAlignment().isNucleotide())
1320 triplet = ResidueProperties.nucleotideName
1321 .get(seq.getCharAt(column) + "");
1325 triplet = ResidueProperties.aa2Triplet
1326 .get(seq.getCharAt(column) + "");
1329 if (triplet == null)
1334 int seqPos = seq.findPosition(column);
1335 int gSize = groups.length;
1336 for (int g = 0; g < gSize; g++)
1338 if (text.length() < 1)
1340 text.append("<area shape=\"rect\" coords=\"")
1341 .append((idWidth + column * av.getCharWidth()))
1342 .append(",").append(sy).append(",")
1344 + (column + 1) * av.getCharWidth()))
1345 .append(",").append((av.getCharHeight() + sy))
1346 .append("\"").append(" onMouseOver=\"toolTip('")
1347 .append(seqPos).append(" ").append(triplet);
1350 if (groups[g].getStartRes() < column
1351 && groups[g].getEndRes() > column)
1353 text.append("<br><em>").append(groups[g].getName())
1358 if (text.length() < 1)
1360 text.append("<area shape=\"rect\" coords=\"")
1361 .append((idWidth + column * av.getCharWidth()))
1362 .append(",").append(sy).append(",")
1363 .append((idWidth + (column + 1) * av.getCharWidth()))
1364 .append(",").append((av.getCharHeight() + sy))
1365 .append("\"").append(" onMouseOver=\"toolTip('")
1366 .append(seqPos).append(" ").append(triplet);
1368 if (!Comparison.isGap(seq.getCharAt(column)))
1370 List<SequenceFeature> features = seq.findFeatures(column,
1372 for (SequenceFeature sf : features)
1374 if (sf.isContactFeature())
1376 text.append("<br>").append(sf.getType()).append(" ")
1377 .append(sf.getBegin()).append(":")
1378 .append(sf.getEnd());
1382 text.append("<br>");
1383 text.append(sf.getType());
1384 String description = sf.getDescription();
1385 if (description != null
1386 && !sf.getType().equals(description))
1388 description = description.replace("\"", """);
1389 text.append(" ").append(description);
1392 String status = sf.getStatus();
1393 if (status != null && !"".equals(status))
1395 text.append(" (").append(status).append(")");
1398 if (text.length() > 1)
1400 text.append("')\"; onMouseOut=\"toolTip()\"; href=\"#\">");
1401 out.println(text.toString());
1406 out.println("</map></body></html>");
1409 } catch (Exception ex)
1411 ex.printStackTrace();
1413 } // /////////END OF IMAGE MAP
1418 * Answers the height of the entire alignment in pixels, assuming it is in
1423 int getWrappedHeight()
1425 int seqPanelWidth = getSeqPanel().seqCanvas.getWidth();
1427 if (System.getProperty("java.awt.headless") != null
1428 && System.getProperty("java.awt.headless").equals("true"))
1430 seqPanelWidth = alignFrame.getWidth() - getVisibleIdWidth()
1431 - vscroll.getPreferredSize().width
1432 - alignFrame.getInsets().left - alignFrame.getInsets().right;
1435 int chunkWidth = getSeqPanel().seqCanvas
1436 .getWrappedCanvasWidth(seqPanelWidth);
1438 int hgap = av.getCharHeight();
1439 if (av.getScaleAboveWrapped())
1441 hgap += av.getCharHeight();
1444 int annotationHeight = 0;
1445 if (av.isShowAnnotation())
1447 hgap += SeqCanvas.SEQS_ANNOTATION_GAP;
1448 annotationHeight = getAnnotationPanel().adjustPanelHeight();
1451 int cHeight = av.getAlignment().getHeight() * av.getCharHeight() + hgap
1454 int maxwidth = av.getAlignment().getWidth();
1455 if (av.hasHiddenColumns())
1457 maxwidth = av.getAlignment().getHiddenColumns()
1458 .absoluteToVisibleColumn(maxwidth) - 1;
1461 int height = ((maxwidth / chunkWidth) + 1) * cHeight;
1467 * close the panel - deregisters all listeners and nulls any references to
1470 public void closePanel()
1472 PaintRefresher.RemoveComponent(getSeqPanel().seqCanvas);
1473 PaintRefresher.RemoveComponent(getIdPanel().getIdCanvas());
1474 PaintRefresher.RemoveComponent(this);
1479 * try to ensure references are nulled
1481 if (annotationPanel != null)
1483 annotationPanel.dispose();
1484 annotationPanel = null;
1489 av.removePropertyChangeListener(propertyChangeListener);
1490 propertyChangeListener = null;
1491 StructureSelectionManager ssm = av.getStructureSelectionManager();
1492 ssm.removeStructureViewerListener(getSeqPanel(), null);
1493 ssm.removeSelectionListener(getSeqPanel());
1494 ssm.removeCommandListener(av);
1495 ssm.removeStructureViewerListener(getSeqPanel(), null);
1496 ssm.removeSelectionListener(getSeqPanel());
1502 if (Console.isDebugEnabled())
1504 Console.warn("Closing alignment panel which is already closed.");
1510 * Close any open dialogs that would be orphaned when this one is closed
1512 protected void closeChildFrames()
1514 if (overviewPanel != null)
1516 overviewPanel.dispose();
1517 overviewPanel = null;
1519 if (calculationDialog != null)
1521 calculationDialog.closeFrame();
1522 calculationDialog = null;
1527 * hides or shows dynamic annotation rows based on groups and av state flags
1529 public void updateAnnotation()
1531 updateAnnotation(false, false);
1534 public void updateAnnotation(boolean applyGlobalSettings)
1536 updateAnnotation(applyGlobalSettings, false);
1539 public void updateAnnotation(boolean applyGlobalSettings,
1540 boolean preserveNewGroupSettings)
1542 av.updateGroupAnnotationSettings(applyGlobalSettings,
1543 preserveNewGroupSettings);
1544 adjustAnnotationHeight();
1548 public AlignmentI getAlignment()
1550 return av == null ? null : av.getAlignment();
1554 public String getViewName()
1556 return av.getViewName();
1560 * Make/Unmake this alignment panel the current input focus
1564 public void setSelected(boolean b)
1568 if (alignFrame.getSplitViewContainer() != null)
1571 * bring enclosing SplitFrame to front first if there is one
1573 ((SplitFrame) alignFrame.getSplitViewContainer()).setSelected(b);
1575 alignFrame.setSelected(b);
1576 } catch (Exception ex)
1582 setAlignFrameView();
1586 public void setAlignFrameView()
1588 alignFrame.setDisplayedView(this);
1592 public StructureSelectionManager getStructureSelectionManager()
1594 return av.getStructureSelectionManager();
1598 public void raiseOOMWarning(String string, OutOfMemoryError error)
1600 new OOMWarning(string, error, this);
1604 public jalview.api.FeatureRenderer cloneFeatureRenderer()
1607 return new FeatureRenderer(this);
1611 public jalview.api.FeatureRenderer getFeatureRenderer()
1613 return seqPanel.seqCanvas.getFeatureRenderer();
1616 public void updateFeatureRenderer(
1617 jalview.renderer.seqfeatures.FeatureRenderer fr)
1619 fr.transferSettings(getSeqPanel().seqCanvas.getFeatureRenderer());
1622 public void updateFeatureRendererFrom(jalview.api.FeatureRenderer fr)
1624 if (getSeqPanel().seqCanvas.getFeatureRenderer() != null)
1626 getSeqPanel().seqCanvas.getFeatureRenderer().transferSettings(fr);
1630 public ScalePanel getScalePanel()
1635 public void setScalePanel(ScalePanel scalePanel)
1637 this.scalePanel = scalePanel;
1640 public SeqPanel getSeqPanel()
1645 public void setSeqPanel(SeqPanel seqPanel)
1647 this.seqPanel = seqPanel;
1650 public AnnotationPanel getAnnotationPanel()
1652 return annotationPanel;
1655 public void setAnnotationPanel(AnnotationPanel annotationPanel)
1657 this.annotationPanel = annotationPanel;
1660 public AnnotationLabels getAlabels()
1665 public void setAlabels(AnnotationLabels alabels)
1667 this.alabels = alabels;
1670 public IdPanel getIdPanel()
1675 public void setIdPanel(IdPanel idPanel)
1677 this.idPanel = idPanel;
1681 * Follow a scrolling change in the (cDNA/Protein) complementary alignment.
1682 * The aim is to keep the two alignments 'lined up' on their centre columns.
1685 * holds mapped region(s) of this alignment that we are scrolling
1686 * 'to'; may be modified for sequence offset by this method
1687 * @param verticalOffset
1688 * the number of visible sequences to show above the mapped region
1690 protected void scrollToCentre(SearchResultsI sr, int verticalOffset)
1692 scrollToPosition(sr, verticalOffset, true);
1696 * Set a flag to say do not scroll any (cDNA/protein) complement.
1700 protected void setToScrollComplementPanel(boolean b)
1702 this.scrollComplementaryPanel = b;
1706 * Get whether to scroll complement panel
1708 * @return true if cDNA/protein complement panels should be scrolled
1710 protected boolean isSetToScrollComplementPanel()
1712 return this.scrollComplementaryPanel;
1718 * @adjustHeight if true, try to recalculate panel height for visible
1721 protected void refresh(boolean adjustHeight)
1723 validateAnnotationDimensions(adjustHeight);
1727 // sort, repaint, update overview
1728 paintAlignment(true, false);
1732 // lightweight repaint
1739 * Property change event fired when a change is made to the viewport ranges
1740 * object associated with this alignment panel's viewport
1742 public void propertyChange(PropertyChangeEvent evt)
1744 // update this panel's scroll values based on the new viewport ranges values
1745 updateScrollBarsFromRanges();
1747 // now update any complementary alignment (its viewport ranges object
1748 // is different so does not get automatically updated)
1749 if (isSetToScrollComplementPanel())
1751 setToScrollComplementPanel(false);
1752 av.scrollComplementaryAlignment();
1753 setToScrollComplementPanel(true);
1757 void updateScrollBarsFromRanges()
1759 ViewportRanges ranges = av.getRanges();
1760 setScrollValues(ranges.getStartRes(), ranges.getStartSeq());
1763 * Set the reference to the PCA/Tree chooser dialog for this panel. This
1764 * reference should be nulled when the dialog is closed.
1766 * @param calculationChooser
1768 public void setCalculationDialog(CalculationChooser calculationChooser)
1770 calculationDialog = calculationChooser;
1774 * Returns the reference to the PCA/Tree chooser dialog for this panel (null
1777 public CalculationChooser getCalculationDialog()
1779 return calculationDialog;
1783 * From appletgui, for JalviewJS JavaScript interface
1785 * preliminary - untested
1790 * @param scrollToNearest
1791 * @param redrawOverview
1794 public boolean scrollTo(int ostart, int end, int seqIndex,
1795 boolean scrollToNearest, boolean redrawOverview)
1797 int startv, endv, starts, ends;// , width;
1800 if (av.hasHiddenColumns())
1802 AlignmentI al = av.getAlignment();
1803 start = al.getHiddenColumns().absoluteToVisibleColumn(ostart);
1804 end = al.getHiddenColumns().absoluteToVisibleColumn(end);
1807 if (!scrollToNearest && !al.getHiddenColumns().isVisible(ostart))
1809 // don't scroll - position isn't visible
1819 ViewportRanges ranges = av.getRanges();
1820 if (!av.getWrapAlignment())
1823 * int spos=av.getStartRes(),sqpos=av.getStartSeq(); if ((startv =
1824 * av.getStartRes()) >= start) { spos=start-1; // seqIn //
1825 * setScrollValues(start - 1, seqIndex); } else if ((endv =
1826 * av.getEndRes()) <= end) { // setScrollValues(spos=startv + 1 + end -
1827 * endv, seqIndex); spos=startv + 1 + end - endv; } else if ((starts =
1828 * av.getStartSeq()) > seqIndex) { setScrollValues(av.getStartRes(),
1829 * seqIndex); } else if ((ends = av.getEndSeq()) <= seqIndex) {
1830 * setScrollValues(av.getStartRes(), starts + seqIndex - ends + 1); }
1833 // below is scrolling logic up to Jalview 2.8.2
1834 // if ((av.getStartRes() > end)
1835 // || (av.getEndRes() < start)
1836 // || ((av.getStartSeq() > seqIndex) || (av.getEndSeq() < seqIndex)))
1838 // if (start > av.getAlignment().getWidth() - hextent)
1840 // start = av.getAlignment().getWidth() - hextent;
1847 // if (seqIndex > av.getAlignment().getHeight() - vextent)
1849 // seqIndex = av.getAlignment().getHeight() - vextent;
1850 // if (seqIndex < 0)
1855 // setScrollValues(start, seqIndex);
1857 // logic copied from jalview.gui.AlignmentPanel:
1858 if ((startv = ranges.getStartRes()) >= start)
1861 * Scroll left to make start of search results visible
1863 setScrollValues(start - 1, seqIndex);
1865 else if ((endv = ranges.getEndRes()) <= end)
1868 * Scroll right to make end of search results visible
1870 setScrollValues(startv + 1 + end - endv, seqIndex);
1872 else if ((starts = ranges.getStartSeq()) > seqIndex)
1875 * Scroll up to make start of search results visible
1877 setScrollValues(ranges.getStartRes(), seqIndex);
1879 else if ((ends = ranges.getEndSeq()) <= seqIndex)
1882 * Scroll down to make end of search results visible
1884 setScrollValues(ranges.getStartRes(), starts + seqIndex - ends + 1);
1887 * Else results are already visible - no need to scroll
1892 ranges.scrollToWrappedVisible(start);
1895 paintAlignment(redrawOverview, false);
1899 private boolean holdRepaint = false;
1902 * Called by IdCanvas and SeqPanel to defer painting until after JVP loading.
1904 * @return true if holding
1906 public boolean getHoldRepaint()
1912 * Called by Jalview2xml while loading
1916 public void setHoldRepaint(boolean tf)
1918 if (holdRepaint == tf)
1930 public void repaint()
1934 // System.out.println("AP repaint holding");
1935 // Platform.stackTrace();
1941 public void selectAllSequences()
1943 selectSequences(av.getAlignment().getSequences());
1946 public void deselectAllSequences()
1950 getSeqPanel().keyboardNo1 = null;
1951 getSeqPanel().keyboardNo2 = null;
1953 av.setSelectionGroup(null);
1954 av.getColumnSelection().clear();
1955 av.setSearchResults(null);
1956 getIdPanel().getIdCanvas().searchResults = null;
1958 // JAL-2034 - should delegate to
1959 // alignPanel to decide if overview needs
1961 paintAlignment(false, false);
1962 PaintRefresher.Refresh(this, av.getSequenceSetId());
1965 public void selectSequences(List<SequenceI> seqs)
1967 SequenceGroup sg = new SequenceGroup(seqs);
1968 sg.setEndRes(av.getAlignment().getWidth() - 1);
1969 av.setSelectionGroup(sg);
1970 av.isSelectionGroupChanged(true);
1972 // JAL-2034 - should delegate to
1973 // alignPanel to decide if overview needs
1975 paintAlignment(false, false);
1976 PaintRefresher.Refresh(this, av.getSequenceSetId());