add(alignPanel);\r
alignPanel.validate();\r
\r
- String treeFile = applet.getParameter("treeFile");\r
- if (treeFile != null)\r
+ if(applet!=null)\r
{\r
- try\r
+ String treeFile = applet.getParameter("treeFile");\r
+ if (treeFile != null)\r
{\r
- treeFile = treeFile;\r
- jalview.io.NewickFile fin = new jalview.io.NewickFile(applet.\r
- getCodeBase() + treeFile, "URL");\r
- fin.parse();\r
+ try\r
+ {\r
+ treeFile = treeFile;\r
+ jalview.io.NewickFile fin = new jalview.io.NewickFile(applet.\r
+ getCodeBase() + treeFile, "URL");\r
+ fin.parse();\r
\r
- if (fin.getTree() != null)\r
+ if (fin.getTree() != null)\r
+ {\r
+ TreePanel tp = null;\r
+ tp = new TreePanel(viewport, viewport.getAlignment().getSequences(),\r
+ fin, "FromFile", applet.getCodeBase() + treeFile);\r
+ jalview.bin.JalviewLite.addFrame(tp, treeFile, 600, 500);\r
+ addTreeMenuItem(tp, treeFile);\r
+ }\r
+ }\r
+ catch (Exception ex)\r
{\r
- TreePanel tp = null;\r
- tp = new TreePanel(viewport, viewport.getAlignment().getSequences(),\r
- fin, "FromFile", applet.getCodeBase() + treeFile);\r
- jalview.bin.JalviewLite.addFrame(tp, treeFile, 600, 500);\r
- addTreeMenuItem(tp, treeFile);\r
+ ex.printStackTrace();\r
}\r
}\r
- catch (Exception ex)\r
+\r
+ String param = applet.getParameter("sortBy");\r
+ if (param != null)\r
{\r
- ex.printStackTrace();\r
+ if (param.equalsIgnoreCase("Id"))\r
+ sortIDMenuItem_actionPerformed(null);\r
+ else if (param.equalsIgnoreCase("Pairwise Identity"))\r
+ sortPairwiseMenuItem_actionPerformed(null);\r
}\r
}\r
\r
- String param = applet.getParameter("sortBy");\r
- if(param!=null)\r
- {\r
- if (param.equalsIgnoreCase("Id"))\r
- sortIDMenuItem_actionPerformed(null);\r
- else if (param.equalsIgnoreCase("Pairwise Identity"))\r
- sortPairwiseMenuItem_actionPerformed(null);\r
- }\r
-\r
this.addWindowListener(new WindowAdapter()\r
{\r
public void windowClosing(WindowEvent e)\r
{\r
PaintRefresher.components.remove(viewport.alignment);\r
dispose();\r
+ if(PaintRefresher.components.size()==0 && applet==null)\r
+ System.exit(0);\r
}\r
\r
Stack historyList = new Stack();\r
idCanvas.addMouseMotionListener(this);\r
\r
String label, url;\r
- for(int i=1; i<10; i++)\r
+ if(parent.alignFrame.applet!=null)\r
{\r
- label = parent.alignFrame.applet.getParameter("linkLabel_"+i);\r
- url = parent.alignFrame.applet.getParameter("linkURL_"+i);\r
+ for (int i = 1; i < 10; i++)\r
+ {\r
+ label = parent.alignFrame.applet.getParameter("linkLabel_" + i);\r
+ url = parent.alignFrame.applet.getParameter("linkURL_" + i);\r
\r
- if(label!=null && url!=null)\r
- links.addElement(label+"|"+url);\r
+ if (label != null && url != null)\r
+ links.addElement(label + "|" + url);\r
\r
+ }\r
}\r
if (links.size() < 1)\r
{\r
}\r
}\r
\r
+ public static void main(String [] args)\r
+ {\r
+ if(args.length!=1)\r
+ {\r
+ System.out.println("\nUsage: java -jar jalviewApplet.jar fileName\n");\r
+ System.exit(1);\r
+ }\r
+\r
+ String format = jalview.io.IdentifyFile.Identify(args[0],"File");\r
+ SequenceI[] sequences = FormatAdapter.readFile(args[0], "File", format);\r
+\r
+ if ( (sequences != null) && (sequences.length > 0))\r
+ {\r
+ AlignFrame af = new AlignFrame(new Alignment(sequences), null);\r
+ addFrame(af, args[0], AlignFrame.NEW_WINDOW_WIDTH,\r
+ AlignFrame.NEW_WINDOW_HEIGHT);\r
+ af.statusBar.setText("Successfully loaded file " + args[0]);\r
+ }\r
+ }\r
+\r
/**\r
* Displays the given URL in a new browser window\r
*\r
\r
public static void showURL(String url, String target)\r
{\r
- try\r
+ if(applet==null)\r
{\r
- applet.getAppletContext().showDocument(new java.net.URL(url),\r
- target);\r
+ System.out.println("Not running as applet - no browser available.");\r
}\r
- catch (Exception ex)\r
+ else\r
{\r
- ex.printStackTrace();\r
+ try\r
+ {\r
+ applet.getAppletContext().showDocument(new java.net.URL(url),\r
+ target);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
}\r
}\r
\r