X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalview.java;h=07958b4121bd6987d61c723891be89980c10e161;hb=588042b69abf8e60bcc950b24c283933c7dd422f;hp=ffa844a894fd571dd1366e9821f641f2b0e7dc48;hpb=e5127e5f27f02c8f328539eaac68eabfbee1d135;p=jalview.git diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index ffa844a..07958b4 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -1,145 +1,154 @@ -/******************** - * 2004 Jalview Reengineered - * Barton Group - * Dundee University - * - * AM Waterhouse - *******************/ - - +/* +* Jalview - A Sequence Alignment Editor and Viewer +* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +*/ package jalview.bin; import jalview.gui.*; -import javax.swing.*; -import java.awt.event.*; + import jalview.io.*; import org.apache.log4j.*; -public class Jalview extends JApplet -{ - public static JApplet applet; - Desktop frame; - public void init() - { - applet = this; - Cache.loadProperties(); - jalview.gui.Preferences.initPreferences(); - - frame = new Desktop(); - frame.setResizable(true); - frame.setVisible(true); - frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); - frame.addWindowListener(new WindowAdapter() - { - public void windowClosing(WindowEvent e) - { - applet.stop(); - applet.destroy(); - } - }); - - String file = getParameter("alignment"); - - if(file!=null) - { - jalview.bin.Cache.setProperty("LAST_DIRECTORY", file); - String protocol = "File"; - if (file.indexOf("http:") > -1) - protocol = "URL"; - - String format = jalview.io.IdentifyFile.Identify(file, protocol); - - frame.LoadFile(file, protocol, format); +import java.awt.event.*; + +import javax.swing.*; + + +public class Jalview extends JApplet { + public static JApplet applet; + Desktop frame; + + public void init() { + applet = this; + Cache.loadProperties(); + jalview.gui.Preferences.initPreferences(); + + frame = new Desktop(); + frame.setResizable(true); + frame.setVisible(true); + frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + applet.stop(); + applet.destroy(); + } + }); + + String file = getParameter("alignment"); + + if (file != null) { + jalview.bin.Cache.setProperty("LAST_DIRECTORY", file); + + String protocol = "File"; + + if (file.indexOf("http:") > -1) { + protocol = "URL"; + } + + String format = jalview.io.IdentifyFile.Identify(file, protocol); + + frame.LoadFile(file, protocol, format); + } } - } - - public void destroy() - { - if(applet!=null) - applet.stop(); - else - System.exit(0); - frame.setVisible(false); - } - - private static void initLogger() { - Logger l = Logger.getLogger("org.apache.axis"); - if (Cache.getProperty("logs.Axis.Level")==null) { - Cache.setProperty("logs.Axis.Level", Level.INFO.toString()); + + public void destroy() { + if (applet != null) { + applet.stop(); + } else { + System.exit(0); + } + + frame.setVisible(false); } - l.setLevel(Level.toLevel(Cache.getProperty("logs.Axis.Level"))); - ConsoleAppender ap = new ConsoleAppender(new SimpleLayout(),"System.err"); - ap.setName("Axis"); - l.addAppender(ap); - } - public static void main(String[] args) { - - Cache.loadProperties(); - jalview.gui.Preferences.initPreferences(); - try { - initLogger(); - } catch (Exception e) { - System.err.println("Problems initializing the log4j system\n"); - e.printStackTrace(); + private static void initLogger() { + Logger l = Logger.getLogger("org.apache.axis"); + + if (Cache.getProperty("logs.Axis.Level") == null) { + Cache.setProperty("logs.Axis.Level", Level.INFO.toString()); + } + + l.setLevel(Level.toLevel(Cache.getProperty("logs.Axis.Level"))); + + ConsoleAppender ap = new ConsoleAppender(new SimpleLayout(), + "System.err"); + ap.setName("Axis"); + l.addAppender(ap); } - try{ - UIManager.setLookAndFeel( - // "javax.swing.plaf.metal.MetalLookAndFeel" - // "javax.swing.plaf.multi.MultiLookAndFeel" - UIManager.getSystemLookAndFeelClassName() - // UIManager.getCrossPlatformLookAndFeelClassName() - // "com.sun.java.swing.plaf.gtk.GTKLookAndFeel" - // "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" - // "com.sun.java.swing.plaf.motif.MotifLookAndFeel" - ); - } - catch (Exception ex) - {} - - Desktop frame = new Desktop(); - frame.setResizable(true); - frame.setVisible(true); - - - - if(args!=null && args.length>0) - { - String file=null; - if(args[0].equals("-open")) - file = args[1]; - else - file = args[0]; - - String protocol = "File"; - if(file.indexOf("http:")>-1) - protocol = "URL"; - - String format = jalview.io.IdentifyFile.Identify(file, protocol); - - frame.LoadFile(file, protocol, format); - } - - if(jalview.gui.Preferences.showStartupFile) - { - String file = jalview.gui.Preferences.startupFile; - String protocol = "File"; - if (file.indexOf("http:") > -1) - protocol = "URL"; - - if(file.endsWith(".jar")) - Jalview2XML.LoadJalviewAlign(file); - else - { - String format = jalview.io.IdentifyFile.Identify(file, protocol); - frame.LoadFile(file, protocol, format); - } - } - - - - } + public static void main(String[] args) { + Cache.loadProperties(); + jalview.gui.Preferences.initPreferences(); + + try { + initLogger(); + } catch (Exception e) { + System.err.println("Problems initializing the log4j system\n"); + e.printStackTrace(); + } + + try { + UIManager.setLookAndFeel( + // "javax.swing.plaf.metal.MetalLookAndFeel" + // "javax.swing.plaf.multi.MultiLookAndFeel" + UIManager.getSystemLookAndFeelClassName()); + } catch (Exception ex) { + } + + Desktop frame = new Desktop(); + frame.setResizable(true); + frame.setVisible(true); + + if ((args != null) && (args.length > 0)) { + String file = null; + + if (args[0].equals("-open")) { + file = args[1]; + } else { + file = args[0]; + } + + String protocol = "File"; + + if (file.indexOf("http:") > -1) { + protocol = "URL"; + } + + String format = jalview.io.IdentifyFile.Identify(file, protocol); + + frame.LoadFile(file, protocol, format); + } + + if (jalview.gui.Preferences.showStartupFile && + (jalview.gui.Preferences.startupFile != null)) { + String file = jalview.gui.Preferences.startupFile; + String protocol = "File"; + + if (file.indexOf("http:") > -1) { + protocol = "URL"; + } + + if (file.endsWith(".jar")) { + Jalview2XML.LoadJalviewAlign(file); + } else { + String format = jalview.io.IdentifyFile.Identify(file, protocol); + frame.LoadFile(file, protocol, format); + } + } + } } -