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;
48 import java.util.Vector;
50 import javax.swing.JInternalFrame;
51 import javax.swing.JOptionPane;
53 import jalview.analysis.AlignmentUtils;
54 import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
55 import jalview.analysis.NJTree;
56 import jalview.api.AlignViewportI;
57 import jalview.api.ViewStyleI;
58 import jalview.bin.Cache;
59 import jalview.commands.CommandI;
60 import jalview.datamodel.AlignedCodonFrame;
61 import jalview.datamodel.Alignment;
62 import jalview.datamodel.AlignmentI;
63 import jalview.datamodel.ColumnSelection;
64 import jalview.datamodel.PDBEntry;
65 import jalview.datamodel.Sequence;
66 import jalview.datamodel.SequenceGroup;
67 import jalview.datamodel.SequenceI;
68 import jalview.schemes.ColourSchemeProperty;
69 import jalview.schemes.UserColourScheme;
70 import jalview.structure.CommandListener;
71 import jalview.structure.SelectionSource;
72 import jalview.structure.StructureSelectionManager;
73 import jalview.structure.VamsasSource;
74 import jalview.util.MessageManager;
75 import jalview.viewmodel.AlignmentViewport;
76 import jalview.ws.params.AutoCalcSetting;
82 * @version $Revision: 1.141 $
84 public class AlignViewport extends AlignmentViewport implements
85 SelectionSource, AlignViewportI, CommandListener
97 NJTree currentTree = null;
99 boolean cursorMode = false;
101 boolean antiAlias = false;
103 private Rectangle explodedGeometry;
108 * Flag set true on the view that should 'gather' multiple views of the same
109 * sequence set id when a project is reloaded. Set false on all views when
110 * they are 'exploded' into separate windows. Set true on the current view
111 * when 'Gather' is performed, and also on the first tab when the first new
114 private boolean gatherViewsHere = false;
116 private AnnotationColumnChooser annotationColumnSelectionState;
118 * Creates a new AlignViewport object.
123 public AlignViewport(AlignmentI al)
130 * Create a new AlignViewport object with a specific sequence set ID
134 * (may be null - but potential for ambiguous constructor exception)
136 public AlignViewport(AlignmentI al, String seqsetid)
138 this(al, seqsetid, null);
141 public AlignViewport(AlignmentI al, String seqsetid, String viewid)
143 sequenceSetID = seqsetid;
145 // TODO remove these once 2.4.VAMSAS release finished
146 if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null)
148 Cache.log.debug("Setting viewport's sequence set id : "
151 if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null)
153 Cache.log.debug("Setting viewport's view id : " + viewId);
160 * Create a new AlignViewport with hidden regions
164 * @param hiddenColumns
167 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns)
170 if (hiddenColumns != null)
172 colSel = hiddenColumns;
178 * New viewport with hidden columns and an existing sequence set id
181 * @param hiddenColumns
185 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns,
188 this(al, hiddenColumns, seqsetid, null);
192 * New viewport with hidden columns and an existing sequence set id and viewid
195 * @param hiddenColumns
201 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns,
202 String seqsetid, String viewid)
204 sequenceSetID = seqsetid;
206 // TODO remove these once 2.4.VAMSAS release finished
207 if (Cache.log != null && Cache.log.isDebugEnabled() && seqsetid != null)
209 Cache.log.debug("Setting viewport's sequence set id : "
212 if (Cache.log != null && Cache.log.isDebugEnabled() && viewId != null)
214 Cache.log.debug("Setting viewport's view id : " + viewId);
217 if (hiddenColumns != null)
219 colSel = hiddenColumns;
225 * Apply any settings saved in user preferences
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);
252 viewStyle.setScaleProteinAsCdna(Cache.getDefault(
253 Preferences.SCALE_PROTEIN_TO_CDNA, false));
259 this.endRes = alignment.getWidth() - 1;
261 this.endSeq = alignment.getHeight() - 1;
262 applyViewProperties();
264 String fontName = Cache.getDefault("FONT_NAME", "SansSerif");
265 String fontStyle = Cache.getDefault("FONT_STYLE", Font.PLAIN + "");
266 String fontSize = Cache.getDefault("FONT_SIZE", "10");
270 if (fontStyle.equals("bold"))
274 else if (fontStyle.equals("italic"))
279 setFont(new Font(fontName, style, Integer.parseInt(fontSize)), true);
282 .setGapCharacter(Cache.getDefault("GAP_SYMBOL", "-").charAt(0));
284 // We must set conservation and consensus before setting colour,
285 // as Blosum and Clustal require this to be done
286 if (hconsensus == null && !isDataset)
288 if (!alignment.isNucleotide())
290 showConservation = Cache.getDefault("SHOW_CONSERVATION", true);
291 showQuality = Cache.getDefault("SHOW_QUALITY", true);
292 showGroupConservation = Cache.getDefault("SHOW_GROUP_CONSERVATION",
295 showConsensusHistogram = Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM",
297 showSequenceLogo = Cache.getDefault("SHOW_CONSENSUS_LOGO", false);
298 normaliseSequenceLogo = Cache.getDefault("NORMALISE_CONSENSUS_LOGO",
300 showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false);
301 showConsensus = Cache.getDefault("SHOW_IDENTITY", true);
303 initAutoAnnotation();
304 String colourProperty = alignment.isNucleotide() ? Preferences.DEFAULT_COLOUR_NUC
305 : Preferences.DEFAULT_COLOUR_PROT;
306 String propertyValue = Cache.getProperty(colourProperty);
307 if (propertyValue == null)
309 // fall back on this property for backwards compatibility
310 propertyValue = Cache.getProperty(Preferences.DEFAULT_COLOUR);
312 if (propertyValue != null)
314 globalColourScheme = ColourSchemeProperty.getColour(alignment,
317 if (globalColourScheme instanceof UserColourScheme)
319 globalColourScheme = UserDefinedColours.loadDefaultColours();
320 ((UserColourScheme) globalColourScheme).setThreshold(0,
321 isIgnoreGapsConsensus());
324 if (globalColourScheme != null)
326 globalColourScheme.setConsensus(hconsensus);
332 * get the consensus sequence as displayed under the PID consensus annotation
335 * @return consensus sequence as a new sequence object
337 public SequenceI getConsensusSeq()
339 if (consensus == null)
341 updateConsensus(null);
343 if (consensus == null)
347 StringBuffer seqs = new StringBuffer();
348 for (int i = 0; i < consensus.annotations.length; i++)
350 if (consensus.annotations[i] != null)
352 if (consensus.annotations[i].description.charAt(0) == '[')
354 seqs.append(consensus.annotations[i].description.charAt(1));
358 seqs.append(consensus.annotations[i].displayCharacter);
363 SequenceI sq = new Sequence("Consensus", seqs.toString());
364 sq.setDescription("Percentage Identity Consensus "
365 + ((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
372 * @return DOCUMENT ME!
374 public int getStartRes()
382 * @return DOCUMENT ME!
384 public int getEndRes()
392 * @return DOCUMENT ME!
394 public int getStartSeq()
405 public void setStartRes(int res)
416 public void setStartSeq(int seq)
427 public void setEndRes(int res)
429 if (res > (alignment.getWidth() - 1))
431 // log.System.out.println(" Corrected res from " + res + " to maximum " +
432 // (alignment.getWidth()-1));
433 res = alignment.getWidth() - 1;
450 public void setEndSeq(int seq)
452 if (seq > alignment.getHeight())
454 seq = alignment.getHeight();
468 * @return DOCUMENT ME!
470 public int getEndSeq()
475 boolean validCharWidth;
478 * update view settings with the given font. You may need to call
479 * alignPanel.fontChanged to update the layout geometry
482 * when true, charWidth/height is set according to font mentrics
484 public void setFont(Font f, boolean setGrid)
488 Container c = new Container();
490 java.awt.FontMetrics fm = c.getFontMetrics(font);
491 int w = viewStyle.getCharWidth(), ww = fm.charWidth('M'), h = viewStyle
495 setCharHeight(fm.getHeight());
498 viewStyle.setFontName(font.getName());
499 viewStyle.setFontStyle(font.getStyle());
500 viewStyle.setFontSize(font.getSize());
502 validCharWidth = true;
506 public void setViewStyle(ViewStyleI settingsForView)
508 super.setViewStyle(settingsForView);
509 setFont(new Font(viewStyle.getFontName(), viewStyle.getFontStyle(),
510 viewStyle.getFontSize()), false);
516 * @return DOCUMENT ME!
518 public Font getFont()
529 public void setAlignment(AlignmentI align)
531 if (alignment != null && alignment.getCodonFrames() != null)
533 StructureSelectionManager.getStructureSelectionManager(
534 Desktop.instance).removeMappings(alignment.getCodonFrames());
536 this.alignment = align;
537 if (alignment != null && alignment.getCodonFrames() != null)
539 StructureSelectionManager.getStructureSelectionManager(
540 Desktop.instance).addMappings(alignment.getCodonFrames());
547 * @return DOCUMENT ME!
549 public char getGapCharacter()
551 return getAlignment().getGapCharacter();
560 public void setGapCharacter(char gap)
562 if (getAlignment() != null)
564 getAlignment().setGapCharacter(gap);
571 * @return DOCUMENT ME!
573 public ColumnSelection getColumnSelection()
584 public void setCurrentTree(NJTree tree)
592 * @return DOCUMENT ME!
594 public NJTree getCurrentTree()
600 * returns the visible column regions of the alignment
602 * @param selectedRegionOnly
603 * true to just return the contigs intersecting with the selected
607 public int[] getViewAsVisibleContigs(boolean selectedRegionOnly)
609 int[] viscontigs = null;
610 int start = 0, end = 0;
611 if (selectedRegionOnly && selectionGroup != null)
613 start = selectionGroup.getStartRes();
614 end = selectionGroup.getEndRes() + 1;
618 end = alignment.getWidth();
620 viscontigs = colSel.getVisibleContigs(start, end);
625 * get hash of undo and redo list for the alignment
627 * @return long[] { historyList.hashCode, redoList.hashCode };
629 public long[] getUndoRedoHash()
632 if (historyList == null || redoList == null)
638 { historyList.hashCode(), this.redoList.hashCode() };
642 * test if a particular set of hashcodes are different to the hashcodes for
643 * the undo and redo list.
646 * the stored set of hashcodes as returned by getUndoRedoHash
647 * @return true if the hashcodes differ (ie the alignment has been edited) or
648 * the stored hashcode array differs in size
650 public boolean isUndoRedoHashModified(long[] undoredo)
652 if (undoredo == null)
656 long[] cstate = getUndoRedoHash();
657 if (cstate.length != undoredo.length)
662 for (int i = 0; i < cstate.length; i++)
664 if (cstate[i] != undoredo[i])
673 * when set, view will scroll to show the highlighted position
675 public boolean followHighlight = true;
678 * @return true if view should scroll to show the highlighted region of a
682 public boolean getFollowHighlight()
684 return followHighlight;
687 public boolean followSelection = true;
690 * @return true if view selection should always follow the selections
691 * broadcast by other selection sources
693 public boolean getFollowSelection()
695 return followSelection;
699 * Send the current selection to be broadcast to any selection listeners.
701 public void sendSelection()
703 jalview.structure.StructureSelectionManager
704 .getStructureSelectionManager(Desktop.instance).sendSelection(
705 new SequenceGroup(getSelectionGroup()),
706 new ColumnSelection(getColumnSelection()), this);
710 * return the alignPanel containing the given viewport. Use this to get the
711 * components currently handling the given viewport.
714 * @return null or an alignPanel guaranteed to have non-null alignFrame
717 public AlignmentPanel getAlignPanel()
719 AlignmentPanel[] aps = PaintRefresher.getAssociatedPanels(this
720 .getSequenceSetId());
721 for (int p = 0; aps != null && p < aps.length; p++)
723 if (aps[p].av == this)
731 public boolean getSortByTree()
736 public void setSortByTree(boolean sort)
742 * synthesize a column selection if none exists so it covers the given
743 * selection group. if wholewidth is false, no column selection is made if the
744 * selection group covers the whole alignment width.
749 public void expandColSelection(SequenceGroup sg, boolean wholewidth)
753 && (sgs = sg.getStartRes()) >= 0
754 && sg.getStartRes() <= (sge = sg.getEndRes())
755 && (colSel == null || colSel.getSelected() == null || colSel
756 .getSelected().size() == 0))
758 if (!wholewidth && alignment.getWidth() == (1 + sge - sgs))
765 colSel = new ColumnSelection();
767 for (int cspos = sg.getStartRes(); cspos <= sg.getEndRes(); cspos++)
769 colSel.addElement(cspos);
775 * Returns the (Desktop) instance of the StructureSelectionManager
778 public StructureSelectionManager getStructureSelectionManager()
780 return StructureSelectionManager
781 .getStructureSelectionManager(Desktop.instance);
787 * @return a series of SequenceI arrays, one for each PDBEntry, listing which
788 * sequence in the alignment holds a reference to it
790 public SequenceI[][] collateForPDB(PDBEntry[] pdbEntries)
792 ArrayList<SequenceI[]> seqvectors = new ArrayList<SequenceI[]>();
793 for (PDBEntry pdb : pdbEntries)
795 ArrayList<SequenceI> seqs = new ArrayList<SequenceI>();
796 for (int i = 0; i < alignment.getHeight(); i++)
798 Vector pdbs = alignment.getSequenceAt(i).getDatasetSequence()
805 for (int p = 0; p < pdbs.size(); p++)
807 PDBEntry p1 = (PDBEntry) pdbs.elementAt(p);
808 if (p1.getId().equals(pdb.getId()))
810 if (!seqs.contains(sq = alignment.getSequenceAt(i)))
819 seqvectors.add(seqs.toArray(new SequenceI[seqs.size()]));
821 return seqvectors.toArray(new SequenceI[seqvectors.size()][]);
824 public boolean isNormaliseSequenceLogo()
826 return normaliseSequenceLogo;
829 public void setNormaliseSequenceLogo(boolean state)
831 normaliseSequenceLogo = state;
836 * @return true if alignment characters should be displayed
838 public boolean isValidCharWidth()
840 return validCharWidth;
843 private Hashtable<String, AutoCalcSetting> calcIdParams = new Hashtable<String, AutoCalcSetting>();
845 public AutoCalcSetting getCalcIdSettingsFor(String calcId)
847 return calcIdParams.get(calcId);
850 public void setCalcIdSettingsFor(String calcId, AutoCalcSetting settings,
853 calcIdParams.put(calcId, settings);
854 // TODO: create a restart list to trigger any calculations that need to be
855 // restarted after load
856 // calculator.getRegisteredWorkersOfClass(settings.getWorkerClass())
859 Cache.log.debug("trigger update for " + calcId);
864 * Method called when another alignment's edit (or possibly other) command is
867 * To allow for sequence mappings (e.g. protein to cDNA), we have to first
868 * 'unwind' the command on the source sequences (in simulation, not in fact),
869 * and then for each edit in turn:
871 * <li>compute the equivalent edit on the mapped sequences</li>
872 * <li>apply the mapped edit</li>
873 * <li>'apply' the source edit to the working copy of the source sequences</li>
881 public void mirrorCommand(CommandI command, boolean undo,
882 StructureSelectionManager ssm, VamsasSource source)
885 * Do nothing unless we are a 'complement' of the source. May replace this
886 * with direct calls not via SSM.
888 if (source instanceof AlignViewportI
889 && ((AlignViewportI) source).getCodingComplement() == this)
898 CommandI mappedCommand = ssm.mapCommand(command, undo, getAlignment(),
900 if (mappedCommand != null)
902 AlignmentI[] views = getAlignPanel().alignFrame.getViewAlignments();
903 mappedCommand.doCommand(views);
904 getAlignPanel().alignmentChanged();
909 * Add the sequences from the given alignment to this viewport. Optionally,
910 * may give the user the option to open a new frame, or split panel, with cDNA
911 * and protein linked.
916 public void addAlignment(AlignmentI al, String title)
918 // TODO: promote to AlignViewportI? applet CutAndPasteTransfer is different
920 // JBPComment: title is a largely redundant parameter at the moment
921 // JBPComment: this really should be an 'insert/pre/append' controller
922 // JBPComment: but the DNA/Protein check makes it a bit more complex
924 // refactored from FileLoader / CutAndPasteTransfer / SequenceFetcher with
926 // TODO: create undo object for this JAL-1101
929 * If one alignment is protein and one nucleotide, with at least one
930 * sequence name in common, offer to open a linked alignment.
932 if (AlignmentUtils.isMappable(al, getAlignment()))
934 if (openLinkedAlignment(al, title))
939 // TODO: JAL-407 regardless of above - identical sequences (based on ID and
940 // provenance) should share the same dataset sequence
942 for (int i = 0; i < al.getHeight(); i++)
944 getAlignment().addSequence(al.getSequenceAt(i));
946 // TODO this call was done by SequenceFetcher but not FileLoader or
947 // CutAndPasteTransfer. Is it needed?
948 // JBPComment: this repositions the view to show the new sequences
949 // JBPComment: so it is needed for UX
950 setEndSeq(getAlignment().getHeight());
951 firePropertyChange("alignment", null, getAlignment().getSequences());
955 * Show a dialog with the option to open and link (cDNA <-> protein) as a new
956 * alignment. Returns true if the new alignment was opened, false if not,
957 * because the user declined the offer.
961 protected boolean openLinkedAlignment(AlignmentI al, String title)
963 String[] options = new String[]
964 { MessageManager.getString("action.no"),
965 MessageManager.getString("label.split_window"),
966 MessageManager.getString("label.new_window"), };
967 final String question = JvSwingUtils.wrapTooltip(true,
968 MessageManager.getString("label.open_split_window?"));
969 int response = JOptionPane.showOptionDialog(Desktop.desktop, question,
970 MessageManager.getString("label.open_split_window"),
971 JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null,
972 options, options[0]);
974 if (response != 1 && response != 2)
978 final boolean openSplitPane = (response == 1);
979 final boolean openInNewWindow = (response == 2);
982 * Create the AlignFrame first (which creates the new alignment's datasets),
983 * before attempting sequence mapping.
985 AlignFrame newAlignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
986 AlignFrame.DEFAULT_HEIGHT);
987 newAlignFrame.setTitle(title);
990 * Identify protein and dna alignments. Make a copy of this one if opening
991 * in a new split pane.
993 AlignmentI thisAlignment = openSplitPane ? new Alignment(getAlignment())
995 AlignmentI protein = al.isNucleotide() ? thisAlignment : al;
996 final AlignmentI cdna = al.isNucleotide() ? al : thisAlignment;
998 newAlignFrame.statusBar.setText(MessageManager.formatMessage(
999 "label.successfully_loaded_file", new Object[]
1002 // TODO if we want this (e.g. to enable reload of the alignment from file),
1003 // we will need to add parameters to the stack.
1004 // if (!protocol.equals(AppletFormatAdapter.PASTE))
1006 // alignFrame.setFileName(file, format);
1009 if (openInNewWindow)
1011 Desktop.addInternalFrame(newAlignFrame, title,
1012 AlignFrame.DEFAULT_WIDTH,
1013 AlignFrame.DEFAULT_HEIGHT);
1017 * Map sequences. At least one should get mapped as we have already passed
1018 * the test for 'mappability'. Any mappings made will be added to the
1019 * protein alignment.
1021 AlignmentUtils.mapProteinToCdna(protein, cdna);
1025 newAlignFrame.setMaximum(jalview.bin.Cache.getDefault(
1028 } catch (java.beans.PropertyVetoException ex)
1034 protein = openSplitFrame(newAlignFrame, thisAlignment,
1035 protein.getCodonFrames());
1039 * Register the mappings (held on the protein alignment) with the
1040 * StructureSelectionManager (for mouseover linking).
1042 final StructureSelectionManager ssm = StructureSelectionManager
1043 .getStructureSelectionManager(Desktop.instance);
1044 ssm.addMappings(protein.getCodonFrames());
1050 * Helper method to open a new SplitFrame holding linked dna and protein
1053 * @param newAlignFrame
1054 * containing a new alignment to be shown
1056 * cdna/protein complement alignment to show in the other split half
1058 * @return the protein alignment in the split frame
1060 protected AlignmentI openSplitFrame(AlignFrame newAlignFrame,
1061 AlignmentI complement, Set<AlignedCodonFrame> mappings)
1064 * Open in split pane. DNA sequence above, protein below.
1066 AlignFrame copyMe = new AlignFrame(complement,
1067 AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
1068 copyMe.setTitle(getAlignPanel().alignFrame.getTitle());
1070 AlignmentI al = newAlignFrame.viewport.getAlignment();
1071 final AlignFrame proteinFrame = al.isNucleotide() ? copyMe
1073 final AlignFrame cdnaFrame = al.isNucleotide() ? newAlignFrame
1075 AlignmentI protein = proteinFrame.viewport.getAlignment();
1076 protein.setCodonFrames(mappings);
1078 cdnaFrame.setVisible(true);
1079 proteinFrame.setVisible(true);
1080 String linkedTitle = MessageManager
1081 .getString("label.linked_view_title");
1082 JInternalFrame splitFrame = new SplitFrame(cdnaFrame, proteinFrame);
1083 Desktop.addInternalFrame(splitFrame, linkedTitle, -1, -1);
1088 public AnnotationColumnChooser getAnnotationColumnSelectionState()
1090 return annotationColumnSelectionState;
1093 public void setAnnotationColumnSelectionState(
1094 AnnotationColumnChooser currentAnnotationColumnSelectionState)
1096 this.annotationColumnSelectionState = currentAnnotationColumnSelectionState;
1100 public void setIdWidth(int i)
1102 super.setIdWidth(i);
1103 AlignmentPanel ap = getAlignPanel();
1106 // modify GUI elements to reflect geometry change
1107 Dimension idw = getAlignPanel().getIdPanel().getIdCanvas()
1108 .getPreferredSize();
1110 getAlignPanel().getIdPanel().getIdCanvas().setPreferredSize(idw);
1114 public Rectangle getExplodedGeometry()
1116 return explodedGeometry;
1119 public void setExplodedGeometry(Rectangle explodedPosition)
1121 this.explodedGeometry = explodedPosition;
1124 public boolean isGatherViewsHere()
1126 return gatherViewsHere;
1129 public void setGatherViewsHere(boolean gatherViewsHere)
1131 this.gatherViewsHere = gatherViewsHere;