KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > project > ui > customizer > CustomizerSources


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.web.project.ui.customizer;
21
22 import java.io.File JavaDoc;
23 import javax.swing.JFileChooser JavaDoc;
24 import javax.swing.JTable JavaDoc;
25 import javax.swing.ListSelectionModel JavaDoc;
26 import javax.swing.event.ListDataEvent JavaDoc;
27 import javax.swing.event.ListDataListener JavaDoc;
28 import javax.swing.table.TableColumn JavaDoc;
29 import org.openide.filesystems.FileObject;
30 import org.openide.filesystems.FileUtil;
31 import org.openide.util.HelpCtx;
32 import org.openide.util.NbBundle;
33 import org.netbeans.api.queries.CollocationQuery;
34 import org.netbeans.spi.project.support.ant.PropertyUtils;
35 import org.netbeans.modules.web.project.WebProject;
36
37 /**
38  *
39  * @author tom, Radko Najman
40  */

41 public class CustomizerSources extends javax.swing.JPanel JavaDoc implements HelpCtx.Provider {
42     
43     private File JavaDoc projectFld;
44     
45     public CustomizerSources( WebProjectProperties uiProperties ) {
46         initComponents();
47         jScrollPane1.getViewport().setBackground( sourceRoots.getBackground() );
48         jScrollPane2.getViewport().setBackground( testRoots.getBackground() );
49         
50         sourceRoots.setModel( uiProperties.SOURCE_ROOTS_MODEL );
51         testRoots.setModel( uiProperties.TEST_ROOTS_MODEL );
52         sourceRoots.getTableHeader().setReorderingAllowed(false);
53         testRoots.getTableHeader().setReorderingAllowed(false);
54         
55         FileObject projectFolder = uiProperties.getProject().getProjectDirectory();
56         File JavaDoc pf = FileUtil.toFile( projectFolder );
57         this.projectLocation.setText( pf == null ? "" : pf.getPath() ); // NOI18N
58
this.projectFld = pf;
59         
60         jTextFieldWebPages.setDocument(uiProperties.WEB_DOCBASE_DIR_MODEL);
61         
62         WebSourceRootsUi.EditMediator emSR = WebSourceRootsUi.registerEditMediator(
63                 (WebProject)uiProperties.getProject(),
64                 ((WebProject)uiProperties.getProject()).getSourceRoots(),
65                 sourceRoots,
66                 addSourceRoot,
67                 removeSourceRoot,
68                 upSourceRoot,
69                 downSourceRoot);
70         
71         WebSourceRootsUi.EditMediator emTSR = WebSourceRootsUi.registerEditMediator(
72                 (WebProject)uiProperties.getProject(),
73                 ((WebProject)uiProperties.getProject()).getTestSourceRoots(),
74                 testRoots,
75                 addTestRoot,
76                 removeTestRoot,
77                 upTestRoot,
78                 downTestRoot);
79         
80         emSR.setRelatedEditMediator( emTSR );
81         emTSR.setRelatedEditMediator( emSR );
82         
83         this.jComboBoxSourceLevel.setModel(uiProperties.JAVAC_SOURCE_MODEL);
84         uiProperties.JAVAC_SOURCE_MODEL.addListDataListener(new ListDataListener JavaDoc() {
85             public void intervalAdded(ListDataEvent JavaDoc e) {
86                 enableSourceLevel();
87             }
88             
89             public void intervalRemoved(ListDataEvent JavaDoc e) {
90                 enableSourceLevel();
91             }
92             
93             public void contentsChanged(ListDataEvent JavaDoc e) {
94                 enableSourceLevel();
95             }
96         });
97         enableSourceLevel();
98         initTableVisualProperties(sourceRoots);
99         initTableVisualProperties(testRoots);
100     }
101     
102     private void initTableVisualProperties(JTable JavaDoc table) {
103         //table.setGridColor(jTableCpC.getBackground());
104
table.setRowHeight(testRoots.getRowHeight() + 4);
105         table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
106         table.setIntercellSpacing(new java.awt.Dimension JavaDoc(0, 0));
107         // set the color of the table's JViewport
108
table.getParent().setBackground(table.getBackground());
109
110         //#88174 - Need horizontal scrollbar for library names
111
//ugly but I didn't find a better way how to do it
112
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
113         TableColumn JavaDoc column = table.getColumnModel().getColumn(0);
114         column.setMinWidth(230);
115         column.setWidth(230);
116         column.setMinWidth(75);
117        
118         column = table.getColumnModel().getColumn(1);
119         column.setMinWidth(220);
120         column.setWidth(220);
121         column.setMinWidth(75);
122     }
123     
124     public HelpCtx getHelpCtx() {
125         return new HelpCtx(CustomizerSources.class);
126     }
127     
128     private void enableSourceLevel() {
129         this.jComboBoxSourceLevel.setEnabled(jComboBoxSourceLevel.getItemCount()>0);
130     }
131     
132     /** This method is called from within the constructor to
133      * initialize the form.
134      * WARNING: Do NOT modify this code. The content of this method is
135      * always regenerated by the Form Editor.
136      */

137     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
138
private void initComponents() {
139         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
140
141         jLabel1 = new javax.swing.JLabel JavaDoc();
142         projectLocation = new javax.swing.JTextField JavaDoc();
143         jLabelWebPages = new javax.swing.JLabel JavaDoc();
144         jTextFieldWebPages = new javax.swing.JTextField JavaDoc();
145         jButtonBrowse = new javax.swing.JButton JavaDoc();
146         sourceRootsPanel = new javax.swing.JPanel JavaDoc();
147         jLabel2 = new javax.swing.JLabel JavaDoc();
148         jScrollPane1 = new javax.swing.JScrollPane JavaDoc();
149         sourceRoots = new javax.swing.JTable JavaDoc();
150         addSourceRoot = new javax.swing.JButton JavaDoc();
151         removeSourceRoot = new javax.swing.JButton JavaDoc();
152         upSourceRoot = new javax.swing.JButton JavaDoc();
153         downSourceRoot = new javax.swing.JButton JavaDoc();
154         testRootsPanel = new javax.swing.JPanel JavaDoc();
155         jLabel3 = new javax.swing.JLabel JavaDoc();
156         jScrollPane2 = new javax.swing.JScrollPane JavaDoc();
157         testRoots = new javax.swing.JTable JavaDoc();
158         addTestRoot = new javax.swing.JButton JavaDoc();
159         removeTestRoot = new javax.swing.JButton JavaDoc();
160         upTestRoot = new javax.swing.JButton JavaDoc();
161         downTestRoot = new javax.swing.JButton JavaDoc();
162         jLabelSourceLevel = new javax.swing.JLabel JavaDoc();
163         jComboBoxSourceLevel = new javax.swing.JComboBox JavaDoc();
164
165         setLayout(new java.awt.GridBagLayout JavaDoc());
166
167         jLabel1.setDisplayedMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_ProjectFolder").charAt(0));
168         jLabel1.setLabelFor(projectLocation);
169         jLabel1.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_ProjectFolder"));
170         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
171         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
172         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 12, 12);
173         add(jLabel1, gridBagConstraints);
174
175         projectLocation.setEditable(false);
176         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
177         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
178         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
179         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
180         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 12, 0);
181         add(projectLocation, gridBagConstraints);
182         projectLocation.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_projectLocation"));
183
184         jLabelWebPages.setDisplayedMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_WebPages").charAt(0));
185         jLabelWebPages.setLabelFor(jTextFieldWebPages);
186         jLabelWebPages.setText(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "CTL_WebPagesFolder"));
187         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
188         gridBagConstraints.gridx = 0;
189         gridBagConstraints.gridy = 1;
190         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
191         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 12);
192         add(jLabelWebPages, gridBagConstraints);
193
194         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
195         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
196         gridBagConstraints.weightx = 1.0;
197         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 12);
198         add(jTextFieldWebPages, gridBagConstraints);
199         jTextFieldWebPages.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_webPagesFolder"));
200
201         jButtonBrowse.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_WebPagesBrowse").charAt(0));
202         jButtonBrowse.setText(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "LBL_Browse_JButton"));
203         jButtonBrowse.addActionListener(new java.awt.event.ActionListener JavaDoc() {
204             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
205                 jButtonBrowseActionPerformed(evt);
206             }
207         });
208
209         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
210         gridBagConstraints.gridx = 2;
211         gridBagConstraints.gridy = 1;
212         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
213         add(jButtonBrowse, gridBagConstraints);
214         jButtonBrowse.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_webPagesFolderBrowse"));
215
216         sourceRootsPanel.setLayout(new java.awt.GridBagLayout JavaDoc());
217
218         jLabel2.setDisplayedMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_SourceRoots").charAt(0));
219         jLabel2.setLabelFor(sourceRoots);
220         jLabel2.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_SourceRoots"));
221         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
222         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
223         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
224         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
225         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 6, 0);
226         sourceRootsPanel.add(jLabel2, gridBagConstraints);
227
228         sourceRoots.setModel(new javax.swing.table.DefaultTableModel JavaDoc(
229             new Object JavaDoc [][] {
230                 {null, null},
231                 {null, null},
232                 {null, null},
233                 {null, null}
234             },
235             new String JavaDoc [] {
236                 "Package Folder", "Label"
237             }
238         ) {
239             Class JavaDoc[] types = new Class JavaDoc [] {
240                 java.lang.Object JavaDoc.class, java.lang.String JavaDoc.class
241             };
242             boolean[] canEdit = new boolean [] {
243                 false, false
244             };
245
246             public Class JavaDoc getColumnClass(int columnIndex) {
247                 return types [columnIndex];
248             }
249
250             public boolean isCellEditable(int rowIndex, int columnIndex) {
251                 return canEdit [columnIndex];
252             }
253         });
254         jScrollPane1.setViewportView(sourceRoots);
255         sourceRoots.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_sourceRoots"));
256
257         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
258         gridBagConstraints.gridx = 0;
259         gridBagConstraints.gridy = 1;
260         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
261         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
262         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
263         gridBagConstraints.weightx = 1.0;
264         gridBagConstraints.weighty = 1.0;
265         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 12);
266         sourceRootsPanel.add(jScrollPane1, gridBagConstraints);
267
268         addSourceRoot.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_AddSourceRoot").charAt(0));
269         addSourceRoot.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_AddSourceRoot"));
270         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
271         gridBagConstraints.gridx = 1;
272         gridBagConstraints.gridy = 1;
273         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
274         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
275         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
276         sourceRootsPanel.add(addSourceRoot, gridBagConstraints);
277         addSourceRoot.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_addSourceRoot"));
278
279         removeSourceRoot.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_RemoveSourceRoot").charAt(0));
280         removeSourceRoot.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_RemoveSourceRoot"));
281         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
282         gridBagConstraints.gridx = 1;
283         gridBagConstraints.gridy = 2;
284         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
285         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
286         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
287         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 0, 0, 0);
288         sourceRootsPanel.add(removeSourceRoot, gridBagConstraints);
289         removeSourceRoot.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_removeSourceRoot"));
290
291         upSourceRoot.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_UpSourceRoot").charAt(0));
292         upSourceRoot.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_UpSourceRoot"));
293         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
294         gridBagConstraints.gridx = 1;
295         gridBagConstraints.gridy = 3;
296         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
297         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
298         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
299         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 0, 0);
300         sourceRootsPanel.add(upSourceRoot, gridBagConstraints);
301         upSourceRoot.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_upSourceRoot"));
302
303         downSourceRoot.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_DownSourceRoot").charAt(0));
304         downSourceRoot.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_DownSourceRoot"));
305         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
306         gridBagConstraints.gridx = 1;
307         gridBagConstraints.gridy = 4;
308         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
309         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
310         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
311         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 0, 0, 0);
312         sourceRootsPanel.add(downSourceRoot, gridBagConstraints);
313         downSourceRoot.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_downSourceRoot"));
314
315         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
316         gridBagConstraints.gridx = 0;
317         gridBagConstraints.gridy = 2;
318         gridBagConstraints.gridwidth = 3;
319         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
320         gridBagConstraints.weightx = 1.0;
321         gridBagConstraints.weighty = 0.45;
322         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 0, 0);
323         add(sourceRootsPanel, gridBagConstraints);
324
325         testRootsPanel.setLayout(new java.awt.GridBagLayout JavaDoc());
326
327         jLabel3.setDisplayedMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_TestRoots").charAt(0));
328         jLabel3.setLabelFor(testRoots);
329         jLabel3.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_TestRoots"));
330         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
331         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
332         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
333         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
334         gridBagConstraints.weightx = 1.0;
335         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 6, 0);
336         testRootsPanel.add(jLabel3, gridBagConstraints);
337
338         testRoots.setModel(new javax.swing.table.DefaultTableModel JavaDoc(
339             new Object JavaDoc [][] {
340                 {null, null},
341                 {null, null},
342                 {null, null},
343                 {null, null}
344             },
345             new String JavaDoc [] {
346                 "Package Folder", "Label"
347             }
348         ) {
349             Class JavaDoc[] types = new Class JavaDoc [] {
350                 java.lang.Object JavaDoc.class, java.lang.String JavaDoc.class
351             };
352             boolean[] canEdit = new boolean [] {
353                 false, false
354             };
355
356             public Class JavaDoc getColumnClass(int columnIndex) {
357                 return types [columnIndex];
358             }
359
360             public boolean isCellEditable(int rowIndex, int columnIndex) {
361                 return canEdit [columnIndex];
362             }
363         });
364         jScrollPane2.setViewportView(testRoots);
365         testRoots.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_testRoots"));
366
367         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
368         gridBagConstraints.gridx = 0;
369         gridBagConstraints.gridy = 1;
370         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
371         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
372         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
373         gridBagConstraints.weightx = 1.0;
374         gridBagConstraints.weighty = 1.0;
375         testRootsPanel.add(jScrollPane2, gridBagConstraints);
376
377         addTestRoot.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_AddTestRoot").charAt(0));
378         addTestRoot.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_AddTestRoot"));
379         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
380         gridBagConstraints.gridx = 1;
381         gridBagConstraints.gridy = 1;
382         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
383         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
384         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
385         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 6, 0);
386         testRootsPanel.add(addTestRoot, gridBagConstraints);
387         addTestRoot.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_addTestRoot"));
388
389         removeTestRoot.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_RemoveTestRoot").charAt(0));
390         removeTestRoot.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_RemoveTestRoot"));
391         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
392         gridBagConstraints.gridx = 1;
393         gridBagConstraints.gridy = 2;
394         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
395         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
396         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
397         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 12, 0);
398         testRootsPanel.add(removeTestRoot, gridBagConstraints);
399         removeTestRoot.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_removeTestRoot"));
400
401         upTestRoot.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_UpTestRoot").charAt(0));
402         upTestRoot.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_UpTestRoot"));
403         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
404         gridBagConstraints.gridx = 1;
405         gridBagConstraints.gridy = 3;
406         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
407         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
408         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
409         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 6, 0);
410         testRootsPanel.add(upTestRoot, gridBagConstraints);
411         upTestRoot.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_upTestRoot"));
412
413         downTestRoot.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_DownTestRoot").charAt(0));
414         downTestRoot.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_DownTestRoot"));
415         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
416         gridBagConstraints.gridx = 1;
417         gridBagConstraints.gridy = 4;
418         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
419         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
420         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
421         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 0, 0);
422         testRootsPanel.add(downTestRoot, gridBagConstraints);
423         downTestRoot.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_downTestRoot"));
424
425         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
426         gridBagConstraints.gridx = 0;
427         gridBagConstraints.gridy = 3;
428         gridBagConstraints.gridwidth = 3;
429         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
430         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
431         gridBagConstraints.weightx = 1.0;
432         gridBagConstraints.weighty = 0.45;
433         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 0, 0);
434         add(testRootsPanel, gridBagConstraints);
435
436         jLabelSourceLevel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "MNE_SourceLevel").charAt(0));
437         jLabelSourceLevel.setLabelFor(jComboBoxSourceLevel);
438         jLabelSourceLevel.setText(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "TXT_SourceLevel"));
439         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
440         gridBagConstraints.gridx = 0;
441         gridBagConstraints.gridy = 4;
442         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
443         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
444         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 0, 12);
445         add(jLabelSourceLevel, gridBagConstraints);
446
447         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
448         gridBagConstraints.gridx = 1;
449         gridBagConstraints.gridy = 4;
450         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
451         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
452         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
453         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 0, 0);
454         add(jComboBoxSourceLevel, gridBagConstraints);
455         jComboBoxSourceLevel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "AN_SourceLevel"));
456         jComboBoxSourceLevel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "AD_SourceLevel"));
457
458     }
459     // </editor-fold>//GEN-END:initComponents
460

