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 java.awt.Container;
42 import java.awt.Dimension;
44 import java.awt.Rectangle;
45 import java.util.ArrayList;
46 import java.util.Hashtable;
47 import java.util.List;
49 import java.util.Vector;
51 import javax.swing.JInternalFrame;
52 import javax.swing.JOptionPane;
54 import jalview.analysis.AlignmentUtils;
55 import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
56 import jalview.analysis.NJTree;
57 import jalview.api.AlignViewportI;
58 import jalview.api.FeatureRenderer;
59 import jalview.api.ViewStyleI;
60 import jalview.bin.Cache;
61 import jalview.commands.CommandI;
62 import jalview.datamodel.AlignedCodonFrame;
63 import jalview.datamodel.Alignment;
64 import jalview.datamodel.AlignmentI;
65 import jalview.datamodel.ColumnSelection;
66 import jalview.datamodel.PDBEntry;
67 import jalview.datamodel.SearchResults;
68 import jalview.datamodel.Sequence;
69 import jalview.datamodel.SequenceGroup;
70 import jalview.datamodel.SequenceI;
71 import jalview.schemes.ColourSchemeProperty;
72 import jalview.schemes.UserColourScheme;
73 import jalview.structure.CommandListener;
74 import jalview.structure.SelectionSource;
75 import jalview.structure.StructureSelectionManager;
76 import jalview.structure.VamsasSource;
77 import jalview.util.MessageManager;
78 import jalview.viewmodel.AlignmentViewport;
79 import jalview.ws.params.AutoCalcSetting;
85 * @version $Revision: 1.141 $
87 public class AlignViewport extends AlignmentViewport implements
88 SelectionSource, CommandListener
92 NJTree currentTree = null;
94 boolean cursorMode = false;
96 boolean antiAlias = false;
98 private Rectangle explodedGeometry;
100 private FeatureRenderer featureRenderer;
105 * Flag set true on the view that should 'gather' multiple views of the same
106 * sequence set id when a project is reloaded. Set false on all views when
107 * they are 'exploded' into separate windows. Set true on the current view
108 * when 'Gather' is performed, and also on the first tab when the first new
111 private boolean gatherViewsHere = false;
113 private AnnotationColumnChooser annotationColumnSelectionState;
115 * Creates a new AlignViewport object.
120 public AlignViewport(AlignmentI al)
127 * Create a new AlignViewport object with a specific sequence set ID
131 * (may be null - but potential for ambiguous constructor exception)
133 public AlignViewport(AlignmentI al, String seqsetid)
135 this(al, seqsetid, null);
138 public AlignViewport(AlignmentI al, String seqsetid, String viewid)
140 sequenceSetID = seqsetid;
142 // TODO remove these once 2.4.VAMSAS release finished
143 if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null)
145 Cache.log.debug("Setting viewport's sequence set id : "
148 if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null)
150 Cache.log.debug("Setting viewport's view id : " + viewId);
157 * Create a new AlignViewport with hidden regions
161 * @param hiddenColumns
164 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns)
167 if (hiddenColumns != null)
169 colSel = hiddenColumns;
175 * New viewport with hidden columns and an existing sequence set id
178 * @param hiddenColumns
182 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns,
185 this(al, hiddenColumns, seqsetid, null);
189 * New viewport with hidden columns and an existing sequence set id and viewid
192 * @param hiddenColumns
198 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns,
199 String seqsetid, String viewid)
201 sequenceSetID = seqsetid;
203 // TODO remove these once 2.4.VAMSAS release finished
204 if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null)
206 Cache.log.debug("Setting viewport's sequence set id : "
209 if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null)
211 Cache.log.debug("Setting viewport's view id : " + viewId);
214 if (hiddenColumns != null)
216 colSel = hiddenColumns;
222 * Apply any settings saved in user preferences
224 private void applyViewProperties()
226 antiAlias = Cache.getDefault("ANTI_ALIAS", false);
228 viewStyle.setShowJVSuffix(Cache.getDefault("SHOW_JVSUFFIX", true));
229 setShowAnnotation(Cache.getDefault("SHOW_ANNOTATIONS", true));
231 setRightAlignIds(Cache.getDefault("RIGHT_ALIGN_IDS", false));
232 setCentreColumnLabels(Cache.getDefault("CENTRE_COLUMN_LABELS", false));
233 autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true);
235 setPadGaps(Cache.getDefault("PAD_GAPS", true));
236 setShowNPFeats(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true));
237 setShowDBRefs(Cache.getDefault("SHOW_DBREFS_TOOLTIP", true));
238 viewStyle.setSeqNameItalics(Cache.getDefault("ID_ITALICS", true));
239 viewStyle.setWrapAlignment(Cache.getDefault("WRAP_ALIGNMENT", false));
240 viewStyle.setShowUnconserved(Cache
241 .getDefault("SHOW_UNCONSERVED", false));
242 sortByTree = Cache.getDefault("SORT_BY_TREE", false);
243 followSelection = Cache.getDefault("FOLLOW_SELECTIONS", true);
244 sortAnnotationsBy = SequenceAnnotationOrder.valueOf(Cache.getDefault(
245 Preferences.SORT_ANNOTATIONS,
246 SequenceAnnotationOrder.NONE.name()));
247 showAutocalculatedAbove = Cache.getDefault(
248 Preferences.SHOW_AUTOCALC_ABOVE, false);
249 viewStyle.setScaleProteinAsCdna(Cache.getDefault(
250 Preferences.SCALE_PROTEIN_TO_CDNA, true));
256 this.endRes = alignment.getWidth() - 1;
258 this.endSeq = alignment.getHeight() - 1;
259 applyViewProperties();
261 String fontName = Cache.getDefault("FONT_NAME", "SansSerif");
262 String fontStyle = Cache.getDefault("FONT_STYLE", Font.PLAIN + "");
263 String fontSize = Cache.getDefault("FONT_SIZE", "10");
267 if (fontStyle.equals("bold"))
271 else if (fontStyle.equals("italic"))
276 setFont(new Font(fontName, style, Integer.parseInt(fontSize)), true);
279 .setGapCharacter(Cache.getDefault("GAP_SYMBOL", "-").charAt(0));
281 // We must set conservation and consensus before setting colour,
282 // as Blosum and Clustal require this to be done
283 if (hconsensus == null && !isDataset)
285 if (!alignment.isNucleotide())
287 showConservation = Cache.getDefault("SHOW_CONSERVATION", true);
288 showQuality = Cache.getDefault("SHOW_QUALITY", true);
289 showGroupConservation = Cache.getDefault("SHOW_GROUP_CONSERVATION",
292 showConsensusHistogram = Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM",
294 showSequenceLogo = Cache.getDefault("SHOW_CONSENSUS_LOGO", false);
295 normaliseSequenceLogo = Cache.getDefault("NORMALISE_CONSENSUS_LOGO",
297 showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false);
298 showConsensus = Cache.getDefault("SHOW_IDENTITY", true);
300 initAutoAnnotation();
301 String colourProperty = alignment.isNucleotide() ? Preferences.DEFAULT_COLOUR_NUC
302 : Preferences.DEFAULT_COLOUR_PROT;
303 String propertyValue = Cache.getProperty(colourProperty);
304 if (propertyValue == null)
306 // fall back on this property for backwards compatibility
307 propertyValue = Cache.getProperty(Preferences.DEFAULT_COLOUR);
309 if (propertyValue != null)
311 globalColourScheme = ColourSchemeProperty.getColour(alignment,
314 if (globalColourScheme instanceof UserColourScheme)
316 globalColourScheme = UserDefinedColours.loadDefaultColours();
317 ((UserColourScheme) globalColourScheme).setThreshold(0,
318 isIgnoreGapsConsensus());
321 if (globalColourScheme != null)
323 globalColourScheme.setConsensus(hconsensus);
329 * get the consensus sequence as displayed under the PID consensus annotation
332 * @return consensus sequence as a new sequence object
334 public SequenceI getConsensusSeq()
336 if (consensus == null)
338 updateConsensus(null);
340 if (consensus == null)
344 StringBuffer seqs = new StringBuffer();
345 for (int i = 0; i < consensus.annotations.length; i++)
347 if (consensus.annotations[i] != null)
349 if (consensus.annotations[i].description.charAt(0) == '[')
351 seqs.append(consensus.annotations[i].description.charAt(1));
355 seqs.append(consensus.annotations[i].displayCharacter);
360 SequenceI sq = new Sequence("Consensus", seqs.toString());
361 sq.setDescription("Percentage Identity Consensus "
362 + ((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
366 boolean validCharWidth;
369 * update view settings with the given font. You may need to call
370 * alignPanel.fontChanged to update the layout geometry
373 * when true, charWidth/height is set according to font mentrics
375 public void setFont(Font f, boolean setGrid)
379 Container c = new Container();
381 java.awt.FontMetrics fm = c.getFontMetrics(font);
382 int w = viewStyle.getCharWidth(), ww = fm.charWidth('M'), h = viewStyle
386 setCharHeight(fm.getHeight());
389 viewStyle.setFontName(font.getName());
390 viewStyle.setFontStyle(font.getStyle());
391 viewStyle.setFontSize(font.getSize());
393 validCharWidth = true;
397 public void setViewStyle(ViewStyleI settingsForView)
399 super.setViewStyle(settingsForView);
400 setFont(new Font(viewStyle.getFontName(), viewStyle.getFontStyle(),
401 viewStyle.getFontSize()), false);
407 * @return DOCUMENT ME!
409 public Font getFont()
420 public void setAlignment(AlignmentI align)
422 if (alignment != null && alignment.getCodonFrames() != null)
424 StructureSelectionManager.getStructureSelectionManager(
425 Desktop.instance).removeMappings(alignment.getCodonFrames());
427 this.alignment = align;
428 if (alignment != null && alignment.getCodonFrames() != null)
430 StructureSelectionManager.getStructureSelectionManager(
431 Desktop.instance).addMappings(alignment.getCodonFrames());
438 * @return DOCUMENT ME!
440 public char getGapCharacter()
442 return getAlignment().getGapCharacter();
451 public void setGapCharacter(char gap)
453 if (getAlignment() != null)
455 getAlignment().setGapCharacter(gap);
462 * @return DOCUMENT ME!
464 public ColumnSelection getColumnSelection()
475 public void setCurrentTree(NJTree tree)
483 * @return DOCUMENT ME!
485 public NJTree getCurrentTree()
491 * returns the visible column regions of the alignment
493 * @param selectedRegionOnly
494 * true to just return the contigs intersecting with the selected
498 public int[] getViewAsVisibleContigs(boolean selectedRegionOnly)
500 int[] viscontigs = null;
501 int start = 0, end = 0;
502 if (selectedRegionOnly && selectionGroup != null)
504 start = selectionGroup.getStartRes();
505 end = selectionGroup.getEndRes() + 1;
509 end = alignment.getWidth();
511 viscontigs = colSel.getVisibleContigs(start, end);
516 * get hash of undo and redo list for the alignment
518 * @return long[] { historyList.hashCode, redoList.hashCode };
520 public long[] getUndoRedoHash()
523 if (historyList == null || redoList == null)
529 { historyList.hashCode(), this.redoList.hashCode() };
533 * test if a particular set of hashcodes are different to the hashcodes for
534 * the undo and redo list.
537 * the stored set of hashcodes as returned by getUndoRedoHash
538 * @return true if the hashcodes differ (ie the alignment has been edited) or
539 * the stored hashcode array differs in size
541 public boolean isUndoRedoHashModified(long[] undoredo)
543 if (undoredo == null)
547 long[] cstate = getUndoRedoHash();
548 if (cstate.length != undoredo.length)
553 for (int i = 0; i < cstate.length; i++)
555 if (cstate[i] != undoredo[i])
563 public boolean followSelection = true;
566 * @return true if view selection should always follow the selections
567 * broadcast by other selection sources
569 public boolean getFollowSelection()
571 return followSelection;
575 * Send the current selection to be broadcast to any selection listeners.
577 public void sendSelection()
579 jalview.structure.StructureSelectionManager
580 .getStructureSelectionManager(Desktop.instance).sendSelection(
581 new SequenceGroup(getSelectionGroup()),
582 new ColumnSelection(getColumnSelection()), this);
586 * return the alignPanel containing the given viewport. Use this to get the
587 * components currently handling the given viewport.
590 * @return null or an alignPanel guaranteed to have non-null alignFrame
593 public AlignmentPanel getAlignPanel()
595 AlignmentPanel[] aps = PaintRefresher.getAssociatedPanels(this
596 .getSequenceSetId());
597 for (int p = 0; aps != null && p < aps.length; p++)
599 if (aps[p].av == this)
607 public boolean getSortByTree()
612 public void setSortByTree(boolean sort)
618 * synthesize a column selection if none exists so it covers the given
619 * selection group. if wholewidth is false, no column selection is made if the
620 * selection group covers the whole alignment width.
625 public void expandColSelection(SequenceGroup sg, boolean wholewidth)
629 && (sgs = sg.getStartRes()) >= 0
630 && sg.getStartRes() <= (sge = sg.getEndRes())
631 && (colSel == null || colSel.getSelected() == null || colSel
632 .getSelected().size() == 0))
634 if (!wholewidth && alignment.getWidth() == (1 + sge - sgs))
641 colSel = new ColumnSelection();
643 for (int cspos = sg.getStartRes(); cspos <= sg.getEndRes(); cspos++)
645 colSel.addElement(cspos);
651 * Returns the (Desktop) instance of the StructureSelectionManager
654 public StructureSelectionManager getStructureSelectionManager()
656 return StructureSelectionManager
657 .getStructureSelectionManager(Desktop.instance);
663 * @return an array of SequenceI arrays, one for each PDBEntry, listing which
664 * sequences in the alignment hold a reference to it
666 public SequenceI[][] collateForPDB(PDBEntry[] pdbEntries)
668 List<SequenceI[]> seqvectors = new ArrayList<SequenceI[]>();
669 for (PDBEntry pdb : pdbEntries)
671 List<SequenceI> seqs = new ArrayList<SequenceI>();
672 for (SequenceI sq : alignment.getSequences())
674 Vector<PDBEntry> pdbs = sq
675 .getDatasetSequence().getPDBId();
680 for (PDBEntry p1 : pdbs)
682 if (p1.getId().equals(pdb.getId()))
684 if (!seqs.contains(sq))
692 seqvectors.add(seqs.toArray(new SequenceI[seqs.size()]));
694 return seqvectors.toArray(new SequenceI[seqvectors.size()][]);
697 public boolean isNormaliseSequenceLogo()
699 return normaliseSequenceLogo;
702 public void setNormaliseSequenceLogo(boolean state)
704 normaliseSequenceLogo = state;
709 * @return true if alignment characters should be displayed
711 public boolean isValidCharWidth()
713 return validCharWidth;
716 private Hashtable<String, AutoCalcSetting> calcIdParams = new Hashtable<String, AutoCalcSetting>();
718 public AutoCalcSetting getCalcIdSettingsFor(String calcId)
720 return calcIdParams.get(calcId);
723 public void setCalcIdSettingsFor(String calcId, AutoCalcSetting settings,
726 calcIdParams.put(calcId, settings);
727 // TODO: create a restart list to trigger any calculations that need to be
728 // restarted after load
729 // calculator.getRegisteredWorkersOfClass(settings.getWorkerClass())
732 Cache.log.debug("trigger update for " + calcId);
737 * Method called when another alignment's edit (or possibly other) command is
740 * To allow for sequence mappings (e.g. protein to cDNA), we have to first
741 * 'unwind' the command on the source sequences (in simulation, not in fact),
742 * and then for each edit in turn:
744 * <li>compute the equivalent edit on the mapped sequences</li>
745 * <li>apply the mapped edit</li>
746 * <li>'apply' the source edit to the working copy of the source sequences</li>
754 public void mirrorCommand(CommandI command, boolean undo,
755 StructureSelectionManager ssm, VamsasSource source)
758 * Do nothing unless we are a 'complement' of the source. May replace this
759 * with direct calls not via SSM.
761 if (source instanceof AlignViewportI
762 && ((AlignViewportI) source).getCodingComplement() == this)
771 CommandI mappedCommand = ssm.mapCommand(command, undo, getAlignment(),
773 if (mappedCommand != null)
775 AlignmentI[] views = getAlignPanel().alignFrame.getViewAlignments();
776 mappedCommand.doCommand(views);
777 getAlignPanel().alignmentChanged();
782 * Add the sequences from the given alignment to this viewport. Optionally,
783 * may give the user the option to open a new frame, or split panel, with cDNA
784 * and protein linked.
789 public void addAlignment(AlignmentI al, String title)
791 // TODO: promote to AlignViewportI? applet CutAndPasteTransfer is different
793 // JBPComment: title is a largely redundant parameter at the moment
794 // JBPComment: this really should be an 'insert/pre/append' controller
795 // JBPComment: but the DNA/Protein check makes it a bit more complex
797 // refactored from FileLoader / CutAndPasteTransfer / SequenceFetcher with
799 // TODO: create undo object for this JAL-1101
802 * If any cDNA/protein mappings can be made between the alignments, offer to
803 * open a linked alignment with split frame option.
805 if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, false))
807 if (AlignmentUtils.isMappable(al, getAlignment()))
809 if (openLinkedAlignment(al, title))
817 * No mappings, or offer declined - add sequences to this alignment
819 // TODO: JAL-407 regardless of above - identical sequences (based on ID and
820 // provenance) should share the same dataset sequence
822 for (int i = 0; i < al.getHeight(); i++)
824 getAlignment().addSequence(al.getSequenceAt(i));
827 setEndSeq(getAlignment().getHeight());
828 firePropertyChange("alignment", null, getAlignment().getSequences());
832 * Show a dialog with the option to open and link (cDNA <-> protein) as a new
833 * alignment, either as a standalone alignment or in a split frame. Returns
834 * true if the new alignment was opened, false if not, because the user
835 * declined the offer.
840 protected boolean openLinkedAlignment(AlignmentI al, String title)
842 String[] options = new String[]
843 { MessageManager.getString("action.no"),
844 MessageManager.getString("label.split_window"),
845 MessageManager.getString("label.new_window"), };
846 final String question = JvSwingUtils.wrapTooltip(true,
847 MessageManager.getString("label.open_split_window?"));
848 int response = JOptionPane.showOptionDialog(Desktop.desktop, question,
849 MessageManager.getString("label.open_split_window"),
850 JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null,
851 options, options[0]);
853 if (response != 1 && response != 2)
857 final boolean openSplitPane = (response == 1);
858 final boolean openInNewWindow = (response == 2);
861 * Identify protein and dna alignments. Make a copy of this one if opening
862 * in a new split pane.
864 AlignmentI thisAlignment = openSplitPane ? new Alignment(getAlignment())
866 AlignmentI protein = al.isNucleotide() ? thisAlignment : al;
867 final AlignmentI cdna = al.isNucleotide() ? al : thisAlignment;
870 * Map sequences. At least one should get mapped as we have already passed
871 * the test for 'mappability'. Any mappings made will be added to the
872 * protein alignment. Note creating dataset sequences on the new alignment
873 * is a pre-requisite for building mappings.
876 AlignmentUtils.mapProteinToCdna(protein, cdna);
879 * Create the AlignFrame for the added alignment. Note this will include the
880 * cDNA consensus annotation if it is protein (because the alignment holds
881 * mappings to nucleotide)
883 AlignFrame newAlignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
884 AlignFrame.DEFAULT_HEIGHT);
885 newAlignFrame.setTitle(title);
886 newAlignFrame.statusBar.setText(MessageManager.formatMessage(
887 "label.successfully_loaded_file", new Object[]
890 // TODO if we want this (e.g. to enable reload of the alignment from file),
891 // we will need to add parameters to the stack.
892 // if (!protocol.equals(AppletFormatAdapter.PASTE))
894 // alignFrame.setFileName(file, format);
899 Desktop.addInternalFrame(newAlignFrame, title,
900 AlignFrame.DEFAULT_WIDTH,
901 AlignFrame.DEFAULT_HEIGHT);
906 newAlignFrame.setMaximum(jalview.bin.Cache.getDefault(
909 } catch (java.beans.PropertyVetoException ex)
915 protein = openSplitFrame(newAlignFrame, thisAlignment,
916 protein.getCodonFrames());
920 * Register the mappings (held on the protein alignment) with the
921 * StructureSelectionManager (for mouseover linking).
923 final StructureSelectionManager ssm = StructureSelectionManager
924 .getStructureSelectionManager(Desktop.instance);
925 ssm.addMappings(protein.getCodonFrames());
931 * Helper method to open a new SplitFrame holding linked dna and protein
934 * @param newAlignFrame
935 * containing a new alignment to be shown
937 * cdna/protein complement alignment to show in the other split half
939 * @return the protein alignment in the split frame
941 protected AlignmentI openSplitFrame(AlignFrame newAlignFrame,
942 AlignmentI complement, Set<AlignedCodonFrame> mappings)
945 * Make a new frame with a copy of the alignment we are adding to. If this
946 * is protein, the new frame will have a cDNA consensus annotation row
949 AlignFrame copyMe = new AlignFrame(complement,
950 AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
951 copyMe.setTitle(getAlignPanel().alignFrame.getTitle());
953 AlignmentI al = newAlignFrame.viewport.getAlignment();
954 final AlignFrame proteinFrame = al.isNucleotide() ? copyMe
956 final AlignFrame cdnaFrame = al.isNucleotide() ? newAlignFrame
958 AlignmentI protein = proteinFrame.viewport.getAlignment();
959 protein.setCodonFrames(mappings);
961 cdnaFrame.setVisible(true);
962 proteinFrame.setVisible(true);
963 String linkedTitle = MessageManager
964 .getString("label.linked_view_title");
967 * Open in split pane. DNA sequence above, protein below.
969 JInternalFrame splitFrame = new SplitFrame(cdnaFrame, proteinFrame);
970 Desktop.addInternalFrame(splitFrame, linkedTitle, -1, -1);
975 public AnnotationColumnChooser getAnnotationColumnSelectionState()
977 return annotationColumnSelectionState;
980 public void setAnnotationColumnSelectionState(
981 AnnotationColumnChooser currentAnnotationColumnSelectionState)
983 this.annotationColumnSelectionState = currentAnnotationColumnSelectionState;
987 public void setIdWidth(int i)
990 AlignmentPanel ap = getAlignPanel();
993 // modify GUI elements to reflect geometry change
994 Dimension idw = getAlignPanel().getIdPanel().getIdCanvas()
997 getAlignPanel().getIdPanel().getIdCanvas().setPreferredSize(idw);
1001 public Rectangle getExplodedGeometry()
1003 return explodedGeometry;
1006 public void setExplodedGeometry(Rectangle explodedPosition)
1008 this.explodedGeometry = explodedPosition;
1011 public boolean isGatherViewsHere()
1013 return gatherViewsHere;
1016 public void setGatherViewsHere(boolean gatherViewsHere)
1018 this.gatherViewsHere = gatherViewsHere;
1022 * If this viewport has a (Protein/cDNA) complement, then scroll the
1023 * complementary alignment to match this one.
1025 public void scrollComplementaryAlignment()
1028 * Populate a SearchResults object with the mapped location to scroll to. If
1029 * there is no complement, or it is not following highlights, or no mapping
1030 * is found, the result will be empty.
1032 SearchResults sr = new SearchResults();
1033 int seqOffset = findComplementScrollTarget(sr);
1036 // TODO would like next line without cast but needs more refactoring...
1037 final AlignmentPanel complementPanel = ((AlignViewport) getCodingComplement()).getAlignPanel();
1038 complementPanel.setFollowingComplementScroll(true);
1039 complementPanel.scrollToCentre(sr, seqOffset);
1044 public FeatureRenderer getFeatureRenderer()
1046 return featureRenderer;
1050 public void setFeatureRenderer(FeatureRenderer featureRenderer)
1052 this.featureRenderer = featureRenderer;