import jalview.api.ViewStyleI;
import jalview.bin.Cache;
import jalview.commands.CommandI;
+import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
String viewName;
+ /*
+ * Flag set true on the view that should 'gather' multiple views of the same
+ * sequence set id when a project is reloaded. Set false on all views when
+ * they are 'exploded' into separate windows. Set true on the current view
+ * when 'Gather' is performed, and also on the first tab when the first new
+ * view is created.
+ */
private boolean gatherViewsHere = false;
private AnnotationColumnChooser annotationColumnSelectionState;
showConsensus = Cache.getDefault("SHOW_IDENTITY", true);
}
initAutoAnnotation();
- if (jalview.bin.Cache.getProperty("DEFAULT_COLOUR") != null)
+ String colourProperty = alignment.isNucleotide() ? Preferences.DEFAULT_COLOUR_NUC
+ : Preferences.DEFAULT_COLOUR_PROT;
+ String propertyValue = Cache.getProperty(colourProperty);
+ if (propertyValue == null)
+ {
+ // fall back on this property for backwards compatibility
+ propertyValue = Cache.getProperty(Preferences.DEFAULT_COLOUR);
+ }
+ if (propertyValue != null)
{
globalColourScheme = ColourSchemeProperty.getColour(alignment,
- jalview.bin.Cache.getProperty("DEFAULT_COLOUR"));
+ propertyValue);
if (globalColourScheme instanceof UserColourScheme)
{
MessageManager.getString("label.split_window"),
MessageManager.getString("label.new_window"), };
final String question = JvSwingUtils.wrapTooltip(true,
- MessageManager.getString("label.open_linked_alignment?"));
+ MessageManager.getString("label.open_split_window?"));
int response = JOptionPane.showOptionDialog(Desktop.desktop, question,
- MessageManager.getString("label.open_linked_alignment"),
+ MessageManager.getString("label.open_split_window"),
JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null,
options, options[0]);
if (openSplitPane)
{
- protein = openSplitFrame(newAlignFrame, thisAlignment);
+ protein = openSplitFrame(newAlignFrame,
+ thisAlignment.getSequencesArray(), protein.getCodonFrames());
}
/*
*
* @param newAlignFrame
* containing a new alignment to be shown
- * @param existingAlignment
- * an existing alignment to be copied for display in the split frame
+ * @param seqs
+ * 'complementary' sequences to show in the other split half
+ * @param mappings
* @return the protein alignment in the split frame
*/
protected AlignmentI openSplitFrame(AlignFrame newAlignFrame,
- AlignmentI existingAlignment)
+ SequenceI[] seqs, Set<AlignedCodonFrame> mappings)
{
+ AlignmentI complementAlignment = new Alignment(seqs);
// TODO: move this to a factory/controller method ?
/*
* Open in split pane. DNA sequence above, protein below.
*/
- AlignFrame copyMe = new AlignFrame(existingAlignment,
+ AlignFrame copyMe = new AlignFrame(complementAlignment,
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
copyMe.setTitle(getAlignPanel().alignFrame.getTitle());
final AlignFrame cdnaFrame = al.isNucleotide() ? newAlignFrame
: copyMe;
AlignmentI protein = proteinFrame.viewport.getAlignment();
+ protein.setCodonFrames(mappings);
cdnaFrame.setVisible(true);
proteinFrame.setVisible(true);
JInternalFrame splitFrame = new SplitFrame(cdnaFrame, proteinFrame);
Desktop.addInternalFrame(splitFrame, linkedTitle, -1, -1);
- /*
- * Set the frames to listen for each other's edit and sort commands.
- */
- final StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance);
- ssm.addCommandListener(cdnaFrame.getViewport());
- ssm.addCommandListener(proteinFrame.getViewport());
-
- /*
- * 'Coding complement' (dna/protein) views will mirror each others' edits,
- * selections, sorting etc as decided from time to time by the relevant
- * authorities.
- */
- proteinFrame.getViewport().setCodingComplement(cdnaFrame.getViewport());
return protein;
}