001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.j2ee.ddloaders.web.multiview;
043:
044: import org.netbeans.modules.j2ee.dd.api.web.JspPropertyGroup;
045: import org.netbeans.modules.j2ee.ddloaders.web.*;
046: import org.netbeans.modules.xml.multiview.ui.*;
047: import org.netbeans.modules.xml.multiview.Error;
048: import org.netbeans.modules.xml.multiview.Utils;
049: import org.openide.util.NbBundle;
050: import org.netbeans.api.project.SourceGroup;
051:
052: /**
053: * @author mkuchtiak
054: */
055: public class JspPGPanel extends SectionInnerPanel implements
056: java.awt.event.ItemListener {
057: private JspPropertyGroup group;
058: private DDDataObject dObj;
059:
060: /** Creates new form JspPGPanel */
061: public JspPGPanel(SectionView sectionView, DDDataObject dObj,
062: JspPropertyGroup group) {
063: super (sectionView);
064: this .dObj = dObj;
065: this .group = group;
066: initComponents();
067:
068: trimWhiteSpaces.setEnabled(false);
069: deferredSyntaxAllowed.setEnabled(false);
070:
071: dispNameTF.setText(group.getDefaultDisplayName());
072: addModifier(dispNameTF);
073:
074: Utils.makeTextAreaLikeTextField(descriptionTA, dispNameTF);
075: descriptionTA.setText(group.getDefaultDescription());
076: addModifier(descriptionTA);
077:
078: pageEncodingTF.setText(group.getPageEncoding());
079: addModifier(pageEncodingTF);
080:
081: ignoreEL.setSelected(group.isElIgnored());
082: ignoreEL.addItemListener(this );
083: disableScripting.setSelected(group.isScriptingInvalid());
084: disableScripting.addItemListener(this );
085: xmlSyntax.setSelected(group.isIsXml());
086: xmlSyntax.addItemListener(this );
087:
088: if (group instanceof org.netbeans.modules.j2ee.dd.impl.web.model_2_5.JspPropertyGroup) {
089: org.netbeans.modules.j2ee.dd.impl.web.model_2_5.JspPropertyGroup group25 = (org.netbeans.modules.j2ee.dd.impl.web.model_2_5.JspPropertyGroup) group;
090: trimWhiteSpaces.setEnabled(true);
091: deferredSyntaxAllowed.setEnabled(true);
092: trimWhiteSpaces.setSelected(group25
093: .isTrimDirectiveWhitespaces());
094: trimWhiteSpaces.addItemListener(this );
095: deferredSyntaxAllowed.setSelected(group25
096: .isDeferredSyntaxAllowedAsLiteral());
097: deferredSyntaxAllowed.addItemListener(this );
098: }
099:
100: urlPatternsTF.setText(DDUtils.urlPatternList(group
101: .getUrlPattern()));
102: addValidatee(urlPatternsTF);
103:
104: preludeTF.setText(DDUtils.urlPatternList(group
105: .getIncludePrelude()));
106: addModifier(preludeTF);
107:
108: codaTF.setText(DDUtils.urlPatternList(group.getIncludeCoda()));
109: addModifier(codaTF);
110:
111: LinkButton linkButton = new LinkButton(this , group,
112: "url_patterns"); //NOI18N
113: java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
114: gridBagConstraints.gridx = 3;
115: gridBagConstraints.gridy = 2;
116: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
117: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
118: gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 0);
119: linkButton.setText(NbBundle.getMessage(JspPGPanel.class,
120: "LBL_goToSources"));
121: linkButton.setMnemonic(NbBundle.getMessage(JspPGPanel.class,
122: "LBL_goToSource_mnem").charAt(0));
123: add(linkButton, gridBagConstraints);
124:
125: linkButton = new LinkButton(this , group, "preludes"); //NOI18N
126: gridBagConstraints = new java.awt.GridBagConstraints();
127: gridBagConstraints.gridx = 3;
128: gridBagConstraints.gridy = 8;
129: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
130: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
131: gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 0);
132: linkButton.setText(NbBundle.getMessage(JspPGPanel.class,
133: "LBL_goToSources"));
134: linkButton.setMnemonic(NbBundle.getMessage(JspPGPanel.class,
135: "LBL_goToSource_mnem1").charAt(0));
136: add(linkButton, gridBagConstraints);
137:
138: linkButton = new LinkButton(this , group, "codas"); //NOI18N
139: gridBagConstraints = new java.awt.GridBagConstraints();
140: gridBagConstraints.gridx = 3;
141: gridBagConstraints.gridy = 9;
142: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
143: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
144: gridBagConstraints.insets = new java.awt.Insets(5, 10, 5, 0);
145: linkButton.setText(NbBundle.getMessage(JspPGPanel.class,
146: "LBL_goToSources"));
147: linkButton.setMnemonic(NbBundle.getMessage(JspPGPanel.class,
148: "LBL_goToSource_mnem2").charAt(0));
149: add(linkButton, gridBagConstraints);
150: }
151:
152: public javax.swing.JComponent getErrorComponent(String errorId) {
153: if ("url_patterns".equals(errorId))
154: return urlPatternsTF;
155: return null;
156: }
157:
158: public void documentChanged(javax.swing.text.JTextComponent comp,
159: String value) {
160: if (comp == urlPatternsTF) {
161: String val = (String) value;
162: if (val.length() == 0) {
163: getSectionView().getErrorPanel().setError(
164: new Error(Error.TYPE_FATAL,
165: Error.MISSING_VALUE_MESSAGE,
166: "URL Pattern", urlPatternsTF));
167: return;
168: }
169: getSectionView().getErrorPanel().clearError();
170: }
171: }
172:
173: public void setValue(javax.swing.JComponent source, Object value) {
174: if (source == urlPatternsTF) {
175: String text = (String) value;
176: // change servlet-mappings
177: setUrlPatterns(text);
178: } else if (source == dispNameTF) {
179: String text = (String) value;
180: group.setDisplayName(text.length() == 0 ? null : text);
181: SectionPanel enclosingPanel = getSectionView()
182: .findSectionPanel(group);
183: enclosingPanel
184: .setTitle(((PagesMultiViewElement.PagesView) getSectionView())
185: .getJspGroupTitle(group));
186: enclosingPanel
187: .getNode()
188: .setDisplayName(
189: ((PagesMultiViewElement.PagesView) getSectionView())
190: .getJspGroupNodeName(group));
191: } else if (source == descriptionTA) {
192: String text = (String) value;
193: group.setDescription(text.length() == 0 ? null : text);
194: } else if (source == pageEncodingTF) {
195: String text = (String) value;
196: group.setPageEncoding(text.length() == 0 ? null : text);
197: } else if (source == preludeTF) {
198: String text = (String) value;
199: setPreludes(text);
200: } else if (source == codaTF) {
201: String text = (String) value;
202: setCodas(text);
203: }
204: }
205:
206: private void setUrlPatterns(String text) {
207: String[] urlPatterns = DDUtils.getStringArray(text);
208: group.setUrlPattern(urlPatterns);
209: SectionPanel enclosingPanel = getSectionView()
210: .findSectionPanel(group);
211: enclosingPanel
212: .setTitle(((PagesMultiViewElement.PagesView) getSectionView())
213: .getJspGroupTitle(group));
214: }
215:
216: private void setPreludes(String text) {
217: String[] preludes = DDUtils.getStringArray(text);
218: group.setIncludePrelude(preludes);
219: }
220:
221: private void setCodas(String text) {
222: String[] codas = DDUtils.getStringArray(text);
223: group.setIncludeCoda(codas);
224: }
225:
226: public void rollbackValue(javax.swing.text.JTextComponent source) {
227: if (source == urlPatternsTF) {
228: urlPatternsTF.setText(DDUtils.urlPatternList(group
229: .getUrlPattern()));
230: }
231: }
232:
233: public void linkButtonPressed(Object obj, String id) {
234: String text = null;
235: if ("url_patterns".equals(id)) {
236: text = urlPatternsTF.getText();
237: } else if ("preludes".equals(id)) {
238: text = preludeTF.getText();
239: } else if ("codas".equals(id)) {
240: text = codaTF.getText();
241: }
242: java.util.StringTokenizer tok = new java.util.StringTokenizer(
243: text, ",");
244: DDUtils.openEditorForFiles(dObj, tok);
245: }
246:
247: /** This method is called from within the constructor to
248: * initialize the form.
249: * WARNING: Do NOT modify this code. The content of this method is
250: * always regenerated by the Form Editor.
251: */
252: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
253: private void initComponents() {
254: java.awt.GridBagConstraints gridBagConstraints;
255:
256: dispNameLabel = new javax.swing.JLabel();
257: dispNameTF = new javax.swing.JTextField();
258: descriptionLabel = new javax.swing.JLabel();
259: descriptionTA = new javax.swing.JTextArea();
260: urlPatternsLabel = new javax.swing.JLabel();
261: urlPatternsTF = new javax.swing.JTextField();
262: browseButton1 = new javax.swing.JButton();
263: hintUrlPatterns = new javax.swing.JLabel();
264: pageEncodingLabel = new javax.swing.JLabel();
265: pageEncodingTF = new javax.swing.JTextField();
266: ignoreEL = new javax.swing.JCheckBox();
267: disableScripting = new javax.swing.JCheckBox();
268: xmlSyntax = new javax.swing.JCheckBox();
269: preludeLabel = new javax.swing.JLabel();
270: preludeTF = new javax.swing.JTextField();
271: browseButton2 = new javax.swing.JButton();
272: codaLabel = new javax.swing.JLabel();
273: codaTF = new javax.swing.JTextField();
274: browseButton3 = new javax.swing.JButton();
275: filler = new javax.swing.JPanel();
276: trimWhiteSpaces = new javax.swing.JCheckBox();
277: deferredSyntaxAllowed = new javax.swing.JCheckBox();
278:
279: setLayout(new java.awt.GridBagLayout());
280:
281: dispNameLabel.setDisplayedMnemonic(org.openide.util.NbBundle
282: .getMessage(JspPGPanel.class, "LBL_displayName_mnem")
283: .charAt(0));
284: dispNameLabel.setLabelFor(dispNameTF);
285: dispNameLabel.setText(org.openide.util.NbBundle.getMessage(
286: JspPGPanel.class, "LBL_displayName"));
287: gridBagConstraints = new java.awt.GridBagConstraints();
288: gridBagConstraints.gridx = 0;
289: gridBagConstraints.gridy = 0;
290: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
291: gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 10);
292: add(dispNameLabel, gridBagConstraints);
293:
294: gridBagConstraints = new java.awt.GridBagConstraints();
295: gridBagConstraints.gridx = 1;
296: gridBagConstraints.gridy = 0;
297: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
298: gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
299: add(dispNameTF, gridBagConstraints);
300:
301: descriptionLabel.setDisplayedMnemonic(org.openide.util.NbBundle
302: .getMessage(JspPGPanel.class, "LBL_description_mnem")
303: .charAt(0));
304: descriptionLabel.setLabelFor(descriptionTA);
305: descriptionLabel.setText(org.openide.util.NbBundle.getMessage(
306: JspPGPanel.class, "LBL_description"));
307: gridBagConstraints = new java.awt.GridBagConstraints();
308: gridBagConstraints.gridx = 0;
309: gridBagConstraints.gridy = 1;
310: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
311: gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 10);
312: add(descriptionLabel, gridBagConstraints);
313:
314: descriptionTA.setRows(3);
315: gridBagConstraints = new java.awt.GridBagConstraints();
316: gridBagConstraints.gridx = 1;
317: gridBagConstraints.gridy = 1;
318: gridBagConstraints.gridwidth = 2;
319: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
320: gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
321: add(descriptionTA, gridBagConstraints);
322:
323: urlPatternsLabel.setDisplayedMnemonic(org.openide.util.NbBundle
324: .getMessage(JspPGPanel.class, "LBL_urlPatterns_mnem")
325: .charAt(0));
326: urlPatternsLabel.setLabelFor(urlPatternsTF);
327: urlPatternsLabel.setText(org.openide.util.NbBundle.getMessage(
328: JspPGPanel.class, "LBL_urlPatterns"));
329: gridBagConstraints = new java.awt.GridBagConstraints();
330: gridBagConstraints.gridx = 0;
331: gridBagConstraints.gridy = 2;
332: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
333: gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 10);
334: add(urlPatternsLabel, gridBagConstraints);
335:
336: urlPatternsTF.setColumns(40);
337: gridBagConstraints = new java.awt.GridBagConstraints();
338: gridBagConstraints.gridx = 1;
339: gridBagConstraints.gridy = 2;
340: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
341: gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
342: add(urlPatternsTF, gridBagConstraints);
343:
344: browseButton1.setMnemonic(org.openide.util.NbBundle.getMessage(
345: JspPGPanel.class, "LBL_browse_mnem").charAt(0));
346: browseButton1.setText(org.openide.util.NbBundle.getMessage(
347: JspPGPanel.class, "LBL_browse"));
348: browseButton1.setMargin(new java.awt.Insets(0, 14, 0, 14));
349: browseButton1
350: .addActionListener(new java.awt.event.ActionListener() {
351: public void actionPerformed(
352: java.awt.event.ActionEvent evt) {
353: browseButton1ActionPerformed(evt);
354: }
355: });
356:
357: gridBagConstraints = new java.awt.GridBagConstraints();
358: gridBagConstraints.gridx = 2;
359: gridBagConstraints.gridy = 2;
360: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
361: gridBagConstraints.insets = new java.awt.Insets(3, 5, 0, 0);
362: add(browseButton1, gridBagConstraints);
363:
364: hintUrlPatterns.setText(org.openide.util.NbBundle.getMessage(
365: JspPGPanel.class, "HINT_urlPatterns"));
366: gridBagConstraints = new java.awt.GridBagConstraints();
367: gridBagConstraints.gridx = 1;
368: gridBagConstraints.gridy = 3;
369: gridBagConstraints.gridwidth = 2;
370: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
371: add(hintUrlPatterns, gridBagConstraints);
372:
373: pageEncodingLabel
374: .setDisplayedMnemonic(org.openide.util.NbBundle
375: .getMessage(JspPGPanel.class,
376: "LBL_pageEncoding_mnem").charAt(0));
377: pageEncodingLabel.setLabelFor(pageEncodingTF);
378: pageEncodingLabel.setText(org.openide.util.NbBundle.getMessage(
379: JspPGPanel.class, "LBL_pageEncoding"));
380: gridBagConstraints = new java.awt.GridBagConstraints();
381: gridBagConstraints.gridx = 0;
382: gridBagConstraints.gridy = 4;
383: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
384: gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 10);
385: add(pageEncodingLabel, gridBagConstraints);
386:
387: gridBagConstraints = new java.awt.GridBagConstraints();
388: gridBagConstraints.gridx = 1;
389: gridBagConstraints.gridy = 4;
390: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
391: gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
392: add(pageEncodingTF, gridBagConstraints);
393:
394: ignoreEL.setMnemonic(org.openide.util.NbBundle.getMessage(
395: JspPGPanel.class, "CHB_ignoreEL_mnem").charAt(0));
396: ignoreEL.setText(org.openide.util.NbBundle.getMessage(
397: JspPGPanel.class, "CHB_ignoreEL"));
398: ignoreEL.setActionCommand("Expression Language Ignored");
399: ignoreEL.setOpaque(false);
400: gridBagConstraints = new java.awt.GridBagConstraints();
401: gridBagConstraints.gridx = 1;
402: gridBagConstraints.gridy = 5;
403: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
404: gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
405: add(ignoreEL, gridBagConstraints);
406:
407: disableScripting.setMnemonic(org.openide.util.NbBundle
408: .getMessage(JspPGPanel.class,
409: "CHB_ignoreScripting_mnem").charAt(0));
410: disableScripting.setText(org.openide.util.NbBundle.getMessage(
411: JspPGPanel.class, "CHB_ignoreScripting"));
412: disableScripting.setOpaque(false);
413: gridBagConstraints = new java.awt.GridBagConstraints();
414: gridBagConstraints.gridx = 1;
415: gridBagConstraints.gridy = 6;
416: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
417: gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
418: add(disableScripting, gridBagConstraints);
419:
420: xmlSyntax.setMnemonic(org.openide.util.NbBundle.getMessage(
421: JspPGPanel.class, "CHB_xmlSyntax_mnem").charAt(0));
422: xmlSyntax.setText(org.openide.util.NbBundle.getMessage(
423: JspPGPanel.class, "CHB_xmlSyntax"));
424: xmlSyntax.setOpaque(false);
425: gridBagConstraints = new java.awt.GridBagConstraints();
426: gridBagConstraints.gridx = 1;
427: gridBagConstraints.gridy = 7;
428: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
429: gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
430: add(xmlSyntax, gridBagConstraints);
431:
432: preludeLabel
433: .setDisplayedMnemonic(org.openide.util.NbBundle
434: .getMessage(JspPGPanel.class,
435: "LBL_includePrelude_mnem").charAt(0));
436: preludeLabel.setLabelFor(preludeTF);
437: preludeLabel.setText(org.openide.util.NbBundle.getMessage(
438: JspPGPanel.class, "LBL_includePrelude"));
439: gridBagConstraints = new java.awt.GridBagConstraints();
440: gridBagConstraints.gridx = 0;
441: gridBagConstraints.gridy = 10;
442: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
443: gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 10);
444: add(preludeLabel, gridBagConstraints);
445:
446: gridBagConstraints = new java.awt.GridBagConstraints();
447: gridBagConstraints.gridx = 1;
448: gridBagConstraints.gridy = 10;
449: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
450: gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
451: add(preludeTF, gridBagConstraints);
452:
453: browseButton2.setMnemonic(org.openide.util.NbBundle.getMessage(
454: JspPGPanel.class, "LBL_browse_mnem1").charAt(0));
455: browseButton2.setText(org.openide.util.NbBundle.getMessage(
456: JspPGPanel.class, "LBL_browse"));
457: browseButton2.setMargin(new java.awt.Insets(0, 14, 0, 14));
458: browseButton2
459: .addActionListener(new java.awt.event.ActionListener() {
460: public void actionPerformed(
461: java.awt.event.ActionEvent evt) {
462: browseButton2ActionPerformed(evt);
463: }
464: });
465:
466: gridBagConstraints = new java.awt.GridBagConstraints();
467: gridBagConstraints.gridx = 2;
468: gridBagConstraints.gridy = 10;
469: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
470: gridBagConstraints.insets = new java.awt.Insets(3, 5, 0, 0);
471: add(browseButton2, gridBagConstraints);
472:
473: codaLabel.setDisplayedMnemonic(org.openide.util.NbBundle
474: .getMessage(JspPGPanel.class, "LBL_includeCoda_mnem")
475: .charAt(0));
476: codaLabel.setLabelFor(codaTF);
477: codaLabel.setText(org.openide.util.NbBundle.getMessage(
478: JspPGPanel.class, "LBL_includeCoda"));
479: gridBagConstraints = new java.awt.GridBagConstraints();
480: gridBagConstraints.gridx = 0;
481: gridBagConstraints.gridy = 11;
482: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
483: gridBagConstraints.insets = new java.awt.Insets(5, 10, 5, 10);
484: add(codaLabel, gridBagConstraints);
485:
486: gridBagConstraints = new java.awt.GridBagConstraints();
487: gridBagConstraints.gridx = 1;
488: gridBagConstraints.gridy = 11;
489: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
490: gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 0);
491: add(codaTF, gridBagConstraints);
492:
493: browseButton3.setMnemonic(org.openide.util.NbBundle.getMessage(
494: JspPGPanel.class, "LBL_browse_mnem2").charAt(0));
495: browseButton3.setText(org.openide.util.NbBundle.getMessage(
496: JspPGPanel.class, "LBL_browse"));
497: browseButton3.setMargin(new java.awt.Insets(0, 14, 0, 14));
498: browseButton3
499: .addActionListener(new java.awt.event.ActionListener() {
500: public void actionPerformed(
501: java.awt.event.ActionEvent evt) {
502: browseButton3ActionPerformed(evt);
503: }
504: });
505:
506: gridBagConstraints = new java.awt.GridBagConstraints();
507: gridBagConstraints.gridx = 2;
508: gridBagConstraints.gridy = 11;
509: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
510: gridBagConstraints.insets = new java.awt.Insets(3, 5, 5, 0);
511: add(browseButton3, gridBagConstraints);
512:
513: filler.setOpaque(false);
514: gridBagConstraints = new java.awt.GridBagConstraints();
515: gridBagConstraints.gridx = 4;
516: gridBagConstraints.gridy = 0;
517: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
518: gridBagConstraints.weightx = 1.0;
519: add(filler, gridBagConstraints);
520:
521: trimWhiteSpaces
522: .setMnemonic(java.util.ResourceBundle
523: .getBundle(
524: "org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle")
525: .getString("CHB_TrimDirectiveWhitespace_mnem")
526: .charAt(0));
527: trimWhiteSpaces
528: .setText(java.util.ResourceBundle
529: .getBundle(
530: "org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle")
531: .getString("CHB_TrimDirectiveWhitespace"));
532: trimWhiteSpaces.setOpaque(false);
533: gridBagConstraints = new java.awt.GridBagConstraints();
534: gridBagConstraints.gridx = 1;
535: gridBagConstraints.gridy = 8;
536: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
537: add(trimWhiteSpaces, gridBagConstraints);
538:
539: deferredSyntaxAllowed
540: .setMnemonic(java.util.ResourceBundle
541: .getBundle(
542: "org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle")
543: .getString(
544: "CHB_DeferredSyntaxAllowedAsLiteral_mnem")
545: .charAt(0));
546: deferredSyntaxAllowed
547: .setText(java.util.ResourceBundle
548: .getBundle(
549: "org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle")
550: .getString("CHB_DeferredSyntaxAllowedAsLiteral"));
551: deferredSyntaxAllowed.setOpaque(false);
552: gridBagConstraints = new java.awt.GridBagConstraints();
553: gridBagConstraints.gridx = 1;
554: gridBagConstraints.gridy = 9;
555: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
556: add(deferredSyntaxAllowed, gridBagConstraints);
557:
558: }// </editor-fold>//GEN-END:initComponents
559:
560: private void browseButton3ActionPerformed(
561: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButton3ActionPerformed
562: // TODO add your handling code here:
563: // TODO add your handling code here:
564: try {
565: SourceGroup[] groups = DDUtils.getDocBaseGroups(dObj);
566: org.openide.filesystems.FileObject fo = BrowseFolders
567: .showDialog(groups);
568: if (fo != null) {
569: String fileName = "/"
570: + DDUtils
571: .getResourcePath(groups, fo, '/', true);
572: String oldValue = codaTF.getText();
573: if (fileName.length() > 0) {
574: String newValue = DDUtils.addItem(oldValue,
575: fileName, false);
576: if (!oldValue.equals(newValue)) {
577: dObj.modelUpdatedFromUI();
578: dObj.setChangedFromUI(true);
579: codaTF.setText(newValue);
580: setCodas(newValue);
581: dObj.setChangedFromUI(false);
582: }
583: }
584: }
585: } catch (java.io.IOException ex) {
586: }
587: }//GEN-LAST:event_browseButton3ActionPerformed
588:
589: private void browseButton2ActionPerformed(
590: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButton2ActionPerformed
591: // TODO add your handling code here:
592: try {
593: SourceGroup[] groups = DDUtils.getDocBaseGroups(dObj);
594: org.openide.filesystems.FileObject fo = BrowseFolders
595: .showDialog(groups);
596: if (fo != null) {
597: String fileName = "/"
598: + DDUtils
599: .getResourcePath(groups, fo, '/', true);
600: String oldValue = preludeTF.getText();
601: if (fileName.length() > 0) {
602: String newValue = DDUtils.addItem(oldValue,
603: fileName, false);
604: if (!oldValue.equals(newValue)) {
605: dObj.modelUpdatedFromUI();
606: dObj.setChangedFromUI(true);
607: preludeTF.setText(newValue);
608: setPreludes(newValue);
609: dObj.setChangedFromUI(false);
610: }
611: }
612: }
613: } catch (java.io.IOException ex) {
614: }
615: }//GEN-LAST:event_browseButton2ActionPerformed
616:
617: private void browseButton1ActionPerformed(
618: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButton1ActionPerformed
619: // TODO add your handling code here:
620: try {
621: SourceGroup[] groups = DDUtils.getDocBaseGroups(dObj);
622: org.openide.filesystems.FileObject fo = BrowseFolders
623: .showDialog(groups);
624: if (fo != null) {
625: String fileName = "/"
626: + DDUtils
627: .getResourcePath(groups, fo, '/', true);
628: String oldValue = urlPatternsTF.getText();
629: if (fileName.length() > 0) {
630: String newValue = DDUtils.addItem(oldValue,
631: fileName, false);
632: if (!oldValue.equals(newValue)) {
633: dObj.modelUpdatedFromUI();
634: dObj.setChangedFromUI(true);
635: urlPatternsTF.setText(newValue);
636: setUrlPatterns(newValue);
637: dObj.setChangedFromUI(false);
638: getSectionView().checkValidity();
639: }
640: }
641: }
642: } catch (java.io.IOException ex) {
643: }
644: }//GEN-LAST:event_browseButton1ActionPerformed
645:
646: // Variables declaration - do not modify//GEN-BEGIN:variables
647: private javax.swing.JButton browseButton1;
648: private javax.swing.JButton browseButton2;
649: private javax.swing.JButton browseButton3;
650: private javax.swing.JLabel codaLabel;
651: private javax.swing.JTextField codaTF;
652: private javax.swing.JCheckBox deferredSyntaxAllowed;
653: private javax.swing.JLabel descriptionLabel;
654: private javax.swing.JTextArea descriptionTA;
655: private javax.swing.JCheckBox disableScripting;
656: private javax.swing.JLabel dispNameLabel;
657: private javax.swing.JTextField dispNameTF;
658: private javax.swing.JPanel filler;
659: private javax.swing.JLabel hintUrlPatterns;
660: private javax.swing.JCheckBox ignoreEL;
661: private javax.swing.JLabel pageEncodingLabel;
662: private javax.swing.JTextField pageEncodingTF;
663: private javax.swing.JLabel preludeLabel;
664: private javax.swing.JTextField preludeTF;
665: private javax.swing.JCheckBox trimWhiteSpaces;
666: private javax.swing.JLabel urlPatternsLabel;
667: private javax.swing.JTextField urlPatternsTF;
668: private javax.swing.JCheckBox xmlSyntax;
669:
670: // End of variables declaration//GEN-END:variables
671:
672: public void itemStateChanged(java.awt.event.ItemEvent evt) {
673: // TODO add your handling code here:
674: System.out.println("State changed: " + evt);
675: System.out.println("State changed: " + evt.getSource());
676: dObj.modelUpdatedFromUI();
677: dObj.setChangedFromUI(true);
678: if (evt.getSource() == ignoreEL) {
679: group.setElIgnored(ignoreEL.isSelected());
680: } else if (evt.getSource() == disableScripting) {
681: group.setScriptingInvalid(disableScripting.isSelected());
682: } else if (evt.getSource() == xmlSyntax) {
683: group.setIsXml(xmlSyntax.isSelected());
684: } else if (evt.getSource() == trimWhiteSpaces) {
685: ((org.netbeans.modules.j2ee.dd.impl.web.model_2_5.JspPropertyGroup) group)
686: .setTrimDirectiveWhitespaces(trimWhiteSpaces
687: .isSelected());
688: } else if (evt.getSource() == deferredSyntaxAllowed) {
689: ((org.netbeans.modules.j2ee.dd.impl.web.model_2_5.JspPropertyGroup) group)
690: .setDeferredSyntaxAllowedAsLiteral(deferredSyntaxAllowed
691: .isSelected());
692: }
693: dObj.setChangedFromUI(false);
694: }
695:
696: /** This will be called before model is changed from this panel
697: */
698: protected void startUIChange() {
699: dObj.setChangedFromUI(true);
700: }
701:
702: /** This will be called after model is changed from this panel
703: */
704: protected void endUIChange() {
705: dObj.modelUpdatedFromUI();
706: dObj.setChangedFromUI(false);
707: }
708: }
|