KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > ddloaders > web > multiview > JspPGPanel


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.ddloaders.web.multiview;
21
22 import org.netbeans.modules.j2ee.dd.api.web.JspPropertyGroup;
23 import org.netbeans.modules.j2ee.ddloaders.web.*;
24 import org.netbeans.modules.xml.multiview.ui.*;
25 import org.netbeans.modules.xml.multiview.Error;
26 import org.netbeans.modules.xml.multiview.Utils;
27 import org.openide.util.NbBundle;
28 import org.netbeans.api.project.SourceGroup;
29
30 /**
31  * @author mkuchtiak
32  */

33 public class JspPGPanel extends SectionInnerPanel implements java.awt.event.ItemListener JavaDoc {
34     private JspPropertyGroup group;
35     private DDDataObject dObj;
36     /** Creates new form JspPGPanel */
37     public JspPGPanel(SectionView sectionView, DDDataObject dObj,JspPropertyGroup group) {
38         super(sectionView);
39         this.dObj=dObj;
40         this.group=group;
41         initComponents();
42         
43         trimWhiteSpaces.setEnabled(false);
44         deferredSyntaxAllowed.setEnabled(false);
45         
46         dispNameTF.setText(group.getDefaultDisplayName());
47         addModifier(dispNameTF);
48         
49         Utils.makeTextAreaLikeTextField(descriptionTA,dispNameTF);
50         descriptionTA.setText(group.getDefaultDescription());
51         addModifier(descriptionTA);
52         
53         pageEncodingTF.setText(group.getPageEncoding());
54         addModifier(pageEncodingTF);
55         
56         ignoreEL.setSelected(group.isElIgnored());
57         ignoreEL.addItemListener(this);
58         disableScripting.setSelected(group.isScriptingInvalid());
59         disableScripting.addItemListener(this);
60         xmlSyntax.setSelected(group.isIsXml());
61         xmlSyntax.addItemListener(this);
62         
63         if (group instanceof org.netbeans.modules.j2ee.dd.impl.web.model_2_5.JspPropertyGroup){
64             org.netbeans.modules.j2ee.dd.impl.web.model_2_5.JspPropertyGroup group25 = (org.netbeans.modules.j2ee.dd.impl.web.model_2_5.JspPropertyGroup) group;
65             trimWhiteSpaces.setEnabled(true);
66             deferredSyntaxAllowed.setEnabled(true);
67             trimWhiteSpaces.setSelected(group25.isTrimDirectiveWhitespaces());
68             trimWhiteSpaces.addItemListener(this);
69             deferredSyntaxAllowed.setSelected(group25.isDeferredSyntaxAllowedAsLiteral());
70             deferredSyntaxAllowed.addItemListener(this);
71         }
72         
73         urlPatternsTF.setText(DDUtils.urlPatternList(group.getUrlPattern()));
74         addValidatee(urlPatternsTF);
75         
76         preludeTF.setText(DDUtils.urlPatternList(group.getIncludePrelude()));
77         addModifier(preludeTF);
78         
79         codaTF.setText(DDUtils.urlPatternList(group.getIncludeCoda()));
80         addModifier(codaTF);
81         
82         LinkButton linkButton = new LinkButton(this, group, "url_patterns"); //NOI18N
83
java.awt.GridBagConstraints JavaDoc gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
84         gridBagConstraints.gridx = 3;
85         gridBagConstraints.gridy = 2;
86         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
87         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
88         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 10, 0, 0);
89         linkButton.setText(NbBundle.getMessage(JspPGPanel.class, "LBL_goToSources"));
90         linkButton.setMnemonic(NbBundle.getMessage(JspPGPanel.class, "LBL_goToSource_mnem").charAt(0));
91         add(linkButton, gridBagConstraints);
92         
93         linkButton = new LinkButton(this, group, "preludes"); //NOI18N
94
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
95         gridBagConstraints.gridx = 3;
96         gridBagConstraints.gridy = 8;
97         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
98         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
99         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 10, 0, 0);
100         linkButton.setText(NbBundle.getMessage(JspPGPanel.class, "LBL_goToSources"));
101         linkButton.setMnemonic(NbBundle.getMessage(JspPGPanel.class, "LBL_goToSource_mnem1").charAt(0));
102         add(linkButton, gridBagConstraints);
103         
104         linkButton = new LinkButton(this, group, "codas"); //NOI18N
105
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
106         gridBagConstraints.gridx = 3;
107         gridBagConstraints.gridy = 9;
108         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
109         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
110         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 10, 5, 0);
111         linkButton.setText(NbBundle.getMessage(JspPGPanel.class, "LBL_goToSources"));
112         linkButton.setMnemonic(NbBundle.getMessage(JspPGPanel.class, "LBL_goToSource_mnem2").charAt(0));
113         add(linkButton, gridBagConstraints);
114     }
115     public javax.swing.JComponent JavaDoc getErrorComponent(String JavaDoc errorId) {
116         if ("url_patterns".equals(errorId)) return urlPatternsTF;
117         return null;
118     }
119     
120     public void documentChanged(javax.swing.text.JTextComponent JavaDoc comp, String JavaDoc value) {
121         if (comp==urlPatternsTF) {
122             String JavaDoc val = (String JavaDoc)value;
123             if (val.length()==0) {
124                 getSectionView().getErrorPanel().setError(new Error JavaDoc(Error.TYPE_FATAL, Error.MISSING_VALUE_MESSAGE, "URL Pattern",urlPatternsTF));
125                 return;
126             }
127             getSectionView().getErrorPanel().clearError();
128         }
129     }
130     
131     public void setValue(javax.swing.JComponent JavaDoc source, Object JavaDoc value) {
132         if (source==urlPatternsTF) {
133             String JavaDoc text = (String JavaDoc)value;
134             // change servlet-mappings
135
setUrlPatterns(text);
136         } else if (source==dispNameTF) {
137             String JavaDoc text = (String JavaDoc)value;
138             group.setDisplayName(text.length()==0?null:text);
139             SectionPanel enclosingPanel = getSectionView().findSectionPanel(group);
140             enclosingPanel.setTitle(((PagesMultiViewElement.PagesView)getSectionView()).getJspGroupTitle(group));
141             enclosingPanel.getNode().setDisplayName(((PagesMultiViewElement.PagesView)getSectionView()).getJspGroupNodeName(group));
142         } else if (source==descriptionTA) {
143             String JavaDoc text = (String JavaDoc)value;
144             group.setDescription(text.length()==0?null:text);
145         } else if (source==pageEncodingTF) {
146             String JavaDoc text = (String JavaDoc)value;
147             group.setPageEncoding(text.length()==0?null:text);
148         } else if (source==preludeTF) {
149             String JavaDoc text = (String JavaDoc)value;
150             setPreludes(text);
151         } else if (source==codaTF) {
152             String JavaDoc text = (String JavaDoc)value;
153             setCodas(text);
154         }
155     }
156     
157     private void setUrlPatterns(String JavaDoc text) {
158         String JavaDoc[] urlPatterns = DDUtils.getStringArray(text);
159         group.setUrlPattern(urlPatterns);
160         SectionPanel enclosingPanel = getSectionView().findSectionPanel(group);
161         enclosingPanel.setTitle(((PagesMultiViewElement.PagesView)getSectionView()).getJspGroupTitle(group));
162     }
163     private void setPreludes(String JavaDoc text) {
164         String JavaDoc[] preludes = DDUtils.getStringArray(text);
165         group.setIncludePrelude(preludes);
166     }
167     private void setCodas(String JavaDoc text) {
168         String JavaDoc[] codas = DDUtils.getStringArray(text);
169         group.setIncludeCoda(codas);
170     }
171     public void rollbackValue(javax.swing.text.JTextComponent JavaDoc source) {
172         if (source==urlPatternsTF) {
173             urlPatternsTF.setText(DDUtils.urlPatternList(group.getUrlPattern()));
174         }
175     }
176     
177     public void linkButtonPressed(Object JavaDoc obj, String JavaDoc id) {
178         String JavaDoc text=null;
179         if ("url_patterns".equals(id)) {
180             text = urlPatternsTF.getText();
181         } else if ("preludes".equals(id)) {
182             text = preludeTF.getText();
183         } else if ("codas".equals(id)) {
184             text = codaTF.getText();
185         }
186         java.util.StringTokenizer JavaDoc tok = new java.util.StringTokenizer JavaDoc(text,",");
187         DDUtils.openEditorForFiles(dObj,tok);
188     }
189     
190     
191     
192     /** This method is called from within the constructor to
193      * initialize the form.
194      * WARNING: Do NOT modify this code. The content of this method is
195      * always regenerated by the Form Editor.
196      */

