Vector alignPanels = new Vector();
- TCoffeeScoreFile tcoffeeScoreFile;
-
/**
* Last format used to load or save alignments in this window
*/
{
TCoffeeScoreFile result = TCoffeeScoreFile.load(new File(sFilePath));
if( result == null ) {
+ // TODO: raise a dialog box here rather than bomb out.
+
throw new RuntimeException("The file provided does not match the T-Coffee scores file format");
}
*/
AlignmentI aln;
if( (aln=viewport.alignment) != null && (aln.getHeight() != result.getHeight() || aln.getWidth() != result.getWidth()) ) {
- throw new RuntimeException("The scores matrix does not match the alignment dimensions");
+ // TODO: raise a dialog box here rather than bomb out.
+ throw new RuntimeException("The scores matrix does not match the alignment dimensions");
}
-
- changeColour( new TCoffeeColourScheme(result) );
- tcoffeeScoreFile = result;
- tcoffeeColour.setEnabled(true);
- tcoffeeColour.setSelected(true);
-
+ if (result.annotateAlignment(alignPanel.getAlignment(), true))
+ {
+ tcoffeeColour.setEnabled(true);
+ tcoffeeColour.setSelected(true);
+ // switch to this color
+ changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));
+ } else {
+ tcoffeeColour.setEnabled(false);
+ tcoffeeColour.setSelected(false);
+ }
}
catch (Exception ex) {
JOptionPane.showMessageDialog(
@Override
protected void tcoffeeColorScheme_actionPerformed(ActionEvent e) {
- if( tcoffeeScoreFile != null ) {
- changeColour( new TCoffeeColourScheme(tcoffeeScoreFile) );
- }
+ changeColour( new TCoffeeColourScheme(alignPanel.getAlignment()) );
}
// /**