Merge branch 'Jalview-JS/develop' of https://source.jalview.org/git/jalview.git into...
[jalview.git] / src / jalview / bin / JalviewJS2.java
1 package jalview.bin;
2
3 import jalview.util.Platform;
4
5 import java.awt.event.ActionEvent;
6 import java.awt.event.ActionListener;
7
8 import javax.swing.Timer;
9
10 /**
11  * Entry point for JalviewJS development. 
12  * 
13  * 
14  * 
15  * @author RM
16  *
17  */
18 public class JalviewJS2
19 {
20
21   static {
22     /**
23      * @j2sNative
24      * 
25      *            thisApplet.__Info.args =
26      *            ["open","examples/uniref50.fa","features",
27      *            "examples/exampleFeatures.txt"];
28      */
29
30     /**
31      * set space-delimited query parameters as arguments to Jalview main
32      * 
33      * @j2sNative
34      * 
35      *            var hr = decodeURI(document.location.href); var pos =
36      *            hr.indexOf("?"); if (pos > 0) { thisApplet.__Info.args =
37      *            hr.substring(pos+1).split(" "); }
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
52     if (Platform.isJS())
53     {
54       Timer t = new Timer(100, new ActionListener()
55       {
56
57         @Override
58         public void actionPerformed(ActionEvent e)
59         {
60           String s = /** @j2sNative document.activeElement.id || */
61                   null;
62
63           s += " " + (++focusTime);
64
65           /** @j2sNative document.title = s; */
66         }
67
68       });
69
70       t.setRepeats(true);
71       t.start();
72     }
73   }
74
75
76 }