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.seqfeatures.FeatureRendererModel;
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
634 doMouseReleasedDefineMode(evt, didDrag);
648 public void mousePressed(MouseEvent evt)
650 lastMousePress = evt.getPoint();
652 if (SwingUtilities.isMiddleMouseButton(evt))
654 mouseWheelPressed = true;
658 boolean isControlDown = Platform.isControlDown(evt);
659 if (evt.isShiftDown() || isControlDown)
669 doMousePressedDefineMode(evt);
673 int seq = findSeq(evt);
674 int res = findColumn(evt);
676 if (seq < 0 || res < 0)
681 if ((seq < av.getAlignment().getHeight())
682 && (res < av.getAlignment().getSequenceAt(seq).getLength()))
699 public void mouseOverSequence(SequenceI sequence, int index, int pos)
701 String tmp = sequence.hashCode() + " " + index + " " + pos;
703 if (lastMessage == null || !lastMessage.equals(tmp))
705 // System.err.println("mouseOver Sequence: "+tmp);
706 ssm.mouseOverSequence(sequence, index, pos, av);
712 * Highlight the mapped region described by the search results object (unless
713 * unchanged). This supports highlight of protein while mousing over linked
714 * cDNA and vice versa. The status bar is also updated to show the location of
715 * the start of the highlighted region.
718 public void highlightSequence(SearchResultsI results)
720 if (results == null || results.equals(lastSearchResults))
724 lastSearchResults = results;
726 boolean wasScrolled = false;
728 if (av.isFollowHighlight())
730 // don't allow highlight of protein/cDNA to also scroll a complementary
731 // panel,as this sets up a feedback loop (scrolling panel 1 causes moused
732 // over residue to change abruptly, causing highlighted residue in panel 2
733 // to change, causing a scroll in panel 1 etc)
734 ap.setToScrollComplementPanel(false);
735 wasScrolled = ap.scrollToPosition(results, false);
738 seqCanvas.revalidate();
740 ap.setToScrollComplementPanel(true);
743 boolean noFastPaint = wasScrolled && av.getWrapAlignment();
744 if (seqCanvas.highlightSearchResults(results, noFastPaint))
746 setStatusMessage(results);
751 public VamsasSource getVamsasSource()
753 return this.ap == null ? null : this.ap.av;
757 public void updateColours(SequenceI seq, int index)
759 System.out.println("update the seqPanel colours");
764 * Action on mouse movement is to update the status bar to show the current
765 * sequence position, and (if features are shown) to show any features at the
766 * position in a tooltip. Does nothing if the mouse move does not change
772 public void mouseMoved(MouseEvent evt)
776 // This is because MacOSX creates a mouseMoved
777 // If control is down, other platforms will not.
781 final int column = findColumn(evt);
782 final int seq = findSeq(evt);
784 if (column < 0 || seq < 0 || seq >= av.getAlignment().getHeight())
789 if (column == lastMouseColumn && seq == lastMouseSeq)
792 * just a pixel move without change of residue
796 lastMouseColumn = column;
799 SequenceI sequence = av.getAlignment().getSequenceAt(seq);
801 if (column >= sequence.getLength())
807 * set status bar message, returning residue position in sequence
809 boolean isGapped = Comparison.isGap(sequence.getCharAt(column));
810 final int pos = setStatusMessage(sequence, column, seq);
811 if (ssm != null && !isGapped)
813 mouseOverSequence(sequence, column, pos);
816 tooltipText.setLength(6); // Cuts the buffer back to <html>
818 SequenceGroup[] groups = av.getAlignment().findAllGroups(sequence);
821 for (int g = 0; g < groups.length; g++)
823 if (groups[g].getStartRes() <= column
824 && groups[g].getEndRes() >= column)
826 if (!groups[g].getName().startsWith("JTreeGroup")
827 && !groups[g].getName().startsWith("JGroup"))
829 tooltipText.append(groups[g].getName());
832 if (groups[g].getDescription() != null)
834 tooltipText.append(": " + groups[g].getDescription());
841 * add any features at the position to the tooltip; if over a gap, only
842 * add features that straddle the gap (pos may be the residue before or
845 if (av.isShowSequenceFeatures())
847 List<SequenceFeature> features = ap.getFeatureRenderer()
848 .findFeaturesAtColumn(sequence, column + 1);
849 seqARep.appendFeatures(tooltipText, pos, features,
850 this.ap.getSeqPanel().seqCanvas.fr);
853 * add features in CDS/protein complement at the corresponding
854 * position if configured to do so
856 if (av.isShowComplementFeatures())
858 if (!Comparison.isGap(sequence.getCharAt(column)))
860 AlignViewportI complement = ap.getAlignViewport()
861 .getCodingComplement();
862 AlignFrame af = Desktop.getAlignFrameFor(complement);
863 FeatureRendererModel fr2 = af.getFeatureRenderer();
864 features = fr2.findComplementFeaturesAtResidue(sequence, pos);
865 seqARep.appendFeatures(tooltipText, pos, features, fr2);
869 if (tooltipText.length() == 6) // <html>
871 setToolTipText(null);
876 if (tooltipText.length() > MAX_TOOLTIP_LENGTH) // constant
878 tooltipText.setLength(MAX_TOOLTIP_LENGTH);
879 tooltipText.append("...");
881 String textString = tooltipText.toString();
882 if (lastTooltip == null || !lastTooltip.equals(textString))
884 String formattedTooltipText = JvSwingUtils.wrapTooltip(true,
886 setToolTipText(formattedTooltipText);
887 lastTooltip = textString;
892 private Point lastp = null;
897 * @see javax.swing.JComponent#getToolTipLocation(java.awt.event.MouseEvent)
900 public Point getToolTipLocation(MouseEvent event)
902 int x = event.getX(), w = getWidth();
903 int wdth = (w - x < 200) ? -(w / 2) : 5; // switch sides when tooltip is too
906 if (!event.isShiftDown() || p == null)
908 p = (tooltipText != null && tooltipText.length() > 6)
909 ? new Point(event.getX() + wdth, event.getY() - 20)
913 * TODO: try to modify position region is not obcured by tooltip
921 * set when the current UI interaction has resulted in a change that requires
922 * shading in overviews and structures to be recalculated. this could be
923 * changed to a something more expressive that indicates what actually has
924 * changed, so selective redraws can be applied (ie. only structures, only
927 private boolean updateOverviewAndStructs = false; // TODO: refactor to avcontroller
930 * set if av.getSelectionGroup() refers to a group that is defined on the
931 * alignment view, rather than a transient selection
933 // private boolean editingDefinedGroup = false; // TODO: refactor to
934 // avcontroller or viewModel
937 * Sets the status message in alignment panel, showing the sequence number
938 * (index) and id, and residue and residue position if not at a gap, for the
939 * given sequence and column position. Returns the residue position returned
940 * by Sequence.findPosition. Note this may be for the nearest adjacent residue
941 * if at a gapped position.
944 * aligned sequence object
948 * index of sequence in alignment
949 * @return sequence position of residue at column, or adjacent residue if at a
952 int setStatusMessage(SequenceI sequence, final int column, int seqIndex)
954 char sequenceChar = sequence.getCharAt(column);
955 int pos = sequence.findPosition(column);
956 setStatusMessage(sequence, seqIndex, sequenceChar, pos);
962 * Builds the status message for the current cursor location and writes it to
963 * the status bar, for example
966 * Sequence 3 ID: FER1_SOLLC
967 * Sequence 5 ID: FER1_PEA Residue: THR (4)
968 * Sequence 5 ID: FER1_PEA Residue: B (3)
969 * Sequence 6 ID: O.niloticus.3 Nucleotide: Uracil (2)
974 * sequence position in the alignment (1..)
975 * @param sequenceChar
976 * the character under the cursor
978 * the sequence residue position (if not over a gap)
980 protected void setStatusMessage(SequenceI sequence, int seqIndex,
981 char sequenceChar, int residuePos)
983 StringBuilder text = new StringBuilder(32);
986 * Sequence number (if known), and sequence name.
988 String seqno = seqIndex == -1 ? "" : " " + (seqIndex + 1);
989 text.append("Sequence").append(seqno).append(" ID: ")
990 .append(sequence.getName());
992 String residue = null;
995 * Try to translate the display character to residue name (null for gap).
997 boolean isGapped = Comparison.isGap(sequenceChar);
1001 boolean nucleotide = av.getAlignment().isNucleotide();
1002 String displayChar = String.valueOf(sequenceChar);
1005 residue = ResidueProperties.nucleotideName.get(displayChar);
1009 residue = "X".equalsIgnoreCase(displayChar) ? "X"
1010 : ("*".equals(displayChar) ? "STOP"
1011 : ResidueProperties.aa2Triplet.get(displayChar));
1013 text.append(" ").append(nucleotide ? "Nucleotide" : "Residue")
1014 .append(": ").append(residue == null ? displayChar : residue);
1016 text.append(" (").append(Integer.toString(residuePos)).append(")");
1018 ap.alignFrame.statusBar.setText(text.toString());
1022 * Set the status bar message to highlight the first matched position in
1027 private void setStatusMessage(SearchResultsI results)
1029 AlignmentI al = this.av.getAlignment();
1030 int sequenceIndex = al.findIndex(results);
1031 if (sequenceIndex == -1)
1035 SequenceI ds = al.getSequenceAt(sequenceIndex).getDatasetSequence();
1036 for (SearchResultMatchI m : results.getResults())
1038 SequenceI seq = m.getSequence();
1039 if (seq.getDatasetSequence() != null)
1041 seq = seq.getDatasetSequence();
1046 int start = m.getStart();
1047 setStatusMessage(seq, sequenceIndex, seq.getCharAt(start - 1),
1058 public void mouseDragged(MouseEvent evt)
1060 if (mouseWheelPressed)
1062 boolean inSplitFrame = ap.av.getCodingComplement() != null;
1063 boolean copyChanges = inSplitFrame && av.isProteinFontAsCdna();
1065 int oldWidth = av.getCharWidth();
1067 // Which is bigger, left-right or up-down?
1068 if (Math.abs(evt.getY() - lastMousePress.getY()) > Math
1069 .abs(evt.getX() - lastMousePress.getX()))
1072 * on drag up or down, decrement or increment font size
1074 int fontSize = av.font.getSize();
1075 boolean fontChanged = false;
1077 if (evt.getY() < lastMousePress.getY())
1082 else if (evt.getY() > lastMousePress.getY())
1095 Font newFont = new Font(av.font.getName(), av.font.getStyle(),
1097 av.setFont(newFont, true);
1098 av.setCharWidth(oldWidth);
1102 ap.av.getCodingComplement().setFont(newFont, true);
1103 SplitFrame splitFrame = (SplitFrame) ap.alignFrame
1104 .getSplitViewContainer();
1105 splitFrame.adjustLayout();
1106 splitFrame.repaint();
1113 * on drag left or right, decrement or increment character width
1116 if (evt.getX() < lastMousePress.getX() && av.getCharWidth() > 1)
1118 newWidth = av.getCharWidth() - 1;
1119 av.setCharWidth(newWidth);
1121 else if (evt.getX() > lastMousePress.getX())
1123 newWidth = av.getCharWidth() + 1;
1124 av.setCharWidth(newWidth);
1128 ap.paintAlignment(false, false);
1132 * need to ensure newWidth is set on cdna, regardless of which
1133 * panel the mouse drag happened in; protein will compute its
1134 * character width as 1:1 or 3:1
1136 av.getCodingComplement().setCharWidth(newWidth);
1137 SplitFrame splitFrame = (SplitFrame) ap.alignFrame
1138 .getSplitViewContainer();
1139 splitFrame.adjustLayout();
1140 splitFrame.repaint();
1145 FontMetrics fm = getFontMetrics(av.getFont());
1146 av.validCharWidth = fm.charWidth('M') <= av.getCharWidth();
1148 lastMousePress = evt.getPoint();
1155 doMouseDraggedDefineMode(evt);
1159 int res = findColumn(evt);
1166 if ((lastres == -1) || (lastres == res))
1171 if ((res < av.getAlignment().getWidth()) && (res < lastres))
1173 // dragLeft, delete gap
1174 editSequence(false, false, res);
1178 editSequence(true, false, res);
1181 mouseDragging = true;
1182 if ((scrollThread != null) && (scrollThread.isRunning()))
1184 scrollThread.setEvent(evt);
1188 // TODO: Make it more clever than many booleans
1189 synchronized void editSequence(boolean insertGap, boolean editSeq,
1193 int fixedRight = -1;
1194 boolean fixedColumns = false;
1195 SequenceGroup sg = av.getSelectionGroup();
1197 SequenceI seq = av.getAlignment().getSequenceAt(startseq);
1199 // No group, but the sequence may represent a group
1200 if (!groupEditing && av.hasHiddenRows())
1202 if (av.isHiddenRepSequence(seq))
1204 sg = av.getRepresentedSequences(seq);
1205 groupEditing = true;
1209 StringBuilder message = new StringBuilder(64);
1212 message.append("Edit group:");
1213 if (editCommand == null)
1215 editCommand = new EditCommand(
1216 MessageManager.getString("action.edit_group"));
1221 message.append("Edit sequence: " + seq.getName());
1222 String label = seq.getName();
1223 if (label.length() > 10)
1225 label = label.substring(0, 10);
1227 if (editCommand == null)
1229 editCommand = new EditCommand(MessageManager
1230 .formatMessage("label.edit_params", new String[]
1237 message.append(" insert ");
1241 message.append(" delete ");
1244 message.append(Math.abs(startres - lastres) + " gaps.");
1245 ap.alignFrame.statusBar.setText(message.toString());
1247 // Are we editing within a selection group?
1248 if (groupEditing || (sg != null
1249 && sg.getSequences(av.getHiddenRepSequences()).contains(seq)))
1251 fixedColumns = true;
1253 // sg might be null as the user may only see 1 sequence,
1254 // but the sequence represents a group
1257 if (!av.isHiddenRepSequence(seq))
1262 sg = av.getRepresentedSequences(seq);
1265 fixedLeft = sg.getStartRes();
1266 fixedRight = sg.getEndRes();
1268 if ((startres < fixedLeft && lastres >= fixedLeft)
1269 || (startres >= fixedLeft && lastres < fixedLeft)
1270 || (startres > fixedRight && lastres <= fixedRight)
1271 || (startres <= fixedRight && lastres > fixedRight))
1277 if (fixedLeft > startres)
1279 fixedRight = fixedLeft - 1;
1282 else if (fixedRight < startres)
1284 fixedLeft = fixedRight;
1289 if (av.hasHiddenColumns())
1291 fixedColumns = true;
1292 int y1 = av.getAlignment().getHiddenColumns()
1293 .getNextHiddenBoundary(true, startres);
1294 int y2 = av.getAlignment().getHiddenColumns()
1295 .getNextHiddenBoundary(false, startres);
1297 if ((insertGap && startres > y1 && lastres < y1)
1298 || (!insertGap && startres < y2 && lastres > y2))
1304 // System.out.print(y1+" "+y2+" "+fixedLeft+" "+fixedRight+"~~");
1305 // Selection spans a hidden region
1306 if (fixedLeft < y1 && (fixedRight > y2 || fixedRight == -1))
1314 fixedRight = y2 - 1;
1321 List<SequenceI> vseqs = sg.getSequences(av.getHiddenRepSequences());
1322 int g, groupSize = vseqs.size();
1323 SequenceI[] groupSeqs = new SequenceI[groupSize];
1324 for (g = 0; g < groupSeqs.length; g++)
1326 groupSeqs[g] = vseqs.get(g);
1332 // If the user has selected the whole sequence, and is dragging to
1333 // the right, we can still extend the alignment and selectionGroup
1334 if (sg.getStartRes() == 0 && sg.getEndRes() == fixedRight
1335 && sg.getEndRes() == av.getAlignment().getWidth() - 1)
1337 sg.setEndRes(av.getAlignment().getWidth() + startres - lastres);
1338 fixedRight = sg.getEndRes();
1341 // Is it valid with fixed columns??
1342 // Find the next gap before the end
1343 // of the visible region boundary
1344 boolean blank = false;
1345 for (; fixedRight > lastres; fixedRight--)
1349 for (g = 0; g < groupSize; g++)
1351 for (int j = 0; j < startres - lastres; j++)
1353 if (!Comparison.isGap(groupSeqs[g].getCharAt(fixedRight - j)))
1368 if (sg.getSize() == av.getAlignment().getHeight())
1370 if ((av.hasHiddenColumns() && startres < av.getAlignment()
1372 .getNextHiddenBoundary(false, startres)))
1378 int alWidth = av.getAlignment().getWidth();
1379 if (av.hasHiddenRows())
1381 int hwidth = av.getAlignment().getHiddenSequences()
1383 if (hwidth > alWidth)
1388 // We can still insert gaps if the selectionGroup
1389 // contains all the sequences
1390 sg.setEndRes(sg.getEndRes() + startres - lastres);
1391 fixedRight = alWidth + startres - lastres;
1402 else if (!insertGap)
1404 // / Are we able to delete?
1405 // ie are all columns blank?
1407 for (g = 0; g < groupSize; g++)
1409 for (int j = startres; j < lastres; j++)
1411 if (groupSeqs[g].getLength() <= j)
1416 if (!Comparison.isGap(groupSeqs[g].getCharAt(j)))
1418 // Not a gap, block edit not valid
1428 // dragging to the right
1429 if (fixedColumns && fixedRight != -1)
1431 for (int j = lastres; j < startres; j++)
1433 insertChar(j, groupSeqs, fixedRight);
1438 appendEdit(Action.INSERT_GAP, groupSeqs, startres,
1439 startres - lastres);
1444 // dragging to the left
1445 if (fixedColumns && fixedRight != -1)
1447 for (int j = lastres; j > startres; j--)
1449 deleteChar(startres, groupSeqs, fixedRight);
1454 appendEdit(Action.DELETE_GAP, groupSeqs, startres,
1455 lastres - startres);
1461 // ///Editing a single sequence///////////
1465 // dragging to the right
1466 if (fixedColumns && fixedRight != -1)
1468 for (int j = lastres; j < startres; j++)
1470 insertChar(j, new SequenceI[] { seq }, fixedRight);
1475 appendEdit(Action.INSERT_GAP, new SequenceI[] { seq }, lastres,
1476 startres - lastres);
1483 // dragging to the left
1484 if (fixedColumns && fixedRight != -1)
1486 for (int j = lastres; j > startres; j--)
1488 if (!Comparison.isGap(seq.getCharAt(startres)))
1493 deleteChar(startres, new SequenceI[] { seq }, fixedRight);
1498 // could be a keyboard edit trying to delete none gaps
1500 for (int m = startres; m < lastres; m++)
1502 if (!Comparison.isGap(seq.getCharAt(m)))
1511 appendEdit(Action.DELETE_GAP, new SequenceI[] { seq },
1517 {// insertGap==false AND editSeq==TRUE;
1518 if (fixedColumns && fixedRight != -1)
1520 for (int j = lastres; j < startres; j++)
1522 insertChar(j, new SequenceI[] { seq }, fixedRight);
1527 appendEdit(Action.INSERT_NUC, new SequenceI[] { seq }, lastres,
1528 startres - lastres);
1535 seqCanvas.repaint();
1538 void insertChar(int j, SequenceI[] seq, int fixedColumn)
1540 int blankColumn = fixedColumn;
1541 for (int s = 0; s < seq.length; s++)
1543 // Find the next gap before the end of the visible region boundary
1544 // If lastCol > j, theres a boundary after the gap insertion
1546 for (blankColumn = fixedColumn; blankColumn > j; blankColumn--)
1548 if (Comparison.isGap(seq[s].getCharAt(blankColumn)))
1550 // Theres a space, so break and insert the gap
1555 if (blankColumn <= j)
1557 blankColumn = fixedColumn;
1563 appendEdit(Action.DELETE_GAP, seq, blankColumn, 1);
1565 appendEdit(Action.INSERT_GAP, seq, j, 1);
1570 * Helper method to add and perform one edit action.
1577 protected void appendEdit(Action action, SequenceI[] seq, int pos,
1581 final Edit edit = new EditCommand().new Edit(action, seq, pos, count,
1582 av.getAlignment().getGapCharacter());
1584 editCommand.appendEdit(edit, av.getAlignment(), true, null);
1587 void deleteChar(int j, SequenceI[] seq, int fixedColumn)
1590 appendEdit(Action.DELETE_GAP, seq, j, 1);
1592 appendEdit(Action.INSERT_GAP, seq, fixedColumn, 1);
1602 public void mouseEntered(MouseEvent e)
1609 if ((scrollThread != null) && (scrollThread.isRunning()))
1611 scrollThread.stopScrolling();
1612 scrollThread = null;
1623 public void mouseExited(MouseEvent e)
1625 if (av.getWrapAlignment())
1630 if (mouseDragging && scrollThread == null)
1632 scrollThread = new ScrollThread();
1637 * Handler for double-click on a position with one or more sequence features.
1638 * Opens the Amend Features dialog to allow feature details to be amended, or
1639 * the feature deleted.
1642 public void mouseClicked(MouseEvent evt)
1644 SequenceGroup sg = null;
1645 SequenceI sequence = av.getAlignment().getSequenceAt(findSeq(evt));
1646 if (evt.getClickCount() > 1)
1648 sg = av.getSelectionGroup();
1649 if (sg != null && sg.getSize() == 1
1650 && sg.getEndRes() - sg.getStartRes() < 2)
1652 av.setSelectionGroup(null);
1655 int column = findColumn(evt);
1658 * find features at the position (if not gapped), or straddling
1659 * the position (if at a gap)
1661 List<SequenceFeature> features = seqCanvas.getFeatureRenderer()
1662 .findFeaturesAtColumn(sequence, column + 1);
1664 if (!features.isEmpty())
1667 * highlight the first feature at the position on the alignment
1669 SearchResultsI highlight = new SearchResults();
1670 highlight.addResult(sequence, features.get(0).getBegin(), features
1672 seqCanvas.highlightSearchResults(highlight, false);
1675 * open the Amend Features dialog; clear highlighting afterwards,
1676 * whether changes were made or not
1678 List<SequenceI> seqs = Collections.singletonList(sequence);
1679 seqCanvas.getFeatureRenderer().amendFeatures(seqs, features, false,
1681 av.setSearchResults(null); // clear highlighting
1682 seqCanvas.repaint(); // draw new/amended features
1688 public void mouseWheelMoved(MouseWheelEvent e)
1691 double wheelRotation = e.getPreciseWheelRotation();
1692 if (wheelRotation > 0)
1694 if (e.isShiftDown())
1696 av.getRanges().scrollRight(true);
1701 av.getRanges().scrollUp(false);
1704 else if (wheelRotation < 0)
1706 if (e.isShiftDown())
1708 av.getRanges().scrollRight(false);
1712 av.getRanges().scrollUp(true);
1717 * update status bar and tooltip for new position
1718 * (need to synthesize a mouse movement to refresh tooltip)
1721 ToolTipManager.sharedInstance().mouseMoved(e);
1730 public void doMousePressedDefineMode(MouseEvent evt)
1732 final int res = findColumn(evt);
1733 final int seq = findSeq(evt);
1735 updateOverviewAndStructs = false;
1737 startWrapBlock = wrappedBlock;
1739 if (av.getWrapAlignment() && seq > av.getAlignment().getHeight())
1741 JvOptionPane.showInternalMessageDialog(Desktop.desktop,
1742 MessageManager.getString(
1743 "label.cannot_edit_annotations_in_wrapped_view"),
1744 MessageManager.getString("label.wrapped_view_no_edit"),
1745 JvOptionPane.WARNING_MESSAGE);
1749 if (seq < 0 || res < 0)
1754 SequenceI sequence = av.getAlignment().getSequenceAt(seq);
1756 if ((sequence == null) || (res > sequence.getLength()))
1761 stretchGroup = av.getSelectionGroup();
1763 if (stretchGroup == null || !stretchGroup.contains(sequence, res))
1765 stretchGroup = av.getAlignment().findGroup(sequence, res);
1766 if (stretchGroup != null)
1768 // only update the current selection if the popup menu has a group to
1770 av.setSelectionGroup(stretchGroup);
1774 if (evt.isPopupTrigger()) // Mac: mousePressed
1781 * defer right-mouse click handling to mouseReleased on Windows
1782 * (where isPopupTrigger() will answer true)
1783 * NB isRightMouseButton is also true for Cmd-click on Mac
1785 if (SwingUtilities.isRightMouseButton(evt) && !Platform.isAMac())
1792 seqCanvas.cursorX = findColumn(evt);
1793 seqCanvas.cursorY = findSeq(evt);
1794 seqCanvas.repaint();
1798 if (stretchGroup == null)
1800 createStretchGroup(res, sequence);
1803 if (stretchGroup != null)
1805 stretchGroup.addPropertyChangeListener(seqCanvas);
1808 seqCanvas.repaint();
1811 private void createStretchGroup(int res, SequenceI sequence)
1813 // Only if left mouse button do we want to change group sizes
1814 // define a new group here
1815 SequenceGroup sg = new SequenceGroup();
1816 sg.setStartRes(res);
1818 sg.addSequence(sequence, false);
1819 av.setSelectionGroup(sg);
1822 if (av.getConservationSelected())
1824 SliderPanel.setConservationSlider(ap, av.getResidueShading(),
1828 if (av.getAbovePIDThreshold())
1830 SliderPanel.setPIDSliderSource(ap, av.getResidueShading(),
1833 // TODO: stretchGroup will always be not null. Is this a merge error ?
1834 // or is there a threading issue here?
1835 if ((stretchGroup != null) && (stretchGroup.getEndRes() == res))
1837 // Edit end res position of selected group
1838 changeEndRes = true;
1840 else if ((stretchGroup != null) && (stretchGroup.getStartRes() == res))
1842 // Edit end res position of selected group
1843 changeStartRes = true;
1845 stretchGroup.getWidth();
1850 * Build and show a pop-up menu at the right-click mouse position
1856 void showPopupMenu(MouseEvent evt)
1858 final int column = findColumn(evt);
1859 final int seq = findSeq(evt);
1860 SequenceI sequence = av.getAlignment().getSequenceAt(seq);
1861 List<SequenceFeature> features = ap.getFeatureRenderer()
1862 .findFeaturesAtColumn(sequence, column + 1);
1864 PopupMenu pop = new PopupMenu(ap, null, features);
1865 pop.show(this, evt.getX(), evt.getY());
1869 * Update the display after mouse up on a selection or group
1872 * mouse released event details
1874 * true if this event is happening after a mouse drag (rather than a
1877 public void doMouseReleasedDefineMode(MouseEvent evt, boolean afterDrag)
1879 if (stretchGroup == null)
1884 stretchGroup.removePropertyChangeListener(seqCanvas);
1886 // always do this - annotation has own state
1887 // but defer colourscheme update until hidden sequences are passed in
1888 boolean vischange = stretchGroup.recalcConservation(true);
1889 updateOverviewAndStructs |= vischange && av.isSelectionDefinedGroup()
1891 if (stretchGroup.cs != null)
1893 stretchGroup.cs.alignmentChanged(stretchGroup,
1894 av.getHiddenRepSequences());
1896 ResidueShaderI groupColourScheme = stretchGroup
1897 .getGroupColourScheme();
1898 String name = stretchGroup.getName();
1899 if (stretchGroup.cs.conservationApplied())
1901 SliderPanel.setConservationSlider(ap, groupColourScheme, name);
1903 if (stretchGroup.cs.getThreshold() > 0)
1905 SliderPanel.setPIDSliderSource(ap, groupColourScheme, name);
1908 PaintRefresher.Refresh(this, av.getSequenceSetId());
1909 // TODO: structure colours only need updating if stretchGroup used to or now
1910 // does contain sequences with structure views
1911 ap.paintAlignment(updateOverviewAndStructs, updateOverviewAndStructs);
1912 updateOverviewAndStructs = false;
1913 changeEndRes = false;
1914 changeStartRes = false;
1915 stretchGroup = null;
1925 public void doMouseDraggedDefineMode(MouseEvent evt)
1927 int res = findColumn(evt);
1928 int y = findSeq(evt);
1930 if (wrappedBlock != startWrapBlock)
1935 if (stretchGroup == null)
1940 if (res >= av.getAlignment().getWidth())
1942 res = av.getAlignment().getWidth() - 1;
1945 if (stretchGroup.getEndRes() == res)
1947 // Edit end res position of selected group
1948 changeEndRes = true;
1950 else if (stretchGroup.getStartRes() == res)
1952 // Edit start res position of selected group
1953 changeStartRes = true;
1956 if (res < av.getRanges().getStartRes())
1958 res = av.getRanges().getStartRes();
1963 if (res > (stretchGroup.getStartRes() - 1))
1965 stretchGroup.setEndRes(res);
1966 updateOverviewAndStructs |= av.isSelectionDefinedGroup();
1969 else if (changeStartRes)
1971 if (res < (stretchGroup.getEndRes() + 1))
1973 stretchGroup.setStartRes(res);
1974 updateOverviewAndStructs |= av.isSelectionDefinedGroup();
1978 int dragDirection = 0;
1984 else if (y < oldSeq)
1989 while ((y != oldSeq) && (oldSeq > -1)
1990 && (y < av.getAlignment().getHeight()))
1992 // This routine ensures we don't skip any sequences, as the
1993 // selection is quite slow.
1994 Sequence seq = (Sequence) av.getAlignment().getSequenceAt(oldSeq);
1996 oldSeq += dragDirection;
2003 Sequence nextSeq = (Sequence) av.getAlignment().getSequenceAt(oldSeq);
2005 if (stretchGroup.getSequences(null).contains(nextSeq))
2007 stretchGroup.deleteSequence(seq, false);
2008 updateOverviewAndStructs |= av.isSelectionDefinedGroup();
2014 stretchGroup.addSequence(seq, false);
2017 stretchGroup.addSequence(nextSeq, false);
2018 updateOverviewAndStructs |= av.isSelectionDefinedGroup();
2027 mouseDragging = true;
2029 if ((scrollThread != null) && (scrollThread.isRunning()))
2031 scrollThread.setEvent(evt);
2035 void scrollCanvas(MouseEvent evt)
2039 if ((scrollThread != null) && (scrollThread.isRunning()))
2041 scrollThread.stopScrolling();
2042 scrollThread = null;
2044 mouseDragging = false;
2048 if (scrollThread == null)
2050 scrollThread = new ScrollThread();
2053 mouseDragging = true;
2054 scrollThread.setEvent(evt);
2059 // this class allows scrolling off the bottom of the visible alignment
2060 class ScrollThread extends Thread
2064 private volatile boolean threadRunning = true;
2066 public ScrollThread()
2071 public void setEvent(MouseEvent e)
2076 public void stopScrolling()
2078 threadRunning = false;
2081 public boolean isRunning()
2083 return threadRunning;
2089 while (threadRunning)
2093 if (mouseDragging && (evt.getY() < 0)
2094 && (av.getRanges().getStartSeq() > 0))
2096 av.getRanges().scrollUp(true);
2099 if (mouseDragging && (evt.getY() >= getHeight()) && (av
2100 .getAlignment().getHeight() > av.getRanges().getEndSeq()))
2102 av.getRanges().scrollUp(false);
2105 if (mouseDragging && (evt.getX() < 0))
2107 av.getRanges().scrollRight(false);
2109 else if (mouseDragging && (evt.getX() >= getWidth()))
2111 av.getRanges().scrollRight(true);
2118 } catch (Exception ex)
2126 * modify current selection according to a received message.
2129 public void selection(SequenceGroup seqsel, ColumnSelection colsel,
2130 HiddenColumns hidden, SelectionSource source)
2132 // TODO: fix this hack - source of messages is align viewport, but SeqPanel
2133 // handles selection messages...
2134 // TODO: extend config options to allow user to control if selections may be
2135 // shared between viewports.
2136 boolean iSentTheSelection = (av == source
2137 || (source instanceof AlignViewport
2138 && ((AlignmentViewport) source).getSequenceSetId()
2139 .equals(av.getSequenceSetId())));
2141 if (iSentTheSelection)
2143 // respond to our own event by updating dependent dialogs
2144 if (ap.getCalculationDialog() != null)
2146 ap.getCalculationDialog().validateCalcTypes();
2152 // process further ?
2153 if (!av.followSelection)
2159 * Ignore the selection if there is one of our own pending.
2161 if (av.isSelectionGroupChanged(false) || av.isColSelChanged(false))
2167 * Check for selection in a view of which this one is a dna/protein
2170 if (selectionFromTranslation(seqsel, colsel, hidden, source))
2175 // do we want to thread this ? (contention with seqsel and colsel locks, I
2178 * only copy colsel if there is a real intersection between
2179 * sequence selection and this panel's alignment
2181 boolean repaint = false;
2182 boolean copycolsel = false;
2184 SequenceGroup sgroup = null;
2185 if (seqsel != null && seqsel.getSize() > 0)
2187 if (av.getAlignment() == null)
2189 Cache.log.warn("alignviewport av SeqSetId=" + av.getSequenceSetId()
2190 + " ViewId=" + av.getViewId()
2191 + " 's alignment is NULL! returning immediately.");
2194 sgroup = seqsel.intersect(av.getAlignment(),
2195 (av.hasHiddenRows()) ? av.getHiddenRepSequences() : null);
2196 if ((sgroup != null && sgroup.getSize() > 0))
2201 if (sgroup != null && sgroup.getSize() > 0)
2203 av.setSelectionGroup(sgroup);
2207 av.setSelectionGroup(null);
2209 av.isSelectionGroupChanged(true);
2214 // the current selection is unset or from a previous message
2215 // so import the new colsel.
2216 if (colsel == null || colsel.isEmpty())
2218 if (av.getColumnSelection() != null)
2220 av.getColumnSelection().clear();
2226 // TODO: shift colSel according to the intersecting sequences
2227 if (av.getColumnSelection() == null)
2229 av.setColumnSelection(new ColumnSelection(colsel));
2233 av.getColumnSelection().setElementsFrom(colsel,
2234 av.getAlignment().getHiddenColumns());
2237 av.isColSelChanged(true);
2241 if (copycolsel && av.hasHiddenColumns()
2242 && (av.getAlignment().getHiddenColumns() == null))
2244 System.err.println("Bad things");
2246 if (repaint) // always true!
2248 // probably finessing with multiple redraws here
2249 PaintRefresher.Refresh(this, av.getSequenceSetId());
2250 // ap.paintAlignment(false);
2253 // lastly, update dependent dialogs
2254 if (ap.getCalculationDialog() != null)
2256 ap.getCalculationDialog().validateCalcTypes();
2262 * If this panel is a cdna/protein translation view of the selection source,
2263 * tries to map the source selection to a local one, and returns true. Else
2270 protected boolean selectionFromTranslation(SequenceGroup seqsel,
2271 ColumnSelection colsel, HiddenColumns hidden,
2272 SelectionSource source)
2274 if (!(source instanceof AlignViewportI))
2278 final AlignViewportI sourceAv = (AlignViewportI) source;
2279 if (sourceAv.getCodingComplement() != av
2280 && av.getCodingComplement() != sourceAv)
2286 * Map sequence selection
2288 SequenceGroup sg = MappingUtils.mapSequenceGroup(seqsel, sourceAv, av);
2289 av.setSelectionGroup(sg);
2290 av.isSelectionGroupChanged(true);
2293 * Map column selection
2295 // ColumnSelection cs = MappingUtils.mapColumnSelection(colsel, sourceAv,
2297 ColumnSelection cs = new ColumnSelection();
2298 HiddenColumns hs = new HiddenColumns();
2299 MappingUtils.mapColumnSelection(colsel, hidden, sourceAv, av, cs, hs);
2300 av.setColumnSelection(cs);
2301 av.getAlignment().setHiddenColumns(hs);
2303 // lastly, update any dependent dialogs
2304 if (ap.getCalculationDialog() != null)
2306 ap.getCalculationDialog().validateCalcTypes();
2309 PaintRefresher.Refresh(this, av.getSequenceSetId());
2316 * @return null or last search results handled by this panel
2318 public SearchResultsI getLastSearchResults()
2320 return lastSearchResults;