KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > extbrowser > ExtBrowserImpl


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.extbrowser;
21
22 import java.beans.PropertyChangeListener JavaDoc;
23 import java.beans.PropertyChangeSupport JavaDoc;
24 import java.net.URL JavaDoc;
25 import org.openide.awt.HtmlBrowser;
26
27 /**
28  * The ExtBrowserImpl is generalized external browser.
29  *
30  * @author Radim Kubacki
31  */

32 public abstract class ExtBrowserImpl extends HtmlBrowser.Impl {
33
34     /** standart helper variable */
35     protected PropertyChangeSupport JavaDoc pcs;
36
37     /** requested URL */
38     protected URL JavaDoc url;
39     protected String JavaDoc title = ""; // NOI18N
40

41     /** reference to a factory to get settings */
42     protected ExtWebBrowser extBrowserFactory;
43
44     /** Default constructor.
45       * <p>Builds PropertyChangeSupport.
46       */

47     public ExtBrowserImpl () {
48         pcs = new PropertyChangeSupport JavaDoc (this);
49     }
50     
51     /** Dummy implementations */
52     public boolean isBackward() { return false; }
53     public boolean isForward() { return false; }
54     public void backward() { }
55     public void forward() { }
56     public boolean isHistory() { return false; }
57     public void showHistory() {}
58     public void stopLoading() { }
59     
60     protected void setTitle (String JavaDoc title) {
61         return;
62     }
63     
64     public String JavaDoc getTitle() {
65         return "";
66     }
67
68     
69     /** Returns status message representing status of html browser.
70      *
71      * @return status message.
72      */

73     public String JavaDoc getStatusMessage() {
74         return "";
75     }
76         
77     /** Call setURL again to force reloading.
78      * Browser must be set to reload document and do not cache them.
79      */

80     public void reloadDocument() {
81         if (url != null) {
82             setURL(url);
83         }
84     }
85         
86     
87     /** Returns current URL.
88      *
89      * @return current URL.
90      */

91     public URL JavaDoc getURL() {
92         return url;
93     }
94     
95     /**
96      * Sets current URL. Descendants of this class will implement it and they can call this
97      * to display internal resources.
98      *
99      * @param url URL to show in the browser.
100      */

101     public abstract void setURL(URL JavaDoc url);
102     
103     /** Returns visual component of html browser.
104      *
105      * @return visual component of html browser.
106      */

107     public final java.awt.Component JavaDoc getComponent() {
108         return null;
109     }
110
111     /** Adds PropertyChangeListener to this browser.
112      *
113      * @param l Listener to add.
114      */

115     public void addPropertyChangeListener(PropertyChangeListener JavaDoc l) {
116         pcs.addPropertyChangeListener (l);
117     }
118     
119     /** Removes PropertyChangeListener from this browser.
120      *
121      * @param l Listener to remove.
122      */

123     public void removePropertyChangeListener(PropertyChangeListener JavaDoc l) {
124         pcs.removePropertyChangeListener (l);
125     }
126
127 }
128
Popular Tags