From: jprocter Date: Fri, 18 Mar 2005 17:23:36 +0000 (+0000) Subject: various loadTree bits for loading and saving trees. X-Git-Tag: Release_2_0~551 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a2d2bfc9a2efd08446954c01dc5957560fdec9be;p=jalview.git various loadTree bits for loading and saving trees. --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 079f315..867de61 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -185,6 +185,7 @@ public class AlignFrame extends GAlignFrame Stack historyList = new Stack(); Stack redoList = new Stack(); + JMenuBar jMenuBar1 = new JMenuBar(); void updateEditMenuBar() { @@ -1094,4 +1095,49 @@ if ( viewport.getConservationSelected() ) g.drawString("Clustal Alignment Web Service running", 30,30); } } + public void jpredMenuItem_actionPerformed(ActionEvent e) + { + JInternalFrame frame = new JInternalFrame(); + JPredClient ct = new JPredClient((SequenceI) + viewport.getAlignment().getSequences().elementAt(0)); + } + + + protected void LoadtreeMenuItem_actionPerformed(ActionEvent e) { + // Pick the tree file + JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache. + getProperty("LAST_DIRECTORY")); + chooser.setFileView(new JalviewFileView()); + chooser.setDialogTitle("Select a newick-like tree file"); + chooser.setToolTipText("Load a tree file"); + int value = chooser.showOpenDialog(null); + if (value == JalviewFileChooser.APPROVE_OPTION) + { + String choice = chooser.getSelectedFile().getPath(); + jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice); + TreePanel treepanel = null; + try + { + jalview.io.NewickFile fin = new jalview.io.NewickFile(choice, "File"); + fin.parse(); + + if (fin.getTree() != null) + { + TreePanel tp = null; + tp = new TreePanel(viewport, viewport.getAlignment().getSequences(), + fin, "FromFile", choice); + Desktop.addInternalFrame(tp, title, 600, 500); + } + } + catch (Exception ex) + { + JOptionPane.showMessageDialog(Desktop.desktop, + "Problem reading tree file", + ex.getMessage(), + JOptionPane.WARNING_MESSAGE); + ex.printStackTrace(); + } + } + } + } diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 997966f..bfff00f 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -11,9 +11,9 @@ import java.awt.print.*; import com.sun.image.codec.jpeg.*; import java.io.*; import java.awt.image.*; - import org.jibble.epsgraphics.*; import javax.imageio.*; + public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListener, Printable diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 8bf7523..fe25cd4 100755 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -180,7 +180,7 @@ public void windowClosing(WindowEvent evt) else JOptionPane.showInternalMessageDialog(Desktop.desktop, "Couldn't open file.\n" + "Formats currently supported are\n" - + "Fasta, MSF, Clustal, BLC, PIR, MSP or PFAM" + + "Fasta, MSF, Clustal, BLC, PIR, MSP or PFAM" // JBPNote - message should be generated through FormatAdapter! ,"Error loading file", JOptionPane.WARNING_MESSAGE);