import jalview.gui.*;\r
import jalview.io.*;\r
import jalview.datamodel.*;\r
-import jalview.schemes.*;\r
import javax.swing.*;\r
import java.awt.*;\r
import java.awt.event.*;\r
import java.awt.dnd.*;\r
import javax.swing.*;\r
import java.awt.datatransfer.*;\r
-import java.io.*;\r
+import jalview.bin.Cache;\r
\r
\r
public class Desktop extends jalview.jbgui.GDesktop implements DropTargetListener\r
setTitle("Jalview 2005");\r
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r
desktop = new JDesktopPane();\r
- // desktop.setBackground(Color.white);\r
+ desktop.setBackground(Color.white);\r
setContentPane(desktop);\r
desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);\r
\r
frame.toFront();\r
final JMenuItem menuItem = new JMenuItem(title);\r
frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()\r
- { public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt)\r
- {\r
- openFrameCount--;\r
- windowMenu.remove(menuItem);\r
- };\r
- });\r
+ {\r
+ public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt)\r
+ {\r
+ openFrameCount--;\r
+ windowMenu.remove(menuItem);\r
+ };\r
+ });\r
\r
menuItem.addActionListener(new ActionListener()\r
{\r
{\r
String file = files.get(i).toString();\r
String protocol = "File";\r
- String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
- LoadFile(file, protocol, format);\r
+ if(file.endsWith(".jar"))\r
+ Jalview2XML.LoadJalviewAlign(file);\r
+ else\r
+ {\r
+ String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
+ LoadFile(file, protocol, format);\r
+ }\r
}\r
\r
}catch(Exception ex){ex.printStackTrace();}\r
}\r
\r
+\r
public void inputLocalFileMenuItem_actionPerformed(ActionEvent e)\r
{\r
JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty("LAST_DIRECTORY"),\r
- new String[]{"fa", "fasta", "fastq", "blc", "msf", "pfam", "aln", "pir"}, "Alignment files");\r
+ new String[]{"fa, fasta, fastq", "aln", "pfam", "msf", "pir","blc","jar"},\r
+ new String[]{"Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"}\r
+ ,jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));\r
+\r
chooser.setFileView(new JalviewFileView());\r
chooser.setDialogTitle("Open local file");\r
chooser.setToolTipText("Open");\r
if(value == JalviewFileChooser.APPROVE_OPTION)\r
{\r
String choice = chooser.getSelectedFile().getPath();\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);\r
- String format = IdentifyFile.Identify(choice, "File");\r
- LoadFile(choice, "File", format);\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser.getSelectedFile().getParent());\r
+ if(chooser.getSelectedFormat().equals("Jalview"))\r
+ {\r
+ jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT", "Jalivew");\r
+ Jalview2XML.LoadJalviewAlign(choice);\r
+ }\r
+ else\r
+ {\r
+ String format = IdentifyFile.Identify(choice, "File");\r
+ jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT", format);\r
+ LoadFile(choice, "File", format);\r
+ }\r
}\r
}\r
\r
{\r
SequenceI [] sequences = null;\r
\r
- if (FormatProperties.contains(format))\r
- sequences = FormatAdapter.read(file, protocol, format);\r
+ if (FormatAdapter.formats.contains(format))\r
+ sequences = FormatAdapter.readFile(file, protocol, format);\r
\r
if (sequences != null && sequences.length>0)\r
{\r
AlignFrame af = new AlignFrame(new Alignment(sequences));\r
addInternalFrame(af, file, AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT);\r
+ af.currentFileFormat = format;\r
af.statusBar.setText("Successfully loaded file " + file);\r
+ try{\r
+ af.setMaximum(Preferences.showFullscreen);\r
+ }catch(Exception ex){}\r
+\r
}\r
else\r
JOptionPane.showInternalMessageDialog(Desktop.desktop, "Couldn't open file.\n"\r
+ "Formats currently supported are\n"\r
- + "Fasta, MSF, Clustal, BLC, PIR, MSP or PFAM" // JBPNote - message should be generated through FormatAdapter!\r
+ + "Fasta, MSF, Clustal, BLC, PIR, MSP, and PFAM" // JBPNote - message should be generated through FormatAdapter!\r
,"Error loading file",\r
JOptionPane.WARNING_MESSAGE);\r
\r
{\r
String url = JOptionPane.showInternalInputDialog(Desktop.desktop,"Enter url of input file",\r
"Input alignment from URL",\r
- JOptionPane.QUESTION_MESSAGE);\r
+ JOptionPane.QUESTION_MESSAGE,\r
+ null, null,\r
+ "http://www.").toString();\r
if (url == null)\r
return;\r
\r
\r
public void inputTextboxMenuItem_actionPerformed(ActionEvent e)\r
{\r
- CutAndPasteTransfer cap = new CutAndPasteTransfer(true);\r
- int accept = JOptionPane.showInternalOptionDialog(Desktop.desktop, cap, "Cut & paste Alignment File",\r
- JOptionPane.YES_NO_CANCEL_OPTION,\r
- JOptionPane.PLAIN_MESSAGE,\r
- null,\r
- new Object[]{"Accept", "Cancel", }, null);\r
-\r
-\r
- if(accept == JOptionPane.YES_OPTION)\r
- {\r
- String format = IdentifyFile.Identify(cap.getText(), "Paste");\r
- SequenceI [] sequences = null;\r
-\r
- if (FormatProperties.contains( format ))\r
- sequences = FormatAdapter.read(cap.getText(), "Paste", format);\r
-\r
-\r
- if(sequences!=null)\r
- {\r
- AlignFrame af = new AlignFrame(new Alignment(sequences));\r
- addInternalFrame(af, "Cut & Paste input - "+format,\r
- AlignFrame.NEW_WINDOW_WIDTH,\r
- AlignFrame.NEW_WINDOW_HEIGHT);\r
- af.statusBar.setText("Successfully pasted alignment file");\r
- }\r
- else\r
- JOptionPane.showInternalMessageDialog(Desktop.desktop, "Couldn't read the pasted text.\n"\r
- +"Formats currently supported are\n"\r
- +"Fasta, MSF, Clustal, BLC, PIR, MSP or PFAM",\r
- "Error parsing text", JOptionPane.WARNING_MESSAGE);\r
-\r
- }\r
+ CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
+ cap.setForInput();\r
+ Desktop.addInternalFrame(cap, "Cut & Paste Alignment File", 600, 500);\r
}\r
\r
/*\r
"JalView 2005 version " + jalview.bin.Cache.VERSION+"; last updated: "+jalview.bin.Cache.BUILD_DATE\r
+"\nAuthors: Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton."\r
+"\nCurrent development managed by Andrew Waterhouse; Barton Group, University of Dundee."\r
- +"\nIf you use JalView, please cite:"\r
+ +"\nFor all issues relating to Jalview, email help@jalview.org"\r
+ +"\n\nIf you use JalView, please cite:"\r
+"\n\"Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004), The Jalview Java Alignment Editor\""\r
+"\nBioinformatics, 2004 12;426-7.",\r
"About Jalview",\r
ex.printStackTrace();\r
}\r
}\r
+\r
+ protected void preferences_actionPerformed(ActionEvent e)\r
+ {\r
+ Preferences pref = new Preferences();\r
+ }\r
+\r
+ public void saveState_actionPerformed(ActionEvent e)\r
+ {\r
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
+ getProperty("LAST_DIRECTORY"),\r
+ new String[]\r
+ {"jar"}, new String[]{"Jalview Project"}, "Jalview Project");\r
+\r
+ chooser.setFileView(new JalviewFileView());\r
+ chooser.setDialogTitle("Save State");\r
+ int value = chooser.showSaveDialog(this);\r
+ if (value == JalviewFileChooser.APPROVE_OPTION)\r
+ {\r
+ java.io.File choice = chooser.getSelectedFile();\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());\r
+ Jalview2XML.SaveState(choice);\r
+ }\r
+\r
+ }\r
+\r
+\r
+ public void loadState_actionPerformed(ActionEvent e)\r
+ {\r
+ JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty("LAST_DIRECTORY"),\r
+ new String[]{"jar"}, new String[]{"Jalview Project"}, "Jalview Project");\r
+ chooser.setFileView(new JalviewFileView());\r
+ chooser.setDialogTitle("Restore state");\r
+ int value = chooser.showOpenDialog(this);\r
+ if(value == JalviewFileChooser.APPROVE_OPTION)\r
+ {\r
+ String choice = chooser.getSelectedFile().getAbsolutePath();\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser.getSelectedFile().getParent());\r
+ Jalview2XML.LoadJalviewAlign(choice);\r
+ }\r
+ }\r
}\r
\r
\r