JAL-3253-applet headless branch - just experimenting.
[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      * @ could do it this way:
24      * 
25      * j2sNative
26      * 
27      * J2S.thisApplet.__Info.args = [ "open","examples/uniref50.fa",
28      * "features","examples/exampleFeatures.txt", "noannotation" ];
29      */
30   }
31
32   public static void main(String[] args) throws Exception
33   {
34     if (args.length == 0)
35     {
36       args = new String[] { "headless", "open", "examples/uniref50.fa",
37           "features",
38           "examples/exampleFeatures.txt"
39           , "noannotation"
40           , "showoverview"
41           , "png", "ALIGN.png"
42       };
43     }
44     Jalview.main(args);
45         //showFocusTimer();
46 }
47
48 protected static int focusTime = 0;
49
50   private static void showFocusTimer()
51   {
52
53     if (Platform.isJS())
54     {
55       Timer t = new Timer(100, new ActionListener()
56       {
57
58         @Override
59         public void actionPerformed(ActionEvent e)
60         {
61           String s = /** @j2sNative document.activeElement.id || */
62                   null;
63
64           s += " " + (++focusTime);
65
66           /** @j2sNative document.title = s; */
67         }
68
69       });
70
71       t.setRepeats(true);
72       t.start();
73     }
74   }
75
76
77 }