1 19 20 package org.netbeans.modules.j2ee.deployment.impl.ui.wizard; 21 22 import java.awt.Component ; 23 import java.util.ArrayList ; 24 import java.util.Iterator ; 25 import java.util.List ; 26 import javax.swing.event.ChangeEvent ; 27 import javax.swing.event.ChangeListener ; 28 import org.openide.WizardDescriptor; 29 import org.openide.util.HelpCtx; 30 31 35 class ServerChooserPanel implements WizardDescriptor.Panel, ChangeListener { 36 private final List listeners = new ArrayList (); 37 private ServerChooserVisual component; 38 39 public ServerChooserPanel() { 40 } 41 42 public Component getComponent() { 43 if (component == null) { 44 component = new ServerChooserVisual(); 45 component.addChangeListener(this); 46 } 47 return component; 48 } 49 50 public HelpCtx getHelp() { 51 return HelpCtx.DEFAULT_HELP; 52 } 53 54 public void readSettings(Object settings) { 55 getVisual().read((AddServerInstanceWizard)settings); 56 } 57 58 public void storeSettings(Object settings) { 59 getVisual().store((AddServerInstanceWizard)settings); 60 } 61 62 public boolean isValid() { 63 return getVisual().isValid(); 64 } 65 66 public void addChangeListener(ChangeListener l) { 67 synchronized (listeners) { 68 listeners.add(l); 69 } 70 } 71 72 public void removeChangeListener(ChangeListener l) { 73 synchronized (listeners) { 74 listeners.remove(l); 75 } 76 } 77 78 public void stateChanged(ChangeEvent event) { 79 fireChange(event); 80 } 81 82 private void fireChange(ChangeEvent event) { 83 ArrayList tempList; 84 85 synchronized (listeners) { 86 tempList = new ArrayList (listeners); 87 } 88 89 Iterator iter = tempList.iterator(); 90 while (iter.hasNext()) 91 ((ChangeListener )iter.next()).stateChanged(event); 92 } 93 94 private ServerChooserVisual getVisual() { 95 return (ServerChooserVisual)getComponent(); 96 } 97 } 98 | Popular Tags |