1 /***
2 *
3 */
4 package org.telscenter.pas.ui.browser;
5
6 import java.awt.Component;
7 import java.net.URL;
8
9 /***
10 * Generic interface for any web browser component. Modeled after JDIC's <a
11 * href="https://jdic.dev.java.net/nonav/documentation/javadoc/jdic/org/jdesktop/jdic/browser/IWebBrowser.html#setURL(java.net.URL)">org.jdesktop.jdic.browser.IWebBrowser</a>
12 *
13 * @author turadg
14 */
15 public interface IBrowser {
16
17 public final static String SAFARI = "safari";
18
19 public final static String IE = "ie";
20
21 public final static String MOZILLA = "mozilla";
22
23
24 public String getPageTitle();
25
26 /***
27 *
28 * @return identifier of browser type (e.g. Safari, IE, Mozilla)
29 */
30 public String getBrowserType();
31
32 /***
33 * Returns the Canvas representing the interface of the browser
34 *
35 * @return
36 */
37 public Component getComponent();
38
39 /***
40 * Navigates backward one item in the history list.
41 */
42 public void back();
43
44 /***
45 * Navigates forward one item in the history list.
46 */
47 public void forward();
48
49 /***
50 * Returns the URL of the resource that is currently being displayed.
51 *
52 * @return the current URL being display, or null if no URL is currently
53 * displayed or the WebBrowser is not yet initialized.
54 */
55 public URL getUrl();
56
57 /***
58 * Navigates to a resource identified by an URL using HTTP GET method.
59 *
60 * @param url
61 * the URL to which to navigate.
62 */
63 public void setUrl(URL url);
64
65 /***
66 * Navigates to a resource identified by an URL using HTTP POST method.
67 *
68 * @param url
69 * the URL to which to navigate.
70 * @param postData
71 * Data to send to the server during the HTTP POST transaction.
72 */
73 public void setUrl(URL url, String postData);
74
75 /***
76 * Stops any page loading and rendering activities.
77 *
78 */
79 public void stop();
80
81 /***
82 * Reloads the URL that is currently displayed in the WebBrowser component.
83 *
84 */
85 public void refresh();
86
87 /***
88 * Get the current content displayed in the webbrowser.
89 * The coorsponding setContent is not implemented because jdic
90 * does not support a relative url for file locations, but webrenderer
91 * does. It is not clear how to deal with this.
92 * @return
93 */
94 public String getContent();
95
96
97 public void setContent(String content);
98 /***
99 * Policy with whitelist and blacklist of what urls can be navigated to
100 *
101 * @param policy
102 * @throws UnsupportedOperationException
103 */
104 public void setNavigationPolicy(NavigationPolicy policy)
105 throws UnsupportedOperationException;
106
107 public void addBrowserListener(IBrowserListener listener);
108
109 public void removeBrowserListener(IBrowserListener listener);
110
111 }