/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
- * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4.0.b2)
+ * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
import jalview.datamodel.*;
import jalview.io.*;
-public class CutAndPasteTransfer
- extends Panel implements ActionListener, MouseListener
+public class CutAndPasteTransfer extends Panel implements ActionListener,
+ MouseListener
{
boolean pdbImport = false;
+
boolean treeImport = false;
+
boolean annotationImport = false;
- Sequence seq;
+
+ Sequence seq;
+
AlignFrame alignFrame;
public CutAndPasteTransfer(boolean forImport, AlignFrame alignFrame)
try
{
jbInit();
- }
- catch (Exception e)
+ } catch (Exception e)
{
e.printStackTrace();
}
textarea.append("\n");
if (textarea.getText().length() == length)
{
- String warning =
- "\n\n#################################################\n"
- + "WARNING!! THIS IS THE MAXIMUM SIZE OF TEXTAREA!!\n"
- + "\nCAN'T INPUT FULL ALIGNMENT"
- + "\n\nYOU MUST DELETE THIS WARNING TO CONTINUE"
- + "\n\nMAKE SURE LAST SEQUENCE PASTED IS COMPLETE"
- + "\n#################################################\n";
+ String warning = "\n\n#################################################\n"
+ + "WARNING!! THIS IS THE MAXIMUM SIZE OF TEXTAREA!!\n"
+ + "\nCAN'T INPUT FULL ALIGNMENT"
+ + "\n\nYOU MUST DELETE THIS WARNING TO CONTINUE"
+ + "\n\nMAKE SURE LAST SEQUENCE PASTED IS COMPLETE"
+ + "\n#################################################\n";
textarea.setText(text.substring(0, text.length() - warning.length())
- + warning);
+ + warning);
textarea.setCaretPosition(text.length());
}
PDBEntry pdb = new PDBEntry();
pdb.setFile(text);
- if ( alignFrame.alignPanel.av.applet.jmolAvailable )
- new jalview.appletgui.AppletJmol(pdb,
- new Sequence[]{seq},
- null,
- alignFrame.alignPanel,
- AppletFormatAdapter.PASTE);
+ if (alignFrame.alignPanel.av.applet.jmolAvailable)
+ new jalview.appletgui.AppletJmol(pdb, new Sequence[]
+ { seq }, null, alignFrame.alignPanel, AppletFormatAdapter.PASTE);
else
- new MCview.AppletPDBViewer(pdb,
- new Sequence[]{seq},
- null,
- alignFrame.alignPanel,
- AppletFormatAdapter.PASTE);
+ new MCview.AppletPDBViewer(pdb, new Sequence[]
+ { seq }, null, alignFrame.alignPanel, AppletFormatAdapter.PASTE);
}
else if (treeImport)
{
try
{
- jalview.io.NewickFile fin = new jalview.io.NewickFile(textarea.getText(),
- "Paste");
+ jalview.io.NewickFile fin = new jalview.io.NewickFile(textarea
+ .getText(), "Paste");
fin.parse();
if (fin.getTree() != null)
alignFrame.loadTree(fin, "Pasted tree file");
}
- }
- catch (Exception ex)
+ } catch (Exception ex)
{
textarea.setText("Could not parse Newick file!\n" + ex);
return;
else if (annotationImport)
{
if (new AnnotationFile().readAnnotationFile(
- alignFrame.viewport.alignment, textarea.getText(),
- jalview.io.AppletFormatAdapter.PASTE))
+ alignFrame.viewport.alignment, textarea.getText(),
+ jalview.io.AppletFormatAdapter.PASTE))
{
alignFrame.alignPanel.fontChanged();
alignFrame.alignPanel.setScrollValues(0, 0);
else
{
alignFrame.parseFeaturesFile(textarea.getText(),
- jalview.io.AppletFormatAdapter.PASTE);
+ jalview.io.AppletFormatAdapter.PASTE);
}
}
else if (alignFrame != null)
Alignment al = null;
String format = new IdentifyFile().Identify(text,
- AppletFormatAdapter.PASTE);
+ AppletFormatAdapter.PASTE);
try
{
- al = new AppletFormatAdapter().readFile(text, AppletFormatAdapter.PASTE,
- format);
- }
- catch (java.io.IOException ex)
+ al = new AppletFormatAdapter().readFile(text,
+ AppletFormatAdapter.PASTE, format);
+ } catch (java.io.IOException ex)
{
ex.printStackTrace();
}
if (newWindow)
{
AlignFrame af = new AlignFrame(al, alignFrame.viewport.applet,
- "Cut & Paste input - " + format,
- false);
+ "Cut & Paste input - " + format, false);
af.statusBar.setText("Successfully pasted alignment file");
}
else
if (this.getParent() instanceof Frame)
{
- ( (Frame)this.getParent()).setVisible(false);
+ ((Frame) this.getParent()).setVisible(false);
}
else
{
- ( (Dialog)this.getParent()).setVisible(false);
+ ((Dialog) this.getParent()).setVisible(false);
}
}
textarea.setText("");
if (this.getParent() instanceof Frame)
{
- ( (Frame)this.getParent()).setVisible(false);
+ ((Frame) this.getParent()).setVisible(false);
}
else
{
- ( (Dialog)this.getParent()).setVisible(false);
+ ((Dialog) this.getParent()).setVisible(false);
}
}
protected TextArea textarea = new TextArea();
+
Button accept = new Button("New Window");
+
Button addSequences = new Button("Add to Current Alignment");
+
Button cancel = new Button("Close");
protected Panel buttonPanel = new Panel();
+
BorderLayout borderLayout1 = new BorderLayout();
- private void jbInit()
- throws Exception
+ private void jbInit() throws Exception
{
textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 10));
textarea.setText("Paste your alignment file here");
}
public void mouseReleased(MouseEvent evt)
- {}
+ {
+ }
public void mouseClicked(MouseEvent evt)
- {}
+ {
+ }
public void mouseEntered(MouseEvent evt)
- {}
+ {
+ }
public void mouseExited(MouseEvent evt)
- {}
+ {
+ }
}