2
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
6
* The contents of this file are subject to the terms of either the GNU
7
* General Public License Version 2 only ("GPL") or the Common
8
* Development and Distribution License("CDDL") (collectively, the
9
* "License"). You may not use this file except in compliance with the
10
* License. You can obtain a copy of the License at
11
* http://www.netbeans.org/cddl-gplv2.html
12
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
* specific language governing permissions and limitations under the
14
* License. When distributing the software, include this License Header
15
* Notice in each file and include the License file at
16
* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
17
* particular file as subject to the "Classpath" exception as provided
18
* by Sun in the GPL Version 2 section of the License file that
19
* accompanied this code. If applicable, add the following below the
20
* License Header, with the fields enclosed by brackets [] replaced by
21
* your own identifying information:
22
* "Portions Copyrighted [year] [name of copyright owner]"
26
* The Original Software is NetBeans. The Initial Developer of the Original
27
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
28
* Microsystems, Inc. All Rights Reserved.
30
* If you wish your version of this file to be governed by only the CDDL
31
* or only the GPL Version 2, indicate your decision by adding
32
* "[Contributor] elects to include this software in this distribution
33
* under the [CDDL or GPL Version 2] license." If you do not indicate a
34
* single choice of license, a recipient has the option to distribute
35
* your version of this file under either the CDDL, the GPL Version 2 or
36
* to extend the choice of license to its licensees as provided above.
37
* However, if you add GPL Version 2 code and therefore, elected the GPL
38
* Version 2 license, then the option applies only if the new code is
39
* made subject to such option by the copyright holder.
42
package org.netbeans.modules.php.project.wizards;
44
import javax.swing.DefaultComboBoxModel;
45
import org.openide.WizardDescriptor;
51
class PhpVersionPanel extends javax.swing.JPanel {
53
private static final long serialVersionUID = 2168064940970450732L;
55
/** Creates new form PhpVersionPanel */
56
PhpVersionPanel(PhpSourcesConfigurePanel panel) {
64
void read(WizardDescriptor descriptor) {
65
Object obj = descriptor.getProperty(NewPhpProjectWizardIterator.VERSION);
66
Versions version = null;
67
if (obj instanceof Versions) {
68
version = (Versions) obj;
71
if (version == null) {
72
String defaultVersion = getPanel().getDefaultPhpVersion();
73
int intValue = Integer.parseInt(defaultVersion);
74
version = Versions.valueOf(intValue);
76
if (version != null) {
77
myVersion.setSelectedItem(version);
81
boolean dataIsValid( WizardDescriptor wizardDescriptor) {
85
void store(WizardDescriptor descriptor) {
86
descriptor.putProperty(NewPhpProjectWizardIterator.VERSION, myVersion.getSelectedItem());
90
myVersion.setModel(new DefaultComboBoxModel(Versions.values()));
93
private PhpSourcesConfigurePanel getPanel() {
97
/** This method is called from within the constructor to
98
* initialize the form.
99
* WARNING: Do NOT modify this code. The content of this method is
100
* always regenerated by the Form Editor.
102
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
103
private void initComponents() {
105
myVersion = new javax.swing.JComboBox();
106
myLabel = new javax.swing.JLabel();
108
org.openide.awt.Mnemonics.setLocalizedText(myLabel, org.openide.util.NbBundle.getMessage(PhpVersionPanel.class, "LBL_ChooseVersion")); // NOI18N
110
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
111
this.setLayout(layout);
112
layout.setHorizontalGroup(
113
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
114
.add(layout.createSequentialGroup()
116
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
117
.add(myVersion, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
118
.addContainerGap(78, Short.MAX_VALUE))
120
layout.setVerticalGroup(
121
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
122
.add(layout.createSequentialGroup()
124
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
126
.add(myVersion, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
127
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
129
}// </editor-fold>//GEN-END:initComponents
139
public static Versions valueOf(int version) {
150
public String toString() {
151
return Integer.toString(myNumber);
154
private int myNumber;
157
// Variables declaration - do not modify//GEN-BEGIN:variables
158
private javax.swing.JLabel myLabel;
159
private javax.swing.JComboBox myVersion;
160
// End of variables declaration//GEN-END:variables
161
private PhpSourcesConfigurePanel myPanel;