1 19 20 package org.netbeans.modules.form.wizard; 21 22 import javax.swing.event.*; 23 import org.netbeans.modules.form.*; 24 25 32 33 class ConnectionWizardPanel1 implements org.openide.WizardDescriptor.Panel { 34 35 private Event selectedEvent; 36 37 private RADComponent sourceComponent; 38 39 private EventListenerList listenerList; 40 41 private ConnectionPanel1 uiPanel; 42 43 45 ConnectionWizardPanel1(RADComponent source) { 46 sourceComponent = source; 47 } 48 49 RADComponent getSourceComponent() { 50 return sourceComponent; 51 } 52 53 Event getSelectedEvent() { 54 return selectedEvent; 55 } 56 String getEventName() { 57 return uiPanel != null ? uiPanel.getEventName() : null; 58 } 59 60 void setSelectedEvent(Event event) { 61 selectedEvent = event; 62 fireStateChanged(); 63 } 64 65 boolean handlerAlreadyExists() { 66 if (uiPanel == null) 67 return false; 68 69 return selectedEvent != null 70 && selectedEvent.hasEventHandler(uiPanel.getEventName()); 71 } 72 73 76 public java.awt.Component getComponent() { 77 if (uiPanel == null) 78 uiPanel = new ConnectionPanel1(this); 79 return uiPanel; 80 } 81 82 public org.openide.util.HelpCtx getHelp() { 83 return new org.openide.util.HelpCtx("gui.connecting.source"); } 85 86 public boolean isValid() { 87 String eventName = uiPanel != null ? uiPanel.getEventName() : null; 88 return selectedEvent != null 89 && eventName != null && !"".equals(eventName) 90 && org.openide.util.Utilities.isJavaIdentifier(eventName); 91 } 92 93 public void readSettings(java.lang.Object settings) { 94 } 95 96 public void storeSettings(java.lang.Object settings) { 97 } 98 99 public void addChangeListener(ChangeListener listener) { 100 if (listenerList == null) 101 listenerList = new EventListenerList(); 102 listenerList.add(ChangeListener.class, listener); 103 } 104 105 public void removeChangeListener(ChangeListener listener) { 106 if (listenerList != null) 107 listenerList.remove(ChangeListener.class, listener); 108 } 109 110 112 void fireStateChanged() { 113 if (listenerList == null) 114 return; 115 116 ChangeEvent e = null; 117 Object [] listeners = listenerList.getListenerList(); 118 for (int i = listeners.length-2; i>=0; i-=2) { 119 if (listeners[i] == ChangeListener.class) { 120 if (e == null) 121 e = new ChangeEvent(this); 122 ((ChangeListener)listeners[i+1]).stateChanged(e); 123 } 124 } 125 } 126 } 127 | Popular Tags |