KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > project > ui > groups > DirectoryGroupEditPanel


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.project.ui.groups;
21
22 import java.io.File JavaDoc;
23 import org.openide.filesystems.FileObject;
24 import org.openide.filesystems.FileUtil;
25
26 /**
27  * Panel to configure state of an existing directory-based group.
28  * @author Jesse Glick
29  */

30 public class DirectoryGroupEditPanel extends GroupEditPanel {
31
32     private final DirectoryGroup g;
33
34     public DirectoryGroupEditPanel(DirectoryGroup g) {
35         this.g = g;
36         initComponents();
37         nameField.setText(g.getName());
38         FileObject dir = g.getDirectory();
39         if (dir != null) {
40             File JavaDoc d = FileUtil.toFile(dir);
41             if (d != null) {
42                 folderField.setText(d.getAbsolutePath());
43             }
44         }
45     }
46
47     public void applyChanges() {
48         g.setName(nameField.getText().trim());
49     }
50
51     /** This method is called from within the constructor to
52      * initialize the form.
53      * WARNING: Do NOT modify this code. The content of this method is
54      * always regenerated by the Form Editor.
55      */

56     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
57
private void initComponents() {
58
59         nameLabel = new javax.swing.JLabel JavaDoc();
60         nameField = new javax.swing.JTextField JavaDoc();
61         folderLabel = new javax.swing.JLabel JavaDoc();
62         folderField = new javax.swing.JTextField JavaDoc();
63
64         org.openide.awt.Mnemonics.setLocalizedText(nameLabel, org.openide.util.NbBundle.getMessage(DirectoryGroupEditPanel.class, "DirectoryGroupEditPanel.nameLabel.text")); // NOI18N
65

66         org.openide.awt.Mnemonics.setLocalizedText(folderLabel, org.openide.util.NbBundle.getMessage(DirectoryGroupEditPanel.class, "DirectoryGroupEditPanel.folderLabel.text")); // NOI18N
67

68         folderField.setEditable(false);
69
70         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
71         this.setLayout(layout);
72         layout.setHorizontalGroup(
73             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
74             .add(layout.createSequentialGroup()
75                 .addContainerGap()
76                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
77                     .add(nameLabel)
78                     .add(folderLabel))
79                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
80                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
81                     .add(folderField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE)
82                     .add(nameField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE))
83                 .addContainerGap())
84         );
85         layout.setVerticalGroup(
86             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
87             .add(layout.createSequentialGroup()
88                 .addContainerGap()
89                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
90                     .add(nameLabel)
91                     .add(nameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
92                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
93                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
94                     .add(folderLabel)
95                     .add(folderField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
96                 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
97         );
98     }// </editor-fold>//GEN-END:initComponents
99

100     // Variables declaration - do not modify//GEN-BEGIN:variables
101
private javax.swing.JTextField JavaDoc folderField;
102     private javax.swing.JLabel JavaDoc folderLabel;
103     private javax.swing.JTextField JavaDoc nameField;
104     private javax.swing.JLabel JavaDoc nameLabel;
105     // End of variables declaration//GEN-END:variables
106

107 }
108
Popular Tags