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