KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > earproject > 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.j2ee.earproject.ui.wizards;
21
22 import java.awt.BorderLayout JavaDoc;
23 import java.awt.GridBagConstraints JavaDoc;
24 import java.util.ResourceBundle JavaDoc;
25 import javax.swing.JPanel JavaDoc;
26 import org.openide.WizardDescriptor;
27
28 public class PanelConfigureProjectVisual extends JPanel JavaDoc {
29
30     private final SettingsPanel projectLocationPanel;
31     private final PanelOptionsVisual optionsPanel;
32
33     /** Creates new form PanelInitProject */
34     public PanelConfigureProjectVisual(PanelConfigureProject panel, String JavaDoc namePropIndex, ResourceBundle JavaDoc customBundle, boolean importStyle) {
35         initComponents();
36         this.getAccessibleContext().setAccessibleDescription(customBundle.getString("ACS_NWP1_NamePanel_A11YDesc")); // NOI18N
37

38         if (!importStyle) {
39             projectLocationPanel = new PanelProjectLocationVisual(panel, namePropIndex, customBundle,importStyle);
40         } else {
41             projectLocationPanel = new PanelProjectImportVisual(panel, namePropIndex, customBundle,importStyle);
42         }
43         locationContainer.add(projectLocationPanel, BorderLayout.CENTER);
44
45         optionsPanel = new PanelOptionsVisual(panel,importStyle);
46         GridBagConstraints JavaDoc gridBagConstraints = new GridBagConstraints JavaDoc();
47         gridBagConstraints.fill = GridBagConstraints.BOTH;
48         gridBagConstraints.weightx = 1.0;
49         gridBagConstraints.weighty = 1.0;
50         optionsContainer.add(optionsPanel, gridBagConstraints);
51         
52         if (!importStyle) {
53             projectLocationPanel.addPropertyChangeListener(optionsPanel);
54         }
55         
56         // Provide a name in the title bar.
57
setName(customBundle.getString("LBL_NWP1_ProjectTitleName")); //NOI18N
58
if (!importStyle) {
59             putClientProperty("NewProjectWizard_Title", customBundle.getString("TXT_NewProject")); //NOI18N
60
} else {
61             putClientProperty("NewProjectWizard_Title", customBundle.getString("TXT_ImportProject")); //NOI18N
62
}
63     }
64     
65     boolean valid(WizardDescriptor wizardDescriptor) {
66         if (!projectLocationPanel.valid(wizardDescriptor)) {
67             return false;
68         }
69         boolean optionsValid = true;
70         if (optionsPanel != null) {
71             optionsValid = optionsPanel.valid(wizardDescriptor);
72         }
73         return optionsValid;
74     }
75
76     void read (WizardDescriptor d) {
77         projectLocationPanel.read(d);
78         if (null != optionsPanel) {
79             optionsPanel.read(d);
80         }
81     }
82
83     void store(WizardDescriptor d) {
84         projectLocationPanel.store(d);
85         if (null != optionsPanel) {
86             optionsPanel.store(d);
87         }
88     }
89     
90     /** This method is called from within the constructor to
91      * initialize the form.
92      * WARNING: Do NOT modify this code. The content of this method is
93      * always regenerated by the Form Editor.
94      */

95     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
96
private void initComponents() {
97         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
98
99         locationContainer = new javax.swing.JPanel JavaDoc();
100         jSeparator1 = new javax.swing.JSeparator JavaDoc();
101         optionsContainer = new javax.swing.JPanel JavaDoc();
102
103         setLayout(new java.awt.GridBagLayout JavaDoc());
104
105         setRequestFocusEnabled(false);
106         locationContainer.setLayout(new java.awt.BorderLayout JavaDoc());
107
108         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
109         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
110         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
111         gridBagConstraints.weightx = 1.0;
112         add(locationContainer, gridBagConstraints);
113
114         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
115         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
116         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
117         gridBagConstraints.weightx = 1.0;
118         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 12, 0);
119         add(jSeparator1, gridBagConstraints);
120
121         optionsContainer.setLayout(new java.awt.GridBagLayout JavaDoc());
122
123         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
124         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
125         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
126         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
127         gridBagConstraints.weightx = 1.0;
128         gridBagConstraints.weighty = 1.0;
129         add(optionsContainer, gridBagConstraints);
130
131     }// </editor-fold>//GEN-END:initComponents
132

133     // Variables declaration - do not modify//GEN-BEGIN:variables
134
private javax.swing.JSeparator JavaDoc jSeparator1;
135     private javax.swing.JPanel JavaDoc locationContainer;
136     private javax.swing.JPanel JavaDoc optionsContainer;
137     // End of variables declaration//GEN-END:variables
138

139 }
140
Popular Tags