X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FDesktop.java;h=76d02e76837d57956907a70ea55eb6a09dbf193b;hb=69933be26034fbebe01d573a9290f0baa2b468b4;hp=fd741be605b4655f57a54426354a21e73be82c8d;hpb=c2404cecc845332c659d1a42bda51576235ba92b;p=jalview.git diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index fd741be..76d02e7 100755 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -23,6 +23,7 @@ import java.awt.*; import java.awt.datatransfer.*; import java.awt.dnd.*; import java.awt.event.*; +import java.lang.reflect.Constructor; import java.util.*; import javax.swing.*; @@ -42,8 +43,8 @@ public class Desktop //Need to decide if the Memory Usage is to be included in //Next release or not. - public static MyDesktopPane desktop; - // public static JDesktopPane desktop; + // public static MyDesktopPane desktop; + public static JDesktopPane desktop; static int openFrameCount = 0; @@ -63,32 +64,13 @@ public class Desktop { instance = this; doVamsasClientCheck(); - Image image = null; + doGroovyCheck(); - try - { - java.net.URL url = getClass().getResource("/images/logo.gif"); - - if (url != null) - { - image = java.awt.Toolkit.getDefaultToolkit().createImage(url); - - MediaTracker mt = new MediaTracker(this); - mt.addImage(image, 0); - mt.waitForID(0); - setIconImage(image); - } - } - catch (Exception ex) - { - } - setTitle("Jalview " + jalview.bin.Cache.getProperty("VERSION")); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - desktop = new MyDesktopPane(true); - // desktop = new JDesktopPane(); + desktop = new JDesktopPane(); desktop.setBackground(Color.white); getContentPane().setLayout(new BorderLayout()); getContentPane().add(desktop, BorderLayout.CENTER); @@ -139,15 +121,8 @@ public class Desktop /////////Add a splashscreen on startup /////////Add a splashscreen on startup - JInternalFrame frame = new JInternalFrame(); - - SplashScreen splash = new SplashScreen(frame, image); - frame.setContentPane(splash); - frame.setLayer(JLayeredPane.PALETTE_LAYER); - frame.setLocation( (int) ( (getWidth() - 750) / 2), - (int) ( (getHeight() - 160) / 2)); + new SplashScreen(); - addInternalFrame(frame, "", 750, 160, false); discoverer = new jalview.ws.Discoverer(); // Only gets started if gui is displayed. } @@ -807,28 +782,6 @@ public class Desktop } } - /* public void vamsasLoad_actionPerformed(ActionEvent e) - { - JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache. - getProperty("LAST_DIRECTORY")); - - chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle("Load Vamsas file"); - chooser.setToolTipText("Import"); - - int value = chooser.showOpenDialog(this); - - if (value == JalviewFileChooser.APPROVE_OPTION) - { - jalview.io.VamsasDatastore vs = new jalview.io.VamsasDatastore(null); - vs.load( - chooser.getSelectedFile().getAbsolutePath() - ); - } - - }*/ - - public void inputSequence_actionPerformed(ActionEvent e) { new SequenceFetcher(null); @@ -960,12 +913,14 @@ public class Desktop } - jalview.gui.VamsasClient v_client = null; + jalview.gui.VamsasApplication v_client = null; public void vamsasLoad_actionPerformed(ActionEvent e) { if (v_client == null) { // Start a session. + // we just start a default session for moment. + /* JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache. getProperty("LAST_DIRECTORY")); @@ -977,13 +932,14 @@ public class Desktop if (value == JalviewFileChooser.APPROVE_OPTION) { - v_client = new jalview.gui.VamsasClient(this, + v_client = new jalview.gui.VamsasApplication(this, chooser.getSelectedFile()); - this.vamsasLoad.setText("Session Update"); - this.vamsasStop.setVisible(true); - v_client.initial_update(); - v_client.startWatcher(); - } + * + */ + v_client = new VamsasApplication(this); + vamsasLoad.setText("Session Update"); + vamsasStop.setVisible(true); + v_client.initial_update(); } else { @@ -1033,7 +989,8 @@ public class Desktop javax.swing.SwingUtilities.invokeLater(jvq); } - class MyDesktopPane extends JDesktopPane implements Runnable + /*DISABLED + class MyDesktopPane extends JDesktopPane implements Runnable { boolean showMemoryUsage = false; Runtime runtime; @@ -1102,6 +1059,88 @@ public class Desktop getHeight() - g.getFontMetrics().getHeight()); } } + }*/ + protected JMenuItem groovyShell; + public void doGroovyCheck() { + if (jalview.bin.Cache.groovyJarsPresent()) + { + groovyShell = new JMenuItem(); + groovyShell.setText("Groovy Shell..."); + groovyShell.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) { + groovyShell_actionPerformed(e); + } + }); + toolsMenu.add(groovyShell); + groovyShell.setVisible(true); + } } + /** + * Accessor method to quickly get all the AlignmentFrames + * loaded. + */ + protected AlignFrame[] getAlignframes() { + JInternalFrame[] frames = Desktop.desktop.getAllFrames(); + if (frames == null) + { + return null; + } + Vector avp=new Vector(); + try + { + //REVERSE ORDER + for (int i = frames.length - 1; i > -1; i--) + { + if (frames[i] instanceof AlignFrame) + { + AlignFrame af = (AlignFrame) frames[i]; + avp.addElement(af); + } + } + } + catch (Exception ex) + { + ex.printStackTrace(); + } + if (avp.size()==0) + { + return null; + } + AlignFrame afs[] = new AlignFrame[avp.size()]; + for (int i=0,j=avp.size(); i