461     private void jButtonBrowseActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_jButtonBrowseActionPerformed
462
JFileChooser JavaDoc chooser = new JFileChooser JavaDoc();
463         FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
464         chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
465         File JavaDoc fileName = new File JavaDoc(jTextFieldWebPages.getText());
466         File JavaDoc webPages = fileName.isAbsolute() ? fileName : new File JavaDoc(projectFld, fileName.getPath());
467         if (webPages.exists()) {
468             chooser.setSelectedFile(webPages);
469         } else {
470             chooser.setSelectedFile(projectFld);
471         }
472         if ( JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
473             File JavaDoc selected = FileUtil.normalizeFile(chooser.getSelectedFile());
474             String JavaDoc newWebPages;
475             if (CollocationQuery.areCollocated(projectFld, selected)) {
476                 newWebPages = PropertyUtils.relativizeFile(projectFld, selected);
477             } else {
478                 newWebPages = selected.getPath();
479             }
480             jTextFieldWebPages.setText(newWebPages);
481         }
482     }//GEN-LAST:event_jButtonBrowseActionPerformed
483

484     
485     // Variables declaration - do not modify//GEN-BEGIN:variables
486
private javax.swing.JButton JavaDoc addSourceRoot;
487     private javax.swing.JButton JavaDoc addTestRoot;
488     private javax.swing.JButton JavaDoc downSourceRoot;
489     private javax.swing.JButton JavaDoc downTestRoot;
490     private javax.swing.JButton JavaDoc jButtonBrowse;
491     private javax.swing.JComboBox JavaDoc jComboBoxSourceLevel;
492     private javax.swing.JLabel JavaDoc jLabel1;
493     private javax.swing.JLabel JavaDoc jLabel2;
494     private javax.swing.JLabel JavaDoc jLabel3;
495     private javax.swing.JLabel JavaDoc jLabelSourceLevel;
496     private javax.swing.JLabel JavaDoc jLabelWebPages;
497     private javax.swing.JScrollPane JavaDoc jScrollPane1;
498     private javax.swing.JScrollPane JavaDoc jScrollPane2;
499     private javax.swing.JTextField JavaDoc jTextFieldWebPages;
500     private javax.swing.JTextField JavaDoc projectLocation;
501     private javax.swing.JButton JavaDoc removeSourceRoot;
502     private javax.swing.JButton JavaDoc removeTestRoot;
503     private javax.swing.JTable JavaDoc sourceRoots;
504     private javax.swing.JPanel JavaDoc sourceRootsPanel;
505     private javax.swing.JTable JavaDoc testRoots;
506     private javax.swing.JPanel JavaDoc testRootsPanel;
507     private javax.swing.JButton JavaDoc upSourceRoot;
508     private javax.swing.JButton JavaDoc upTestRoot;
509     // End of variables declaration//GEN-END:variables
510

511 }
512
Popular Tags