KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > websphere6 > dd > loaders > ui > WSWebExtAttributesPanel


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 package org.netbeans.modules.j2ee.websphere6.dd.loaders.ui;
20
21 import javax.swing.SpinnerDateModel JavaDoc;
22 import javax.swing.SpinnerModel JavaDoc;
23 import org.netbeans.modules.j2ee.websphere6.dd.beans.WSWebExt;
24 import org.netbeans.modules.xml.multiview.*;
25 import org.netbeans.modules.xml.multiview.ui.*;
26 import org.netbeans.modules.xml.multiview.Error;
27 import org.netbeans.modules.j2ee.websphere6.dd.loaders.webext.*;
28
29 /**
30  *
31  * @author dlm198383
32  */

33 public class WSWebExtAttributesPanel extends SectionInnerPanel implements java.awt.event.ItemListener JavaDoc, javax.swing.event.ChangeListener JavaDoc {
34     
35     WSWebExt webext;
36     WSWebExtDataObject dObj;
37     
38     /** Creates new form WSWebExtAttributesPanel */
39     public WSWebExtAttributesPanel(SectionView view, WSWebExtDataObject dObj, WSWebExt webext) {
40         super(view);
41         this.dObj=dObj;
42         this.webext=webext;
43         initComponents();
44         fileServingCheckBox.setSelected(webext.getFileServingEnabled());
45         serveServletsCheckBox.setSelected(webext.getServeServletsByClassname());
46         directoryBrowsingCheckBox.setSelected(webext.getDirectoryBrowsing());
47         reloadIntervalCheckBox.setSelected(webext.getReload());
48         SpinnerModel JavaDoc sm=new javax.swing.SpinnerNumberModel JavaDoc(0,0,600,1);
49         reloadIntervalSpinner.setModel(sm);
50         reloadIntervalSpinner.setValue(new Integer JavaDoc(webext.getReloadInterval()));
51         precompileJPSCheckBox.setSelected(webext.getPrecompileJSPs());
52         autoRequestEncCheckBox.setSelected(webext.getAutoRequestEncoding());
53         autoResponseEncCheckBox.setSelected(webext.getAutoResponseEncoding());
54         autoLoadFiltersCheckBox.setSelected(webext.getAutoLoadFilters());
55         additionalClassPathField.setText(webext.getAdditionalClassPath());
56         defaultErrorPageField.setText(webext.getDefaultErrorPage());
57         hrefField.setText(webext.getWebApplicationHref());
58         nameField.setText(webext.getXmiId());
59         
60         fileServingCheckBox.addItemListener(this);
61         serveServletsCheckBox.addItemListener(this);
62         directoryBrowsingCheckBox.addItemListener(this);
63         reloadIntervalCheckBox.addItemListener(this);
64         precompileJPSCheckBox.addItemListener(this);
65         autoRequestEncCheckBox.addItemListener(this);
66         autoResponseEncCheckBox.addItemListener(this);
67         autoLoadFiltersCheckBox.addItemListener(this);
68         reloadIntervalSpinner.addChangeListener(this);
69         addModifier(additionalClassPathField);
70         addModifier(defaultErrorPageField);
71         addModifier(hrefField);
72         addModifier(nameField);
73         //addModifier(virtualHostField);
74
//getSectionView().getErrorPanel().clearError();
75
}
76     public void setValue(javax.swing.JComponent JavaDoc source,Object JavaDoc value) {
77         if (source==additionalClassPathField) {
78             webext.setAdditionalClassPath((String JavaDoc)value);
79         } else if (source==defaultErrorPageField) {
80             webext.setDefaultErrorPage((String JavaDoc)value);
81         } else if(source==hrefField) {
82             webext.setWebApplicationHref((String JavaDoc)value);
83         }
84     }
85     public void linkButtonPressed(Object JavaDoc ddBean, String JavaDoc ddProperty) {
86     }
87     
88     public javax.swing.JComponent JavaDoc getErrorComponent(String JavaDoc errorId) {
89         //if ("name".equals(errorId)) return nameField;
90
//if ("vhn".equals(errorId)) return virtualHostField;
91
return null;
92     }
93     public void stateChanged(javax.swing.event.ChangeEvent JavaDoc evt) {
94         webext.setReloadInterval(reloadIntervalSpinner.getValue().toString());
95         dObj.modelUpdatedFromUI();
96     }
97     
98     public void itemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {
99         // TODO add your handling code here:
100
dObj.setChangedFromUI(true);
101         webext.setPrecompileJSPs(precompileJPSCheckBox.isSelected());
102         webext.setServeServletsByClassname(serveServletsCheckBox.isSelected());
103         webext.setDirectoryBrowsing(directoryBrowsingCheckBox.isSelected());
104         webext.setAutoRequestEncoding(autoRequestEncCheckBox.isSelected());
105         webext.setAutoResponseEncoding(autoResponseEncCheckBox.isSelected());
106         webext.setAutoLoadFilters(autoLoadFiltersCheckBox.isSelected());
107         webext.setFileServingEnabled(fileServingCheckBox.isSelected());
108         webext.setReload(reloadIntervalCheckBox.isSelected());
109         webext.setReloadInterval(reloadIntervalSpinner.getValue().toString());
110         dObj.modelUpdatedFromUI();
111         dObj.setChangedFromUI(false);
112     }
113     
114     /** This will be called before model is changed from this panel
115      */

116     
117     protected void startUIChange() {
118         dObj.setChangedFromUI(true);
119     }
120     
121     /** This will be called after model is changed from this panel
122      */

123     
124     protected void endUIChange() {
125         dObj.modelUpdatedFromUI();
126         dObj.setChangedFromUI(false);
127     }
128     
129     /** This method is called from within the constructor to
130      * initialize the form.
131      * WARNING: Do NOT modify this code. The content of this method is
132      * always regenerated by the Form Editor.
133      */

134     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
135
private void initComponents() {
136         reloadIntervalCheckBox = new javax.swing.JCheckBox JavaDoc();
137         reloadIntervalSpinner = new javax.swing.JSpinner JavaDoc();
138         additionalClassPathLabel = new javax.swing.JLabel JavaDoc();
139         additionalClassPathField = new javax.swing.JTextField JavaDoc();
140         fileServingCheckBox = new javax.swing.JCheckBox JavaDoc();
141         directoryBrowsingCheckBox = new javax.swing.JCheckBox JavaDoc();
142         serveServletsCheckBox = new javax.swing.JCheckBox JavaDoc();
143         precompileJPSCheckBox = new javax.swing.JCheckBox JavaDoc();
144         autoRequestEncCheckBox = new javax.swing.JCheckBox JavaDoc();
145         autoResponseEncCheckBox = new javax.swing.JCheckBox JavaDoc();
146         jLabel1 = new javax.swing.JLabel JavaDoc();
147         defaultErrorPageField = new javax.swing.JTextField JavaDoc();
148         jLabel2 = new javax.swing.JLabel JavaDoc();
149         hrefField = new javax.swing.JTextField JavaDoc();
150         jLabel3 = new javax.swing.JLabel JavaDoc();
151         nameField = new javax.swing.JTextField JavaDoc();
152         autoLoadFiltersCheckBox = new javax.swing.JCheckBox JavaDoc();
153
154         reloadIntervalCheckBox.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/websphere6/dd/loaders/ui/Bundle").getString("LBL_ReloadInterval"));
155         reloadIntervalCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
156         reloadIntervalCheckBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
157
158         reloadIntervalSpinner.setFont(new java.awt.Font JavaDoc("Courier", 0, 12));
159
160         additionalClassPathLabel.setText("Additional Class Path:");
161
162         fileServingCheckBox.setText("File Serving");
163         fileServingCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
164         fileServingCheckBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
165
166         directoryBrowsingCheckBox.setText("Directory Browsing");
167         directoryBrowsingCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
168         directoryBrowsingCheckBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
169
170         serveServletsCheckBox.setText("Serve Servlets by Classname");
171         serveServletsCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
172         serveServletsCheckBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
173
174         precompileJPSCheckBox.setText("Precompile JSPs");
175         precompileJPSCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
176         precompileJPSCheckBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
177
178         autoRequestEncCheckBox.setText("Auto Request Encoding");
179         autoRequestEncCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
180         autoRequestEncCheckBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
181
182         autoResponseEncCheckBox.setText("Auto Response Encoding");
183         autoResponseEncCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
184         autoResponseEncCheckBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
185
186         jLabel1.setText("Default Error Page:");
187
188         jLabel2.setText("Name in Web.xml:");
189
190         jLabel3.setText("Name:");
191
192         autoLoadFiltersCheckBox.setText("Auto Load Filters");
193         autoLoadFiltersCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
194         autoLoadFiltersCheckBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
195
196         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
197         this.setLayout(layout);
198         layout.setHorizontalGroup(
199             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
200             .add(layout.createSequentialGroup()
201                 .addContainerGap()
202                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
203                     .add(serveServletsCheckBox)
204                     .add(fileServingCheckBox)
205                     .add(directoryBrowsingCheckBox)
206                     .add(precompileJPSCheckBox)
207                     .add(autoRequestEncCheckBox)
208                     .add(autoResponseEncCheckBox)
209                     .add(layout.createSequentialGroup()
210                         .add(reloadIntervalCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 111, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
211                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
212                         .add(reloadIntervalSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
213                     .add(layout.createSequentialGroup()
214                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
215                             .add(jLabel1)
216                             .add(additionalClassPathLabel)
217                             .add(jLabel2)
218                             .add(jLabel3))
219                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
220                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
221                             .add(nameField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE)
222                             .add(hrefField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE)
223                             .add(additionalClassPathField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE)
224                             .add(org.jdesktop.layout.GroupLayout.TRAILING, defaultErrorPageField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE)))
225                     .add(autoLoadFiltersCheckBox))
226                 .addContainerGap())
227         );
228         layout.setVerticalGroup(
229             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
230             .add(layout.createSequentialGroup()
231                 .addContainerGap()
232                 .add(fileServingCheckBox)
233                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
234                 .add(serveServletsCheckBox)
235                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
236                 .add(directoryBrowsingCheckBox)
237                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
238                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
239                     .add(layout.createSequentialGroup()
240                         .add(reloadIntervalCheckBox)
241                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
242                         .add(precompileJPSCheckBox))
243                     .add(reloadIntervalSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
244                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
245                 .add(autoRequestEncCheckBox)
246                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
247                 .add(autoResponseEncCheckBox)
248                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
249                 .add(autoLoadFiltersCheckBox)
250                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
251                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
252                     .add(additionalClassPathLabel)
253                     .add(additionalClassPathField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
254                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
255                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
256                     .add(jLabel1)
257                     .add(defaultErrorPageField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
258                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
259                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
260                     .add(jLabel2)
261                     .add(hrefField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
262                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
263                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
264                     .add(jLabel3)
265                     .add(nameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
266                 .add(24, 24, 24))
267         );
268     }// </editor-fold>//GEN-END:initComponents
269

270     
271     // Variables declaration - do not modify//GEN-BEGIN:variables
272
private javax.swing.JTextField JavaDoc additionalClassPathField;
273     private javax.swing.JLabel JavaDoc additionalClassPathLabel;
274     private javax.swing.JCheckBox JavaDoc autoLoadFiltersCheckBox;
275     private javax.swing.JCheckBox JavaDoc autoRequestEncCheckBox;
276     private javax.swing.JCheckBox JavaDoc autoResponseEncCheckBox;
277     private javax.swing.JTextField JavaDoc defaultErrorPageField;
278     private javax.swing.JCheckBox JavaDoc directoryBrowsingCheckBox;
279     private javax.swing.JCheckBox JavaDoc fileServingCheckBox;
280     private javax.swing.JTextField JavaDoc hrefField;
281     private javax.swing.JLabel JavaDoc jLabel1;
282     private javax.swing.JLabel JavaDoc jLabel2;
283     private javax.swing.JLabel JavaDoc jLabel3;
284     private javax.swing.JTextField JavaDoc nameField;
285     private javax.swing.JCheckBox JavaDoc precompileJPSCheckBox;
286     private javax.swing.JCheckBox JavaDoc reloadIntervalCheckBox;
287     private javax.swing.JSpinner JavaDoc reloadIntervalSpinner;
288     private javax.swing.JCheckBox JavaDoc serveServletsCheckBox;
289     // End of variables declaration//GEN-END:variables
290
/*
291     public javax.swing.JTextField getAdditionalClassPathField() {
292         return additionalClassPathField;
293     }
294     public javax.swing.JCheckBox getAutoRequestEncCheckBox() {
295         return autoRequestEncCheckBox;
296     }
297     public javax.swing.JCheckBox getAutoResponseEncCheckBox() {
298         return autoResponseEncCheckBox;
299     }
300     public javax.swing.JCheckBox getDirectoryBrowsingCheckBox() {
301         return directoryBrowsingCheckBox;
302     }
303     public javax.swing.JCheckBox getFileServingCheckBox(){
304         return fileServingCheckBox;
305     }
306     public javax.swing.JCheckBox getPrecompileJPSCheckBox(){
307         return precompileJPSCheckBox;
308     }
309     public javax.swing.JCheckBox getReloadIntervalCheckBox(){
310         return reloadIntervalCheckBox;
311     }
312     public javax.swing.JSpinner getReloadIntervalSpinner(){
313         return reloadIntervalSpinner;
314     }
315     public javax.swing.JCheckBox getServeServletsCheckBox(){
316         return serveServletsCheckBox;
317     }*/

318     
319 }
320
Popular Tags