KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > blueprints > ui > SolutionTab


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.j2ee.blueprints.ui;
21
22 import java.net.URL JavaDoc;
23 import org.netbeans.modules.j2ee.blueprints.catalog.bpcatalogxmlparser.Nbcategory;
24 import org.netbeans.modules.j2ee.blueprints.catalog.bpcatalogxmlparser.Nbsolution;
25 import org.netbeans.modules.j2ee.blueprints.catalog.bpcatalogxmlparser.Nbwriteup;
26
27 /**
28  * Tab Panel containing a browser with the contents of the article.
29  *
30  * @author Mark Roth
31  */

32 public class SolutionTab
33     extends BluePrintsTabPanel
34 {
35     /** Creates new form SolutionTab */
36     public SolutionTab(BluePrintsPanel bluePrintsPanel) {
37         super(bluePrintsPanel);
38         initComponents();
39     }
40
41     /** This method is called from within the constructor to
42      * initialize the form.
43      * WARNING: Do NOT modify this code. The content of this method is
44      * always regenerated by the Form Editor.
45      */

46     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
47
private void initComponents() {
48         solutionBrowser = new HtmlBrowserWithScrollPosition();
49
50         setLayout(new java.awt.BorderLayout JavaDoc());
51
52         add(solutionBrowser, java.awt.BorderLayout.CENTER);
53
54     }
55     // </editor-fold>//GEN-END:initComponents
56

57     
58     // Variables declaration - do not modify//GEN-BEGIN:variables
59
private javax.swing.JPanel JavaDoc solutionBrowser;
60     // End of variables declaration//GEN-END:variables
61

62     public void setScrollPosition(int scrollPosition) {
63         ((HtmlBrowserWithScrollPosition)solutionBrowser).
64             setScrollPosition(scrollPosition);
65     }
66
67     public int getScrollPosition() {
68         return ((HtmlBrowserWithScrollPosition)solutionBrowser).
69             getScrollPosition();
70     }
71     
72     public void updateTab() {
73         Nbcategory category = bluePrintsPanel.getSelectedCategory();
74         Nbsolution solution = bluePrintsPanel.getSelectedArticle();
75         if(solution != null) {
76             Nbwriteup writeup = solution.getNbwriteup();
77             String JavaDoc articleURLString = BluePrintsPanel.CATALOG_RESOURCES_URL
78                 + "/" + writeup.getArticlePath(); // NOI18N
79
BpcatalogLocalizedResource htmlrsc =
80                     new BpcatalogLocalizedResource(articleURLString, "html");
81             URL JavaDoc articleURL = htmlrsc.getResourceURL();
82             /***
83             URL articleURL = getClass().getResource(articleURLString);
84              ***/

85             ((HtmlBrowserWithScrollPosition)solutionBrowser).setURL(
86                 articleURL);
87         }
88     }
89 }
90
Popular Tags