197     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
198
private void initComponents() {
199         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
200
201         dispNameLabel = new javax.swing.JLabel JavaDoc();
202         dispNameTF = new javax.swing.JTextField JavaDoc();
203         descriptionLabel = new javax.swing.JLabel JavaDoc();
204         descriptionTA = new javax.swing.JTextArea JavaDoc();
205         urlPatternsLabel = new javax.swing.JLabel JavaDoc();
206         urlPatternsTF = new javax.swing.JTextField JavaDoc();
207         browseButton1 = new javax.swing.JButton JavaDoc();
208         hintUrlPatterns = new javax.swing.JLabel JavaDoc();
209         pageEncodingLabel = new javax.swing.JLabel JavaDoc();
210         pageEncodingTF = new javax.swing.JTextField JavaDoc();
211         ignoreEL = new javax.swing.JCheckBox JavaDoc();
212         disableScripting = new javax.swing.JCheckBox JavaDoc();
213         xmlSyntax = new javax.swing.JCheckBox JavaDoc();
214         preludeLabel = new javax.swing.JLabel JavaDoc();
215         preludeTF = new javax.swing.JTextField JavaDoc();
216         browseButton2 = new javax.swing.JButton JavaDoc();
217         codaLabel = new javax.swing.JLabel JavaDoc();
218         codaTF = new javax.swing.JTextField JavaDoc();
219         browseButton3 = new javax.swing.JButton JavaDoc();
220         filler = new javax.swing.JPanel JavaDoc();
221         trimWhiteSpaces = new javax.swing.JCheckBox JavaDoc();
222         deferredSyntaxAllowed = new javax.swing.JCheckBox JavaDoc();
223
224         setLayout(new java.awt.GridBagLayout JavaDoc());
225
226         dispNameLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_displayName_mnem").charAt(0));
227         dispNameLabel.setLabelFor(dispNameTF);
228         dispNameLabel.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_displayName"));
229         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
230         gridBagConstraints.gridx = 0;
231         gridBagConstraints.gridy = 0;
232         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
233         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 10, 0, 10);
234         add(dispNameLabel, gridBagConstraints);
235
236         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
237         gridBagConstraints.gridx = 1;
238         gridBagConstraints.gridy = 0;
239         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
240         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 0, 0, 0);
241         add(dispNameTF, gridBagConstraints);
242
243         descriptionLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_description_mnem").charAt(0));
244         descriptionLabel.setLabelFor(descriptionTA);
245         descriptionLabel.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_description"));
246         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
247         gridBagConstraints.gridx = 0;
248         gridBagConstraints.gridy = 1;
249         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
250         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 10, 0, 10);
251         add(descriptionLabel, gridBagConstraints);
252
253         descriptionTA.setRows(3);
254         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
255         gridBagConstraints.gridx = 1;
256         gridBagConstraints.gridy = 1;
257         gridBagConstraints.gridwidth = 2;
258         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
259         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 0, 0, 0);
260         add(descriptionTA, gridBagConstraints);
261
262         urlPatternsLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_urlPatterns_mnem").charAt(0));
263         urlPatternsLabel.setLabelFor(urlPatternsTF);
264         urlPatternsLabel.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_urlPatterns"));
265         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
266         gridBagConstraints.gridx = 0;
267         gridBagConstraints.gridy = 2;
268         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
269         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 10, 0, 10);
270         add(urlPatternsLabel, gridBagConstraints);
271
272         urlPatternsTF.setColumns(40);
273         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
274         gridBagConstraints.gridx = 1;
275         gridBagConstraints.gridy = 2;
276         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
277         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 0, 0, 0);
278         add(urlPatternsTF, gridBagConstraints);
279
280         browseButton1.setMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_browse_mnem").charAt(0));
281         browseButton1.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_browse"));
282         browseButton1.setMargin(new java.awt.Insets JavaDoc(0, 14, 0, 14));
283         browseButton1.addActionListener(new java.awt.event.ActionListener JavaDoc() {
284             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
285                 browseButton1ActionPerformed(evt);
286             }
287         });
288
289         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
290         gridBagConstraints.gridx = 2;
291         gridBagConstraints.gridy = 2;
292         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
293         gridBagConstraints.insets = new java.awt.Insets JavaDoc(3, 5, 0, 0);
294         add(browseButton1, gridBagConstraints);
295
296         hintUrlPatterns.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "HINT_urlPatterns"));
297         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
298         gridBagConstraints.gridx = 1;
299         gridBagConstraints.gridy = 3;
300         gridBagConstraints.gridwidth = 2;
301         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
302         add(hintUrlPatterns, gridBagConstraints);
303
304         pageEncodingLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_pageEncoding_mnem").charAt(0));
305         pageEncodingLabel.setLabelFor(pageEncodingTF);
306         pageEncodingLabel.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_pageEncoding"));
307         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
308         gridBagConstraints.gridx = 0;
309         gridBagConstraints.gridy = 4;
310         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
311         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 10, 0, 10);
312         add(pageEncodingLabel, gridBagConstraints);
313
314         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
315         gridBagConstraints.gridx = 1;
316         gridBagConstraints.gridy = 4;
317         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
318         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 0, 0, 0);
319         add(pageEncodingTF, gridBagConstraints);
320
321         ignoreEL.setMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "CHB_ignoreEL_mnem").charAt(0));
322         ignoreEL.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "CHB_ignoreEL"));
323         ignoreEL.setActionCommand("Expression Language Ignored");
324         ignoreEL.setOpaque(false);
325         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
326         gridBagConstraints.gridx = 1;
327         gridBagConstraints.gridy = 5;
328         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
329         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 0, 0, 0);
330         add(ignoreEL, gridBagConstraints);
331
332         disableScripting.setMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "CHB_ignoreScripting_mnem").charAt(0));
333         disableScripting.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "CHB_ignoreScripting"));
334         disableScripting.setOpaque(false);
335         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
336         gridBagConstraints.gridx = 1;
337         gridBagConstraints.gridy = 6;
338         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
339         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 0, 0, 0);
340         add(disableScripting, gridBagConstraints);
341
342         xmlSyntax.setMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "CHB_xmlSyntax_mnem").charAt(0));
343         xmlSyntax.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "CHB_xmlSyntax"));
344         xmlSyntax.setOpaque(false);
345         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
346         gridBagConstraints.gridx = 1;
347         gridBagConstraints.gridy = 7;
348         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
349         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 0, 0, 0);
350         add(xmlSyntax, gridBagConstraints);
351
352         preludeLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_includePrelude_mnem").charAt(0));
353         preludeLabel.setLabelFor(preludeTF);
354         preludeLabel.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_includePrelude"));
355         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
356         gridBagConstraints.gridx = 0;
357         gridBagConstraints.gridy = 10;
358         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
359         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 10, 0, 10);
360         add(preludeLabel, gridBagConstraints);
361
362         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
363         gridBagConstraints.gridx = 1;
364         gridBagConstraints.gridy = 10;
365         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
366         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 0, 0, 0);
367         add(preludeTF, gridBagConstraints);
368
369         browseButton2.setMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_browse_mnem1").charAt(0));
370         browseButton2.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_browse"));
371         browseButton2.setMargin(new java.awt.Insets JavaDoc(0, 14, 0, 14));
372         browseButton2.addActionListener(new java.awt.event.ActionListener JavaDoc() {
373             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
374                 browseButton2ActionPerformed(evt);
375             }
376         });
377
378         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
379         gridBagConstraints.gridx = 2;
380         gridBagConstraints.gridy = 10;
381         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
382         gridBagConstraints.insets = new java.awt.Insets JavaDoc(3, 5, 0, 0);
383         add(browseButton2, gridBagConstraints);
384
385         codaLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_includeCoda_mnem").charAt(0));
386         codaLabel.setLabelFor(codaTF);
387         codaLabel.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_includeCoda"));
388         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
389         gridBagConstraints.gridx = 0;
390         gridBagConstraints.gridy = 11;
391         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
392         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 10, 5, 10);
393         add(codaLabel, gridBagConstraints);
394
395         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
396         gridBagConstraints.gridx = 1;
397         gridBagConstraints.gridy = 11;
398         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
399         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 0, 5, 0);
400         add(codaTF, gridBagConstraints);
401
402         browseButton3.setMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_browse_mnem2").charAt(0));
403         browseButton3.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_browse"));
404         browseButton3.setMargin(new java.awt.Insets JavaDoc(0, 14, 0, 14));
405         browseButton3.addActionListener(new java.awt.event.ActionListener JavaDoc() {
406             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
407                 browseButton3ActionPerformed(evt);
408             }
409         });
410
411         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
412         gridBagConstraints.gridx = 2;
413         gridBagConstraints.gridy = 11;
414         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
415         gridBagConstraints.insets = new java.awt.Insets JavaDoc(3, 5, 5, 0);
416         add(browseButton3, gridBagConstraints);
417
418         filler.setOpaque(false);
419         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
420         gridBagConstraints.gridx = 4;
421         gridBagConstraints.gridy = 0;
422         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
423         gridBagConstraints.weightx = 1.0;
424         add(filler, gridBagConstraints);
425
426         trimWhiteSpaces.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("CHB_TrimDirectiveWhitespace_mnem").charAt(0));
427         trimWhiteSpaces.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("CHB_TrimDirectiveWhitespace"));
428         trimWhiteSpaces.setOpaque(false);
429         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
430         gridBagConstraints.gridx = 1;
431         gridBagConstraints.gridy = 8;
432         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
433         add(trimWhiteSpaces, gridBagConstraints);
434
435         deferredSyntaxAllowed.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("CHB_DeferredSyntaxAllowedAsLiteral_mnem").charAt(0));
436         deferredSyntaxAllowed.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("CHB_DeferredSyntaxAllowedAsLiteral"));
437         deferredSyntaxAllowed.setOpaque(false);
438         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
439         gridBagConstraints.gridx = 1;
440         gridBagConstraints.gridy = 9;
441         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
442         add(deferredSyntaxAllowed, gridBagConstraints);
443
444     }// </editor-fold>//GEN-END:initComponents
445

