KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ws7 > ui > WS70AddServerChoicePanel


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 /*
21  * WS70AddServerChoicePanel.java
22  */

23
24 package org.netbeans.modules.j2ee.sun.ws7.ui;
25
26 import org.openide.WizardDescriptor;
27 import javax.swing.event.ChangeListener JavaDoc;
28 import java.awt.Component JavaDoc;
29 import javax.swing.event.ChangeEvent JavaDoc;
30 import java.util.ArrayList JavaDoc;
31 import java.util.List JavaDoc;
32 import java.util.Iterator JavaDoc;
33
34
35 import org.openide.util.HelpCtx;
36 /**
37  *
38  * @author Mukesh Garg
39  */

40 public class WS70AddServerChoicePanel implements WizardDescriptor.Panel, ChangeListener JavaDoc{
41
42     private final List JavaDoc listeners = new ArrayList JavaDoc();
43     private WS70AddServerChoiceVisualPanel panel;
44     private WizardDescriptor wizard;
45     
46     /** Creates a new instance of WS70AddServerChoicePanel */
47     public WS70AddServerChoicePanel() {
48     }
49     //WizardDescriptor.Panel method implementation
50
public Component JavaDoc getComponent(){
51         if(panel==null){
52             panel = new WS70AddServerChoiceVisualPanel();
53             panel.addChangeListener(this);
54         }
55         return panel;
56     }
57     //WizardDescriptor.Panel method implementation
58
public HelpCtx getHelp(){
59         return new HelpCtx("wsplugin_webserver7_plugin_help");
60     }
61     //WizardDescriptor.Panel method implementation
62
public boolean isValid(){
63         WS70AddServerChoiceVisualPanel p = (WS70AddServerChoiceVisualPanel)getComponent();
64         boolean retval = p.isValid(wizard);
65         return retval;
66     }
67     //WizardDescriptor.Panel method implementation
68
public void readSettings(Object JavaDoc obj){
69         wizard = (WizardDescriptor)obj;
70     }
71     //WizardDescriptor.Panel method implementation
72
public void storeSettings(Object JavaDoc obj){
73         
74     }
75     //WizardDescriptor.Panel method implementation
76
public void addChangeListener(ChangeListener JavaDoc l){
77         synchronized (listeners) {
78             listeners.add(l);
79         }
80     }
81     //WizardDescriptor.Panel method implementation
82
public void removeChangeListener(ChangeListener JavaDoc l){
83         synchronized (listeners) {
84             listeners.remove(l);
85         }
86     }
87     public void stateChanged(ChangeEvent JavaDoc event) {
88         fireChange(event);
89     }
90     private void fireChange(ChangeEvent JavaDoc event) {
91         ArrayList JavaDoc tempList;
92
93         synchronized (listeners) {
94             tempList = new ArrayList JavaDoc(listeners);
95         }
96
97         Iterator JavaDoc iter = tempList.iterator();
98         while (iter.hasNext()){
99             ((ChangeListener JavaDoc)iter.next()).stateChanged(event);
100         }
101     }
102     
103 }
104
Popular Tags