KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > freeform > ui > WebClasspathWizardPanel


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.web.freeform.ui;
21
22 import java.awt.Component JavaDoc;
23 import java.io.BufferedReader JavaDoc;
24 import java.io.File JavaDoc;
25 import java.io.InputStreamReader JavaDoc;
26 import java.util.Enumeration JavaDoc;
27 import java.util.HashSet JavaDoc;
28 import java.util.Iterator JavaDoc;
29 import java.util.List JavaDoc;
30 import java.util.Set JavaDoc;
31 import javax.swing.event.ChangeEvent JavaDoc;
32 import javax.swing.event.ChangeListener JavaDoc;
33 import org.netbeans.modules.ant.freeform.spi.support.NewFreeformProjectSupport;
34 import org.netbeans.modules.java.freeform.spi.support.NewJavaFreeformProjectSupport;
35 import org.openide.ErrorManager;
36 import org.openide.WizardDescriptor;
37 import org.openide.filesystems.FileObject;
38 import org.openide.filesystems.FileStateInvalidException;
39 import org.openide.filesystems.FileUtil;
40 import org.openide.util.HelpCtx;
41 import org.openide.util.NbBundle;
42
43 /**
44  * @author Petr Pisl
45  */

46
47 public class WebClasspathWizardPanel implements WizardDescriptor.Panel {
48
49     private WebClasspathPanel component;
50     private WizardDescriptor wizardDescriptor;
51
52     public WebClasspathWizardPanel() {
53         getComponent().setName(NbBundle.getMessage(NewWebFreeformProjectWizardIterator.class, "TXT_NewWebFreeformProjectWizardIterator_WebSources_Classpath")); // NOI18N
54
}
55
56     public Component JavaDoc getComponent() {
57         if (component == null) {
58             component = new WebClasspathPanel();
59         }
60         return component;
61     }
62
63     public HelpCtx getHelp() {
64         return new HelpCtx( WebClasspathWizardPanel.class );
65     }
66     
67     public boolean isValid() {
68         return true;
69     }
70
71     private final Set JavaDoc/*<ChangeListener>*/ listeners = new HashSet JavaDoc(1);
72     public final void addChangeListener(ChangeListener JavaDoc l) {
73         synchronized (listeners) {
74             listeners.add(l);
75         }
76     }
77     public final void removeChangeListener(ChangeListener JavaDoc l) {
78         synchronized (listeners) {
79             listeners.remove(l);
80         }
81     }
82     protected final void fireChangeEvent() {
83         Iterator JavaDoc it;
84         synchronized (listeners) {
85             it = new HashSet JavaDoc(listeners).iterator();
86         }
87         ChangeEvent JavaDoc ev = new ChangeEvent JavaDoc(this);
88         while (it.hasNext()) {
89             ((ChangeListener JavaDoc)it.next()).stateChanged(ev);
90         }
91     }
92
93     public void readSettings(Object JavaDoc settings) {
94         wizardDescriptor = (WizardDescriptor) settings;
95         wizardDescriptor.putProperty("NewProjectWizard_Title", component.getClientProperty("NewProjectWizard_Title")); // NOI18N
96
File JavaDoc baseFolder = (File JavaDoc)wizardDescriptor.getProperty(NewFreeformProjectSupport.PROP_PROJECT_LOCATION);
97         File JavaDoc nbProjectFolder = (File JavaDoc)wizardDescriptor.getProperty(NewFreeformProjectSupport.PROP_PROJECT_FOLDER);
98         component.setProjectFolders(baseFolder, nbProjectFolder);
99     }
100
101     public void storeSettings(Object JavaDoc settings) {
102         wizardDescriptor = (WizardDescriptor) settings;
103         wizardDescriptor.putProperty(NewWebFreeformProjectWizardIterator.PROP_WEB_CLASSPATH, component.getClasspath());
104     }
105
106 }
107
Popular Tags