446     private void browseButton3ActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_browseButton3ActionPerformed
447
// TODO add your handling code here:
448
// TODO add your handling code here:
449
try {
450             SourceGroup[] groups = DDUtils.getDocBaseGroups(dObj);
451             org.openide.filesystems.FileObject fo = BrowseFolders.showDialog(groups);
452             if (fo!=null) {
453                 String JavaDoc fileName = "/"+DDUtils.getResourcePath(groups,fo,'/',true);
454                 String JavaDoc oldValue = codaTF.getText();
455                 if (fileName.length()>0) {
456                     String JavaDoc newValue = DDUtils.addItem(oldValue,fileName,false);
457                     if (!oldValue.equals(newValue)) {
458                         dObj.modelUpdatedFromUI();
459                         dObj.setChangedFromUI(true);
460                         codaTF.setText(newValue);
461                         setCodas(newValue);
462                         dObj.setChangedFromUI(false);
463                     }
464                 }
465             }
466         } catch (java.io.IOException JavaDoc ex) {}
467     }//GEN-LAST:event_browseButton3ActionPerformed
468

469     private void browseButton2ActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_browseButton2ActionPerformed
470
// TODO add your handling code here:
471
try {
472             SourceGroup[] groups = DDUtils.getDocBaseGroups(dObj);
473             org.openide.filesystems.FileObject fo = BrowseFolders.showDialog(groups);
474             if (fo!=null) {
475                 String JavaDoc fileName = "/"+DDUtils.getResourcePath(groups,fo,'/',true);
476                 String JavaDoc oldValue = preludeTF.getText();
477                 if (fileName.length()>0) {
478                     String JavaDoc newValue = DDUtils.addItem(oldValue,fileName,false);
479                     if (!oldValue.equals(newValue)) {
480                         dObj.modelUpdatedFromUI();
481                         dObj.setChangedFromUI(true);
482                         preludeTF.setText(newValue);
483                         setPreludes(newValue);
484                         dObj.setChangedFromUI(false);
485                     }
486                 }
487             }
488         } catch (java.io.IOException JavaDoc ex) {}
489     }//GEN-LAST:event_browseButton2ActionPerformed
490

