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.
41
package org.netbeans.modules.php.project.wizards;
43
import java.awt.Component;
44
import java.util.Collection;
45
import java.util.LinkedList;
47
import javax.swing.event.ChangeEvent;
48
import javax.swing.event.ChangeListener;
50
import org.openide.WizardDescriptor;
51
import org.openide.WizardDescriptor.FinishablePanel;
52
import org.openide.WizardDescriptor.Panel;
53
import org.openide.util.HelpCtx;
54
import org.openide.util.NbBundle;
61
final class ProviderSpecificPanel implements Panel, FinishablePanel {
63
ProviderSpecificPanel() {
68
* @see org.openide.WizardDescriptor.Panel#addChangeListener(javax.swing.event.ChangeListener)
70
public void addChangeListener( ChangeListener listener ) {
71
synchronized ( myListeners ) {
72
myListeners.add(listener);
77
* @see org.openide.WizardDescriptor.Panel#removeChangeListener(javax.swing.event.ChangeListener)
79
public void removeChangeListener( ChangeListener listener ) {
80
synchronized ( myListeners ) {
81
myListeners.remove(listener);
86
* @see org.openide.WizardDescriptor.Panel#getComponent()
88
public Component getComponent() {
93
* @see org.openide.WizardDescriptor.Panel#getHelp()
95
public HelpCtx getHelp() {
96
return new HelpCtx( ProviderSpecificPanel.class );
100
* @see org.openide.WizardDescriptor.Panel#isValid()
102
public boolean isValid() {
103
return getVisual().dataIsValid( getDescriptor() );
107
* @see org.openide.WizardDescriptor.Panel#readSettings(java.lang.Object)
109
public void readSettings( Object settings ) {
110
myDescriptor = (WizardDescriptor) settings;
112
getVisual().read ( getDescriptor() );
115
* Copied from Make project configuration panel
117
// XXX hack, TemplateWizard in final setTemplateImpl() forces new wizard's title
118
// this name is used in NewProjectWizard to modify the title
119
Object substitute = getVisual().getClientProperty(
120
PhpConfigureProjectVisual.NEW_PROJECT_WIZARD_TITLE);
121
if (substitute != null) {
122
getDescriptor().putProperty(
123
PhpConfigureProjectVisual.NEW_PROJECT_WIZARD_TITLE, substitute);
128
* @see org.openide.WizardDescriptor.Panel#storeSettings(java.lang.Object)
130
public void storeSettings( Object settings ) {
131
WizardDescriptor descriptor = (WizardDescriptor) settings;
132
getVisual().store(descriptor);
133
((WizardDescriptor) descriptor).putProperty(
134
PhpConfigureProjectVisual.NEW_PROJECT_WIZARD_TITLE, null);
138
* @see org.openide.WizardDescriptor.FinishablePanel#isFinishPanel()
140
public boolean isFinishPanel() {
144
final void fireChangeEvent() {
145
ChangeListener[] listeners;
146
synchronized ( myListeners) {
147
listeners = myListeners.toArray(
148
new ChangeListener[ myListeners.size() ] );
150
ChangeEvent event = new ChangeEvent(this);
151
for (ChangeListener listener : listeners) {
152
listener.stateChanged(event);
156
private ProviderPanelVisual getVisual() {
160
private WizardDescriptor getDescriptor() {
164
private void init( ) {
165
myComponent = new ProviderPanelVisual( this );
167
/*String[] initialSteps = getDescriptor().getInitialSteps();
168
String[] steps = new String[initialSteps.length + 1];
169
System.arraycopy(initialSteps, 0, steps, 0, initialSteps.length);
170
steps[initialSteps.length] = AddHostWizard.ELIPSIS;
171
getVisual().putClientProperty( AddHostWizard.PROP_CONTENT_DATA, steps);
173
getVisual().putClientProperty(AddHostWizard.SELECTED_INDEX, 0);*/
176
* Provide a name of the step in the title bar.
178
getVisual().setName(NbBundle.getBundle( NewPhpProjectWizardIterator.class).
179
getString( NewPhpProjectWizardIterator.STEP_EXECUTION));
183
private ProviderPanelVisual myComponent;
185
private final Collection<ChangeListener> myListeners =
186
new LinkedList<ChangeListener>();
188
private WizardDescriptor myDescriptor;