KickJava   Java API By Example, From Geeks To Geeks.

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


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 subproject-based group.
28  * @author Jesse Glick
29  */

30 public class SubprojectsGroupEditPanel extends GroupEditPanel {
31
32     private final SubprojectsGroup g;
33
34     public SubprojectsGroupEditPanel(SubprojectsGroup g) {
35         this.g = g;
36         initComponents();
37         nameField.setText(g.getName());
38         FileObject dir = g.getMasterProjectDirectory();
39         if (dir != null) {
40             File JavaDoc d = FileUtil.toFile(dir);
41             if (d != null) {
42                 masterProjectField.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         masterProjectLabel = new javax.swing.JLabel JavaDoc();
62         masterProjectField = new javax.swing.JTextField JavaDoc();
63
64         org.openide.awt.Mnemonics.setLocalizedText(nameLabel, org.openide.util.NbBundle.getMessage(SubprojectsGroupEditPanel.class, "SubprojectsGroupEditPanel.nameLabel.text")); // NOI18N
65

66         masterProjectLabel.setLabelFor(masterProjectField);
67         org.openide.awt.Mnemonics.setLocalizedText(masterProjectLabel, org.openide.util.NbBundle.getMessage(SubprojectsGroupEditPanel.class, "SubprojectsGroupEditPanel.masterProjectLabel.text")); // NOI18N
68

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

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

108 }
109
Popular Tags