491     private void browseButton1ActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_browseButton1ActionPerformed
492
// TODO add your handling code here:
493
try {
494             SourceGroup[] groups = DDUtils.getDocBaseGroups(dObj);
495             org.openide.filesystems.FileObject fo = BrowseFolders.showDialog(groups);
496             if (fo!=null) {
497                 String JavaDoc fileName = "/"+DDUtils.getResourcePath(groups,fo,'/',true);
498                 String JavaDoc oldValue = urlPatternsTF.getText();
499                 if (fileName.length()>0) {
500                     String JavaDoc newValue = DDUtils.addItem(oldValue,fileName,false);
501                     if (!oldValue.equals(newValue)) {
502                         dObj.modelUpdatedFromUI();
503                         dObj.setChangedFromUI(true);
504                         urlPatternsTF.setText(newValue);
505                         setUrlPatterns(newValue);
506                         dObj.setChangedFromUI(false);
507                         getSectionView().checkValidity();
508                     }
509                 }
510             }
511         } catch (java.io.IOException JavaDoc ex) {}
512     }//GEN-LAST:event_browseButton1ActionPerformed
513

514     
515     // Variables declaration - do not modify//GEN-BEGIN:variables
516
private javax.swing.JButton JavaDoc browseButton1;
517     private javax.swing.JButton JavaDoc browseButton2;
518     private javax.swing.JButton JavaDoc browseButton3;
519     private javax.swing.JLabel JavaDoc codaLabel;
520     private javax.swing.JTextField JavaDoc codaTF;
521     private javax.swing.JCheckBox JavaDoc deferredSyntaxAllowed;
522     private javax.swing.JLabel JavaDoc descriptionLabel;
523     private javax.swing.JTextArea JavaDoc descriptionTA;
524     private javax.swing.JCheckBox JavaDoc disableScripting;
525     private javax.swing.JLabel JavaDoc dispNameLabel;
526     private javax.swing.JTextField JavaDoc dispNameTF;
527     private javax.swing.JPanel JavaDoc filler;
528     private javax.swing.JLabel JavaDoc hintUrlPatterns;
529     private javax.swing.JCheckBox JavaDoc ignoreEL;
530     private javax.swing.JLabel JavaDoc pageEncodingLabel;
531     private javax.swing.JTextField JavaDoc pageEncodingTF;
532     private javax.swing.JLabel JavaDoc preludeLabel;
533     private javax.swing.JTextField JavaDoc preludeTF;
534     private javax.swing.JCheckBox JavaDoc trimWhiteSpaces;
535     private javax.swing.JLabel JavaDoc urlPatternsLabel;
536     private javax.swing.JTextField JavaDoc urlPatternsTF;
537     private javax.swing.JCheckBox JavaDoc xmlSyntax;
538     // End of variables declaration//GEN-END:variables
539

