();
}
if (binding.isColourBySequence())
{
if (!binding.isLoadingFromArchive())
{
if (_colourwith.size() == 0 && getAlignmentPanel() != null)
{
// Make the currently displayed alignment panel the associated view
_colourwith.add(getAlignmentPanel().alignFrame.alignPanel);
}
}
// Set the colour using the current view for the associated alignframe
for (AlignmentPanel ap : _colourwith)
{
binding.colourBySequence(ap);
}
}
}
@Override
public void pdbFile_actionPerformed(ActionEvent actionEvent)
{
JalviewFileChooser chooser = new JalviewFileChooser(
Cache.getProperty("LAST_DIRECTORY"));
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(MessageManager.getString("label.save_pdb_file"));
chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(this);
if (value == JalviewFileChooser.APPROVE_OPTION)
{
BufferedReader in = null;
try
{
// TODO: cope with multiple PDB files in view
in = new BufferedReader(
new FileReader(getBinding().getPdbFile()[0]));
File outFile = chooser.getSelectedFile();
PrintWriter out = new PrintWriter(new FileOutputStream(outFile));
String data;
while ((data = in.readLine()) != null)
{
if (!(data.indexOf("") > -1 || data.indexOf("
") > -1))
{
out.println(data);
}
}
out.close();
} catch (Exception ex)
{
ex.printStackTrace();
} finally
{
if (in != null)
{
try
{
in.close();
} catch (IOException e)
{
// ignore
}
}
}
}
}
@Override
public void viewMapping_actionPerformed(ActionEvent actionEvent)
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
try
{
cap.appendText(getBinding().printMappings());
} catch (OutOfMemoryError e)
{
new OOMWarning(
"composing sequence-structure alignments for display in text box.",
e);
cap.dispose();
return;
}
Desktop.addInternalFrame(cap,
MessageManager.getString("label.pdb_sequence_mapping"), 550,
600);
}
protected abstract String getViewerName();
public void updateTitleAndMenus()
{
AAStructureBindingModel binding = getBinding();
if (binding.hasFileLoadingError())
{
repaint();
return;
}
setChainMenuItems(binding.getChainNames());
this.setTitle(binding.getViewerTitle(getViewerName(), true));
if (binding.getPdbFile().length > 1 && binding.getSequence().length > 1)
{
viewerActionMenu.setVisible(true);
}
if (!binding.isLoadingFromArchive())
{
seqColour_actionPerformed(null);
}
}
}