X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FDesktop.java;h=331f8828c0636e3ca532c2a8394e45c685c27172;hb=ac07859006686a2c62bcf57b24742eb610bc46f0;hp=ad7cb847643442b58f66d4f030656599227101b8;hpb=2a15dbb3db1c89edd6bbc0d1ddf80863feb2203f;p=jalview.git diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index ad7cb84..331f882 100755 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -12,12 +12,17 @@ package jalview.gui; import jalview.gui.*; import jalview.io.*; import jalview.datamodel.*; +import jalview.schemes.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; +import java.awt.dnd.*; +import javax.swing.*; +import java.awt.datatransfer.*; +import java.io.*; -public class Desktop extends jalview.jbgui.GDesktop +public class Desktop extends jalview.jbgui.GDesktop implements DropTargetListener { public static JDesktopPane desktop; static int openFrameCount = 0; @@ -27,7 +32,7 @@ public class Desktop extends jalview.jbgui.GDesktop { Image image =null; try{ - java.net.URL url = getClass().getResource("/BartonGroupBanner.gif"); + java.net.URL url = getClass().getResource("/images/logo.gif"); if(url!=null) { image = java.awt.Toolkit.getDefaultToolkit().createImage(url); @@ -41,22 +46,49 @@ public class Desktop extends jalview.jbgui.GDesktop setTitle("Jalview 2005"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - setVisible(true); desktop = new JDesktopPane(); + // desktop.setBackground(Color.white); setContentPane(desktop); desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); + + // This line prevents Windows Look&Feel resizing all new windows to maximum + // if previous window was maximised + desktop.setDesktopManager( new DefaultDesktopManager() ); + + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - int width = 1200, height = 800; - if(screenSize.getWidth()0) { AlignFrame af = new AlignFrame(new Alignment(sequences)); - addInternalFrame(af, file, 700, 500); + addInternalFrame(af, file, AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT); af.statusBar.setText("Successfully loaded file " + file); - } 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); @@ -172,7 +236,6 @@ public class Desktop extends jalview.jbgui.GDesktop String format = IdentifyFile.Identify(url, "URL"); - System.out.println(format +" format"); if (format.equals("URL NOT FOUND")) { JOptionPane.showInternalMessageDialog(Desktop.desktop,"Couldn't locate " + url, @@ -206,7 +269,9 @@ public class Desktop extends jalview.jbgui.GDesktop if(sequences!=null) { AlignFrame af = new AlignFrame(new Alignment(sequences)); - addInternalFrame(af, "Cut & Paste input - "+format, 700, 500); + addInternalFrame(af, "Cut & Paste input - "+format, + AlignFrame.NEW_WINDOW_WIDTH, + AlignFrame.NEW_WINDOW_HEIGHT); af.statusBar.setText("Successfully pasted alignment file"); } else @@ -215,7 +280,6 @@ public class Desktop extends jalview.jbgui.GDesktop +"Fasta, MSF, Clustal, BLC, PIR, MSP or PFAM", "Error parsing text", JOptionPane.WARNING_MESSAGE); - } } @@ -224,35 +288,130 @@ public class Desktop extends jalview.jbgui.GDesktop */ public void quit_actionPerformed(ActionEvent e) { - this.setVisible(false); - System.exit(0); + if(jalview.bin.Jalview.applet!=null) + jalview.bin.Jalview.applet.destroy(); + else + System.exit(0); } - protected void colourIndexMenuItem_actionPerformed(ActionEvent e) - { - ColourKey colourKey = new ColourKey(null); - addInternalFrame(colourKey, "Colour scheme key", 400, 320); - } - public void aboutMenuItem_actionPerformed(ActionEvent e) { JOptionPane.showInternalMessageDialog(Desktop.desktop, - "JalView 2005" + "JalView 2005 version " + jalview.bin.Cache.VERSION+"; last updated: "+jalview.bin.Cache.BUILD_DATE +"\nAuthors: Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton." +"\nCurrent development managed by Andrew Waterhouse; Barton Group, University of Dundee." - +"\nIf you use JalView, please cite: \"Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004), The Jalview Java Alignment Editor\"", + +"\nIf you use JalView, please cite: Bioinformatics, 2004 12;426-7." + +"\n\"Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004), The Jalview Java Alignment Editor\"", "About Jalview", JOptionPane.INFORMATION_MESSAGE); } public void documentationMenuItem_actionPerformed(ActionEvent e) { + try + { + ClassLoader cl = jalview.gui.Desktop.class.getClassLoader(); + java.net.URL url = javax.help.HelpSet.findHelpSet(cl,"help/help"); + javax.help.HelpSet hs = new javax.help.HelpSet(cl,url); + + javax.help.HelpBroker hb = hs.createHelpBroker(); + hb.setLocation(new Point(200, 50)); + hb.setSize(new Dimension(800,700)); + hb.setCurrentID("home"); + hb.setDisplayed(true); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + + static JInternalFrame conservationSlider; + static JInternalFrame PIDSlider; + public static int setConservationSliderSource(AlignmentPanel ap, ColourSchemeI cs, String source) + { + SliderPanel sp = null; + ConservationColourScheme ccs = (ConservationColourScheme)cs; + int value = ccs.inc; + + if(conservationSlider == null) + { + sp = new SliderPanel(ap, value, true, cs); + conservationSlider = new JInternalFrame(); + conservationSlider.setContentPane(sp); + addInternalFrame(conservationSlider, "Conservation Colour Increment ("+source+")", 420, 90, false); + conservationSlider.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() + { + public void internalFrameClosed(javax.swing.event.InternalFrameEvent e) + { + conservationSlider = null; + } + }); + conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER); + } + else + { + + conservationSlider.setTitle("Conservation Colour Increment ("+source+")"); + sp = (SliderPanel)conservationSlider.getContentPane(); + sp.cs = cs; + sp.setValue(value); + } + + if(ap.av.alignment.getGroups()!=null) + sp.setAllGroupsCheckEnabled( true ); + else + sp.setAllGroupsCheckEnabled( false); + + return sp.getValue(); + + } + + public static void hideConservationSlider() + { + try{ + conservationSlider.setClosed(true); + conservationSlider = null; + }catch(Exception ex){} +} + + + public static void hidePIDSlider() + { try{ - jalview.util.BrowserLauncher.openURL("http://www.jalview.org/documentation.html"); + PIDSlider.setClosed(true); + PIDSlider = null; }catch(Exception ex){} } + public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs, String source) + { + SliderPanel pid = null; + if(PIDSlider == null) + { + pid = new SliderPanel(ap, 50, false, cs); + PIDSlider = new JInternalFrame(); + PIDSlider.setContentPane(pid); + addInternalFrame(PIDSlider, "Percentage Identity Threshold ("+source+")", 420, 90, false); + PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER); + } + else + { + PIDSlider.setTitle("Percentage Identity Threshold ("+source+")"); + pid = (SliderPanel)PIDSlider.getContentPane(); + pid.cs = cs; + } + + if (ap.av.alignment.getGroups() != null) + pid.setAllGroupsCheckEnabled(true); + else + pid.setAllGroupsCheckEnabled(false); + + + return pid.getValue(); + + } }