KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > webclient > WebclientBrowser


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.webclient;
21
22 import java.beans.*;
23
24 import org.openide.awt.HtmlBrowser;
25
26 /**
27  * HTML browser that can be used in NetBeans IDE.
28  * It uses webclient interface to Mozilla
29  *
30  * @author Radim.Kubacki@sun.com
31  */

32 public class WebclientBrowser implements HtmlBrowser.Factory, java.io.Serializable JavaDoc {
33
34     private static final long serialVersionUID = -3926191994353231536L;
35
36     /** variable that can hold appDataPath value */
37     private static final String JavaDoc PROP_APP_DATA_PATH = "MOZILLA_FIVE_HOME"; // NOI18N
38

39     /** path to browser binaries */
40     private java.io.File JavaDoc appData;
41     
42     private PropertyChangeSupport pcs;
43     
44     public WebclientBrowser () {
45         init ();
46     }
47     
48     private void init () {
49         pcs = new PropertyChangeSupport (this);
50     }
51     
52     /**
53      * Returns a new instance of BrowserImpl implementation.
54      */

55     public HtmlBrowser.Impl createHtmlBrowserImpl () {
56         try {
57             return new WebclientBrowserImpl (this);
58         }
59         catch (Error JavaDoc e) {
60             e.printStackTrace ();
61             throw e;
62         }
63     }
64     
65     /** Getter for property appData.
66      * @return Value of property appData.
67      */

68     public java.io.File JavaDoc getAppData () {
69         if (appData == null) {
70             if (System.getProperty (PROP_APP_DATA_PATH) != null)
71                 return new java.io.File JavaDoc (System.getProperty (PROP_APP_DATA_PATH));
72         }
73         return appData;
74     }
75     
76     /** Setter for property appData.
77      * @param appData New value of property appData.
78      */

79     public void setAppData (java.io.File JavaDoc appData) {
80         java.io.File JavaDoc old = this.appData;
81         this.appData = appData;
82         pcs.firePropertyChange (PROP_APP_DATA_PATH, old, appData);
83     }
84     
85     /**
86      * @param l new PropertyChangeListener */

87     public void addPropertyChangeListener (PropertyChangeListener l) {
88         pcs.addPropertyChangeListener (l);
89     }
90     
91     /**
92      * @param l PropertyChangeListener to be removed */

93     public void removePropertyChangeListener (PropertyChangeListener l) {
94         pcs.removePropertyChangeListener (l);
95     }
96     
97     private void readObject (java.io.ObjectInputStream JavaDoc ois)
98     throws java.io.IOException JavaDoc, ClassNotFoundException JavaDoc {
99         ois.defaultReadObject ();
100         init ();
101     }
102     
103 }
104
Popular Tags