KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > ruby > rubyproject > ui > wizards > PanelConfigureProjectVisual


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.ruby.rubyproject.ui.wizards;
21
22 import java.io.File JavaDoc;
23 import javax.swing.JPanel JavaDoc;
24 import javax.swing.event.DocumentEvent JavaDoc;
25 import javax.swing.event.DocumentListener JavaDoc;
26 import javax.swing.text.Document JavaDoc;
27 import org.openide.WizardDescriptor;
28 import org.openide.WizardValidationException;
29 import org.openide.util.NbBundle;
30
31 /** First panel in the NewProject wizard. Used for filling in
32  * name, and directory of the project.
33  *
34  * @author Petr Hrebejk
35  */

36 public class PanelConfigureProjectVisual extends JPanel JavaDoc {
37
38     private PanelConfigureProject panel;
39         
40     private boolean ignoreProjectDirChanges;
41     
42     private boolean ignoreRakeProjectNameChanges;
43     
44     private boolean noDir = true;
45     
46     private SettingsPanel projectLocationPanel;
47     
48     private PanelOptionsVisual optionsPanel;
49     
50     private int type;
51     
52     /** Creates new form PanelInitProject */
53     public PanelConfigureProjectVisual( PanelConfigureProject panel, int type ) {
54         this.panel = panel;
55         initComponents();
56         this.type = type;
57         setName(NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_NameAndLoc")); // NOI18N
58
if (type == NewRubyProjectWizardIterator.TYPE_APP) {
59             projectLocationPanel = new PanelProjectLocationVisual( panel, type );
60             putClientProperty ("NewProjectWizard_Title", NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_NewJavaApp")); // NOI18N
61
jSeparator1.setVisible(true);
62             getAccessibleContext ().setAccessibleName (NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_NewJavaApp")); // NOI18N
63
getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage(PanelConfigureProjectVisual.class,"ACSD_NewJavaApp")); // NOI18N
64
}
65 // else if (type == NewRubyProjectWizardIterator.TYPE_LIB) {
66
// projectLocationPanel = new PanelProjectLocationVisual( panel, type );
67
// jSeparator1.setVisible (false);
68
// putClientProperty ("NewProjectWizard_Title", NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_NewJavaLib")); // NOI18N
69
// getAccessibleContext ().setAccessibleName (NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_NewJavaLib")); // NOI18N
70
// getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage(PanelConfigureProjectVisual.class,"ACSD_NewJavaLib")); // NOI18N
71
// }
72
else {
73             projectLocationPanel = new PanelProjectLocationExtSrc ( panel );
74             jSeparator1.setVisible(true);
75             putClientProperty ("NewProjectWizard_Title", NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_JavaExtSourcesProjectLocation")); // NOI18N
76
getAccessibleContext ().setAccessibleName (NbBundle.getMessage(PanelConfigureProjectVisual.class,"TXT_JavaExtSourcesProjectLocation")); // NOI18N
77
getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage(PanelConfigureProjectVisual.class,"ACSD_JavaExtSourcesProjectLocation")); // NOI18N
78
}
79         locationContainer.add( projectLocationPanel, java.awt.BorderLayout.CENTER );
80         optionsPanel = new PanelOptionsVisual( panel, type );
81         projectLocationPanel.addPropertyChangeListener(optionsPanel);
82         optionsContainer.add( optionsPanel, java.awt.BorderLayout.CENTER );
83     }
84     
85     boolean valid( WizardDescriptor wizardDescriptor ) {
86         wizardDescriptor.putProperty( "WizardPanel_errorMessage", "" ); //NOI18N
87
return projectLocationPanel.valid( wizardDescriptor ) && optionsPanel.valid(wizardDescriptor);
88     }
89     
90     void read (WizardDescriptor d) {
91         Integer JavaDoc lastType = (Integer JavaDoc) d.getProperty("ruby-wizard-type"); //NOI18N
92
if (lastType == null || lastType.intValue() != this.type) {
93             //bugfix #46387 The type of project changed, reset values to defaults
94
d.putProperty ("name", null);
95             d.putProperty ("projdir",null);
96         }
97         projectLocationPanel.read (d);
98         optionsPanel.read (d);
99     }
100     
101     void store( WizardDescriptor d ) {
102         d.putProperty("ruby-wizard-type", new Integer JavaDoc(this.type)); //NOI18N
103
projectLocationPanel.store( d );
104         optionsPanel.store( d );
105     }
106     
107     void validate (WizardDescriptor d) throws WizardValidationException {
108         projectLocationPanel.validate (d);
109     }
110     
111     
112     /** This method is called from within the constructor to
113      * initialize the form.
114      * WARNING: Do NOT modify this code. The content of this method is
115      * always regenerated by the Form Editor.
116      */

117     private void initComponents() {//GEN-BEGIN:initComponents
118
java.awt.GridBagConstraints JavaDoc gridBagConstraints;
119
120         locationContainer = new javax.swing.JPanel JavaDoc();
121         jSeparator1 = new javax.swing.JSeparator JavaDoc();
122         optionsContainer = new javax.swing.JPanel JavaDoc();
123
124         setLayout(new java.awt.GridBagLayout JavaDoc());
125
126         locationContainer.setLayout(new java.awt.BorderLayout JavaDoc());
127
128         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
129         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
130         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
131         gridBagConstraints.weightx = 1.0;
132         add(locationContainer, gridBagConstraints);
133         locationContainer.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(PanelConfigureProjectVisual.class).getString("ACSN_locationContainer"));
134         locationContainer.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(PanelConfigureProjectVisual.class).getString("ACSD_locationContainer"));
135
136         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
137         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
138         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
139         gridBagConstraints.weightx = 1.0;
140         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 12, 0);
141         add(jSeparator1, gridBagConstraints);
142
143         optionsContainer.setLayout(new java.awt.BorderLayout JavaDoc());
144
145         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
146         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
147         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
148         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
149         gridBagConstraints.weightx = 1.0;
150         gridBagConstraints.weighty = 1.0;
151         add(optionsContainer, gridBagConstraints);
152         optionsContainer.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(PanelConfigureProjectVisual.class).getString("ACSN_optionsContainer"));
153         optionsContainer.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(PanelConfigureProjectVisual.class).getString("ACSD_optionsContainer"));
154
155     }//GEN-END:initComponents
156

157     /** Currently only handles the "Browse..." button
158      */

159            
160     // Variables declaration - do not modify//GEN-BEGIN:variables
161
private javax.swing.JSeparator JavaDoc jSeparator1;
162     private javax.swing.JPanel JavaDoc locationContainer;
163     private javax.swing.JPanel JavaDoc optionsContainer;
164     // End of variables declaration//GEN-END:variables
165

166     
167 }
168
Popular Tags