1 19 20 package org.netbeans.modules.form.wizard; 21 22 import java.beans.*; 23 import javax.swing.event.*; 24 import org.netbeans.modules.form.*; 25 26 32 33 class ConnectionWizardPanel2 implements org.openide.WizardDescriptor.Panel { 34 35 static final int METHOD_TYPE = 0; 36 static final int PROPERTY_TYPE = 1; 37 static final int CODE_TYPE = 2; 38 39 private RADComponent targetComponent; 40 41 private EventListenerList listenerList; 42 43 private ConnectionPanel2 uiPanel; 44 45 47 ConnectionWizardPanel2(RADComponent target) { 48 targetComponent = target; 49 } 50 51 RADComponent getTargetComponent() { 52 return targetComponent; 53 } 54 55 int getActionType() { 56 return uiPanel != null ? uiPanel.getActionType() : -1 ; 57 } 58 59 MethodDescriptor getSelectedMethod() { 60 return uiPanel != null ? uiPanel.getSelectedMethod() : null; 61 } 62 63 PropertyDescriptor getSelectedProperty() { 64 return uiPanel != null ? uiPanel.getSelectedProperty() : null; 65 } 66 67 70 public java.awt.Component getComponent() { 71 if (uiPanel == null) 72 uiPanel = new ConnectionPanel2(this); 73 return uiPanel; 74 } 75 76 public org.openide.util.HelpCtx getHelp() { 77 return new org.openide.util.HelpCtx("gui.connecting.target"); } 79 80 public boolean isValid() { 81 return getActionType() == CODE_TYPE 82 || getSelectedMethod() != null 83 || getSelectedProperty() != null; 84 } 85 86 public void readSettings(java.lang.Object settings) { 87 } 88 89 public void storeSettings(java.lang.Object 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 105 void fireStateChanged() { 106 if (listenerList == null) 107 return; 108 109 ChangeEvent e = null; 110 Object [] 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 |