various loadTree bits for loading and saving trees.
authorjprocter <Jim Procter>
Fri, 18 Mar 2005 17:23:36 +0000 (17:23 +0000)
committerjprocter <Jim Procter>
Fri, 18 Mar 2005 17:23:36 +0000 (17:23 +0000)
src/jalview/gui/AlignFrame.java
src/jalview/gui/AlignmentPanel.java
src/jalview/gui/Desktop.java

index 079f315..867de61 100755 (executable)
@@ -185,6 +185,7 @@ public class AlignFrame extends GAlignFrame
 \r
   Stack historyList = new Stack();\r
   Stack redoList = new Stack();\r
+  JMenuBar jMenuBar1 = new JMenuBar();\r
 \r
   void updateEditMenuBar()\r
   {\r
@@ -1094,4 +1095,49 @@ if ( viewport.getConservationSelected() )
          g.drawString("Clustal Alignment Web Service running", 30,30);\r
        }\r
   }\r
+  public void jpredMenuItem_actionPerformed(ActionEvent e)\r
+    {\r
+      JInternalFrame frame = new JInternalFrame();\r
+      JPredClient ct = new JPredClient((SequenceI)\r
+                                       viewport.getAlignment().getSequences().elementAt(0));\r
+    }\r
+\r
+\r
+  protected void LoadtreeMenuItem_actionPerformed(ActionEvent e) {\r
+    // Pick the tree file\r
+    JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
+        getProperty("LAST_DIRECTORY"));\r
+    chooser.setFileView(new JalviewFileView());\r
+    chooser.setDialogTitle("Select a newick-like tree file");\r
+    chooser.setToolTipText("Load a tree file");\r
+    int value = chooser.showOpenDialog(null);\r
+    if (value == JalviewFileChooser.APPROVE_OPTION)\r
+    {\r
+      String choice = chooser.getSelectedFile().getPath();\r
+      jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);\r
+      TreePanel treepanel = null;\r
+      try\r
+      {\r
+        jalview.io.NewickFile fin = new jalview.io.NewickFile(choice, "File");\r
+        fin.parse();\r
+\r
+        if (fin.getTree() != null)\r
+        {\r
+          TreePanel tp = null;\r
+          tp = new TreePanel(viewport, viewport.getAlignment().getSequences(),\r
+                             fin, "FromFile", choice);\r
+          Desktop.addInternalFrame(tp, title, 600, 500);\r
+        }\r
+      }\r
+      catch (Exception ex)\r
+      {\r
+        JOptionPane.showMessageDialog(Desktop.desktop,\r
+                                      "Problem reading tree file",\r
+                                      ex.getMessage(),\r
+                                      JOptionPane.WARNING_MESSAGE);\r
+        ex.printStackTrace();\r
+      }\r
+    }\r
+  }\r
+\r
 }\r
index 997966f..bfff00f 100755 (executable)
@@ -11,9 +11,9 @@ import java.awt.print.*;
 import com.sun.image.codec.jpeg.*;\r
 import java.io.*;\r
 import java.awt.image.*;\r
-\r
 import org.jibble.epsgraphics.*;\r
 import javax.imageio.*;\r
+
 \r
 \r
 public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListener, Printable\r
index 8bf7523..fe25cd4 100755 (executable)
@@ -180,7 +180,7 @@ public void windowClosing(WindowEvent evt)
    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"\r
+                          + "Fasta, MSF, Clustal, BLC, PIR, MSP or PFAM" // JBPNote - message should be generated through FormatAdapter!\r
                           ,"Error loading file",\r
                                    JOptionPane.WARNING_MESSAGE);\r
 \r