View Javadoc

1   /*
2       Jiffie Plugin for Jameleon - An Internet Explorer plug-in for Jameleon
3       Copyright (C) 2004 Christian W. Hargraves (engrean@hotmail.com) and
4                          Matthias Marschall (matthias@marschalls.de)
5   
6       This program is free software; you can redistribute it and/or modify
7       it under the terms of the GNU General Public License as published by
8       the Free Software Foundation; either version 2 of the License, or
9       (at your option) any later version.
10  
11      This program is distributed in the hope that it will be useful,
12      but WITHOUT ANY WARRANTY; without even the implied warranty of
13      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14      GNU General Public License for more details.
15  
16      You should have received a copy of the GNU General Public License
17      along with this program; if not, write to the Free Software
18      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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  }