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.
22 * Jalview - A Sequence Alignment Editor and Viewer
23 * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
25 * This program is free software; you can redistribute it and/or
26 * modify it under the terms of the GNU General Public License
27 * as published by the Free Software Foundation; either version 2
28 * of the License, or (at your option) any later version.
30 * This program is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
35 * You should have received a copy of the GNU General Public License
36 * along with this program; if not, write to the Free Software
37 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
41 import jalview.analysis.AlignmentUtils;
42 import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
43 import jalview.analysis.NJTree;
44 import jalview.api.AlignViewportI;
45 import jalview.api.ViewStyleI;
46 import jalview.bin.Cache;
47 import jalview.commands.CommandI;
48 import jalview.datamodel.Alignment;
49 import jalview.datamodel.AlignmentI;
50 import jalview.datamodel.ColumnSelection;
51 import jalview.datamodel.PDBEntry;
52 import jalview.datamodel.SearchResults;
53 import jalview.datamodel.Sequence;
54 import jalview.datamodel.SequenceGroup;
55 import jalview.datamodel.SequenceI;
56 import jalview.schemes.ColourSchemeProperty;
57 import jalview.schemes.UserColourScheme;
58 import jalview.structure.CommandListener;
59 import jalview.structure.SelectionSource;
60 import jalview.structure.StructureSelectionManager;
61 import jalview.structure.VamsasSource;
62 import jalview.util.MessageManager;
63 import jalview.viewmodel.AlignmentViewport;
64 import jalview.ws.params.AutoCalcSetting;
66 import java.awt.Container;
67 import java.awt.Dimension;
69 import java.awt.Rectangle;
70 import java.util.ArrayList;
71 import java.util.Hashtable;
72 import java.util.List;
73 import java.util.Vector;
75 import javax.swing.JInternalFrame;
76 import javax.swing.JOptionPane;
82 * @version $Revision: 1.141 $
84 public class AlignViewport extends AlignmentViewport implements
85 SelectionSource, CommandListener
89 NJTree currentTree = null;
91 boolean cursorMode = false;
93 boolean antiAlias = false;
95 private Rectangle explodedGeometry;
100 * Flag set true on the view that should 'gather' multiple views of the same
101 * sequence set id when a project is reloaded. Set false on all views when
102 * they are 'exploded' into separate windows. Set true on the current view
103 * when 'Gather' is performed, and also on the first tab when the first new
106 private boolean gatherViewsHere = false;
108 private AnnotationColumnChooser annotationColumnSelectionState;
110 * Creates a new AlignViewport object.
115 public AlignViewport(AlignmentI al)
122 * Create a new AlignViewport object with a specific sequence set ID
126 * (may be null - but potential for ambiguous constructor exception)
128 public AlignViewport(AlignmentI al, String seqsetid)
130 this(al, seqsetid, null);
133 public AlignViewport(AlignmentI al, String seqsetid, String viewid)
135 sequenceSetID = seqsetid;
137 // TODO remove these once 2.4.VAMSAS release finished
138 if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null)
140 Cache.log.debug("Setting viewport's sequence set id : "
143 if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null)
145 Cache.log.debug("Setting viewport's view id : " + viewId);
152 * Create a new AlignViewport with hidden regions
156 * @param hiddenColumns
159 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns)
162 if (hiddenColumns != null)
164 colSel = hiddenColumns;
170 * New viewport with hidden columns and an existing sequence set id
173 * @param hiddenColumns
177 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns,
180 this(al, hiddenColumns, seqsetid, null);
184 * New viewport with hidden columns and an existing sequence set id and viewid
187 * @param hiddenColumns
193 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns,
194 String seqsetid, String viewid)
196 sequenceSetID = seqsetid;
198 // TODO remove these once 2.4.VAMSAS release finished
199 if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null)
201 Cache.log.debug("Setting viewport's sequence set id : "
204 if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null)
206 Cache.log.debug("Setting viewport's view id : " + viewId);
209 if (hiddenColumns != null)
211 colSel = hiddenColumns;
217 * Apply any settings saved in user preferences
219 private void applyViewProperties()
221 antiAlias = Cache.getDefault("ANTI_ALIAS", false);
223 viewStyle.setShowJVSuffix(Cache.getDefault("SHOW_JVSUFFIX", true));
224 setShowAnnotation(Cache.getDefault("SHOW_ANNOTATIONS", true));
226 setRightAlignIds(Cache.getDefault("RIGHT_ALIGN_IDS", false));
227 setCentreColumnLabels(Cache.getDefault("CENTRE_COLUMN_LABELS", false));
228 autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true);
230 setPadGaps(Cache.getDefault("PAD_GAPS", true));
231 setShowNPFeats(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true));
232 setShowDBRefs(Cache.getDefault("SHOW_DBREFS_TOOLTIP", true));
233 viewStyle.setSeqNameItalics(Cache.getDefault("ID_ITALICS", true));
234 viewStyle.setWrapAlignment(Cache.getDefault("WRAP_ALIGNMENT", false));
235 viewStyle.setShowUnconserved(Cache
236 .getDefault("SHOW_UNCONSERVED", false));
237 sortByTree = Cache.getDefault("SORT_BY_TREE", false);
238 followSelection = Cache.getDefault("FOLLOW_SELECTIONS", true);
239 sortAnnotationsBy = SequenceAnnotationOrder.valueOf(Cache.getDefault(
240 Preferences.SORT_ANNOTATIONS,
241 SequenceAnnotationOrder.NONE.name()));
242 showAutocalculatedAbove = Cache.getDefault(
243 Preferences.SHOW_AUTOCALC_ABOVE, false);
244 viewStyle.setScaleProteinAsCdna(Cache.getDefault(
245 Preferences.SCALE_PROTEIN_TO_CDNA, true));
251 this.endRes = alignment.getWidth() - 1;
253 this.endSeq = alignment.getHeight() - 1;
254 applyViewProperties();
256 String fontName = Cache.getDefault("FONT_NAME", "SansSerif");
257 String fontStyle = Cache.getDefault("FONT_STYLE", Font.PLAIN + "");
258 String fontSize = Cache.getDefault("FONT_SIZE", "10");
262 if (fontStyle.equals("bold"))
266 else if (fontStyle.equals("italic"))
271 setFont(new Font(fontName, style, Integer.parseInt(fontSize)), true);
274 .setGapCharacter(Cache.getDefault("GAP_SYMBOL", "-").charAt(0));
276 // We must set conservation and consensus before setting colour,
277 // as Blosum and Clustal require this to be done
278 if (hconsensus == null && !isDataset)
280 if (!alignment.isNucleotide())
282 showConservation = Cache.getDefault("SHOW_CONSERVATION", true);
283 showQuality = Cache.getDefault("SHOW_QUALITY", true);
284 showGroupConservation = Cache.getDefault("SHOW_GROUP_CONSERVATION",
287 showConsensusHistogram = Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM",
289 showSequenceLogo = Cache.getDefault("SHOW_CONSENSUS_LOGO", false);
290 normaliseSequenceLogo = Cache.getDefault("NORMALISE_CONSENSUS_LOGO",
292 showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false);
293 showConsensus = Cache.getDefault("SHOW_IDENTITY", true);
295 initAutoAnnotation();
296 String colourProperty = alignment.isNucleotide() ? Preferences.DEFAULT_COLOUR_NUC
297 : Preferences.DEFAULT_COLOUR_PROT;
298 String propertyValue = Cache.getProperty(colourProperty);
299 if (propertyValue == null)
301 // fall back on this property for backwards compatibility
302 propertyValue = Cache.getProperty(Preferences.DEFAULT_COLOUR);
304 if (propertyValue != null)
306 globalColourScheme = ColourSchemeProperty.getColour(alignment,
309 if (globalColourScheme instanceof UserColourScheme)
311 globalColourScheme = UserDefinedColours.loadDefaultColours();
312 ((UserColourScheme) globalColourScheme).setThreshold(0,
313 isIgnoreGapsConsensus());
316 if (globalColourScheme != null)
318 globalColourScheme.setConsensus(hconsensus);
324 * get the consensus sequence as displayed under the PID consensus annotation
327 * @return consensus sequence as a new sequence object
329 public SequenceI getConsensusSeq()
331 if (consensus == null)
333 updateConsensus(null);
335 if (consensus == null)
339 StringBuffer seqs = new StringBuffer();
340 for (int i = 0; i < consensus.annotations.length; i++)
342 if (consensus.annotations[i] != null)
344 if (consensus.annotations[i].description.charAt(0) == '[')
346 seqs.append(consensus.annotations[i].description.charAt(1));
350 seqs.append(consensus.annotations[i].displayCharacter);
355 SequenceI sq = new Sequence("Consensus", seqs.toString());
356 sq.setDescription("Percentage Identity Consensus "
357 + ((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
361 boolean validCharWidth;
364 * update view settings with the given font. You may need to call
365 * alignPanel.fontChanged to update the layout geometry
368 * when true, charWidth/height is set according to font mentrics
370 public void setFont(Font f, boolean setGrid)
374 Container c = new Container();
376 java.awt.FontMetrics fm = c.getFontMetrics(font);
377 int w = viewStyle.getCharWidth(), ww = fm.charWidth('M'), h = viewStyle
381 setCharHeight(fm.getHeight());
384 viewStyle.setFontName(font.getName());
385 viewStyle.setFontStyle(font.getStyle());
386 viewStyle.setFontSize(font.getSize());
388 validCharWidth = true;
392 public void setViewStyle(ViewStyleI settingsForView)
394 super.setViewStyle(settingsForView);
395 setFont(new Font(viewStyle.getFontName(), viewStyle.getFontStyle(),
396 viewStyle.getFontSize()), false);
402 * @return DOCUMENT ME!
404 public Font getFont()
415 public void setAlignment(AlignmentI align)
417 replaceMappings(align);
418 this.alignment = align;
422 * Replace any codon mappings for this viewport with those for the given
427 public void replaceMappings(AlignmentI align)
429 StructureSelectionManager ssm = StructureSelectionManager
430 .getStructureSelectionManager(Desktop.instance);
433 * Deregister current mappings (if any)
435 if (alignment != null)
437 ssm.removeMappings(alignment.getCodonFrames());
441 * Register new mappings (if any)
445 ssm.addMappings(align.getCodonFrames());
449 * replace mappings on our alignment
451 if (alignment != null && align != null)
453 alignment.setCodonFrames(align.getCodonFrames());
460 * @return DOCUMENT ME!
462 public char getGapCharacter()
464 return getAlignment().getGapCharacter();
473 public void setGapCharacter(char gap)
475 if (getAlignment() != null)
477 getAlignment().setGapCharacter(gap);
484 * @return DOCUMENT ME!
486 public ColumnSelection getColumnSelection()
497 public void setCurrentTree(NJTree tree)
505 * @return DOCUMENT ME!
507 public NJTree getCurrentTree()
513 * returns the visible column regions of the alignment
515 * @param selectedRegionOnly
516 * true to just return the contigs intersecting with the selected
520 public int[] getViewAsVisibleContigs(boolean selectedRegionOnly)
522 int[] viscontigs = null;
523 int start = 0, end = 0;
524 if (selectedRegionOnly && selectionGroup != null)
526 start = selectionGroup.getStartRes();
527 end = selectionGroup.getEndRes() + 1;
531 end = alignment.getWidth();
533 viscontigs = colSel.getVisibleContigs(start, end);
538 * get hash of undo and redo list for the alignment
540 * @return long[] { historyList.hashCode, redoList.hashCode };
542 public long[] getUndoRedoHash()
545 if (historyList == null || redoList == null)
551 { historyList.hashCode(), this.redoList.hashCode() };
555 * test if a particular set of hashcodes are different to the hashcodes for
556 * the undo and redo list.
559 * the stored set of hashcodes as returned by getUndoRedoHash
560 * @return true if the hashcodes differ (ie the alignment has been edited) or
561 * the stored hashcode array differs in size
563 public boolean isUndoRedoHashModified(long[] undoredo)
565 if (undoredo == null)
569 long[] cstate = getUndoRedoHash();
570 if (cstate.length != undoredo.length)
575 for (int i = 0; i < cstate.length; i++)
577 if (cstate[i] != undoredo[i])
585 public boolean followSelection = true;
588 * @return true if view selection should always follow the selections
589 * broadcast by other selection sources
591 public boolean getFollowSelection()
593 return followSelection;
597 * Send the current selection to be broadcast to any selection listeners.
599 public void sendSelection()
601 jalview.structure.StructureSelectionManager
602 .getStructureSelectionManager(Desktop.instance).sendSelection(
603 new SequenceGroup(getSelectionGroup()),
604 new ColumnSelection(getColumnSelection()), this);
608 * return the alignPanel containing the given viewport. Use this to get the
609 * components currently handling the given viewport.
612 * @return null or an alignPanel guaranteed to have non-null alignFrame
615 public AlignmentPanel getAlignPanel()
617 AlignmentPanel[] aps = PaintRefresher.getAssociatedPanels(this
618 .getSequenceSetId());
619 for (int p = 0; aps != null && p < aps.length; p++)
621 if (aps[p].av == this)
629 public boolean getSortByTree()
634 public void setSortByTree(boolean sort)
640 * synthesize a column selection if none exists so it covers the given
641 * selection group. if wholewidth is false, no column selection is made if the
642 * selection group covers the whole alignment width.
647 public void expandColSelection(SequenceGroup sg, boolean wholewidth)
651 && (sgs = sg.getStartRes()) >= 0
652 && sg.getStartRes() <= (sge = sg.getEndRes())
653 && (colSel == null || colSel.getSelected() == null || colSel
654 .getSelected().size() == 0))
656 if (!wholewidth && alignment.getWidth() == (1 + sge - sgs))
663 colSel = new ColumnSelection();
665 for (int cspos = sg.getStartRes(); cspos <= sg.getEndRes(); cspos++)
667 colSel.addElement(cspos);
673 * Returns the (Desktop) instance of the StructureSelectionManager
676 public StructureSelectionManager getStructureSelectionManager()
678 return StructureSelectionManager
679 .getStructureSelectionManager(Desktop.instance);
685 * @return an array of SequenceI arrays, one for each PDBEntry, listing which
686 * sequences in the alignment hold a reference to it
688 public SequenceI[][] collateForPDB(PDBEntry[] pdbEntries)
690 List<SequenceI[]> seqvectors = new ArrayList<SequenceI[]>();
691 for (PDBEntry pdb : pdbEntries)
693 List<SequenceI> seqs = new ArrayList<SequenceI>();
694 for (SequenceI sq : alignment.getSequences())
696 Vector<PDBEntry> pdbs = sq
697 .getDatasetSequence().getAllPDBEntries();
702 for (PDBEntry p1 : pdbs)
704 if (p1.getId().equals(pdb.getId()))
706 if (!seqs.contains(sq))
714 seqvectors.add(seqs.toArray(new SequenceI[seqs.size()]));
716 return seqvectors.toArray(new SequenceI[seqvectors.size()][]);
719 public boolean isNormaliseSequenceLogo()
721 return normaliseSequenceLogo;
724 public void setNormaliseSequenceLogo(boolean state)
726 normaliseSequenceLogo = state;
731 * @return true if alignment characters should be displayed
733 public boolean isValidCharWidth()
735 return validCharWidth;
738 private Hashtable<String, AutoCalcSetting> calcIdParams = new Hashtable<String, AutoCalcSetting>();
740 public AutoCalcSetting getCalcIdSettingsFor(String calcId)
742 return calcIdParams.get(calcId);
745 public void setCalcIdSettingsFor(String calcId, AutoCalcSetting settings,
748 calcIdParams.put(calcId, settings);
749 // TODO: create a restart list to trigger any calculations that need to be
750 // restarted after load
751 // calculator.getRegisteredWorkersOfClass(settings.getWorkerClass())
754 Cache.log.debug("trigger update for " + calcId);
759 * Method called when another alignment's edit (or possibly other) command is
762 * To allow for sequence mappings (e.g. protein to cDNA), we have to first
763 * 'unwind' the command on the source sequences (in simulation, not in fact),
764 * and then for each edit in turn:
766 * <li>compute the equivalent edit on the mapped sequences</li>
767 * <li>apply the mapped edit</li>
768 * <li>'apply' the source edit to the working copy of the source sequences</li>
776 public void mirrorCommand(CommandI command, boolean undo,
777 StructureSelectionManager ssm, VamsasSource source)
780 * Do nothing unless we are a 'complement' of the source. May replace this
781 * with direct calls not via SSM.
783 if (source instanceof AlignViewportI
784 && ((AlignViewportI) source).getCodingComplement() == this)
793 CommandI mappedCommand = ssm.mapCommand(command, undo, getAlignment(),
795 if (mappedCommand != null)
797 AlignmentI[] views = getAlignPanel().alignFrame.getViewAlignments();
798 mappedCommand.doCommand(views);
799 getAlignPanel().alignmentChanged();
804 * Add the sequences from the given alignment to this viewport. Optionally,
805 * may give the user the option to open a new frame, or split panel, with cDNA
806 * and protein linked.
811 public void addAlignment(AlignmentI al, String title)
813 // TODO: promote to AlignViewportI? applet CutAndPasteTransfer is different
815 // JBPComment: title is a largely redundant parameter at the moment
816 // JBPComment: this really should be an 'insert/pre/append' controller
817 // JBPComment: but the DNA/Protein check makes it a bit more complex
819 // refactored from FileLoader / CutAndPasteTransfer / SequenceFetcher with
821 // TODO: create undo object for this JAL-1101
824 * If any cDNA/protein mappings can be made between the alignments, offer to
825 * open a linked alignment with split frame option.
827 if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true))
829 if (al.getDataset() == null)
831 // need to create ds seqs
832 for (SequenceI sq : al.getSequences())
834 if (sq.getDatasetSequence() == null)
836 sq.createDatasetSequence();
840 if (AlignmentUtils.isMappable(al, getAlignment()))
842 if (openLinkedAlignment(al, title))
850 * No mappings, or offer declined - add sequences to this alignment
852 // TODO: JAL-407 regardless of above - identical sequences (based on ID and
853 // provenance) should share the same dataset sequence
855 for (int i = 0; i < al.getHeight(); i++)
857 getAlignment().addSequence(al.getSequenceAt(i));
860 setEndSeq(getAlignment().getHeight());
861 firePropertyChange("alignment", null, getAlignment().getSequences());
865 * Show a dialog with the option to open and link (cDNA <-> protein) as a new
866 * alignment, either as a standalone alignment or in a split frame. Returns
867 * true if the new alignment was opened, false if not, because the user
868 * declined the offer.
873 protected boolean openLinkedAlignment(AlignmentI al, String title)
875 String[] options = new String[]
876 { MessageManager.getString("action.no"),
877 MessageManager.getString("label.split_window"),
878 MessageManager.getString("label.new_window"), };
879 final String question = JvSwingUtils.wrapTooltip(true,
880 MessageManager.getString("label.open_split_window?"));
881 int response = JOptionPane.showOptionDialog(Desktop.desktop, question,
882 MessageManager.getString("label.open_split_window"),
883 JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null,
884 options, options[0]);
886 if (response != 1 && response != 2)
890 final boolean openSplitPane = (response == 1);
891 final boolean openInNewWindow = (response == 2);
894 * Identify protein and dna alignments. Make a copy of this one if opening
895 * in a new split pane.
897 AlignmentI thisAlignment = openSplitPane ? new Alignment(getAlignment())
899 AlignmentI protein = al.isNucleotide() ? thisAlignment : al;
900 final AlignmentI cdna = al.isNucleotide() ? al : thisAlignment;
903 * Map sequences. At least one should get mapped as we have already passed
904 * the test for 'mappability'. Any mappings made will be added to the
905 * protein alignment. Note creating dataset sequences on the new alignment
906 * is a pre-requisite for building mappings.
909 AlignmentUtils.mapProteinToCdna(protein, cdna);
912 * Create the AlignFrame for the added alignment. If it is protein, mappings
913 * are registered with StructureSelectionManager as a side-effect.
915 AlignFrame newAlignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
916 AlignFrame.DEFAULT_HEIGHT);
917 newAlignFrame.setTitle(title);
918 newAlignFrame.statusBar.setText(MessageManager.formatMessage(
919 "label.successfully_loaded_file", new Object[]
922 // TODO if we want this (e.g. to enable reload of the alignment from file),
923 // we will need to add parameters to the stack.
924 // if (!protocol.equals(AppletFormatAdapter.PASTE))
926 // alignFrame.setFileName(file, format);
931 Desktop.addInternalFrame(newAlignFrame, title,
932 AlignFrame.DEFAULT_WIDTH,
933 AlignFrame.DEFAULT_HEIGHT);
938 newAlignFrame.setMaximum(jalview.bin.Cache.getDefault(
941 } catch (java.beans.PropertyVetoException ex)
947 al.alignAs(thisAlignment);
948 protein = openSplitFrame(newAlignFrame, thisAlignment);
955 * Helper method to open a new SplitFrame holding linked dna and protein
958 * @param newAlignFrame
959 * containing a new alignment to be shown
961 * cdna/protein complement alignment to show in the other split half
962 * @return the protein alignment in the split frame
964 protected AlignmentI openSplitFrame(AlignFrame newAlignFrame,
965 AlignmentI complement)
968 * Make a new frame with a copy of the alignment we are adding to. If this
969 * is protein, the mappings to cDNA will be registered with StructureSelectionManager as a side-effect.
971 AlignFrame copyMe = new AlignFrame(complement,
972 AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
973 copyMe.setTitle(getAlignPanel().alignFrame.getTitle());
975 AlignmentI al = newAlignFrame.viewport.getAlignment();
976 final AlignFrame proteinFrame = al.isNucleotide() ? copyMe
978 final AlignFrame cdnaFrame = al.isNucleotide() ? newAlignFrame
980 cdnaFrame.setVisible(true);
981 proteinFrame.setVisible(true);
982 String linkedTitle = MessageManager
983 .getString("label.linked_view_title");
986 * Open in split pane. DNA sequence above, protein below.
988 JInternalFrame splitFrame = new SplitFrame(cdnaFrame, proteinFrame);
989 Desktop.addInternalFrame(splitFrame, linkedTitle, -1, -1);
991 return proteinFrame.viewport.getAlignment();
994 public AnnotationColumnChooser getAnnotationColumnSelectionState()
996 return annotationColumnSelectionState;
999 public void setAnnotationColumnSelectionState(
1000 AnnotationColumnChooser currentAnnotationColumnSelectionState)
1002 this.annotationColumnSelectionState = currentAnnotationColumnSelectionState;
1006 public void setIdWidth(int i)
1008 super.setIdWidth(i);
1009 AlignmentPanel ap = getAlignPanel();
1012 // modify GUI elements to reflect geometry change
1013 Dimension idw = getAlignPanel().getIdPanel().getIdCanvas()
1014 .getPreferredSize();
1016 getAlignPanel().getIdPanel().getIdCanvas().setPreferredSize(idw);
1020 public Rectangle getExplodedGeometry()
1022 return explodedGeometry;
1025 public void setExplodedGeometry(Rectangle explodedPosition)
1027 this.explodedGeometry = explodedPosition;
1030 public boolean isGatherViewsHere()
1032 return gatherViewsHere;
1035 public void setGatherViewsHere(boolean gatherViewsHere)
1037 this.gatherViewsHere = gatherViewsHere;
1041 * If this viewport has a (Protein/cDNA) complement, then scroll the
1042 * complementary alignment to match this one.
1044 public void scrollComplementaryAlignment()
1047 * Populate a SearchResults object with the mapped location to scroll to. If
1048 * there is no complement, or it is not following highlights, or no mapping
1049 * is found, the result will be empty.
1051 SearchResults sr = new SearchResults();
1052 int verticalOffset = findComplementScrollTarget(sr);
1055 // TODO would like next line without cast but needs more refactoring...
1056 final AlignmentPanel complementPanel = ((AlignViewport) getCodingComplement()).getAlignPanel();
1057 complementPanel.setFollowingComplementScroll(true);
1058 complementPanel.scrollToCentre(sr, verticalOffset);