KickJava   Java API By Example, From Geeks To Geeks.

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


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
26 /**
27  * Tab Panel containing a browser with the contents of the article.
28  *
29  * @author Yutaka Yoshida
30  * @author Mark Roth
31  */

32 public class CategoryTab
33     extends BluePrintsTabPanel
34 {
35     /** Creates new form SolutionTab */
36     public CategoryTab(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         categoryBrowser = new HtmlBrowserWithScrollPosition();
49
50         setLayout(new java.awt.BorderLayout JavaDoc());
51
52         add(categoryBrowser, 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 categoryBrowser;
60     // End of variables declaration//GEN-END:variables
61

62     public void setScrollPosition(int scrollPosition) {
63         ((HtmlBrowserWithScrollPosition)categoryBrowser).
64             setScrollPosition(scrollPosition);
65     }
66
67     public int getScrollPosition() {
68         return ((HtmlBrowserWithScrollPosition)categoryBrowser).
69             getScrollPosition();
70     }
71     
72     public void updateTab() {
73         Nbcategory category = bluePrintsPanel.getSelectedCategory();
74         Nbsolution solution = bluePrintsPanel.getSelectedArticle();
75         if(solution == null) {
76             String JavaDoc articleURLString = BluePrintsPanel.CATALOG_RESOURCES_URL
77                 + "/descriptions/category-" + category.getId() + ".html"; // NOI18N
78
BpcatalogLocalizedResource htmlrsc =
79                     new BpcatalogLocalizedResource(articleURLString, "html");
80             URL JavaDoc articleURL = htmlrsc.getResourceURL();
81             ((HtmlBrowserWithScrollPosition)categoryBrowser).setURL(
82                 articleURL);
83         }
84     }
85 }
86
Popular Tags