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;
52 import java.awt.BorderLayout;
53 import java.awt.Color;
55 import java.awt.FontMetrics;
56 import java.awt.Point;
57 import java.awt.event.MouseEvent;
58 import java.awt.event.MouseListener;
59 import java.awt.event.MouseMotionListener;
60 import java.awt.event.MouseWheelEvent;
61 import java.awt.event.MouseWheelListener;
62 import java.util.Collections;
63 import java.util.List;
65 import javax.swing.JLabel;
66 import javax.swing.JPanel;
67 import javax.swing.JToolTip;
68 import javax.swing.SwingUtilities;
69 import javax.swing.ToolTipManager;
75 * @version $Revision: 1.130 $
77 public class SeqPanel extends JPanel
78 implements MouseListener, MouseMotionListener, MouseWheelListener,
79 SequenceListener, SelectionListener
81 private static final int MAX_TOOLTIP_LENGTH = 300;
83 public SeqCanvas seqCanvas;
85 public AlignmentPanel ap;
88 * last column position for mouseMoved event
90 private int lastMouseColumn;
93 * last sequence offset for mouseMoved event
95 private int lastMouseSeq;
97 protected int lastres;
99 protected int startseq;
101 protected AlignViewport av;
103 ScrollThread scrollThread = null;
105 boolean mouseDragging = false;
107 boolean editingSeqs = false;
109 boolean groupEditing = false;
111 // ////////////////////////////////////////
112 // ///Everything below this is for defining the boundary of the rubberband
113 // ////////////////////////////////////////
116 boolean changeEndSeq = false;
118 boolean changeStartSeq = false;
120 boolean changeEndRes = false;
122 boolean changeStartRes = false;
124 SequenceGroup stretchGroup = null;
126 boolean remove = false;
128 Point lastMousePress;
130 boolean mouseWheelPressed = false;
132 StringBuffer keyboardNo1;
134 StringBuffer keyboardNo2;
136 java.net.URL linkImageURL;
138 private final SequenceAnnotationReport seqARep;
140 StringBuilder tooltipText = new StringBuilder();
144 EditCommand editCommand;
146 StructureSelectionManager ssm;
148 SearchResultsI lastSearchResults;
151 * Creates a new SeqPanel object
156 public SeqPanel(AlignViewport viewport, AlignmentPanel alignPanel)
158 linkImageURL = getClass().getResource("/images/link.gif");
159 seqARep = new SequenceAnnotationReport(linkImageURL.toString());
160 ToolTipManager.sharedInstance().registerComponent(this);
161 ToolTipManager.sharedInstance().setInitialDelay(0);
162 ToolTipManager.sharedInstance().setDismissDelay(10000);
166 setBackground(Color.white);
168 seqCanvas = new SeqCanvas(alignPanel);
169 setLayout(new BorderLayout());
170 add(seqCanvas, BorderLayout.CENTER);
172 this.ap = alignPanel;
174 if (!viewport.isDataset())
176 addMouseMotionListener(this);
177 addMouseListener(this);
178 addMouseWheelListener(this);
179 ssm = viewport.getStructureSelectionManager();
180 ssm.addStructureViewerListener(this);
181 ssm.addSelectionListener(this);
184 lastMouseColumn = -1;
188 int startWrapBlock = -1;
190 int wrappedBlock = -1;
193 * Returns the aligned sequence position (base 0) at the mouse position, or
194 * the closest visible one
199 int findColumn(MouseEvent evt)
204 int startRes = av.getRanges().getStartRes();
205 if (av.getWrapAlignment())
208 int hgap = av.getCharHeight();
209 if (av.getScaleAboveWrapped())
211 hgap += av.getCharHeight();
214 int cHeight = av.getAlignment().getHeight() * av.getCharHeight()
215 + hgap + seqCanvas.getAnnotationHeight();
218 y = Math.max(0, y - hgap);
219 x = Math.max(0, x - seqCanvas.getLabelWidthWest());
221 int cwidth = seqCanvas.getWrappedCanvasWidth(this.getWidth());
227 wrappedBlock = y / cHeight;
228 wrappedBlock += startRes / cwidth;
229 // allow for wrapped view scrolled right (possible from Overview)
230 int startOffset = startRes % cwidth;
231 res = wrappedBlock * cwidth + startOffset
232 + +Math.min(cwidth - 1, x / av.getCharWidth());
236 if (x > seqCanvas.getX() + seqCanvas.getWidth())
238 // make sure we calculate relative to visible alignment, rather than
240 x = seqCanvas.getX() + seqCanvas.getWidth();
242 res = (x / av.getCharWidth()) + startRes;
243 if (res > av.getRanges().getEndRes())
246 res = av.getRanges().getEndRes();
250 if (av.hasHiddenColumns())
252 res = av.getAlignment().getHiddenColumns()
253 .visibleToAbsoluteColumn(res);
260 int findSeq(MouseEvent evt)
265 if (av.getWrapAlignment())
267 int hgap = av.getCharHeight();
268 if (av.getScaleAboveWrapped())
270 hgap += av.getCharHeight();
273 int cHeight = av.getAlignment().getHeight() * av.getCharHeight()
274 + hgap + seqCanvas.getAnnotationHeight();
278 seq = Math.min((y % cHeight) / av.getCharHeight(),
279 av.getAlignment().getHeight() - 1);
284 (y / av.getCharHeight()) + av.getRanges().getStartSeq(),
285 av.getAlignment().getHeight() - 1);
292 * When all of a sequence of edits are complete, put the resulting edit list
293 * on the history stack (undo list), and reset flags for editing in progress.
299 if (editCommand != null && editCommand.getSize() > 0)
301 ap.alignFrame.addHistoryItem(editCommand);
302 av.firePropertyChange("alignment", null,
303 av.getAlignment().getSequences());
308 * Tidy up come what may...
313 groupEditing = false;
322 seqCanvas.cursorY = getKeyboardNo1() - 1;
323 scrollToVisible(true);
326 void setCursorColumn()
328 seqCanvas.cursorX = getKeyboardNo1() - 1;
329 scrollToVisible(true);
332 void setCursorRowAndColumn()
334 if (keyboardNo2 == null)
336 keyboardNo2 = new StringBuffer();
340 seqCanvas.cursorX = getKeyboardNo1() - 1;
341 seqCanvas.cursorY = getKeyboardNo2() - 1;
342 scrollToVisible(true);
346 void setCursorPosition()
348 SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY);
350 seqCanvas.cursorX = sequence.findIndex(getKeyboardNo1()) - 1;
351 scrollToVisible(true);
354 void moveCursor(int dx, int dy)
356 seqCanvas.cursorX += dx;
357 seqCanvas.cursorY += dy;
359 HiddenColumns hidden = av.getAlignment().getHiddenColumns();
361 if (av.hasHiddenColumns() && !hidden.isVisible(seqCanvas.cursorX))
363 int original = seqCanvas.cursorX - dx;
364 int maxWidth = av.getAlignment().getWidth();
366 if (!hidden.isVisible(seqCanvas.cursorX))
368 int visx = hidden.absoluteToVisibleColumn(seqCanvas.cursorX - dx);
369 int[] region = hidden.getRegionWithEdgeAtRes(visx);
371 if (region != null) // just in case
376 seqCanvas.cursorX = region[1] + 1;
381 seqCanvas.cursorX = region[0] - 1;
384 seqCanvas.cursorX = (seqCanvas.cursorX < 0) ? 0 : seqCanvas.cursorX;
387 if (seqCanvas.cursorX >= maxWidth
388 || !hidden.isVisible(seqCanvas.cursorX))
390 seqCanvas.cursorX = original;
394 scrollToVisible(false);
398 * Scroll to make the cursor visible in the viewport.
401 * just jump to the location rather than scrolling
403 void scrollToVisible(boolean jump)
405 if (seqCanvas.cursorX < 0)
407 seqCanvas.cursorX = 0;
409 else if (seqCanvas.cursorX > av.getAlignment().getWidth() - 1)
411 seqCanvas.cursorX = av.getAlignment().getWidth() - 1;
414 if (seqCanvas.cursorY < 0)
416 seqCanvas.cursorY = 0;
418 else if (seqCanvas.cursorY > av.getAlignment().getHeight() - 1)
420 seqCanvas.cursorY = av.getAlignment().getHeight() - 1;
425 boolean repaintNeeded = true;
428 // only need to repaint if the viewport did not move, as otherwise it will
430 repaintNeeded = !av.getRanges().setViewportLocation(seqCanvas.cursorX,
435 if (av.getWrapAlignment())
437 // scrollToWrappedVisible expects x-value to have hidden cols subtracted
438 int x = av.getAlignment().getHiddenColumns()
439 .absoluteToVisibleColumn(seqCanvas.cursorX);
440 av.getRanges().scrollToWrappedVisible(x);
444 av.getRanges().scrollToVisible(seqCanvas.cursorX,
449 if (av.getAlignment().getHiddenColumns().isVisible(seqCanvas.cursorX))
451 setStatusMessage(av.getAlignment().getSequenceAt(seqCanvas.cursorY),
452 seqCanvas.cursorX, seqCanvas.cursorY);
462 void setSelectionAreaAtCursor(boolean topLeft)
464 SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY);
466 if (av.getSelectionGroup() != null)
468 SequenceGroup sg = av.getSelectionGroup();
469 // Find the top and bottom of this group
470 int min = av.getAlignment().getHeight(), max = 0;
471 for (int i = 0; i < sg.getSize(); i++)
473 int index = av.getAlignment().findIndex(sg.getSequenceAt(i));
488 sg.setStartRes(seqCanvas.cursorX);
489 if (sg.getEndRes() < seqCanvas.cursorX)
491 sg.setEndRes(seqCanvas.cursorX);
494 min = seqCanvas.cursorY;
498 sg.setEndRes(seqCanvas.cursorX);
499 if (sg.getStartRes() > seqCanvas.cursorX)
501 sg.setStartRes(seqCanvas.cursorX);
504 max = seqCanvas.cursorY + 1;
509 // Only the user can do this
510 av.setSelectionGroup(null);
514 // Now add any sequences between min and max
515 sg.getSequences(null).clear();
516 for (int i = min; i < max; i++)
518 sg.addSequence(av.getAlignment().getSequenceAt(i), false);
523 if (av.getSelectionGroup() == null)
525 SequenceGroup sg = new SequenceGroup();
526 sg.setStartRes(seqCanvas.cursorX);
527 sg.setEndRes(seqCanvas.cursorX);
528 sg.addSequence(sequence, false);
529 av.setSelectionGroup(sg);
532 ap.paintAlignment(false, false);
536 void insertGapAtCursor(boolean group)
538 groupEditing = group;
539 startseq = seqCanvas.cursorY;
540 lastres = seqCanvas.cursorX;
541 editSequence(true, false, seqCanvas.cursorX + getKeyboardNo1());
545 void deleteGapAtCursor(boolean group)
547 groupEditing = group;
548 startseq = seqCanvas.cursorY;
549 lastres = seqCanvas.cursorX + getKeyboardNo1();
550 editSequence(false, false, seqCanvas.cursorX);
554 void insertNucAtCursor(boolean group, String nuc)
556 // TODO not called - delete?
557 groupEditing = group;
558 startseq = seqCanvas.cursorY;
559 lastres = seqCanvas.cursorX;
560 editSequence(false, true, seqCanvas.cursorX + getKeyboardNo1());
564 void numberPressed(char value)
566 if (keyboardNo1 == null)
568 keyboardNo1 = new StringBuffer();
571 if (keyboardNo2 != null)
573 keyboardNo2.append(value);
577 keyboardNo1.append(value);
585 if (keyboardNo1 != null)
587 int value = Integer.parseInt(keyboardNo1.toString());
591 } catch (Exception x)
602 if (keyboardNo2 != null)
604 int value = Integer.parseInt(keyboardNo2.toString());
608 } catch (Exception x)
622 public void mouseReleased(MouseEvent evt)
624 boolean didDrag = mouseDragging; // did we come here after a drag
625 mouseDragging = false;
626 mouseWheelPressed = false;
628 if (evt.isPopupTrigger()) // Windows: mouseReleased
637 doMouseReleasedDefineMode(evt, didDrag);
651 public void mousePressed(MouseEvent evt)
653 lastMousePress = evt.getPoint();
655 if (SwingUtilities.isMiddleMouseButton(evt))
657 mouseWheelPressed = true;
661 boolean isControlDown = Platform.isControlDown(evt);
662 if (evt.isShiftDown() || isControlDown)
672 doMousePressedDefineMode(evt);
676 int seq = findSeq(evt);
677 int res = findColumn(evt);
679 if (seq < 0 || res < 0)
684 if ((seq < av.getAlignment().getHeight())
685 && (res < av.getAlignment().getSequenceAt(seq).getLength()))
701 private String formattedTooltipText;
704 public void mouseOverSequence(SequenceI sequence, int index, int pos)
706 String tmp = sequence.hashCode() + " " + index + " " + pos;
708 if (lastMessage == null || !lastMessage.equals(tmp))
710 // System.err.println("mouseOver Sequence: "+tmp);
711 ssm.mouseOverSequence(sequence, index, pos, av);
717 * Highlight the mapped region described by the search results object (unless
718 * unchanged). This supports highlight of protein while mousing over linked
719 * cDNA and vice versa. The status bar is also updated to show the location of
720 * the start of the highlighted region.
723 public void highlightSequence(SearchResultsI results)
725 if (results == null || results.equals(lastSearchResults))
729 lastSearchResults = results;
731 boolean wasScrolled = false;
733 if (av.isFollowHighlight())
735 // don't allow highlight of protein/cDNA to also scroll a complementary
736 // panel,as this sets up a feedback loop (scrolling panel 1 causes moused
737 // over residue to change abruptly, causing highlighted residue in panel 2
738 // to change, causing a scroll in panel 1 etc)
739 ap.setToScrollComplementPanel(false);
740 wasScrolled = ap.scrollToPosition(results, false);
743 seqCanvas.revalidate();
745 ap.setToScrollComplementPanel(true);
748 boolean fastPaint = !(wasScrolled && av.getWrapAlignment());
749 if (seqCanvas.highlightSearchResults(results, fastPaint))
751 setStatusMessage(results);
756 public VamsasSource getVamsasSource()
758 return this.ap == null ? null : this.ap.av;
762 public void updateColours(SequenceI seq, int index)
764 System.out.println("update the seqPanel colours");
769 * Action on mouse movement is to update the status bar to show the current
770 * sequence position, and (if features are shown) to show any features at the
771 * position in a tooltip. Does nothing if the mouse move does not change
777 public void mouseMoved(MouseEvent evt)
781 // This is because MacOSX creates a mouseMoved
782 // If control is down, other platforms will not.
786 final int column = findColumn(evt);
787 final int seq = findSeq(evt);
789 if (column < 0 || seq < 0 || seq >= av.getAlignment().getHeight())
794 if (column == lastMouseColumn && seq == lastMouseSeq)
797 * just a pixel move without change of residue
801 lastMouseColumn = column;
804 SequenceI sequence = av.getAlignment().getSequenceAt(seq);
806 if (column >= sequence.getLength())
812 * set status bar message, returning residue position in sequence
814 boolean isGapped = Comparison.isGap(sequence.getCharAt(column));
815 final int pos = setStatusMessage(sequence, column, seq);
816 if (ssm != null && !isGapped)
818 mouseOverSequence(sequence, column, pos);
821 tooltipText.setLength(6); // Cuts the buffer back to <html>
823 SequenceGroup[] groups = av.getAlignment().findAllGroups(sequence);
826 for (int g = 0; g < groups.length; g++)
828 if (groups[g].getStartRes() <= column
829 && groups[g].getEndRes() >= column)
831 if (!groups[g].getName().startsWith("JTreeGroup")
832 && !groups[g].getName().startsWith("JGroup"))
834 tooltipText.append(groups[g].getName());
837 if (groups[g].getDescription() != null)
839 tooltipText.append(": " + groups[g].getDescription());
846 * add any features at the position to the tooltip; if over a gap, only
847 * add features that straddle the gap (pos may be the residue before or
850 if (av.isShowSequenceFeatures())
852 List<SequenceFeature> features = ap.getFeatureRenderer()
853 .findFeaturesAtColumn(sequence, column + 1);
854 seqARep.appendFeatures(tooltipText, pos, features,
855 this.ap.getSeqPanel().seqCanvas.fr);
857 if (tooltipText.length() == 6) // <html>
859 setToolTipText(null);
864 if (tooltipText.length() > MAX_TOOLTIP_LENGTH) // constant
866 tooltipText.setLength(MAX_TOOLTIP_LENGTH);
867 tooltipText.append("...");
869 String textString = tooltipText.toString();
870 if (lastTooltip == null || !lastTooltip.equals(textString))
872 formattedTooltipText = JvSwingUtils.wrapTooltip(true,
874 setToolTipText(formattedTooltipText);
876 lastTooltip = textString;
882 private Point lastp = null;
884 private JToolTip tempTip = new JLabel().createToolTip();
889 * @see javax.swing.JComponent#getToolTipLocation(java.awt.event.MouseEvent)
892 public Point getToolTipLocation(MouseEvent event)
896 if (tooltipText == null || tooltipText.length() == 6)
899 if (lastp != null && event.isShiftDown())
903 int x = event.getX();
904 int y = event.getY();
907 tempTip.setTipText(formattedTooltipText);
908 int tipWidth = (int) tempTip.getPreferredSize().getWidth();
910 // was x += (w - x < 200) ? -(w / 2) : 5;
911 x = (x + tipWidth < w ? x + 10 : w - tipWidth);
912 p = new Point(x, y + 20); // BH 2018 was - 20?
914 * TODO: try to modify position region is not obcured by tooltip
925 * set when the current UI interaction has resulted in a change that requires
926 * shading in overviews and structures to be recalculated. this could be
927 * changed to a something more expressive that indicates what actually has
928 * changed, so selective redraws can be applied (ie. only structures, only
931 private boolean updateOverviewAndStructs = false; // TODO: refactor to avcontroller
934 * set if av.getSelectionGroup() refers to a group that is defined on the
935 * alignment view, rather than a transient selection
937 // private boolean editingDefinedGroup = false; // TODO: refactor to
938 // avcontroller or viewModel
941 * Sets the status message in alignment panel, showing the sequence number
942 * (index) and id, and residue and residue position if not at a gap, for the
943 * given sequence and column position. Returns the residue position returned
944 * by Sequence.findPosition. Note this may be for the nearest adjacent residue
945 * if at a gapped position.
948 * aligned sequence object
952 * index of sequence in alignment
953 * @return sequence position of residue at column, or adjacent residue if at a
956 int setStatusMessage(SequenceI sequence, final int column, int seqIndex)
958 char sequenceChar = sequence.getCharAt(column);
959 int pos = sequence.findPosition(column);
960 setStatusMessage(sequence, seqIndex, sequenceChar, pos);
966 * Builds the status message for the current cursor location and writes it to
967 * the status bar, for example
970 * Sequence 3 ID: FER1_SOLLC
971 * Sequence 5 ID: FER1_PEA Residue: THR (4)
972 * Sequence 5 ID: FER1_PEA Residue: B (3)
973 * Sequence 6 ID: O.niloticus.3 Nucleotide: Uracil (2)
978 * sequence position in the alignment (1..)
979 * @param sequenceChar
980 * the character under the cursor
982 * the sequence residue position (if not over a gap)
984 protected void setStatusMessage(SequenceI sequence, int seqIndex,
985 char sequenceChar, int residuePos)
987 StringBuilder text = new StringBuilder(32);
990 * Sequence number (if known), and sequence name.
992 String seqno = seqIndex == -1 ? "" : " " + (seqIndex + 1);
993 text.append("Sequence").append(seqno).append(" ID: ")
994 .append(sequence.getName());
996 String residue = null;
999 * Try to translate the display character to residue name (null for gap).
1001 boolean isGapped = Comparison.isGap(sequenceChar);
1005 boolean nucleotide = av.getAlignment().isNucleotide();
1006 String displayChar = String.valueOf(sequenceChar);
1009 residue = ResidueProperties.nucleotideName.get(displayChar);
1013 residue = "X".equalsIgnoreCase(displayChar) ? "X"
1014 : ("*".equals(displayChar) ? "STOP"
1015 : ResidueProperties.aa2Triplet.get(displayChar));
1017 text.append(" ").append(nucleotide ? "Nucleotide" : "Residue")
1018 .append(": ").append(residue == null ? displayChar : residue);
1020 text.append(" (").append(Integer.toString(residuePos)).append(")");
1022 ap.alignFrame.statusBar.setText(text.toString());
1026 * Set the status bar message to highlight the first matched position in
1031 private void setStatusMessage(SearchResultsI results)
1033 AlignmentI al = this.av.getAlignment();
1034 int sequenceIndex = al.findIndex(results);
1035 if (sequenceIndex == -1)
1039 SequenceI ds = al.getSequenceAt(sequenceIndex).getDatasetSequence();
1040 for (SearchResultMatchI m : results.getResults())
1042 SequenceI seq = m.getSequence();
1043 if (seq.getDatasetSequence() != null)
1045 seq = seq.getDatasetSequence();
1050 int start = m.getStart();
1051 setStatusMessage(seq, sequenceIndex, seq.getCharAt(start - 1),
1062 public void mouseDragged(MouseEvent evt)
1064 if (mouseWheelPressed)
1066 boolean inSplitFrame = ap.av.getCodingComplement() != null;
1067 boolean copyChanges = inSplitFrame && av.isProteinFontAsCdna();
1069 int oldWidth = av.getCharWidth();
1071 // Which is bigger, left-right or up-down?
1072 if (Math.abs(evt.getY() - lastMousePress.getY()) > Math
1073 .abs(evt.getX() - lastMousePress.getX()))
1076 * on drag up or down, decrement or increment font size
1078 int fontSize = av.font.getSize();
1079 boolean fontChanged = false;
1081 if (evt.getY() < lastMousePress.getY())
1086 else if (evt.getY() > lastMousePress.getY())
1099 Font newFont = new Font(av.font.getName(), av.font.getStyle(),
1101 av.setFont(newFont, true);
1102 av.setCharWidth(oldWidth);
1106 ap.av.getCodingComplement().setFont(newFont, true);
1107 SplitFrame splitFrame = (SplitFrame) ap.alignFrame
1108 .getSplitViewContainer();
1109 splitFrame.adjustLayout();
1110 splitFrame.repaint();
1117 * on drag left or right, decrement or increment character width
1120 if (evt.getX() < lastMousePress.getX() && av.getCharWidth() > 1)
1122 newWidth = av.getCharWidth() - 1;
1123 av.setCharWidth(newWidth);
1125 else if (evt.getX() > lastMousePress.getX())
1127 newWidth = av.getCharWidth() + 1;
1128 av.setCharWidth(newWidth);
1132 ap.paintAlignment(false, false);
1136 * need to ensure newWidth is set on cdna, regardless of which
1137 * panel the mouse drag happened in; protein will compute its
1138 * character width as 1:1 or 3:1
1140 av.getCodingComplement().setCharWidth(newWidth);
1141 SplitFrame splitFrame = (SplitFrame) ap.alignFrame
1142 .getSplitViewContainer();
1143 splitFrame.adjustLayout();
1144 splitFrame.repaint();
1149 FontMetrics fm = getFontMetrics(av.getFont());
1150 av.validCharWidth = fm.charWidth('M') <= av.getCharWidth();
1152 lastMousePress = evt.getPoint();
1159 doMouseDraggedDefineMode(evt);
1163 int res = findColumn(evt);
1170 if ((lastres == -1) || (lastres == res))
1175 if ((res < av.getAlignment().getWidth()) && (res < lastres))
1177 // dragLeft, delete gap
1178 editSequence(false, false, res);
1182 editSequence(true, false, res);
1185 mouseDragging = true;
1186 if ((scrollThread != null) && (scrollThread.isRunning()))
1188 scrollThread.setEvent(evt);
1192 // TODO: Make it more clever than many booleans
1193 synchronized void editSequence(boolean insertGap, boolean editSeq,
1197 int fixedRight = -1;
1198 boolean fixedColumns = false;
1199 SequenceGroup sg = av.getSelectionGroup();
1201 SequenceI seq = av.getAlignment().getSequenceAt(startseq);
1203 // No group, but the sequence may represent a group
1204 if (!groupEditing && av.hasHiddenRows())
1206 if (av.isHiddenRepSequence(seq))
1208 sg = av.getRepresentedSequences(seq);
1209 groupEditing = true;
1213 StringBuilder message = new StringBuilder(64);
1216 message.append("Edit group:");
1217 if (editCommand == null)
1219 editCommand = new EditCommand(
1220 MessageManager.getString("action.edit_group"));
1225 message.append("Edit sequence: " + seq.getName());
1226 String label = seq.getName();
1227 if (label.length() > 10)
1229 label = label.substring(0, 10);
1231 if (editCommand == null)
1233 editCommand = new EditCommand(MessageManager
1234 .formatMessage("label.edit_params", new String[]
1241 message.append(" insert ");
1245 message.append(" delete ");
1248 message.append(Math.abs(startres - lastres) + " gaps.");
1249 ap.alignFrame.statusBar.setText(message.toString());
1251 // Are we editing within a selection group?
1252 if (groupEditing || (sg != null
1253 && sg.getSequences(av.getHiddenRepSequences()).contains(seq)))
1255 fixedColumns = true;
1257 // sg might be null as the user may only see 1 sequence,
1258 // but the sequence represents a group
1261 if (!av.isHiddenRepSequence(seq))
1266 sg = av.getRepresentedSequences(seq);
1269 fixedLeft = sg.getStartRes();
1270 fixedRight = sg.getEndRes();
1272 if ((startres < fixedLeft && lastres >= fixedLeft)
1273 || (startres >= fixedLeft && lastres < fixedLeft)
1274 || (startres > fixedRight && lastres <= fixedRight)
1275 || (startres <= fixedRight && lastres > fixedRight))
1281 if (fixedLeft > startres)
1283 fixedRight = fixedLeft - 1;
1286 else if (fixedRight < startres)
1288 fixedLeft = fixedRight;
1293 if (av.hasHiddenColumns())
1295 fixedColumns = true;
1296 int y1 = av.getAlignment().getHiddenColumns()
1297 .getNextHiddenBoundary(true, startres);
1298 int y2 = av.getAlignment().getHiddenColumns()
1299 .getNextHiddenBoundary(false, startres);
1301 if ((insertGap && startres > y1 && lastres < y1)
1302 || (!insertGap && startres < y2 && lastres > y2))
1308 // System.out.print(y1+" "+y2+" "+fixedLeft+" "+fixedRight+"~~");
1309 // Selection spans a hidden region
1310 if (fixedLeft < y1 && (fixedRight > y2 || fixedRight == -1))
1318 fixedRight = y2 - 1;
1325 List<SequenceI> vseqs = sg.getSequences(av.getHiddenRepSequences());
1326 int g, groupSize = vseqs.size();
1327 SequenceI[] groupSeqs = new SequenceI[groupSize];
1328 for (g = 0; g < groupSeqs.length; g++)
1330 groupSeqs[g] = vseqs.get(g);
1336 // If the user has selected the whole sequence, and is dragging to
1337 // the right, we can still extend the alignment and selectionGroup
1338 if (sg.getStartRes() == 0 && sg.getEndRes() == fixedRight
1339 && sg.getEndRes() == av.getAlignment().getWidth() - 1)
1341 sg.setEndRes(av.getAlignment().getWidth() + startres - lastres);
1342 fixedRight = sg.getEndRes();
1345 // Is it valid with fixed columns??
1346 // Find the next gap before the end
1347 // of the visible region boundary
1348 boolean blank = false;
1349 for (; fixedRight > lastres; fixedRight--)
1353 for (g = 0; g < groupSize; g++)
1355 for (int j = 0; j < startres - lastres; j++)
1357 if (!Comparison.isGap(groupSeqs[g].getCharAt(fixedRight - j)))
1372 if (sg.getSize() == av.getAlignment().getHeight())
1374 if ((av.hasHiddenColumns() && startres < av.getAlignment()
1376 .getNextHiddenBoundary(false, startres)))
1382 int alWidth = av.getAlignment().getWidth();
1383 if (av.hasHiddenRows())
1385 int hwidth = av.getAlignment().getHiddenSequences()
1387 if (hwidth > alWidth)
1392 // We can still insert gaps if the selectionGroup
1393 // contains all the sequences
1394 sg.setEndRes(sg.getEndRes() + startres - lastres);
1395 fixedRight = alWidth + startres - lastres;
1406 else if (!insertGap)
1408 // / Are we able to delete?
1409 // ie are all columns blank?
1411 for (g = 0; g < groupSize; g++)
1413 for (int j = startres; j < lastres; j++)
1415 if (groupSeqs[g].getLength() <= j)
1420 if (!Comparison.isGap(groupSeqs[g].getCharAt(j)))
1422 // Not a gap, block edit not valid
1432 // dragging to the right
1433 if (fixedColumns && fixedRight != -1)
1435 for (int j = lastres; j < startres; j++)
1437 insertChar(j, groupSeqs, fixedRight);
1442 appendEdit(Action.INSERT_GAP, groupSeqs, startres,
1443 startres - lastres);
1448 // dragging to the left
1449 if (fixedColumns && fixedRight != -1)
1451 for (int j = lastres; j > startres; j--)
1453 deleteChar(startres, groupSeqs, fixedRight);
1458 appendEdit(Action.DELETE_GAP, groupSeqs, startres,
1459 lastres - startres);
1465 // ///Editing a single sequence///////////
1469 // dragging to the right
1470 if (fixedColumns && fixedRight != -1)
1472 for (int j = lastres; j < startres; j++)
1474 insertChar(j, new SequenceI[] { seq }, fixedRight);
1479 appendEdit(Action.INSERT_GAP, new SequenceI[] { seq }, lastres,
1480 startres - lastres);
1487 // dragging to the left
1488 if (fixedColumns && fixedRight != -1)
1490 for (int j = lastres; j > startres; j--)
1492 if (!Comparison.isGap(seq.getCharAt(startres)))
1497 deleteChar(startres, new SequenceI[] { seq }, fixedRight);
1502 // could be a keyboard edit trying to delete none gaps
1504 for (int m = startres; m < lastres; m++)
1506 if (!Comparison.isGap(seq.getCharAt(m)))
1515 appendEdit(Action.DELETE_GAP, new SequenceI[] { seq },
1521 {// insertGap==false AND editSeq==TRUE;
1522 if (fixedColumns && fixedRight != -1)
1524 for (int j = lastres; j < startres; j++)
1526 insertChar(j, new SequenceI[] { seq }, fixedRight);
1531 appendEdit(Action.INSERT_NUC, new SequenceI[] { seq }, lastres,
1532 startres - lastres);
1539 seqCanvas.repaint();
1542 void insertChar(int j, SequenceI[] seq, int fixedColumn)
1544 int blankColumn = fixedColumn;
1545 for (int s = 0; s < seq.length; s++)
1547 // Find the next gap before the end of the visible region boundary
1548 // If lastCol > j, theres a boundary after the gap insertion
1550 for (blankColumn = fixedColumn; blankColumn > j; blankColumn--)
1552 if (Comparison.isGap(seq[s].getCharAt(blankColumn)))
1554 // Theres a space, so break and insert the gap
1559 if (blankColumn <= j)
1561 blankColumn = fixedColumn;
1567 appendEdit(Action.DELETE_GAP, seq, blankColumn, 1);
1569 appendEdit(Action.INSERT_GAP, seq, j, 1);
1574 * Helper method to add and perform one edit action.
1581 protected void appendEdit(Action action, SequenceI[] seq, int pos,
1585 final Edit edit = new EditCommand().new Edit(action, seq, pos, count,
1586 av.getAlignment().getGapCharacter());
1588 editCommand.appendEdit(edit, av.getAlignment(), true, null);
1591 void deleteChar(int j, SequenceI[] seq, int fixedColumn)
1594 appendEdit(Action.DELETE_GAP, seq, j, 1);
1596 appendEdit(Action.INSERT_GAP, seq, fixedColumn, 1);
1606 public void mouseEntered(MouseEvent e)
1613 if ((scrollThread != null) && (scrollThread.isRunning()))
1615 scrollThread.stopScrolling();
1616 scrollThread = null;
1627 public void mouseExited(MouseEvent e)
1629 if (av.getWrapAlignment())
1634 if (mouseDragging && scrollThread == null)
1636 scrollThread = new ScrollThread();
1641 * Handler for double-click on a position with one or more sequence features.
1642 * Opens the Amend Features dialog to allow feature details to be amended, or
1643 * the feature deleted.
1646 public void mouseClicked(MouseEvent evt)
1648 SequenceGroup sg = null;
1649 SequenceI sequence = av.getAlignment().getSequenceAt(findSeq(evt));
1650 if (evt.getClickCount() > 1)
1652 sg = av.getSelectionGroup();
1653 if (sg != null && sg.getSize() == 1
1654 && sg.getEndRes() - sg.getStartRes() < 2)
1656 av.setSelectionGroup(null);
1659 int column = findColumn(evt);
1662 * find features at the position (if not gapped), or straddling
1663 * the position (if at a gap)
1665 List<SequenceFeature> features = seqCanvas.getFeatureRenderer()
1666 .findFeaturesAtColumn(sequence, column + 1);
1668 if (!features.isEmpty())
1671 * highlight the first feature at the position on the alignment
1673 SearchResultsI highlight = new SearchResults();
1674 highlight.addResult(sequence, features.get(0).getBegin(), features
1676 seqCanvas.highlightSearchResults(highlight, true);
1679 * open the Amend Features dialog; clear highlighting afterwards,
1680 * whether changes were made or not
1682 List<SequenceI> seqs = Collections.singletonList(sequence);
1683 new FeatureEditor(ap).amendFeatures(seqs, features, new Runnable()
1688 av.setSearchResults(null); // clear highlighting
1689 seqCanvas.repaint(); // draw new/amended features
1697 public void mouseWheelMoved(MouseWheelEvent e)
1700 double wheelRotation = e.getPreciseWheelRotation();
1701 if (wheelRotation > 0)
1703 if (e.isShiftDown())
1705 av.getRanges().scrollRight(true);
1710 av.getRanges().scrollUp(false);
1713 else if (wheelRotation < 0)
1715 if (e.isShiftDown())
1717 av.getRanges().scrollRight(false);
1721 av.getRanges().scrollUp(true);
1726 * update status bar and tooltip for new position
1727 * (need to synthesize a mouse movement to refresh tooltip)
1730 ToolTipManager.sharedInstance().mouseMoved(e);
1739 public void doMousePressedDefineMode(MouseEvent evt)
1741 final int res = findColumn(evt);
1742 final int seq = findSeq(evt);
1744 updateOverviewAndStructs = false;
1746 startWrapBlock = wrappedBlock;
1748 if (av.getWrapAlignment() && seq > av.getAlignment().getHeight())
1750 JvOptionPane.showInternalMessageDialog(Desktop.desktop,
1751 MessageManager.getString(
1752 "label.cannot_edit_annotations_in_wrapped_view"),
1753 MessageManager.getString("label.wrapped_view_no_edit"),
1754 JvOptionPane.WARNING_MESSAGE);
1758 if (seq < 0 || res < 0)
1763 SequenceI sequence = av.getAlignment().getSequenceAt(seq);
1765 if ((sequence == null) || (res > sequence.getLength()))
1770 stretchGroup = av.getSelectionGroup();
1772 if (stretchGroup == null || !stretchGroup.contains(sequence, res))
1774 stretchGroup = av.getAlignment().findGroup(sequence, res);
1775 if (stretchGroup != null)
1777 // only update the current selection if the popup menu has a group to
1779 av.setSelectionGroup(stretchGroup);
1783 if (evt.isPopupTrigger()) // Mac: mousePressed
1790 * defer right-mouse click handling to mouseReleased on Windows
1791 * (where isPopupTrigger() will answer true)
1792 * NB isRightMouseButton is also true for Cmd-click on Mac
1794 if (SwingUtilities.isRightMouseButton(evt) && !Platform.isAMac())
1801 seqCanvas.cursorX = findColumn(evt);
1802 seqCanvas.cursorY = findSeq(evt);
1803 seqCanvas.repaint();
1807 if (stretchGroup == null)
1809 createStretchGroup(res, sequence);
1812 if (stretchGroup != null)
1814 stretchGroup.addPropertyChangeListener(seqCanvas);
1817 seqCanvas.repaint();
1820 private void createStretchGroup(int res, SequenceI sequence)
1822 // Only if left mouse button do we want to change group sizes
1823 // define a new group here
1824 SequenceGroup sg = new SequenceGroup();
1825 sg.setStartRes(res);
1827 sg.addSequence(sequence, false);
1828 av.setSelectionGroup(sg);
1831 if (av.getConservationSelected())
1833 SliderPanel.setConservationSlider(ap, av.getResidueShading(),
1837 if (av.getAbovePIDThreshold())
1839 SliderPanel.setPIDSliderSource(ap, av.getResidueShading(),
1842 // TODO: stretchGroup will always be not null. Is this a merge error ?
1843 // or is there a threading issue here?
1844 if ((stretchGroup != null) && (stretchGroup.getEndRes() == res))
1846 // Edit end res position of selected group
1847 changeEndRes = true;
1849 else if ((stretchGroup != null) && (stretchGroup.getStartRes() == res))
1851 // Edit end res position of selected group
1852 changeStartRes = true;
1854 stretchGroup.getWidth();
1859 * Build and show a pop-up menu at the right-click mouse position
1865 void showPopupMenu(MouseEvent evt)
1867 final int column = findColumn(evt);
1868 final int seq = findSeq(evt);
1869 SequenceI sequence = av.getAlignment().getSequenceAt(seq);
1870 List<SequenceFeature> features = ap.getFeatureRenderer()
1871 .findFeaturesAtColumn(sequence, column + 1);
1873 PopupMenu pop = new PopupMenu(ap, null, features);
1874 pop.show(this, evt.getX(), evt.getY());
1878 * Update the display after mouse up on a selection or group
1881 * mouse released event details
1883 * true if this event is happening after a mouse drag (rather than a
1886 public void doMouseReleasedDefineMode(MouseEvent evt, boolean afterDrag)
1888 if (stretchGroup == null)
1893 stretchGroup.removePropertyChangeListener(seqCanvas);
1895 // always do this - annotation has own state
1896 // but defer colourscheme update until hidden sequences are passed in
1897 boolean vischange = stretchGroup.recalcConservation(true);
1898 updateOverviewAndStructs |= vischange && av.isSelectionDefinedGroup()
1900 if (stretchGroup.cs != null)
1902 stretchGroup.cs.alignmentChanged(stretchGroup,
1903 av.getHiddenRepSequences());
1905 ResidueShaderI groupColourScheme = stretchGroup
1906 .getGroupColourScheme();
1907 String name = stretchGroup.getName();
1908 if (stretchGroup.cs.conservationApplied())
1910 SliderPanel.setConservationSlider(ap, groupColourScheme, name);
1912 if (stretchGroup.cs.getThreshold() > 0)
1914 SliderPanel.setPIDSliderSource(ap, groupColourScheme, name);
1917 PaintRefresher.Refresh(this, av.getSequenceSetId());
1918 // TODO: structure colours only need updating if stretchGroup used to or now
1919 // does contain sequences with structure views
1920 ap.paintAlignment(updateOverviewAndStructs, updateOverviewAndStructs);
1921 updateOverviewAndStructs = false;
1922 changeEndRes = false;
1923 changeStartRes = false;
1924 stretchGroup = null;
1934 public void doMouseDraggedDefineMode(MouseEvent evt)
1936 int res = findColumn(evt);
1937 int y = findSeq(evt);
1939 if (wrappedBlock != startWrapBlock)
1944 if (stretchGroup == null)
1949 if (res >= av.getAlignment().getWidth())
1951 res = av.getAlignment().getWidth() - 1;
1954 if (stretchGroup.getEndRes() == res)
1956 // Edit end res position of selected group
1957 changeEndRes = true;
1959 else if (stretchGroup.getStartRes() == res)
1961 // Edit start res position of selected group
1962 changeStartRes = true;
1965 if (res < av.getRanges().getStartRes())
1967 res = av.getRanges().getStartRes();
1972 if (res > (stretchGroup.getStartRes() - 1))
1974 stretchGroup.setEndRes(res);
1975 updateOverviewAndStructs |= av.isSelectionDefinedGroup();
1978 else if (changeStartRes)
1980 if (res < (stretchGroup.getEndRes() + 1))
1982 stretchGroup.setStartRes(res);
1983 updateOverviewAndStructs |= av.isSelectionDefinedGroup();
1987 int dragDirection = 0;
1993 else if (y < oldSeq)
1998 while ((y != oldSeq) && (oldSeq > -1)
1999 && (y < av.getAlignment().getHeight()))
2001 // This routine ensures we don't skip any sequences, as the
2002 // selection is quite slow.
2003 Sequence seq = (Sequence) av.getAlignment().getSequenceAt(oldSeq);
2005 oldSeq += dragDirection;
2012 Sequence nextSeq = (Sequence) av.getAlignment().getSequenceAt(oldSeq);
2014 if (stretchGroup.getSequences(null).contains(nextSeq))
2016 stretchGroup.deleteSequence(seq, false);
2017 updateOverviewAndStructs |= av.isSelectionDefinedGroup();
2023 stretchGroup.addSequence(seq, false);
2026 stretchGroup.addSequence(nextSeq, false);
2027 updateOverviewAndStructs |= av.isSelectionDefinedGroup();
2036 mouseDragging = true;
2038 if ((scrollThread != null) && (scrollThread.isRunning()))
2040 scrollThread.setEvent(evt);
2044 void scrollCanvas(MouseEvent evt)
2048 if ((scrollThread != null) && (scrollThread.isRunning()))
2050 scrollThread.stopScrolling();
2051 scrollThread = null;
2053 mouseDragging = false;
2057 if (scrollThread == null)
2059 scrollThread = new ScrollThread();
2062 mouseDragging = true;
2063 scrollThread.setEvent(evt);
2068 // this class allows scrolling off the bottom of the visible alignment
2069 class ScrollThread extends Thread
2073 private volatile boolean threadRunning = true;
2075 public ScrollThread()
2080 public void setEvent(MouseEvent e)
2085 public void stopScrolling()
2087 threadRunning = false;
2090 public boolean isRunning()
2092 return threadRunning;
2098 while (threadRunning)
2102 if (mouseDragging && (evt.getY() < 0)
2103 && (av.getRanges().getStartSeq() > 0))
2105 av.getRanges().scrollUp(true);
2108 if (mouseDragging && (evt.getY() >= getHeight()) && (av
2109 .getAlignment().getHeight() > av.getRanges().getEndSeq()))
2111 av.getRanges().scrollUp(false);
2114 if (mouseDragging && (evt.getX() < 0))
2116 av.getRanges().scrollRight(false);
2118 else if (mouseDragging && (evt.getX() >= getWidth()))
2120 av.getRanges().scrollRight(true);
2127 } catch (Exception ex)
2135 * modify current selection according to a received message.
2138 public void selection(SequenceGroup seqsel, ColumnSelection colsel,
2139 HiddenColumns hidden, SelectionSource source)
2141 // TODO: fix this hack - source of messages is align viewport, but SeqPanel
2142 // handles selection messages...
2143 // TODO: extend config options to allow user to control if selections may be
2144 // shared between viewports.
2145 boolean iSentTheSelection = (av == source
2146 || (source instanceof AlignViewport
2147 && ((AlignmentViewport) source).getSequenceSetId()
2148 .equals(av.getSequenceSetId())));
2150 if (iSentTheSelection)
2152 // respond to our own event by updating dependent dialogs
2153 if (ap.getCalculationDialog() != null)
2155 ap.getCalculationDialog().validateCalcTypes();
2161 // process further ?
2162 if (!av.followSelection)
2168 * Ignore the selection if there is one of our own pending.
2170 if (av.isSelectionGroupChanged(false) || av.isColSelChanged(false))
2176 * Check for selection in a view of which this one is a dna/protein
2179 if (selectionFromTranslation(seqsel, colsel, hidden, source))
2184 // do we want to thread this ? (contention with seqsel and colsel locks, I
2187 * only copy colsel if there is a real intersection between
2188 * sequence selection and this panel's alignment
2190 boolean repaint = false;
2191 boolean copycolsel = false;
2193 SequenceGroup sgroup = null;
2194 if (seqsel != null && seqsel.getSize() > 0)
2196 if (av.getAlignment() == null)
2198 Cache.log.warn("alignviewport av SeqSetId=" + av.getSequenceSetId()
2199 + " ViewId=" + av.getViewId()
2200 + " 's alignment is NULL! returning immediately.");
2203 sgroup = seqsel.intersect(av.getAlignment(),
2204 (av.hasHiddenRows()) ? av.getHiddenRepSequences() : null);
2205 if ((sgroup != null && sgroup.getSize() > 0))
2210 if (sgroup != null && sgroup.getSize() > 0)
2212 av.setSelectionGroup(sgroup);
2216 av.setSelectionGroup(null);
2218 av.isSelectionGroupChanged(true);
2223 // the current selection is unset or from a previous message
2224 // so import the new colsel.
2225 if (colsel == null || colsel.isEmpty())
2227 if (av.getColumnSelection() != null)
2229 av.getColumnSelection().clear();
2235 // TODO: shift colSel according to the intersecting sequences
2236 if (av.getColumnSelection() == null)
2238 av.setColumnSelection(new ColumnSelection(colsel));
2242 av.getColumnSelection().setElementsFrom(colsel,
2243 av.getAlignment().getHiddenColumns());
2246 av.isColSelChanged(true);
2250 if (copycolsel && av.hasHiddenColumns()
2251 && (av.getAlignment().getHiddenColumns() == null))
2253 System.err.println("Bad things");
2255 if (repaint) // always true!
2257 // probably finessing with multiple redraws here
2258 PaintRefresher.Refresh(this, av.getSequenceSetId());
2259 // ap.paintAlignment(false);
2262 // lastly, update dependent dialogs
2263 if (ap.getCalculationDialog() != null)
2265 ap.getCalculationDialog().validateCalcTypes();
2271 * If this panel is a cdna/protein translation view of the selection source,
2272 * tries to map the source selection to a local one, and returns true. Else
2279 protected boolean selectionFromTranslation(SequenceGroup seqsel,
2280 ColumnSelection colsel, HiddenColumns hidden,
2281 SelectionSource source)
2283 if (!(source instanceof AlignViewportI))
2287 final AlignViewportI sourceAv = (AlignViewportI) source;
2288 if (sourceAv.getCodingComplement() != av
2289 && av.getCodingComplement() != sourceAv)
2295 * Map sequence selection
2297 SequenceGroup sg = MappingUtils.mapSequenceGroup(seqsel, sourceAv, av);
2298 av.setSelectionGroup(sg);
2299 av.isSelectionGroupChanged(true);
2302 * Map column selection
2304 // ColumnSelection cs = MappingUtils.mapColumnSelection(colsel, sourceAv,
2306 ColumnSelection cs = new ColumnSelection();
2307 HiddenColumns hs = new HiddenColumns();
2308 MappingUtils.mapColumnSelection(colsel, hidden, sourceAv, av, cs, hs);
2309 av.setColumnSelection(cs);
2310 av.getAlignment().setHiddenColumns(hs);
2312 // lastly, update any dependent dialogs
2313 if (ap.getCalculationDialog() != null)
2315 ap.getCalculationDialog().validateCalcTypes();
2318 PaintRefresher.Refresh(this, av.getSequenceSetId());
2325 * @return null or last search results handled by this panel
2327 public SearchResultsI getLastSearchResults()
2329 return lastSearchResults;