540     public void itemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {
541         // TODO add your handling code here:
542
System.out.println("State changed: " + evt);
543         System.out.println("State changed: " + evt.getSource());
544         dObj.modelUpdatedFromUI();
545         dObj.setChangedFromUI(true);
546         if (evt.getSource() == ignoreEL) {
547             group.setElIgnored(ignoreEL.isSelected());
548         } else if (evt.getSource() == disableScripting) {
549             group.setScriptingInvalid(disableScripting.isSelected());
550         } else if (evt.getSource() == xmlSyntax) {
551             group.setIsXml(xmlSyntax.isSelected());
552         }else if (evt.getSource() == trimWhiteSpaces){
553             ((org.netbeans.modules.j2ee.dd.impl.web.model_2_5.JspPropertyGroup) group).setTrimDirectiveWhitespaces(trimWhiteSpaces.isSelected());
554         } else if (evt.getSource() == deferredSyntaxAllowed){
555             ((org.netbeans.modules.j2ee.dd.impl.web.model_2_5.JspPropertyGroup) group).setDeferredSyntaxAllowedAsLiteral(deferredSyntaxAllowed.isSelected());
556         }
557         dObj.setChangedFromUI(false);
558     }
559     /** This will be called before model is changed from this panel
560      */

561     protected void startUIChange() {
562         dObj.setChangedFromUI(true);
563     }
564     
565     /** This will be called after model is changed from this panel
566      */

567     protected void endUIChange() {
568         dObj.modelUpdatedFromUI();
569         dObj.setChangedFromUI(false);
570     }
571 }
572
Popular Tags