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.api.AlignViewportI;
24 import jalview.bin.Cache;
25 import jalview.commands.EditCommand;
26 import jalview.commands.EditCommand.Action;
27 import jalview.commands.EditCommand.Edit;
28 import jalview.datamodel.AlignmentI;
29 import jalview.datamodel.ColumnSelection;
30 import jalview.datamodel.HiddenColumns;
31 import jalview.datamodel.SearchResultMatchI;
32 import jalview.datamodel.SearchResults;
33 import jalview.datamodel.SearchResultsI;
34 import jalview.datamodel.Sequence;
35 import jalview.datamodel.SequenceFeature;
36 import jalview.datamodel.SequenceGroup;
37 import jalview.datamodel.SequenceI;
38 import jalview.io.SequenceAnnotationReport;
39 import jalview.renderer.ResidueShaderI;
40 import jalview.schemes.ResidueProperties;
41 import jalview.structure.SelectionListener;
42 import jalview.structure.SelectionSource;
43 import jalview.structure.SequenceListener;
44 import jalview.structure.StructureSelectionManager;
45 import jalview.structure.VamsasSource;
46 import jalview.util.Comparison;
47 import jalview.util.MappingUtils;
48 import jalview.util.MessageManager;
49 import jalview.util.Platform;
50 import jalview.viewmodel.AlignmentViewport;
51 import jalview.viewmodel.ViewportRanges;
53 import java.awt.BorderLayout;
54 import java.awt.Color;
56 import java.awt.FontMetrics;
57 import java.awt.Point;
58 import java.awt.event.MouseEvent;
59 import java.awt.event.MouseListener;
60 import java.awt.event.MouseMotionListener;
61 import java.awt.event.MouseWheelEvent;
62 import java.awt.event.MouseWheelListener;
63 import java.util.Collections;
64 import java.util.List;
66 import javax.swing.JPanel;
67 import javax.swing.SwingUtilities;
68 import javax.swing.ToolTipManager;
74 * @version $Revision: 1.130 $
76 public class SeqPanel extends JPanel
77 implements MouseListener, MouseMotionListener, MouseWheelListener,
78 SequenceListener, SelectionListener
80 private static final int MAX_TOOLTIP_LENGTH = 300;
82 public SeqCanvas seqCanvas;
84 public AlignmentPanel ap;
87 * last column position for mouseMoved event
89 private int lastMouseColumn;
92 * last sequence offset for mouseMoved event
94 private int lastMouseSeq;
96 protected int lastres;
98 protected int startseq;
100 protected AlignViewport av;
102 ScrollThread scrollThread = null;
104 boolean mouseDragging = false;
106 boolean editingSeqs = false;
108 boolean groupEditing = false;
110 // ////////////////////////////////////////
111 // ///Everything below this is for defining the boundary of the rubberband
112 // ////////////////////////////////////////
115 boolean changeEndSeq = false;
117 boolean changeStartSeq = false;
119 boolean changeEndRes = false;
121 boolean changeStartRes = false;
123 SequenceGroup stretchGroup = null;
125 boolean remove = false;
127 Point lastMousePress;
129 boolean mouseWheelPressed = false;
131 StringBuffer keyboardNo1;
133 StringBuffer keyboardNo2;
135 java.net.URL linkImageURL;
137 private final SequenceAnnotationReport seqARep;
139 StringBuilder tooltipText = new StringBuilder();
143 EditCommand editCommand;
145 StructureSelectionManager ssm;
147 SearchResultsI lastSearchResults;
150 * Creates a new SeqPanel object
155 public SeqPanel(AlignViewport viewport, AlignmentPanel alignPanel)
157 linkImageURL = getClass().getResource("/images/link.gif");
158 seqARep = new SequenceAnnotationReport(linkImageURL.toString());
159 ToolTipManager.sharedInstance().registerComponent(this);
160 ToolTipManager.sharedInstance().setInitialDelay(0);
161 ToolTipManager.sharedInstance().setDismissDelay(10000);
163 setBackground(Color.white);
165 seqCanvas = new SeqCanvas(alignPanel);
166 setLayout(new BorderLayout());
167 add(seqCanvas, BorderLayout.CENTER);
169 this.ap = alignPanel;
171 if (!viewport.isDataset())
173 addMouseMotionListener(this);
174 addMouseListener(this);
175 addMouseWheelListener(this);
176 ssm = viewport.getStructureSelectionManager();
177 ssm.addStructureViewerListener(this);
178 ssm.addSelectionListener(this);
181 lastMouseColumn = -1;
185 int startWrapBlock = -1;
187 int wrappedBlock = -1;
190 * Returns the aligned sequence position (base 0) at the mouse position, or
191 * the closest visible one
196 int findColumn(MouseEvent evt)
201 int startRes = av.getRanges().getStartRes();
202 if (av.getWrapAlignment())
205 int hgap = av.getCharHeight();
206 if (av.getScaleAboveWrapped())
208 hgap += av.getCharHeight();
211 int cHeight = av.getAlignment().getHeight() * av.getCharHeight()
212 + hgap + seqCanvas.getAnnotationHeight();
215 y = Math.max(0, y - hgap);
216 x = Math.max(0, x - seqCanvas.getLabelWidthWest());
218 int cwidth = seqCanvas.getWrappedCanvasWidth(this.getWidth());
224 wrappedBlock = y / cHeight;
225 wrappedBlock += startRes / cwidth;
226 // allow for wrapped view scrolled right (possible from Overview)
227 int startOffset = startRes % cwidth;
228 res = wrappedBlock * cwidth + startOffset
229 + +Math.min(cwidth - 1, x / av.getCharWidth());
233 if (x > seqCanvas.getX() + seqCanvas.getWidth())
235 // make sure we calculate relative to visible alignment, rather than
237 x = seqCanvas.getX() + seqCanvas.getWidth();
239 res = (x / av.getCharWidth()) + startRes;
240 if (res > av.getRanges().getEndRes())
243 res = av.getRanges().getEndRes();
247 if (av.hasHiddenColumns())
249 res = av.getAlignment().getHiddenColumns()
250 .visibleToAbsoluteColumn(res);
257 int findSeq(MouseEvent evt)
262 if (av.getWrapAlignment())
264 int hgap = av.getCharHeight();
265 if (av.getScaleAboveWrapped())
267 hgap += av.getCharHeight();
270 int cHeight = av.getAlignment().getHeight() * av.getCharHeight()
271 + hgap + seqCanvas.getAnnotationHeight();
275 seq = Math.min((y % cHeight) / av.getCharHeight(),
276 av.getAlignment().getHeight() - 1);
281 (y / av.getCharHeight()) + av.getRanges().getStartSeq(),
282 av.getAlignment().getHeight() - 1);
289 * When all of a sequence of edits are complete, put the resulting edit list
290 * on the history stack (undo list), and reset flags for editing in progress.
296 if (editCommand != null && editCommand.getSize() > 0)
298 ap.alignFrame.addHistoryItem(editCommand);
299 av.firePropertyChange("alignment", null,
300 av.getAlignment().getSequences());
305 * Tidy up come what may...
310 groupEditing = false;
319 seqCanvas.cursorY = getKeyboardNo1() - 1;
320 scrollToVisible(true);
323 void setCursorColumn()
325 seqCanvas.cursorX = getKeyboardNo1() - 1;
326 scrollToVisible(true);
329 void setCursorRowAndColumn()
331 if (keyboardNo2 == null)
333 keyboardNo2 = new StringBuffer();
337 seqCanvas.cursorX = getKeyboardNo1() - 1;
338 seqCanvas.cursorY = getKeyboardNo2() - 1;
339 scrollToVisible(true);
343 void setCursorPosition()
345 SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY);
347 seqCanvas.cursorX = sequence.findIndex(getKeyboardNo1()) - 1;
348 scrollToVisible(true);
351 void moveCursor(int dx, int dy)
353 seqCanvas.cursorX += dx;
354 seqCanvas.cursorY += dy;
356 HiddenColumns hidden = av.getAlignment().getHiddenColumns();
358 if (av.hasHiddenColumns() && !hidden.isVisible(seqCanvas.cursorX))
360 int original = seqCanvas.cursorX - dx;
361 int maxWidth = av.getAlignment().getWidth();
363 if (!hidden.isVisible(seqCanvas.cursorX))
365 int visx = hidden.absoluteToVisibleColumn(seqCanvas.cursorX - dx);
366 int[] region = hidden.getRegionWithEdgeAtRes(visx);
368 if (region != null) // just in case
373 seqCanvas.cursorX = region[1] + 1;
378 seqCanvas.cursorX = region[0] - 1;
381 seqCanvas.cursorX = (seqCanvas.cursorX < 0) ? 0 : seqCanvas.cursorX;
384 if (seqCanvas.cursorX >= maxWidth
385 || !hidden.isVisible(seqCanvas.cursorX))
387 seqCanvas.cursorX = original;
391 scrollToVisible(false);
395 * Scroll to make the cursor visible in the viewport.
398 * just jump to the location rather than scrolling
400 void scrollToVisible(boolean jump)
402 if (seqCanvas.cursorX < 0)
404 seqCanvas.cursorX = 0;
406 else if (seqCanvas.cursorX > av.getAlignment().getWidth() - 1)
408 seqCanvas.cursorX = av.getAlignment().getWidth() - 1;
411 if (seqCanvas.cursorY < 0)
413 seqCanvas.cursorY = 0;
415 else if (seqCanvas.cursorY > av.getAlignment().getHeight() - 1)
417 seqCanvas.cursorY = av.getAlignment().getHeight() - 1;
422 boolean repaintNeeded = true;
425 // only need to repaint if the viewport did not move, as otherwise it will
427 repaintNeeded = !av.getRanges().setViewportLocation(seqCanvas.cursorX,
432 if (av.getWrapAlignment())
434 // scrollToWrappedVisible expects x-value to have hidden cols subtracted
435 int x = av.getAlignment().getHiddenColumns()
436 .absoluteToVisibleColumn(seqCanvas.cursorX);
437 av.getRanges().scrollToWrappedVisible(x);
441 av.getRanges().scrollToVisible(seqCanvas.cursorX,
446 if (av.getAlignment().getHiddenColumns().isVisible(seqCanvas.cursorX))
448 setStatusMessage(av.getAlignment().getSequenceAt(seqCanvas.cursorY),
449 seqCanvas.cursorX, seqCanvas.cursorY);
459 void setSelectionAreaAtCursor(boolean topLeft)
461 SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY);
463 if (av.getSelectionGroup() != null)
465 SequenceGroup sg = av.getSelectionGroup();
466 // Find the top and bottom of this group
467 int min = av.getAlignment().getHeight(), max = 0;
468 for (int i = 0; i < sg.getSize(); i++)
470 int index = av.getAlignment().findIndex(sg.getSequenceAt(i));
485 sg.setStartRes(seqCanvas.cursorX);
486 if (sg.getEndRes() < seqCanvas.cursorX)
488 sg.setEndRes(seqCanvas.cursorX);
491 min = seqCanvas.cursorY;
495 sg.setEndRes(seqCanvas.cursorX);
496 if (sg.getStartRes() > seqCanvas.cursorX)
498 sg.setStartRes(seqCanvas.cursorX);
501 max = seqCanvas.cursorY + 1;
506 // Only the user can do this
507 av.setSelectionGroup(null);
511 // Now add any sequences between min and max
512 sg.getSequences(null).clear();
513 for (int i = min; i < max; i++)
515 sg.addSequence(av.getAlignment().getSequenceAt(i), false);
520 if (av.getSelectionGroup() == null)
522 SequenceGroup sg = new SequenceGroup();
523 sg.setStartRes(seqCanvas.cursorX);
524 sg.setEndRes(seqCanvas.cursorX);
525 sg.addSequence(sequence, false);
526 av.setSelectionGroup(sg);
529 ap.paintAlignment(false, false);
533 void insertGapAtCursor(boolean group)
535 groupEditing = group;
536 startseq = seqCanvas.cursorY;
537 lastres = seqCanvas.cursorX;
538 editSequence(true, false, seqCanvas.cursorX + getKeyboardNo1());
542 void deleteGapAtCursor(boolean group)
544 groupEditing = group;
545 startseq = seqCanvas.cursorY;
546 lastres = seqCanvas.cursorX + getKeyboardNo1();
547 editSequence(false, false, seqCanvas.cursorX);
551 void insertNucAtCursor(boolean group, String nuc)
553 // TODO not called - delete?
554 groupEditing = group;
555 startseq = seqCanvas.cursorY;
556 lastres = seqCanvas.cursorX;
557 editSequence(false, true, seqCanvas.cursorX + getKeyboardNo1());
561 void numberPressed(char value)
563 if (keyboardNo1 == null)
565 keyboardNo1 = new StringBuffer();
568 if (keyboardNo2 != null)
570 keyboardNo2.append(value);
574 keyboardNo1.append(value);
582 if (keyboardNo1 != null)
584 int value = Integer.parseInt(keyboardNo1.toString());
588 } catch (Exception x)
599 if (keyboardNo2 != null)
601 int value = Integer.parseInt(keyboardNo2.toString());
605 } catch (Exception x)
619 public void mouseReleased(MouseEvent evt)
621 boolean didDrag = mouseDragging; // did we come here after a drag
622 mouseDragging = false;
623 mouseWheelPressed = false;
625 if (evt.isPopupTrigger()) // Windows: mouseReleased
638 doMouseReleasedDefineMode(evt, didDrag);
649 public void mousePressed(MouseEvent evt)
651 lastMousePress = evt.getPoint();
653 if (SwingUtilities.isMiddleMouseButton(evt))
655 mouseWheelPressed = true;
659 boolean isControlDown = Platform.isControlDown(evt);
660 if (evt.isShiftDown() || isControlDown)
670 doMousePressedDefineMode(evt);
674 int seq = findSeq(evt);
675 int res = findColumn(evt);
677 if (seq < 0 || res < 0)
682 if ((seq < av.getAlignment().getHeight())
683 && (res < av.getAlignment().getSequenceAt(seq).getLength()))
700 public void mouseOverSequence(SequenceI sequence, int index, int pos)
702 String tmp = sequence.hashCode() + " " + index + " " + pos;
704 if (lastMessage == null || !lastMessage.equals(tmp))
706 // System.err.println("mouseOver Sequence: "+tmp);
707 ssm.mouseOverSequence(sequence, index, pos, av);
713 * Highlight the mapped region described by the search results object (unless
714 * unchanged). This supports highlight of protein while mousing over linked
715 * cDNA and vice versa. The status bar is also updated to show the location of
716 * the start of the highlighted region.
719 public void highlightSequence(SearchResultsI results)
721 if (results == null || results.equals(lastSearchResults))
725 lastSearchResults = results;
727 boolean wasScrolled = false;
729 if (av.isFollowHighlight())
731 // don't allow highlight of protein/cDNA to also scroll a complementary
732 // panel,as this sets up a feedback loop (scrolling panel 1 causes moused
733 // over residue to change abruptly, causing highlighted residue in panel 2
734 // to change, causing a scroll in panel 1 etc)
735 ap.setToScrollComplementPanel(false);
736 wasScrolled = ap.scrollToPosition(results, false);
739 seqCanvas.revalidate();
741 ap.setToScrollComplementPanel(true);
744 boolean noFastPaint = wasScrolled && av.getWrapAlignment();
745 if (seqCanvas.highlightSearchResults(results, noFastPaint))
747 setStatusMessage(results);
752 public VamsasSource getVamsasSource()
754 return this.ap == null ? null : this.ap.av;
758 public void updateColours(SequenceI seq, int index)
760 System.out.println("update the seqPanel colours");
765 * Action on mouse movement is to update the status bar to show the current
766 * sequence position, and (if features are shown) to show any features at the
767 * position in a tooltip. Does nothing if the mouse move does not change
773 public void mouseMoved(MouseEvent evt)
777 // This is because MacOSX creates a mouseMoved
778 // If control is down, other platforms will not.
782 final int column = findColumn(evt);
783 final int seq = findSeq(evt);
785 if (column < 0 || seq < 0 || seq >= av.getAlignment().getHeight())
790 if (column == lastMouseColumn && seq == lastMouseSeq)
793 * just a pixel move without change of residue
797 lastMouseColumn = column;
800 SequenceI sequence = av.getAlignment().getSequenceAt(seq);
802 if (column >= sequence.getLength())
808 * set status bar message, returning residue position in sequence
810 boolean isGapped = Comparison.isGap(sequence.getCharAt(column));
811 final int pos = setStatusMessage(sequence, column, seq);
812 if (ssm != null && !isGapped)
814 mouseOverSequence(sequence, column, pos);
817 tooltipText.setLength(6); // Cuts the buffer back to <html>
819 SequenceGroup[] groups = av.getAlignment().findAllGroups(sequence);
822 for (int g = 0; g < groups.length; g++)
824 if (groups[g].getStartRes() <= column
825 && groups[g].getEndRes() >= column)
827 if (!groups[g].getName().startsWith("JTreeGroup")
828 && !groups[g].getName().startsWith("JGroup"))
830 tooltipText.append(groups[g].getName());
833 if (groups[g].getDescription() != null)
835 tooltipText.append(": " + groups[g].getDescription());
842 * add any features at the position to the tooltip; if over a gap, only
843 * add features that straddle the gap (pos may be the residue before or
846 if (av.isShowSequenceFeatures())
848 List<SequenceFeature> features = ap.getFeatureRenderer()
849 .findFeaturesAtColumn(sequence, column + 1);
850 seqARep.appendFeatures(tooltipText, pos, features,
851 this.ap.getSeqPanel().seqCanvas.fr);
853 if (tooltipText.length() == 6) // <html>
855 setToolTipText(null);
860 if (tooltipText.length() > MAX_TOOLTIP_LENGTH) // constant
862 tooltipText.setLength(MAX_TOOLTIP_LENGTH);
863 tooltipText.append("...");
865 String textString = tooltipText.toString();
866 if (lastTooltip == null || !lastTooltip.equals(textString))
868 String formattedTooltipText = JvSwingUtils.wrapTooltip(true,
870 setToolTipText(formattedTooltipText);
871 lastTooltip = textString;
876 private Point lastp = null;
881 * @see javax.swing.JComponent#getToolTipLocation(java.awt.event.MouseEvent)
884 public Point getToolTipLocation(MouseEvent event)
886 int x = event.getX(), w = getWidth();
887 int wdth = (w - x < 200) ? -(w / 2) : 5; // switch sides when tooltip is too
890 if (!event.isShiftDown() || p == null)
892 p = (tooltipText != null && tooltipText.length() > 6)
893 ? new Point(event.getX() + wdth, event.getY() - 20)
897 * TODO: try to modify position region is not obcured by tooltip
905 * set when the current UI interaction has resulted in a change that requires
906 * shading in overviews and structures to be recalculated. this could be
907 * changed to a something more expressive that indicates what actually has
908 * changed, so selective redraws can be applied (ie. only structures, only
911 private boolean updateOverviewAndStructs = false; // TODO: refactor to avcontroller
914 * set if av.getSelectionGroup() refers to a group that is defined on the
915 * alignment view, rather than a transient selection
917 // private boolean editingDefinedGroup = false; // TODO: refactor to
918 // avcontroller or viewModel
921 * Sets the status message in alignment panel, showing the sequence number
922 * (index) and id, and residue and residue position if not at a gap, for the
923 * given sequence and column position. Returns the residue position returned
924 * by Sequence.findPosition. Note this may be for the nearest adjacent residue
925 * if at a gapped position.
928 * aligned sequence object
932 * index of sequence in alignment
933 * @return sequence position of residue at column, or adjacent residue if at a
936 int setStatusMessage(SequenceI sequence, final int column, int seqIndex)
938 char sequenceChar = sequence.getCharAt(column);
939 int pos = sequence.findPosition(column);
940 setStatusMessage(sequence, seqIndex, sequenceChar, pos);
946 * Builds the status message for the current cursor location and writes it to
947 * the status bar, for example
950 * Sequence 3 ID: FER1_SOLLC
951 * Sequence 5 ID: FER1_PEA Residue: THR (4)
952 * Sequence 5 ID: FER1_PEA Residue: B (3)
953 * Sequence 6 ID: O.niloticus.3 Nucleotide: Uracil (2)
958 * sequence position in the alignment (1..)
959 * @param sequenceChar
960 * the character under the cursor
962 * the sequence residue position (if not over a gap)
964 protected void setStatusMessage(SequenceI sequence, int seqIndex,
965 char sequenceChar, int residuePos)
967 StringBuilder text = new StringBuilder(32);
970 * Sequence number (if known), and sequence name.
972 String seqno = seqIndex == -1 ? "" : " " + (seqIndex + 1);
973 text.append("Sequence").append(seqno).append(" ID: ")
974 .append(sequence.getName());
976 String residue = null;
979 * Try to translate the display character to residue name (null for gap).
981 boolean isGapped = Comparison.isGap(sequenceChar);
985 boolean nucleotide = av.getAlignment().isNucleotide();
986 String displayChar = String.valueOf(sequenceChar);
989 residue = ResidueProperties.nucleotideName.get(displayChar);
993 residue = "X".equalsIgnoreCase(displayChar) ? "X"
994 : ("*".equals(displayChar) ? "STOP"
995 : ResidueProperties.aa2Triplet.get(displayChar));
997 text.append(" ").append(nucleotide ? "Nucleotide" : "Residue")
998 .append(": ").append(residue == null ? displayChar : residue);
1000 text.append(" (").append(Integer.toString(residuePos)).append(")");
1002 ap.alignFrame.statusBar.setText(text.toString());
1006 * Set the status bar message to highlight the first matched position in
1011 private void setStatusMessage(SearchResultsI results)
1013 AlignmentI al = this.av.getAlignment();
1014 int sequenceIndex = al.findIndex(results);
1015 if (sequenceIndex == -1)
1019 SequenceI ds = al.getSequenceAt(sequenceIndex).getDatasetSequence();
1020 for (SearchResultMatchI m : results.getResults())
1022 SequenceI seq = m.getSequence();
1023 if (seq.getDatasetSequence() != null)
1025 seq = seq.getDatasetSequence();
1030 int start = m.getStart();
1031 setStatusMessage(seq, sequenceIndex, seq.getCharAt(start - 1),
1042 public void mouseDragged(MouseEvent evt)
1044 if (mouseWheelPressed)
1046 boolean inSplitFrame = ap.av.getCodingComplement() != null;
1047 boolean copyChanges = inSplitFrame && av.isProteinFontAsCdna();
1049 int oldWidth = av.getCharWidth();
1051 // Which is bigger, left-right or up-down?
1052 if (Math.abs(evt.getY() - lastMousePress.getY()) > Math
1053 .abs(evt.getX() - lastMousePress.getX()))
1056 * on drag up or down, decrement or increment font size
1058 int fontSize = av.font.getSize();
1059 boolean fontChanged = false;
1061 if (evt.getY() < lastMousePress.getY())
1066 else if (evt.getY() > lastMousePress.getY())
1079 Font newFont = new Font(av.font.getName(), av.font.getStyle(),
1081 av.setFont(newFont, true);
1082 av.setCharWidth(oldWidth);
1086 ap.av.getCodingComplement().setFont(newFont, true);
1087 SplitFrame splitFrame = (SplitFrame) ap.alignFrame
1088 .getSplitViewContainer();
1089 splitFrame.adjustLayout();
1090 splitFrame.repaint();
1097 * on drag left or right, decrement or increment character width
1100 if (evt.getX() < lastMousePress.getX() && av.getCharWidth() > 1)
1102 newWidth = av.getCharWidth() - 1;
1103 av.setCharWidth(newWidth);
1105 else if (evt.getX() > lastMousePress.getX())
1107 newWidth = av.getCharWidth() + 1;
1108 av.setCharWidth(newWidth);
1112 ap.paintAlignment(false, false);
1116 * need to ensure newWidth is set on cdna, regardless of which
1117 * panel the mouse drag happened in; protein will compute its
1118 * character width as 1:1 or 3:1
1120 av.getCodingComplement().setCharWidth(newWidth);
1121 SplitFrame splitFrame = (SplitFrame) ap.alignFrame
1122 .getSplitViewContainer();
1123 splitFrame.adjustLayout();
1124 splitFrame.repaint();
1129 FontMetrics fm = getFontMetrics(av.getFont());
1130 av.validCharWidth = fm.charWidth('M') <= av.getCharWidth();
1132 lastMousePress = evt.getPoint();
1139 doMouseDraggedDefineMode(evt);
1143 int res = findColumn(evt);
1150 if ((lastres == -1) || (lastres == res))
1155 if ((res < av.getAlignment().getWidth()) && (res < lastres))
1157 // dragLeft, delete gap
1158 editSequence(false, false, res);
1162 editSequence(true, false, res);
1165 mouseDragging = true;
1166 if (scrollThread != null)
1168 scrollThread.setMousePosition(evt.getPoint());
1172 // TODO: Make it more clever than many booleans
1173 synchronized void editSequence(boolean insertGap, boolean editSeq,
1177 int fixedRight = -1;
1178 boolean fixedColumns = false;
1179 SequenceGroup sg = av.getSelectionGroup();
1181 SequenceI seq = av.getAlignment().getSequenceAt(startseq);
1183 // No group, but the sequence may represent a group
1184 if (!groupEditing && av.hasHiddenRows())
1186 if (av.isHiddenRepSequence(seq))
1188 sg = av.getRepresentedSequences(seq);
1189 groupEditing = true;
1193 StringBuilder message = new StringBuilder(64);
1196 message.append("Edit group:");
1197 if (editCommand == null)
1199 editCommand = new EditCommand(
1200 MessageManager.getString("action.edit_group"));
1205 message.append("Edit sequence: " + seq.getName());
1206 String label = seq.getName();
1207 if (label.length() > 10)
1209 label = label.substring(0, 10);
1211 if (editCommand == null)
1213 editCommand = new EditCommand(MessageManager
1214 .formatMessage("label.edit_params", new String[]
1221 message.append(" insert ");
1225 message.append(" delete ");
1228 message.append(Math.abs(startres - lastres) + " gaps.");
1229 ap.alignFrame.statusBar.setText(message.toString());
1231 // Are we editing within a selection group?
1232 if (groupEditing || (sg != null
1233 && sg.getSequences(av.getHiddenRepSequences()).contains(seq)))
1235 fixedColumns = true;
1237 // sg might be null as the user may only see 1 sequence,
1238 // but the sequence represents a group
1241 if (!av.isHiddenRepSequence(seq))
1246 sg = av.getRepresentedSequences(seq);
1249 fixedLeft = sg.getStartRes();
1250 fixedRight = sg.getEndRes();
1252 if ((startres < fixedLeft && lastres >= fixedLeft)
1253 || (startres >= fixedLeft && lastres < fixedLeft)
1254 || (startres > fixedRight && lastres <= fixedRight)
1255 || (startres <= fixedRight && lastres > fixedRight))
1261 if (fixedLeft > startres)
1263 fixedRight = fixedLeft - 1;
1266 else if (fixedRight < startres)
1268 fixedLeft = fixedRight;
1273 if (av.hasHiddenColumns())
1275 fixedColumns = true;
1276 int y1 = av.getAlignment().getHiddenColumns()
1277 .getNextHiddenBoundary(true, startres);
1278 int y2 = av.getAlignment().getHiddenColumns()
1279 .getNextHiddenBoundary(false, startres);
1281 if ((insertGap && startres > y1 && lastres < y1)
1282 || (!insertGap && startres < y2 && lastres > y2))
1288 // System.out.print(y1+" "+y2+" "+fixedLeft+" "+fixedRight+"~~");
1289 // Selection spans a hidden region
1290 if (fixedLeft < y1 && (fixedRight > y2 || fixedRight == -1))
1298 fixedRight = y2 - 1;
1305 List<SequenceI> vseqs = sg.getSequences(av.getHiddenRepSequences());
1306 int g, groupSize = vseqs.size();
1307 SequenceI[] groupSeqs = new SequenceI[groupSize];
1308 for (g = 0; g < groupSeqs.length; g++)
1310 groupSeqs[g] = vseqs.get(g);
1316 // If the user has selected the whole sequence, and is dragging to
1317 // the right, we can still extend the alignment and selectionGroup
1318 if (sg.getStartRes() == 0 && sg.getEndRes() == fixedRight
1319 && sg.getEndRes() == av.getAlignment().getWidth() - 1)
1321 sg.setEndRes(av.getAlignment().getWidth() + startres - lastres);
1322 fixedRight = sg.getEndRes();
1325 // Is it valid with fixed columns??
1326 // Find the next gap before the end
1327 // of the visible region boundary
1328 boolean blank = false;
1329 for (; fixedRight > lastres; fixedRight--)
1333 for (g = 0; g < groupSize; g++)
1335 for (int j = 0; j < startres - lastres; j++)
1337 if (!Comparison.isGap(groupSeqs[g].getCharAt(fixedRight - j)))
1352 if (sg.getSize() == av.getAlignment().getHeight())
1354 if ((av.hasHiddenColumns() && startres < av.getAlignment()
1356 .getNextHiddenBoundary(false, startres)))
1362 int alWidth = av.getAlignment().getWidth();
1363 if (av.hasHiddenRows())
1365 int hwidth = av.getAlignment().getHiddenSequences()
1367 if (hwidth > alWidth)
1372 // We can still insert gaps if the selectionGroup
1373 // contains all the sequences
1374 sg.setEndRes(sg.getEndRes() + startres - lastres);
1375 fixedRight = alWidth + startres - lastres;
1386 else if (!insertGap)
1388 // / Are we able to delete?
1389 // ie are all columns blank?
1391 for (g = 0; g < groupSize; g++)
1393 for (int j = startres; j < lastres; j++)
1395 if (groupSeqs[g].getLength() <= j)
1400 if (!Comparison.isGap(groupSeqs[g].getCharAt(j)))
1402 // Not a gap, block edit not valid
1412 // dragging to the right
1413 if (fixedColumns && fixedRight != -1)
1415 for (int j = lastres; j < startres; j++)
1417 insertChar(j, groupSeqs, fixedRight);
1422 appendEdit(Action.INSERT_GAP, groupSeqs, startres,
1423 startres - lastres);
1428 // dragging to the left
1429 if (fixedColumns && fixedRight != -1)
1431 for (int j = lastres; j > startres; j--)
1433 deleteChar(startres, groupSeqs, fixedRight);
1438 appendEdit(Action.DELETE_GAP, groupSeqs, startres,
1439 lastres - startres);
1445 // ///Editing a single sequence///////////
1449 // dragging to the right
1450 if (fixedColumns && fixedRight != -1)
1452 for (int j = lastres; j < startres; j++)
1454 insertChar(j, new SequenceI[] { seq }, fixedRight);
1459 appendEdit(Action.INSERT_GAP, new SequenceI[] { seq }, lastres,
1460 startres - lastres);
1467 // dragging to the left
1468 if (fixedColumns && fixedRight != -1)
1470 for (int j = lastres; j > startres; j--)
1472 if (!Comparison.isGap(seq.getCharAt(startres)))
1477 deleteChar(startres, new SequenceI[] { seq }, fixedRight);
1482 // could be a keyboard edit trying to delete none gaps
1484 for (int m = startres; m < lastres; m++)
1486 if (!Comparison.isGap(seq.getCharAt(m)))
1495 appendEdit(Action.DELETE_GAP, new SequenceI[] { seq },
1501 {// insertGap==false AND editSeq==TRUE;
1502 if (fixedColumns && fixedRight != -1)
1504 for (int j = lastres; j < startres; j++)
1506 insertChar(j, new SequenceI[] { seq }, fixedRight);
1511 appendEdit(Action.INSERT_NUC, new SequenceI[] { seq }, lastres,
1512 startres - lastres);
1519 seqCanvas.repaint();
1522 void insertChar(int j, SequenceI[] seq, int fixedColumn)
1524 int blankColumn = fixedColumn;
1525 for (int s = 0; s < seq.length; s++)
1527 // Find the next gap before the end of the visible region boundary
1528 // If lastCol > j, theres a boundary after the gap insertion
1530 for (blankColumn = fixedColumn; blankColumn > j; blankColumn--)
1532 if (Comparison.isGap(seq[s].getCharAt(blankColumn)))
1534 // Theres a space, so break and insert the gap
1539 if (blankColumn <= j)
1541 blankColumn = fixedColumn;
1547 appendEdit(Action.DELETE_GAP, seq, blankColumn, 1);
1549 appendEdit(Action.INSERT_GAP, seq, j, 1);
1554 * Helper method to add and perform one edit action.
1561 protected void appendEdit(Action action, SequenceI[] seq, int pos,
1565 final Edit edit = new EditCommand().new Edit(action, seq, pos, count,
1566 av.getAlignment().getGapCharacter());
1568 editCommand.appendEdit(edit, av.getAlignment(), true, null);
1571 void deleteChar(int j, SequenceI[] seq, int fixedColumn)
1574 appendEdit(Action.DELETE_GAP, seq, j, 1);
1576 appendEdit(Action.INSERT_GAP, seq, fixedColumn, 1);
1580 * On reentering the panel, stops any scrolling that was started on dragging
1586 public void mouseEntered(MouseEvent e)
1596 * On leaving the panel, if the mouse is being dragged, starts a thread to
1597 * scroll it until the mouse is released (in unwrapped mode only)
1602 public void mouseExited(MouseEvent e)
1604 if (!av.getWrapAlignment() && mouseDragging && scrollThread == null)
1606 scrollThread = new ScrollThread();
1611 * Handler for double-click on a position with one or more sequence features.
1612 * Opens the Amend Features dialog to allow feature details to be amended, or
1613 * the feature deleted.
1616 public void mouseClicked(MouseEvent evt)
1618 SequenceGroup sg = null;
1619 SequenceI sequence = av.getAlignment().getSequenceAt(findSeq(evt));
1620 if (evt.getClickCount() > 1)
1622 sg = av.getSelectionGroup();
1623 if (sg != null && sg.getSize() == 1
1624 && sg.getEndRes() - sg.getStartRes() < 2)
1626 av.setSelectionGroup(null);
1629 int column = findColumn(evt);
1632 * find features at the position (if not gapped), or straddling
1633 * the position (if at a gap)
1635 List<SequenceFeature> features = seqCanvas.getFeatureRenderer()
1636 .findFeaturesAtColumn(sequence, column + 1);
1638 if (!features.isEmpty())
1641 * highlight the first feature at the position on the alignment
1643 SearchResultsI highlight = new SearchResults();
1644 highlight.addResult(sequence, features.get(0).getBegin(), features
1646 seqCanvas.highlightSearchResults(highlight, false);
1649 * open the Amend Features dialog; clear highlighting afterwards,
1650 * whether changes were made or not
1652 List<SequenceI> seqs = Collections.singletonList(sequence);
1653 seqCanvas.getFeatureRenderer().amendFeatures(seqs, features, false,
1655 av.setSearchResults(null); // clear highlighting
1656 seqCanvas.repaint(); // draw new/amended features
1662 public void mouseWheelMoved(MouseWheelEvent e)
1665 double wheelRotation = e.getPreciseWheelRotation();
1666 if (wheelRotation > 0)
1668 if (e.isShiftDown())
1670 av.getRanges().scrollRight(true);
1675 av.getRanges().scrollUp(false);
1678 else if (wheelRotation < 0)
1680 if (e.isShiftDown())
1682 av.getRanges().scrollRight(false);
1686 av.getRanges().scrollUp(true);
1691 * update status bar and tooltip for new position
1692 * (need to synthesize a mouse movement to refresh tooltip)
1695 ToolTipManager.sharedInstance().mouseMoved(e);
1704 public void doMousePressedDefineMode(MouseEvent evt)
1706 final int res = findColumn(evt);
1707 final int seq = findSeq(evt);
1709 updateOverviewAndStructs = false;
1711 startWrapBlock = wrappedBlock;
1713 if (av.getWrapAlignment() && seq > av.getAlignment().getHeight())
1715 JvOptionPane.showInternalMessageDialog(Desktop.desktop,
1716 MessageManager.getString(
1717 "label.cannot_edit_annotations_in_wrapped_view"),
1718 MessageManager.getString("label.wrapped_view_no_edit"),
1719 JvOptionPane.WARNING_MESSAGE);
1723 if (seq < 0 || res < 0)
1728 SequenceI sequence = av.getAlignment().getSequenceAt(seq);
1730 if ((sequence == null) || (res > sequence.getLength()))
1735 stretchGroup = av.getSelectionGroup();
1737 if (stretchGroup == null || !stretchGroup.contains(sequence, res))
1739 stretchGroup = av.getAlignment().findGroup(sequence, res);
1740 if (stretchGroup != null)
1742 // only update the current selection if the popup menu has a group to
1744 av.setSelectionGroup(stretchGroup);
1748 if (evt.isPopupTrigger()) // Mac: mousePressed
1755 * defer right-mouse click handling to mouseReleased on Windows
1756 * (where isPopupTrigger() will answer true)
1757 * NB isRightMouseButton is also true for Cmd-click on Mac
1759 if (SwingUtilities.isRightMouseButton(evt) && !Platform.isAMac())
1766 seqCanvas.cursorX = findColumn(evt);
1767 seqCanvas.cursorY = findSeq(evt);
1768 seqCanvas.repaint();
1772 if (stretchGroup == null)
1774 createStretchGroup(res, sequence);
1777 if (stretchGroup != null)
1779 stretchGroup.addPropertyChangeListener(seqCanvas);
1782 seqCanvas.repaint();
1785 private void createStretchGroup(int res, SequenceI sequence)
1787 // Only if left mouse button do we want to change group sizes
1788 // define a new group here
1789 SequenceGroup sg = new SequenceGroup();
1790 sg.setStartRes(res);
1792 sg.addSequence(sequence, false);
1793 av.setSelectionGroup(sg);
1796 if (av.getConservationSelected())
1798 SliderPanel.setConservationSlider(ap, av.getResidueShading(),
1802 if (av.getAbovePIDThreshold())
1804 SliderPanel.setPIDSliderSource(ap, av.getResidueShading(),
1807 // TODO: stretchGroup will always be not null. Is this a merge error ?
1808 // or is there a threading issue here?
1809 if ((stretchGroup != null) && (stretchGroup.getEndRes() == res))
1811 // Edit end res position of selected group
1812 changeEndRes = true;
1814 else if ((stretchGroup != null) && (stretchGroup.getStartRes() == res))
1816 // Edit end res position of selected group
1817 changeStartRes = true;
1819 stretchGroup.getWidth();
1824 * Build and show a pop-up menu at the right-click mouse position
1830 void showPopupMenu(MouseEvent evt)
1832 final int column = findColumn(evt);
1833 final int seq = findSeq(evt);
1834 SequenceI sequence = av.getAlignment().getSequenceAt(seq);
1835 List<SequenceFeature> features = ap.getFeatureRenderer()
1836 .findFeaturesAtColumn(sequence, column + 1);
1838 PopupMenu pop = new PopupMenu(ap, null, features);
1839 pop.show(this, evt.getX(), evt.getY());
1843 * Update the display after mouse up on a selection or group
1846 * mouse released event details
1848 * true if this event is happening after a mouse drag (rather than a
1851 public void doMouseReleasedDefineMode(MouseEvent evt, boolean afterDrag)
1853 if (stretchGroup == null)
1858 stretchGroup.removePropertyChangeListener(seqCanvas);
1860 // always do this - annotation has own state
1861 // but defer colourscheme update until hidden sequences are passed in
1862 boolean vischange = stretchGroup.recalcConservation(true);
1863 updateOverviewAndStructs |= vischange && av.isSelectionDefinedGroup()
1865 if (stretchGroup.cs != null)
1867 stretchGroup.cs.alignmentChanged(stretchGroup,
1868 av.getHiddenRepSequences());
1870 ResidueShaderI groupColourScheme = stretchGroup
1871 .getGroupColourScheme();
1872 String name = stretchGroup.getName();
1873 if (stretchGroup.cs.conservationApplied())
1875 SliderPanel.setConservationSlider(ap, groupColourScheme, name);
1877 if (stretchGroup.cs.getThreshold() > 0)
1879 SliderPanel.setPIDSliderSource(ap, groupColourScheme, name);
1882 PaintRefresher.Refresh(this, av.getSequenceSetId());
1883 // TODO: structure colours only need updating if stretchGroup used to or now
1884 // does contain sequences with structure views
1885 ap.paintAlignment(updateOverviewAndStructs, updateOverviewAndStructs);
1886 updateOverviewAndStructs = false;
1887 changeEndRes = false;
1888 changeStartRes = false;
1889 stretchGroup = null;
1899 public void doMouseDraggedDefineMode(MouseEvent evt)
1901 int res = findColumn(evt);
1902 int y = findSeq(evt);
1904 if (wrappedBlock != startWrapBlock)
1909 if (stretchGroup == null)
1914 res = Math.min(res, av.getAlignment().getWidth()-1);
1916 if (stretchGroup.getEndRes() == res)
1918 // Edit end res position of selected group
1919 changeEndRes = true;
1921 else if (stretchGroup.getStartRes() == res)
1923 // Edit start res position of selected group
1924 changeStartRes = true;
1927 if (res < av.getRanges().getStartRes())
1929 res = av.getRanges().getStartRes();
1934 if (res > (stretchGroup.getStartRes() - 1))
1936 stretchGroup.setEndRes(res);
1937 updateOverviewAndStructs |= av.isSelectionDefinedGroup();
1940 else if (changeStartRes)
1942 if (res < (stretchGroup.getEndRes() + 1))
1944 stretchGroup.setStartRes(res);
1945 updateOverviewAndStructs |= av.isSelectionDefinedGroup();
1949 int dragDirection = 0;
1955 else if (y < oldSeq)
1960 while ((y != oldSeq) && (oldSeq > -1)
1961 && (y < av.getAlignment().getHeight()))
1963 // This routine ensures we don't skip any sequences, as the
1964 // selection is quite slow.
1965 Sequence seq = (Sequence) av.getAlignment().getSequenceAt(oldSeq);
1967 oldSeq += dragDirection;
1974 Sequence nextSeq = (Sequence) av.getAlignment().getSequenceAt(oldSeq);
1976 if (stretchGroup.getSequences(null).contains(nextSeq))
1978 stretchGroup.deleteSequence(seq, false);
1979 updateOverviewAndStructs |= av.isSelectionDefinedGroup();
1985 stretchGroup.addSequence(seq, false);
1988 stretchGroup.addSequence(nextSeq, false);
1989 updateOverviewAndStructs |= av.isSelectionDefinedGroup();
1998 mouseDragging = true;
2000 if (scrollThread != null)
2002 scrollThread.setMousePosition(evt.getPoint());
2007 * Stops the scroll thread if it is running
2009 void stopScrolling()
2011 if (scrollThread != null)
2013 scrollThread.stopScrolling();
2014 scrollThread = null;
2016 mouseDragging = false;
2020 * Starts a thread to scroll the alignment, towards a given mouse position
2021 * outside the panel bounds
2025 void startScrolling(Point mousePos)
2027 if (scrollThread == null)
2029 scrollThread = new ScrollThread();
2032 mouseDragging = true;
2033 scrollThread.setMousePosition(mousePos);
2037 * Performs scrolling of the visible alignment left, right, up or down
2039 class ScrollThread extends Thread
2041 private Point mousePos;
2043 private volatile boolean threadRunning = true;
2048 public ScrollThread()
2050 setName("SeqPanel$ScrollThread");
2055 * Sets the position of the mouse that determines the direction of the
2060 public void setMousePosition(Point p)
2066 * Sets a flag that will cause the thread to exit
2068 public void stopScrolling()
2070 threadRunning = false;
2074 * Scrolls the alignment left or right, and/or up or down, depending on the
2075 * last notified mouse position, until the limit of the alignment is
2076 * reached, or a flag is set to stop the scroll
2081 while (threadRunning && mouseDragging)
2083 if (mousePos != null)
2085 boolean scrolled = false;
2086 ViewportRanges ranges = SeqPanel.this.av.getRanges();
2093 // mouse is above this panel - try scroll up
2094 scrolled = ranges.scrollUp(true);
2096 else if (mousePos.y >= getHeight())
2098 // mouse is below this panel - try scroll down
2099 scrolled = ranges.scrollUp(false);
2103 * scroll left or right
2107 scrolled |= ranges.scrollRight(false);
2109 else if (mousePos.x >= getWidth())
2111 scrolled |= ranges.scrollRight(true);
2116 * we have reached the limit of the visible alignment - quit
2118 threadRunning = false;
2119 SeqPanel.this.ap.repaint();
2126 } catch (Exception ex)
2134 * modify current selection according to a received message.
2137 public void selection(SequenceGroup seqsel, ColumnSelection colsel,
2138 HiddenColumns hidden, SelectionSource source)
2140 // TODO: fix this hack - source of messages is align viewport, but SeqPanel
2141 // handles selection messages...
2142 // TODO: extend config options to allow user to control if selections may be
2143 // shared between viewports.
2144 boolean iSentTheSelection = (av == source
2145 || (source instanceof AlignViewport
2146 && ((AlignmentViewport) source).getSequenceSetId()
2147 .equals(av.getSequenceSetId())));
2149 if (iSentTheSelection)
2151 // respond to our own event by updating dependent dialogs
2152 if (ap.getCalculationDialog() != null)
2154 ap.getCalculationDialog().validateCalcTypes();
2160 // process further ?
2161 if (!av.followSelection)
2167 * Ignore the selection if there is one of our own pending.
2169 if (av.isSelectionGroupChanged(false) || av.isColSelChanged(false))
2175 * Check for selection in a view of which this one is a dna/protein
2178 if (selectionFromTranslation(seqsel, colsel, hidden, source))
2183 // do we want to thread this ? (contention with seqsel and colsel locks, I
2186 * only copy colsel if there is a real intersection between
2187 * sequence selection and this panel's alignment
2189 boolean repaint = false;
2190 boolean copycolsel = false;
2192 SequenceGroup sgroup = null;
2193 if (seqsel != null && seqsel.getSize() > 0)
2195 if (av.getAlignment() == null)
2197 Cache.log.warn("alignviewport av SeqSetId=" + av.getSequenceSetId()
2198 + " ViewId=" + av.getViewId()
2199 + " 's alignment is NULL! returning immediately.");
2202 sgroup = seqsel.intersect(av.getAlignment(),
2203 (av.hasHiddenRows()) ? av.getHiddenRepSequences() : null);
2204 if ((sgroup != null && sgroup.getSize() > 0))
2209 if (sgroup != null && sgroup.getSize() > 0)
2211 av.setSelectionGroup(sgroup);
2215 av.setSelectionGroup(null);
2217 av.isSelectionGroupChanged(true);
2222 // the current selection is unset or from a previous message
2223 // so import the new colsel.
2224 if (colsel == null || colsel.isEmpty())
2226 if (av.getColumnSelection() != null)
2228 av.getColumnSelection().clear();
2234 // TODO: shift colSel according to the intersecting sequences
2235 if (av.getColumnSelection() == null)
2237 av.setColumnSelection(new ColumnSelection(colsel));
2241 av.getColumnSelection().setElementsFrom(colsel,
2242 av.getAlignment().getHiddenColumns());
2245 av.isColSelChanged(true);
2249 if (copycolsel && av.hasHiddenColumns()
2250 && (av.getAlignment().getHiddenColumns() == null))
2252 System.err.println("Bad things");
2254 if (repaint) // always true!
2256 // probably finessing with multiple redraws here
2257 PaintRefresher.Refresh(this, av.getSequenceSetId());
2258 // ap.paintAlignment(false);
2261 // lastly, update dependent dialogs
2262 if (ap.getCalculationDialog() != null)
2264 ap.getCalculationDialog().validateCalcTypes();
2270 * If this panel is a cdna/protein translation view of the selection source,
2271 * tries to map the source selection to a local one, and returns true. Else
2278 protected boolean selectionFromTranslation(SequenceGroup seqsel,
2279 ColumnSelection colsel, HiddenColumns hidden,
2280 SelectionSource source)
2282 if (!(source instanceof AlignViewportI))
2286 final AlignViewportI sourceAv = (AlignViewportI) source;
2287 if (sourceAv.getCodingComplement() != av
2288 && av.getCodingComplement() != sourceAv)
2294 * Map sequence selection
2296 SequenceGroup sg = MappingUtils.mapSequenceGroup(seqsel, sourceAv, av);
2297 av.setSelectionGroup(sg);
2298 av.isSelectionGroupChanged(true);
2301 * Map column selection
2303 // ColumnSelection cs = MappingUtils.mapColumnSelection(colsel, sourceAv,
2305 ColumnSelection cs = new ColumnSelection();
2306 HiddenColumns hs = new HiddenColumns();
2307 MappingUtils.mapColumnSelection(colsel, hidden, sourceAv, av, cs, hs);
2308 av.setColumnSelection(cs);
2309 av.getAlignment().setHiddenColumns(hs);
2311 // lastly, update any dependent dialogs
2312 if (ap.getCalculationDialog() != null)
2314 ap.getCalculationDialog().validateCalcTypes();
2317 PaintRefresher.Refresh(this, av.getSequenceSetId());
2324 * @return null or last search results handled by this panel
2326 public SearchResultsI getLastSearchResults()
2328 return lastSearchResults;