1 19 20 package org.netbeans.modules.project.ui.groups; 21 22 import java.io.File ; 23 import org.openide.filesystems.FileObject; 24 import org.openide.filesystems.FileUtil; 25 26 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 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 56 private void initComponents() { 58 59 nameLabel = new javax.swing.JLabel (); 60 nameField = new javax.swing.JTextField (); 61 masterProjectLabel = new javax.swing.JLabel (); 62 masterProjectField = new javax.swing.JTextField (); 63 64 org.openide.awt.Mnemonics.setLocalizedText(nameLabel, org.openide.util.NbBundle.getMessage(SubprojectsGroupEditPanel.class, "SubprojectsGroupEditPanel.nameLabel.text")); 66 masterProjectLabel.setLabelFor(masterProjectField); 67 org.openide.awt.Mnemonics.setLocalizedText(masterProjectLabel, org.openide.util.NbBundle.getMessage(SubprojectsGroupEditPanel.class, "SubprojectsGroupEditPanel.masterProjectLabel.text")); 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 } 101 private javax.swing.JTextField masterProjectField; 103 private javax.swing.JLabel masterProjectLabel; 104 private javax.swing.JTextField nameField; 105 private javax.swing.JLabel nameLabel; 106 108 } 109 | Popular Tags |