KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > form > wizard > ConnectionWizardPanel3


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.form.wizard;
21
22 import javax.swing.event.*;
23 import java.lang.reflect.Method JavaDoc;
24 import org.netbeans.modules.form.*;
25
26 /**
27  * The third panel of connection wizard - for entering parameters for method
28  * which will be called on the target component (specified in step 2).
29  *
30  * @author Tomas Pavek
31  */

32
33 class ConnectionWizardPanel3 implements org.openide.WizardDescriptor.Panel {
34
35     private FormModel formModel;
36     private Method JavaDoc method;
37
38     private EventListenerList listenerList = null;
39
40     private ConnectionPanel3 uiPanel;
41
42     // --------
43

44     ConnectionWizardPanel3(FormModel model) {
45         formModel = model;
46     }
47
48     FormModel getFormModel() {
49         return formModel;
50     }
51
52     void setMethod(Method JavaDoc m) {
53         method = m;
54         if (uiPanel != null)
55             uiPanel.setMethod(m);
56     }
57
58     String JavaDoc getParametersText() {
59         return uiPanel != null ? uiPanel.getParametersText() : null;
60     }
61
62     Object JavaDoc[] getParameters() {
63         return uiPanel != null ? uiPanel.getParameters() : null;
64     }
65
66     // ---------
67
// WizardDescriptor.Panel implementation
68

69     public java.awt.Component JavaDoc getComponent() {
70         if (uiPanel == null) {
71             uiPanel = new ConnectionPanel3(this);
72             if (method != null)
73                 uiPanel.setMethod(method);
74         }
75         return uiPanel;
76     }
77
78     public org.openide.util.HelpCtx getHelp() {
79         return new org.openide.util.HelpCtx("gui.connecting.code"); // NOI18N
80
}
81
82     public boolean isValid() {
83         return uiPanel != null ? uiPanel.isFilled() : false;
84     }
85
86     public void readSettings(java.lang.Object JavaDoc settings) {
87     }
88
89     public void storeSettings(java.lang.Object JavaDoc settings) {
90     }
91
92     public void addChangeListener(ChangeListener listener) {
93         if (listenerList == null)
94             listenerList = new EventListenerList();
95         listenerList.add(ChangeListener.class, listener);
96     }
97
98     public void removeChangeListener(ChangeListener listener) {
99         if (listenerList != null)
100             listenerList.remove(ChangeListener.class, listener);
101     }
102
103     // ------
104

105     void fireStateChanged() {
106         if (listenerList == null)
107             return;
108
109         ChangeEvent e = null;
110         Object JavaDoc[] listeners = listenerList.getListenerList();
111         for (int i = listeners.length-2; i>=0; i-=2) {
112             if (listeners[i] == ChangeListener.class) {
113                 if (e == null)
114                     e = new ChangeEvent(this);
115                 ((ChangeListener)listeners[i+1]).stateChanged(e);
116             }
117         }
118     }
119 }
120
Popular Tags