KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > share > configbean > customizers > webapp > WebAppCachePanel


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  * WebAppCachePanel.java
21  *
22  * Created on November 5, 2003, 4:56 PM
23  */

24
25 package org.netbeans.modules.j2ee.sun.share.configbean.customizers.webapp;
26
27 import java.util.ResourceBundle JavaDoc;
28
29 import javax.swing.JTabbedPane JavaDoc;
30
31 import org.netbeans.modules.j2ee.sun.share.configbean.ValidationError;
32 import org.netbeans.modules.j2ee.sun.share.configbean.WebAppRoot;
33 import org.netbeans.modules.j2ee.sun.share.configbean.WebAppCache;
34
35 /**
36  *
37  * @author Peter Williams
38  */

39 public class WebAppCachePanel extends JTabbedPane JavaDoc {
40     
41     private static final ResourceBundle JavaDoc webappBundle = ResourceBundle.getBundle(
42         "org.netbeans.modules.j2ee.sun.share.configbean.customizers.webapp.Bundle"); // NOI18N
43

44     private WebAppRootCustomizer masterPanel;
45     
46     /** Creates new form WebAppCachePanel */
47     public WebAppCachePanel(WebAppRootCustomizer src) {
48         masterPanel = src;
49         
50         initComponents();
51         initUserComponents();
52     }
53     
54     /** This method is called from within the constructor to
55      * initialize the form.
56      * WARNING: Do NOT modify this code. The content of this method is
57      * always regenerated by the Form Editor.
58      */

59     private void initComponents() {//GEN-BEGIN:initComponents
60

61         setTabPlacement(javax.swing.JTabbedPane.BOTTOM);
62         getAccessibleContext().setAccessibleName(webappBundle.getString("ACSN_WebAppCacheTab"));
63         getAccessibleContext().setAccessibleDescription(webappBundle.getString("ACSD_WebAppCacheTab"));
64     }//GEN-END:initComponents
65

66     
67     // Variables declaration - do not modify//GEN-BEGIN:variables
68
// End of variables declaration//GEN-END:variables
69

70     private CacheGeneralPanel generalPanel;
71     private CacheHelperPanel helperPanel;
72     private CacheMappingPanel mappingPanel;
73     
74     private void initUserComponents() {
75         // add cache general panel
76
generalPanel = new CacheGeneralPanel(masterPanel);
77         addTab(webappBundle.getString("CACHE_GENERAL_TAB"), generalPanel); // NOI18N
78

79         // add cache helper panel
80
helperPanel = new CacheHelperPanel(masterPanel);
81         addTab(webappBundle.getString("CACHE_HELPERS_TAB"), helperPanel); // NOI18N
82

83         // add cache mappings panel
84
mappingPanel = new CacheMappingPanel(masterPanel);
85         addTab(webappBundle.getString("CACHE_MAPPINGS_TAB"), mappingPanel); // NOI18N
86
}
87     
88     public void addListeners() {
89         generalPanel.addListeners();
90         helperPanel.addListeners();
91         mappingPanel.addListeners();
92     }
93     
94     public void removeListeners() {
95         generalPanel.removeListeners();
96         helperPanel.removeListeners();
97         mappingPanel.removeListeners();
98     }
99     
100     /** Initialization of all the fields in this panel from the bean that
101      * was passed in.
102      */

103     public void initFields(WebAppRoot theBean) {
104         WebAppCache cacheBean = theBean.getCacheBean();
105         generalPanel.initFields(cacheBean);
106         helperPanel.initFields(cacheBean);
107         mappingPanel.initFields(cacheBean);
108     }
109     
110     /** Returns the help ID for the selected tab within the cache tab of sun-web-app.
111      *
112      * @return String representing the current active help ID for this tabbed panel.
113      */

114     public String JavaDoc getHelpId() {
115         String JavaDoc result = "AS_CFG_WebAppCacheGeneral"; // NOI18N
116

117         // Determine which tab has focus and return help context for that tab.
118
switch(getSelectedIndex()) {
119             case 2:
120                 result = "AS_CFG_WebAppCacheMapping"; // NOI18N
121
break;
122             case 1:
123                 result = "AS_CFG_WebAppCacheHelpers"; // NOI18N
124
break;
125         }
126         
127         return result;
128     }
129
130     /** Retrieve the partition that should be associated with the current
131      * selected tab.
132      *
133      * @return ValidationError.Partition
134      */

135     public ValidationError.Partition getPartition() {
136         switch(getSelectedIndex()) {
137             case 2:
138                 return ValidationError.PARTITION_CACHE_CONSTRAINTS;
139             case 1:
140                 return ValidationError.PARTITION_CACHE_HELPERS;
141             default:
142                 return ValidationError.PARTITION_CACHE_GENERAL;
143         }
144     }
145 }
146
Popular Tags