KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > struts > wizards > ActionPanel1


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.struts.wizards;
21
22 import java.awt.Component JavaDoc;
23 import java.util.HashSet JavaDoc;
24 import java.util.Set JavaDoc;
25 import javax.swing.event.ChangeListener JavaDoc;
26
27 import org.openide.WizardDescriptor;
28 import org.openide.util.HelpCtx;
29
30 import org.netbeans.api.project.Project;
31
32 /**
33  *
34  * @author radko
35  */

36 public class ActionPanel1 implements WizardDescriptor.Panel, WizardDescriptor.FinishablePanel {
37
38     private WizardDescriptor wizardDescriptor;
39     private ActionPanel1Visual component;
40     private Project project;
41
42     /** Creates a new instance of ActionPanel */
43     public ActionPanel1(Project project) {
44         this.project=project;
45     }
46     
47     Project getProject() {
48         return project;
49     }
50     
51     public Component JavaDoc getComponent() {
52         if (component == null)
53             component = new ActionPanel1Visual(this);
54
55         return component;
56     }
57     
58     public boolean isValid() {
59         getComponent();
60         return component.valid(wizardDescriptor);
61     }
62
63     public void readSettings(Object JavaDoc settings) {
64         wizardDescriptor = (WizardDescriptor) settings;
65         component.read(wizardDescriptor);
66         // XXX hack, TemplateWizard in final setTemplateImpl() forces new wizard's title
67
// this name is used in NewProjectWizard to modify the title
68
Object JavaDoc substitute = ((javax.swing.JComponent JavaDoc) component).getClientProperty("NewFileWizard_Title"); // NOI18N
69
if (substitute != null)
70             wizardDescriptor.putProperty("NewFileWizard_Title", substitute); // NOI18N
71
}
72     
73     public void storeSettings(Object JavaDoc settings) {
74         WizardDescriptor desc = (WizardDescriptor) settings;
75         component.store(desc);
76     }
77
78     public HelpCtx getHelp() {
79         return new HelpCtx(ActionPanel1.class);
80     }
81
82     private final Set JavaDoc/*<ChangeListener>*/ listeners = new HashSet JavaDoc(1);
83     
84     public final void addChangeListener(ChangeListener JavaDoc l) {
85         synchronized (listeners) {
86             listeners.add(l);
87         }
88     }
89     public final void removeChangeListener(ChangeListener JavaDoc l) {
90         synchronized (listeners) {
91             listeners.remove(l);
92         }
93     }
94     
95     public boolean isFinishPanel() {
96         return isValid();
97     }
98
99 }
100
Popular Tags