1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package net.sf.jameleon.plugin.jiffie.ui;
21
22 import net.sf.jiffie.InternetExplorer;
23 import net.sf.jiffie.NavigationListener;
24 import net.sf.jiffie.NewWindowEventHandler;
25 import net.sf.jiffie.WindowListener;
26
27 import java.util.Iterator;
28
29 import com.jacob.com.Variant;
30
31
32 /***
33 * This class implements an event handler which receives all of the events
34 * generated by Internet Explore. This class extends the new window event
35 * handler, which only recieves new window events.
36 *
37 * Note that the non-standard capitalisation of the method names is necessary
38 * to ensure that they match exactly the names used by Internet Explorer.
39 * Detailed documentation on these events can be found at:
40 *
41 * http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reflist_vb.asp
42 */
43 public class JiffieUIEventHandler extends NewWindowEventHandler {
44
45 /***
46 * Constructor.
47 *
48 * @param parentBrowser parent browser
49 */
50 public JiffieUIEventHandler (InternetExplorer parentBrowser) {
51 super (parentBrowser);
52 }
53
54 /***
55 * ProgressChange event handler.
56 *
57 * args[0] Long that specifies the amount of total progress
58 * to show, or -1 when progress is complete.
59 * args[1] Long that specifies the maximum progress value.
60 *
61 * @param args event arguments
62 */
63 public void ProgressChange (Variant[] args) {
64 int nProgress = args[0].toInt();
65 int nProgressMax = args[1].toInt();
66
67 for (Iterator itr = m_navigationListeners.iterator(); itr.hasNext();) {
68 NavigationListener l = (NavigationListener)itr.next();
69 l.progressChange(nProgress, nProgressMax);
70 }
71 }
72
73 /***
74 * OnQuit event handler.
75 *
76 * @param args event arguments
77 */
78 public void OnQuit (Variant[] args) {
79 for (Iterator itr = m_windowListeners.iterator(); itr.hasNext();) {
80 WindowListener l = (WindowListener)itr.next();
81 l.onQuit();
82 }
83 }
84
85 }