X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FDesktop.java;h=25bfa52d648b401d56ef22d163dac3e39b952e58;hb=9ee6d0820f9b6b253900b00da9b1531f9b40e057;hp=feb1e00e5ec2dfeb8a0620fad29c5ed14a020857;hpb=251dab230e63f7240b5050c610c7b8233320a6d0;p=jalview.git diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index feb1e00..25bfa52 100755 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -12,6 +12,7 @@ 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.*; @@ -22,13 +23,12 @@ public class Desktop extends jalview.jbgui.GDesktop public static JDesktopPane desktop; static int openFrameCount = 0; static final int xOffset = 30, yOffset = 30; - static boolean splashScreenVisible = false; public Desktop() { Image image =null; try{ - java.net.URL url = getClass().getResource("/BartonGroupBanner.gif"); + java.net.URL url = getClass().getResource("/images/BartonGroupBanner.gif"); if(url!=null) { image = java.awt.Toolkit.getDefaultToolkit().createImage(url); @@ -65,23 +65,29 @@ public class Desktop extends jalview.jbgui.GDesktop SplashScreen splash = new SplashScreen(frame, image); frame.setContentPane(splash); - addInternalFrame(frame, "",845,200); - splashScreenVisible = true; - + desktop.add(frame); + frame.setVisible(true); + openFrameCount++; + try + { + frame.setSelected(true); + } + catch (java.beans.PropertyVetoException e) + {} + frame.setResizable(true); + frame.setSize(845, 200); frame.setLocation( (int)((getWidth()-845) /2), (int)((getHeight()-240) /2)); frame.setClosable(false); frame.setIconifiable(false); frame.setMaximizable(false); frame.setFrameIcon(null); - splashScreenVisible = false; } public static void addInternalFrame(final JInternalFrame frame, String title, int w, int h) { - if(!splashScreenVisible) - frame.setVisible(true); //necessary as of 1.3 desktop.add(frame); + frame.setVisible(true); openFrameCount++; try { frame.setSelected(true); @@ -119,14 +125,14 @@ public class Desktop extends jalview.jbgui.GDesktop public void inputLocalFileMenuItem_actionPerformed(ActionEvent e) { - JFileChooser chooser = new JFileChooser(jalview.bin.Cache.LAST_DIRECTORY); + JFileChooser chooser = new JFileChooser(jalview.bin.Cache.getProperty("LAST_DIRECTORY")); chooser.setDialogTitle("Open local file"); chooser.setToolTipText("Open"); int value = chooser.showOpenDialog(this); if(value == JFileChooser.APPROVE_OPTION) { String choice = chooser.getSelectedFile().getPath(); - jalview.bin.Cache.LAST_DIRECTORY = choice; + jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice); String format = IdentifyFile.Identify(choice, "File"); LoadFile(choice, "File", format); } @@ -209,7 +215,6 @@ public class Desktop extends jalview.jbgui.GDesktop +"Fasta, MSF, Clustal, BLC, PIR, MSP or PFAM", "Error parsing text", JOptionPane.WARNING_MESSAGE); - } } @@ -218,17 +223,13 @@ 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) { @@ -243,10 +244,104 @@ public class Desktop extends jalview.jbgui.GDesktop 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; + + if(conservationSlider == null) + { + sp = new SliderPanel(ap, 30, true, cs); + conservationSlider = new JInternalFrame(); + conservationSlider.setContentPane(sp); + conservationSlider.setResizable(false); + addInternalFrame(conservationSlider, "Conservation Colour Increment ("+source+")", 420, 90); + conservationSlider.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() + { + public void internalFrameClosed(javax.swing.event.InternalFrameEvent e) + { + conservationSlider = null; + } + }); + } + else + { + conservationSlider.setTitle("Conservation Colour Increment ("+source+")"); + sp = (SliderPanel)conservationSlider.getContentPane(); + sp.cs = cs; + } + + 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); + PIDSlider.setResizable(false); + addInternalFrame(PIDSlider, "Percentage Identity Threshold ("+source+")", 420, 90); + } + 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(); + + } }