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.AlignedCodonFrame;
49 import jalview.datamodel.Alignment;
50 import jalview.datamodel.AlignmentI;
51 import jalview.datamodel.ColumnSelection;
52 import jalview.datamodel.PDBEntry;
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;
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, AlignViewportI, CommandListener
96 SequenceAnnotationOrder sortAnnotationsBy = null;
100 NJTree currentTree = null;
102 boolean cursorMode = false;
104 boolean antiAlias = false;
106 private Rectangle explodedGeometry;
111 * Flag set true on the view that should 'gather' multiple views of the same
112 * sequence set id when a project is reloaded. Set false on all views when
113 * they are 'exploded' into separate windows. Set true on the current view
114 * when 'Gather' is performed, and also on the first tab when the first new
117 private boolean gatherViewsHere = false;
119 private AnnotationColumnChooser annotationColumnSelectionState;
121 * Creates a new AlignViewport object.
126 public AlignViewport(AlignmentI al)
133 * Create a new AlignViewport object with a specific sequence set ID
137 * (may be null - but potential for ambiguous constructor exception)
139 public AlignViewport(AlignmentI al, String seqsetid)
141 this(al, seqsetid, null);
144 public AlignViewport(AlignmentI al, String seqsetid, String viewid)
146 sequenceSetID = seqsetid;
148 // TODO remove these once 2.4.VAMSAS release finished
149 if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null)
151 Cache.log.debug("Setting viewport's sequence set id : "
154 if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null)
156 Cache.log.debug("Setting viewport's view id : " + viewId);
163 * Create a new AlignViewport with hidden regions
167 * @param hiddenColumns
170 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns)
173 if (hiddenColumns != null)
175 colSel = hiddenColumns;
181 * New viewport with hidden columns and an existing sequence set id
184 * @param hiddenColumns
188 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns,
191 this(al, hiddenColumns, seqsetid, null);
195 * New viewport with hidden columns and an existing sequence set id and viewid
198 * @param hiddenColumns
204 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns,
205 String seqsetid, String viewid)
207 sequenceSetID = seqsetid;
209 // TODO remove these once 2.4.VAMSAS release finished
210 if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null)
212 Cache.log.debug("Setting viewport's sequence set id : "
215 if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null)
217 Cache.log.debug("Setting viewport's view id : " + viewId);
220 if (hiddenColumns != null)
222 colSel = hiddenColumns;
227 private void applyViewProperties()
229 antiAlias = Cache.getDefault("ANTI_ALIAS", false);
231 viewStyle.setShowJVSuffix(Cache.getDefault("SHOW_JVSUFFIX", true));
232 setShowAnnotation(Cache.getDefault("SHOW_ANNOTATIONS", true));
234 setRightAlignIds(Cache.getDefault("RIGHT_ALIGN_IDS", false));
235 setCentreColumnLabels(Cache.getDefault("CENTRE_COLUMN_LABELS", false));
236 autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true);
238 setPadGaps(Cache.getDefault("PAD_GAPS", true));
239 setShowNPFeats(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true));
240 setShowDBRefs(Cache.getDefault("SHOW_DBREFS_TOOLTIP", true));
241 viewStyle.setSeqNameItalics(Cache.getDefault("ID_ITALICS", true));
242 viewStyle.setWrapAlignment(Cache.getDefault("WRAP_ALIGNMENT", false));
243 viewStyle.setShowUnconserved(Cache
244 .getDefault("SHOW_UNCONSERVED", false));
245 sortByTree = Cache.getDefault("SORT_BY_TREE", false);
246 followSelection = Cache.getDefault("FOLLOW_SELECTIONS", true);
247 sortAnnotationsBy = SequenceAnnotationOrder.valueOf(Cache.getDefault(
248 Preferences.SORT_ANNOTATIONS,
249 SequenceAnnotationOrder.NONE.name()));
250 showAutocalculatedAbove = Cache.getDefault(
251 Preferences.SHOW_AUTOCALC_ABOVE, false);
258 this.endRes = alignment.getWidth() - 1;
260 this.endSeq = alignment.getHeight() - 1;
261 applyViewProperties();
263 String fontName = Cache.getDefault("FONT_NAME", "SansSerif");
264 String fontStyle = Cache.getDefault("FONT_STYLE", Font.PLAIN + "");
265 String fontSize = Cache.getDefault("FONT_SIZE", "10");
269 if (fontStyle.equals("bold"))
273 else if (fontStyle.equals("italic"))
278 setFont(new Font(fontName, style, Integer.parseInt(fontSize)), true);
281 .setGapCharacter(Cache.getDefault("GAP_SYMBOL", "-").charAt(0));
283 // We must set conservation and consensus before setting colour,
284 // as Blosum and Clustal require this to be done
285 if (hconsensus == null && !isDataset)
287 if (!alignment.isNucleotide())
289 showConservation = Cache.getDefault("SHOW_CONSERVATION", true);
290 showQuality = Cache.getDefault("SHOW_QUALITY", true);
291 showGroupConservation = Cache.getDefault("SHOW_GROUP_CONSERVATION",
294 showConsensusHistogram = Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM",
296 showSequenceLogo = Cache.getDefault("SHOW_CONSENSUS_LOGO", false);
297 normaliseSequenceLogo = Cache.getDefault("NORMALISE_CONSENSUS_LOGO",
299 showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false);
300 showConsensus = Cache.getDefault("SHOW_IDENTITY", true);
302 initAutoAnnotation();
303 String colourProperty = alignment.isNucleotide() ? Preferences.DEFAULT_COLOUR_NUC
304 : Preferences.DEFAULT_COLOUR_PROT;
305 String propertyValue = Cache.getProperty(colourProperty);
306 if (propertyValue == null)
308 // fall back on this property for backwards compatibility
309 propertyValue = Cache.getProperty(Preferences.DEFAULT_COLOUR);
311 if (propertyValue != null)
313 globalColourScheme = ColourSchemeProperty.getColour(alignment,
316 if (globalColourScheme instanceof UserColourScheme)
318 globalColourScheme = UserDefinedColours.loadDefaultColours();
319 ((UserColourScheme) globalColourScheme).setThreshold(0,
320 isIgnoreGapsConsensus());
323 if (globalColourScheme != null)
325 globalColourScheme.setConsensus(hconsensus);
331 * get the consensus sequence as displayed under the PID consensus annotation
334 * @return consensus sequence as a new sequence object
336 public SequenceI getConsensusSeq()
338 if (consensus == null)
340 updateConsensus(null);
342 if (consensus == null)
346 StringBuffer seqs = new StringBuffer();
347 for (int i = 0; i < consensus.annotations.length; i++)
349 if (consensus.annotations[i] != null)
351 if (consensus.annotations[i].description.charAt(0) == '[')
353 seqs.append(consensus.annotations[i].description.charAt(1));
357 seqs.append(consensus.annotations[i].displayCharacter);
362 SequenceI sq = new Sequence("Consensus", seqs.toString());
363 sq.setDescription("Percentage Identity Consensus "
364 + ((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
371 * @return DOCUMENT ME!
373 public int getStartRes()
381 * @return DOCUMENT ME!
383 public int getEndRes()
391 * @return DOCUMENT ME!
393 public int getStartSeq()
404 public void setStartRes(int res)
415 public void setStartSeq(int seq)
426 public void setEndRes(int res)
428 if (res > (alignment.getWidth() - 1))
430 // log.System.out.println(" Corrected res from " + res + " to maximum " +
431 // (alignment.getWidth()-1));
432 res = alignment.getWidth() - 1;
449 public void setEndSeq(int seq)
451 if (seq > alignment.getHeight())
453 seq = alignment.getHeight();
467 * @return DOCUMENT ME!
469 public int getEndSeq()
474 boolean validCharWidth;
477 * update view settings with the given font. You may need to call
478 * alignPanel.fontChanged to update the layout geometry
481 * when true, charWidth/height is set according to font mentrics
483 public void setFont(Font f, boolean setGrid)
487 Container c = new Container();
489 java.awt.FontMetrics fm = c.getFontMetrics(font);
490 int w = viewStyle.getCharWidth(), ww = fm.charWidth('M'), h = viewStyle
494 setCharHeight(fm.getHeight());
497 viewStyle.setFontName(font.getName());
498 viewStyle.setFontStyle(font.getStyle());
499 viewStyle.setFontSize(font.getSize());
501 validCharWidth = true;
505 public void setViewStyle(ViewStyleI settingsForView)
507 super.setViewStyle(settingsForView);
508 setFont(new Font(viewStyle.getFontName(), viewStyle.getFontStyle(),
509 viewStyle.getFontSize()), false);
515 * @return DOCUMENT ME!
517 public Font getFont()
528 public void setAlignment(AlignmentI align)
530 if (alignment != null && alignment.getCodonFrames() != null)
532 StructureSelectionManager.getStructureSelectionManager(
533 Desktop.instance).removeMappings(alignment.getCodonFrames());
535 this.alignment = align;
536 if (alignment != null && alignment.getCodonFrames() != null)
538 StructureSelectionManager.getStructureSelectionManager(
539 Desktop.instance).addMappings(alignment.getCodonFrames());
546 * @return DOCUMENT ME!
548 public char getGapCharacter()
550 return getAlignment().getGapCharacter();
559 public void setGapCharacter(char gap)
561 if (getAlignment() != null)
563 getAlignment().setGapCharacter(gap);
570 * @return DOCUMENT ME!
572 public ColumnSelection getColumnSelection()
583 public void setCurrentTree(NJTree tree)
591 * @return DOCUMENT ME!
593 public NJTree getCurrentTree()
599 * returns the visible column regions of the alignment
601 * @param selectedRegionOnly
602 * true to just return the contigs intersecting with the selected
606 public int[] getViewAsVisibleContigs(boolean selectedRegionOnly)
608 int[] viscontigs = null;
609 int start = 0, end = 0;
610 if (selectedRegionOnly && selectionGroup != null)
612 start = selectionGroup.getStartRes();
613 end = selectionGroup.getEndRes() + 1;
617 end = alignment.getWidth();
619 viscontigs = colSel.getVisibleContigs(start, end);
624 * get hash of undo and redo list for the alignment
626 * @return long[] { historyList.hashCode, redoList.hashCode };
628 public long[] getUndoRedoHash()
631 if (historyList == null || redoList == null)
637 { historyList.hashCode(), this.redoList.hashCode() };
641 * test if a particular set of hashcodes are different to the hashcodes for
642 * the undo and redo list.
645 * the stored set of hashcodes as returned by getUndoRedoHash
646 * @return true if the hashcodes differ (ie the alignment has been edited) or
647 * the stored hashcode array differs in size
649 public boolean isUndoRedoHashModified(long[] undoredo)
651 if (undoredo == null)
655 long[] cstate = getUndoRedoHash();
656 if (cstate.length != undoredo.length)
661 for (int i = 0; i < cstate.length; i++)
663 if (cstate[i] != undoredo[i])
672 * when set, view will scroll to show the highlighted position
674 public boolean followHighlight = true;
677 * @return true if view should scroll to show the highlighted region of a
681 public boolean getFollowHighlight()
683 return followHighlight;
686 public boolean followSelection = true;
689 * @return true if view selection should always follow the selections
690 * broadcast by other selection sources
692 public boolean getFollowSelection()
694 return followSelection;
698 * Send the current selection to be broadcast to any selection listeners.
700 public void sendSelection()
702 jalview.structure.StructureSelectionManager
703 .getStructureSelectionManager(Desktop.instance).sendSelection(
704 new SequenceGroup(getSelectionGroup()),
705 new ColumnSelection(getColumnSelection()), this);
709 * return the alignPanel containing the given viewport. Use this to get the
710 * components currently handling the given viewport.
713 * @return null or an alignPanel guaranteed to have non-null alignFrame
716 public AlignmentPanel getAlignPanel()
718 AlignmentPanel[] aps = PaintRefresher.getAssociatedPanels(this
719 .getSequenceSetId());
720 for (int p = 0; aps != null && p < aps.length; p++)
722 if (aps[p].av == this)
730 public boolean getSortByTree()
735 public void setSortByTree(boolean sort)
741 * synthesize a column selection if none exists so it covers the given
742 * selection group. if wholewidth is false, no column selection is made if the
743 * selection group covers the whole alignment width.
748 public void expandColSelection(SequenceGroup sg, boolean wholewidth)
752 && (sgs = sg.getStartRes()) >= 0
753 && sg.getStartRes() <= (sge = sg.getEndRes())
754 && (colSel == null || colSel.getSelected() == null || colSel
755 .getSelected().size() == 0))
757 if (!wholewidth && alignment.getWidth() == (1 + sge - sgs))
764 colSel = new ColumnSelection();
766 for (int cspos = sg.getStartRes(); cspos <= sg.getEndRes(); cspos++)
768 colSel.addElement(cspos);
774 * Returns the (Desktop) instance of the StructureSelectionManager
777 public StructureSelectionManager getStructureSelectionManager()
779 return StructureSelectionManager
780 .getStructureSelectionManager(Desktop.instance);
786 * @return a series of SequenceI arrays, one for each PDBEntry, listing which
787 * sequence in the alignment holds a reference to it
789 public SequenceI[][] collateForPDB(PDBEntry[] pdbEntries)
791 ArrayList<SequenceI[]> seqvectors = new ArrayList<SequenceI[]>();
792 for (PDBEntry pdb : pdbEntries)
794 ArrayList<SequenceI> seqs = new ArrayList<SequenceI>();
795 for (int i = 0; i < alignment.getHeight(); i++)
797 Vector pdbs = alignment.getSequenceAt(i).getDatasetSequence()
804 for (int p = 0; p < pdbs.size(); p++)
806 PDBEntry p1 = (PDBEntry) pdbs.elementAt(p);
807 if (p1.getId().equals(pdb.getId()))
809 if (!seqs.contains(sq = alignment.getSequenceAt(i)))
818 seqvectors.add(seqs.toArray(new SequenceI[seqs.size()]));
820 return seqvectors.toArray(new SequenceI[seqvectors.size()][]);
823 public boolean isNormaliseSequenceLogo()
825 return normaliseSequenceLogo;
828 public void setNormaliseSequenceLogo(boolean state)
830 normaliseSequenceLogo = state;
835 * @return true if alignment characters should be displayed
837 public boolean isValidCharWidth()
839 return validCharWidth;
842 private Hashtable<String, AutoCalcSetting> calcIdParams = new Hashtable<String, AutoCalcSetting>();
844 private boolean showAutocalculatedAbove;
846 public AutoCalcSetting getCalcIdSettingsFor(String calcId)
848 return calcIdParams.get(calcId);
851 public void setCalcIdSettingsFor(String calcId, AutoCalcSetting settings,
854 calcIdParams.put(calcId, settings);
855 // TODO: create a restart list to trigger any calculations that need to be
856 // restarted after load
857 // calculator.getRegisteredWorkersOfClass(settings.getWorkerClass())
860 Cache.log.debug("trigger update for " + calcId);
864 protected SequenceAnnotationOrder getSortAnnotationsBy()
866 return sortAnnotationsBy;
869 protected void setSortAnnotationsBy(SequenceAnnotationOrder sortAnnotationsBy)
871 this.sortAnnotationsBy = sortAnnotationsBy;
874 protected boolean isShowAutocalculatedAbove()
876 return showAutocalculatedAbove;
879 protected void setShowAutocalculatedAbove(boolean showAutocalculatedAbove)
881 this.showAutocalculatedAbove = showAutocalculatedAbove;
885 * Method called when another alignment's edit (or possibly other) command is
888 * To allow for sequence mappings (e.g. protein to cDNA), we have to first
889 * 'unwind' the command on the source sequences (in simulation, not in fact),
890 * and then for each edit in turn:
892 * <li>compute the equivalent edit on the mapped sequences</li>
893 * <li>apply the mapped edit</li>
894 * <li>'apply' the source edit to the working copy of the source sequences</li>
902 public void mirrorCommand(CommandI command, boolean undo,
903 StructureSelectionManager ssm, VamsasSource source)
906 * Do nothing unless we are a 'complement' of the source. May replace this
907 * with direct calls not via SSM.
909 if (source instanceof AlignViewportI
910 && ((AlignViewportI) source).getCodingComplement() == this)
919 CommandI mappedCommand = ssm.mapCommand(command, undo, getAlignment(),
921 if (mappedCommand != null)
923 AlignmentI[] views = getAlignPanel().alignFrame.getViewAlignments();
924 mappedCommand.doCommand(views);
925 getAlignPanel().alignmentChanged();
930 * Add the sequences from the given alignment to this viewport. Optionally,
931 * may give the user the option to open a new frame, or split panel, with cDNA
932 * and protein linked.
937 public void addAlignment(AlignmentI al, String title)
939 // TODO: promote to AlignViewportI? applet CutAndPasteTransfer is different
941 // JBPComment: title is a largely redundant parameter at the moment
942 // JBPComment: this really should be an 'insert/pre/append' controller
943 // JBPComment: but the DNA/Protein check makes it a bit more complex
945 // refactored from FileLoader / CutAndPasteTransfer / SequenceFetcher with
947 // TODO: create undo object for this JAL-1101
950 * If one alignment is protein and one nucleotide, with at least one
951 * sequence name in common, offer to open a linked alignment.
953 if (AlignmentUtils.isMappable(al, getAlignment()))
955 if (openLinkedAlignment(al, title))
960 // TODO: JAL-407 regardless of above - identical sequences (based on ID and
961 // provenance) should share the same dataset sequence
963 for (int i = 0; i < al.getHeight(); i++)
965 getAlignment().addSequence(al.getSequenceAt(i));
967 // TODO this call was done by SequenceFetcher but not FileLoader or
968 // CutAndPasteTransfer. Is it needed?
969 // JBPComment: this repositions the view to show the new sequences
970 // JBPComment: so it is needed for UX
971 setEndSeq(getAlignment().getHeight());
972 firePropertyChange("alignment", null, getAlignment().getSequences());
976 * Show a dialog with the option to open and link (cDNA <-> protein) as a new
977 * alignment. Returns true if the new alignment was opened, false if not,
978 * because the user declined the offer.
982 protected boolean openLinkedAlignment(AlignmentI al, String title)
984 String[] options = new String[]
985 { MessageManager.getString("action.no"),
986 MessageManager.getString("label.split_window"),
987 MessageManager.getString("label.new_window"), };
988 final String question = JvSwingUtils.wrapTooltip(true,
989 MessageManager.getString("label.open_split_window?"));
990 int response = JOptionPane.showOptionDialog(Desktop.desktop, question,
991 MessageManager.getString("label.open_split_window"),
992 JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null,
993 options, options[0]);
995 if (response != 1 && response != 2)
999 final boolean openSplitPane = (response == 1);
1000 final boolean openInNewWindow = (response == 2);
1003 * Create the AlignFrame first (which creates the new alignment's datasets),
1004 * before attempting sequence mapping.
1006 AlignFrame newAlignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
1007 AlignFrame.DEFAULT_HEIGHT);
1008 newAlignFrame.setTitle(title);
1011 * Identify protein and dna alignments. Make a copy of this one if opening
1012 * in a new split pane.
1014 AlignmentI thisAlignment = openSplitPane ? new Alignment(getAlignment())
1016 AlignmentI protein = al.isNucleotide() ? thisAlignment : al;
1017 final AlignmentI cdna = al.isNucleotide() ? al : thisAlignment;
1019 newAlignFrame.statusBar.setText(MessageManager.formatMessage(
1020 "label.successfully_loaded_file", new Object[]
1023 // TODO if we want this (e.g. to enable reload of the alignment from file),
1024 // we will need to add parameters to the stack.
1025 // if (!protocol.equals(AppletFormatAdapter.PASTE))
1027 // alignFrame.setFileName(file, format);
1030 if (openInNewWindow)
1032 Desktop.addInternalFrame(newAlignFrame, title,
1033 AlignFrame.DEFAULT_WIDTH,
1034 AlignFrame.DEFAULT_HEIGHT);
1038 * Map sequences. At least one should get mapped as we have already passed
1039 * the test for 'mappability'. Any mappings made will be added to the
1040 * protein alignment.
1042 AlignmentUtils.mapProteinToCdna(protein, cdna);
1046 newAlignFrame.setMaximum(jalview.bin.Cache.getDefault(
1049 } catch (java.beans.PropertyVetoException ex)
1055 protein = openSplitFrame(newAlignFrame, thisAlignment,
1056 protein.getCodonFrames());
1060 * Register the mappings (held on the protein alignment) with the
1061 * StructureSelectionManager (for mouseover linking).
1063 final StructureSelectionManager ssm = StructureSelectionManager
1064 .getStructureSelectionManager(Desktop.instance);
1065 ssm.addMappings(protein.getCodonFrames());
1071 * Helper method to open a new SplitFrame holding linked dna and protein
1074 * @param newAlignFrame
1075 * containing a new alignment to be shown
1077 * cdna/protein complement alignment to show in the other split half
1079 * @return the protein alignment in the split frame
1081 protected AlignmentI openSplitFrame(AlignFrame newAlignFrame,
1082 AlignmentI complement, Set<AlignedCodonFrame> mappings)
1085 * Open in split pane. DNA sequence above, protein below.
1087 AlignFrame copyMe = new AlignFrame(complement,
1088 AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
1089 copyMe.setTitle(getAlignPanel().alignFrame.getTitle());
1091 AlignmentI al = newAlignFrame.viewport.getAlignment();
1092 final AlignFrame proteinFrame = al.isNucleotide() ? copyMe
1094 final AlignFrame cdnaFrame = al.isNucleotide() ? newAlignFrame
1096 AlignmentI protein = proteinFrame.viewport.getAlignment();
1097 protein.setCodonFrames(mappings);
1099 cdnaFrame.setVisible(true);
1100 proteinFrame.setVisible(true);
1101 String linkedTitle = MessageManager
1102 .getString("label.linked_view_title");
1103 JInternalFrame splitFrame = new SplitFrame(cdnaFrame, proteinFrame);
1104 Desktop.addInternalFrame(splitFrame, linkedTitle, -1, -1);
1109 public AnnotationColumnChooser getAnnotationColumnSelectionState()
1111 return annotationColumnSelectionState;
1114 public void setAnnotationColumnSelectionState(
1115 AnnotationColumnChooser currentAnnotationColumnSelectionState)
1117 this.annotationColumnSelectionState = currentAnnotationColumnSelectionState;
1121 public void setIdWidth(int i)
1123 super.setIdWidth(i);
1124 AlignmentPanel ap = getAlignPanel();
1127 // modify GUI elements to reflect geometry change
1128 Dimension idw = getAlignPanel().getIdPanel().getIdCanvas()
1129 .getPreferredSize();
1131 getAlignPanel().getIdPanel().getIdCanvas().setPreferredSize(idw);
1135 public Rectangle getExplodedGeometry()
1137 return explodedGeometry;
1140 public void setExplodedGeometry(Rectangle explodedPosition)
1142 this.explodedGeometry = explodedPosition;
1145 public boolean isGatherViewsHere()
1147 return gatherViewsHere;
1150 public void setGatherViewsHere(boolean gatherViewsHere)
1152 this.gatherViewsHere = gatherViewsHere;