KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jinterop > dcom > test > DWebBrowserEvents2


1 package org.jinterop.dcom.test;
2
3 import org.jinterop.dcom.common.JIException;
4 import org.jinterop.dcom.core.JIInterfacePointer;
5 import org.jinterop.dcom.core.JIString;
6 import org.jinterop.dcom.core.JIVariant;
7
8 public class DWebBrowserEvents2 {
9
10
11     public DWebBrowserEvents2()
12     {
13         
14     }
15 // [id(0x00000070), helpstring("Fired when the PutProperty method has been called.")]
16
// void PropertyChange([in] BSTR szProperty);
17
public void PropertyChange(JIString szProperty)
18     {
19         System.out.println("PropertyChange -> " + szProperty.getString());
20     }
21     
22     
23 // [id(0x000000fa), helpstring("Fired before navigate occurs in the given WebBrowser (window or frameset element). The processing of this navigation may be modified.")]
24
// void BeforeNavigate2(
25
// [in] IDispatch* pDisp,
26
// [in] VARIANT* URL,
27
// [in] VARIANT* Flags,
28
// [in] VARIANT* TargetFrameName,
29
// [in] VARIANT* PostData,
30
// [in] VARIANT* Headers,
31
// [in, out] VARIANT_BOOL* Cancel);
32

33     public JIVariant BeforeNavigate2(JIInterfacePointer dispatch,JIVariant URL,JIVariant Flags,JIVariant TargetFrameName,
34                                         JIVariant PostData, JIVariant Headers, JIVariant Cancel) throws JIException
35     {
36         JIVariant realURL = URL;
37         while (realURL.isByRefFlagSet())
38         {
39             realURL = realURL.getObjectAsVariant();
40         }
41         
42         System.out.println("BeforeNavigate2 -> " + realURL.getObjectAsString().getString());
43         
44         //uncomment and return this to stop loading the page
45
//JIVariant variant = new JIVariant(true,true);
46

47         return Cancel;
48     }
49     
50    //[id(0x00000066), helpstring("Statusbar text changed.")]
51
public void StatusTextChange(JIString text)
52     {
53         System.out.println("StatusTextChange -> " + text.getString());
54     }
55     
56     //[id(0x0000006c), helpstring("Fired when download progress is updated.")]
57
public void ProgressChange(
58                      int Progress,
59                      int ProgressMax)
60     {
61         System.out.println("ProgressChange -> " + Progress + " , " + ProgressMax);
62     }
63     
64     //[id(0x00000069), helpstring("The enabled state of a command changed.")]
65
public void CommandStateChange(
66                     int Command,
67                     boolean Enable)
68     {
69         System.out.println("CommandStateChange -> " + Command + " , " + Enable);
70     }
71     
72     // [id(0x0000006a), helpstring("Download of a page started.")]
73
public void DownloadBegin()
74     {
75         System.out.println("DownloadBegin");
76     }
77     
78     // [id(0x00000068), helpstring("Download of page complete.")]
79
public void DownloadComplete()
80     {
81         System.out.println("DownloadComplete");
82     }
83
84     //[id(0x00000071), helpstring("Document title changed.")]
85
public void TitleChange(JIString Text)
86     {
87         System.out.println("TitleChange -> " + Text.getString());
88     }
89     
90    //[id(0x000000fb), helpstring("A new, hidden, non-navigated WebBrowser window is needed.")]
91
public JIVariant NewWindow2(JIVariant ppDisp,
92                             JIVariant Cancel) throws JIException
93     {
94         System.out.println("NewWindow2 -> " + Cancel.getObjectAsBoolean());
95         return Cancel;
96     }
97     
98     //[id(0x000000fc), helpstring("Fired when the document being navigated to becomes visible and enters the navigation stack.")]
99
public void NavigateComplete2(
100                          JIInterfacePointer pDisp,
101                         JIVariant URL) throws JIException
102     {
103         JIVariant realURL = URL;
104         while (realURL.isByRefFlagSet())
105         {
106             realURL = realURL.getObjectAsVariant();
107         }
108
109         System.out.println("NavigateComplete2 -> " + pDisp.getIID() + " , " + realURL.getObjectAsString().getString());
110     }
111     
112     //[id(0x00000103), helpstring("Fired when the document being navigated to reaches ReadyState_Complete.")]
113
public void DocumentComplete(
114                         JIInterfacePointer pDisp,
115                         JIVariant URL) throws JIException
116     {
117         System.out.println("DocumentComplete -> " + pDisp.getIID() + " , " + URL);
118     }
119     
120     //[id(0x000000fd), helpstring("Fired when application is quiting.")]
121
public void OnQuit()
122     {
123         System.out.println("OnQuit -> ");
124     }
125    
126     //[id(0x000000fe), helpstring("Fired when the window should be shown/hidden")]
127
public void OnVisible(boolean Visible)
128     {
129         System.out.println("OnVisible -> " + Visible);
130     }
131     
132     //[id(0x000000ff), helpstring("Fired when the toolbar should be shown/hidden")]
133
public void OnToolBar(boolean ToolBar)
134     {
135         System.out.println("OnToolBar -> " + ToolBar);
136     }
137
138     //[id(0x00000100), helpstring("Fired when the menubar should be shown/hidden")]
139
public void OnMenuBar(boolean MenuBar)
140     {
141         System.out.println("OnMenuBar -> " + MenuBar);
142     }
143     
144     //[id(0x00000101), helpstring("Fired when the statusbar should be shown/hidden")]
145
public void OnStatusBar(boolean StatusBar)
146     {
147         System.out.println("OnStatusBar -> " + StatusBar);
148     }
149     
150     //[id(0x00000102), helpstring("Fired when fullscreen mode should be on/off")]
151
public void OnFullScreen(boolean FullScreen)
152     {
153         System.out.println("OnFullScreen -> " + FullScreen);
154     }
155     
156     //[id(0x00000104), helpstring("Fired when theater mode should be on/off")]
157
public void OnTheaterMode(boolean TheaterMode)
158     {
159         System.out.println("OnTheaterMode -> " + TheaterMode);
160     }
161     
162     //[id(0x00000106), helpstring("Fired when the host window should allow/disallow resizing")]
163
public void WindowSetResizable(boolean Resizable)
164     {
165         System.out.println("OnResizable -> " + Resizable);
166     }
167     
168     //[id(0x00000108), helpstring("Fired when the host window should change its Left coordinate")]
169
public void WindowSetLeft(int Left)
170     {
171         System.out.println("WindowSetLeft - > " + Left);
172     }
173     
174     //[id(0x00000109), helpstring("Fired when the host window should change its Top coordinate")]
175
public void WindowSetTop(int Top)
176     {
177         System.out.println("WindowSetTop - > " + Top);
178     }
179     
180     //[id(0x0000010a), helpstring("Fired when the host window should change its width")]
181
public void WindowSetWidth(int Width)
182     {
183         System.out.println("WindowSetWidth - > " + Width);
184     }
185     
186     //[id(0x0000010b), helpstring("Fired when the host window should change its height")]
187
public void WindowSetHeight(int Height)
188     {
189         System.out.println("WindowSetHeight - > " + Height);
190     }
191     
192     //[id(0x00000107), helpstring("Fired when the WebBrowser is about to be closed by script")]
193
public JIVariant WindowClosing(
194             boolean IsChildWindow,
195                         JIVariant Cancel) throws JIException
196     {
197         System.out.println("WindowClosing -> " + IsChildWindow + " , " + Cancel.getObjectAsBoolean());
198         return Cancel;
199     }
200     
201     //[id(0x0000010c), helpstring("Fired to request client sizes be converted to host window sizes")]
202
public Integer JavaDoc[] ClientToHostWindow(
203                         int CX,
204                         int CY)
205     {
206         System.out.println("ClientToHostWindow - > " + CX + " , " + CY);
207         return new Integer JavaDoc[] {new Integer JavaDoc(CX),new Integer JavaDoc(CY)};
208     }
209     
210     // [id(0x0000010d), helpstring("Fired to indicate the security level of the current web page contents")]
211
public void SetSecureLockIcon(int SecureLockIcon)
212     {
213         System.out.println("SetSecureLockIcon - > " + SecureLockIcon);
214     }
215     
216     //[id(0x0000010e), helpstring("Fired to indicate the File Download dialog is opening")]
217
public JIVariant FileDownload(boolean noIdeaWhat,JIVariant Cancel) throws JIException
218     {
219         System.out.println("FileDownload - > " + Cancel);
220         return Cancel;
221     }
222    
223     //[id(0x0000010f), helpstring("Fired when a binding error occurs (window or frameset element).")]
224
public JIVariant NavigateError(
225                         JIInterfacePointer pDisp,
226                         JIVariant URL,
227                         JIVariant Frame,
228                         JIVariant StatusCode,
229                         JIVariant Cancel) throws JIException
230     {
231         System.out.println("NavigateError - > " + URL.getObjectAsString());
232         return Cancel;
233     }
234     
235    //[id(0x000000e1), helpstring("Fired when a print template is instantiated.")]
236
public void PrintTemplateInstantiation(JIInterfacePointer pDisp)
237    {
238        System.out.println("PrintTemplateInstantiation - > " + pDisp.getIID());
239    }
240    
241    //[id(0x000000e2), helpstring("Fired when a print template destroyed.")]
242
public void PrintTemplateTeardown(JIInterfacePointer pDisp)
243    {
244        System.out.println("PrintTemplateTeardown - > " + pDisp.getIID());
245    }
246    
247    //[id(0x000000e3), helpstring("Fired when a page is spooled. When it is fired can be changed by a custom template.")]
248
public void UpdatePageStatus(
249                         JIInterfacePointer pDisp,
250                         JIVariant nPage,
251                         JIVariant fDone)
252    {
253        System.out.println("UpdatePageStatus - > " + pDisp.getIID());
254    }
255
256    //[id(0x00000110), helpstring("Fired when the global privacy impacted state changes")]
257
public void PrivacyImpactedStateChange(boolean bImpacted)
258    {
259        System.out.println("PrivacyImpactedStateChange - > " + bImpacted);
260    }
261    
262    //[id(0x00000111), helpstring("A new, hidden, non-navigated WebBrowser window is needed.")]
263
public JIVariant NewWindow3(
264                         JIVariant ppDisp,
265                         JIVariant Cancel,
266                         int dwFlags,
267                         JIString bstrUrlContext,
268                         JIString bstrUrl) throws JIException
269    {
270        System.out.println("NewWindow3 - > " + ppDisp + " , " + Cancel.getObjectAsBoolean() + " , " + bstrUrl.getString());
271        return Cancel;
272    }
273
274    public void SetPhishingFilterStatus(int PhishingFilterStatus) throws JIException
275    {
276        System.out.println("SetPhishingFilterStatus - > " + PhishingFilterStatus);
277        //return Cancel;
278
}
279
280    public void WindowStateChanged(
281            int dwWindowStateFlags,
282            int dwValidFlagsMask)
283    {
284        System.out.println("WindowStateChanged - > " + dwWindowStateFlags + " , " + dwValidFlagsMask);
285    }
286
287
288     
289 }
290
Popular Tags