JAL-3032 JalviewJS2 converts url query parameters to 'applet' args
[jalview.git] / src / jalview / bin / JalviewJS2.java
1 package jalview.bin;
2
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
5
6 import javax.swing.Timer;
7
8 /**
9  * Entry point for JalviewJS development. 
10  * 
11  * 
12  * 
13  * @author RM
14  *
15  */
16 public class JalviewJS2
17 {
18
19   static {
20     /**
21      * --j2sNative
22      * 
23      *            thisApplet.__Info.args =
24      *            ["open","examples/uniref50.fa","features",
25      *            "examples/exampleFeatures.txt"];
26      */
27
28     /**
29      * @j2sNative
30      * 
31      *  hr = decodeURI(document.location.href);
32      *  pos = hr.indexOf("?");
33      *  // set space-delimited query parameters as arguments to Jalview main
34      *  if (pos > 0)
35      *  {
36      *     thisApplet.__Info.args = hr.substring(pos+1).split(" ");
37      *  }
38      */
39   }
40
41   public static void main(String[] args) throws Exception
42   {
43     Jalview.main(args);
44         //showFocusTimer();
45 }
46
47 protected static int focusTime = 0;
48
49 private static void showFocusTimer() {
50         
51         Timer t = new Timer(100, new ActionListener() {
52
53                 @Override
54                 public void actionPerformed(ActionEvent e) {
55                         String s = /** @j2sNative document.activeElement.id || */
56                                         null;
57
58                         s += " " + (++focusTime);
59
60                         /** @j2sNative document.title = s; */
61                 }
62
63         });
64
65         t.setRepeats(true);
66         if (/** @j2sNative true || */
67         false)
68                 t.start();
69   }
70
71
72 }