1 19 package org.netbeans.modules.j2ee.archive.wizard; 20 21 import java.awt.Component ; 22 import java.util.HashSet ; 23 import java.util.Iterator ; 24 import java.util.Set ; 25 import javax.swing.event.ChangeEvent ; 26 import javax.swing.event.ChangeListener ; 27 import org.openide.WizardDescriptor; 28 import org.openide.WizardValidationException; 29 import org.openide.util.HelpCtx; 30 import org.openide.util.NbBundle; 31 32 35 public class DeployableWizardPanel implements WizardDescriptor.Panel, 36 WizardDescriptor.ValidatingPanel, WizardDescriptor.FinishablePanel { 37 38 private WizardDescriptor wizardDescriptor; 39 private DeployablePanelVisual component; 40 41 42 public DeployableWizardPanel() { 43 component = null; 44 wizardDescriptor = null;; 45 } 46 47 public Component getComponent() { 48 if (component == null) { 49 component = new DeployablePanelVisual(this); 50 component.setName(NbBundle.getMessage(DeployableWizardPanel.class,"LBL_CreateProjectStep")); 51 } 52 return component; 53 } 54 55 public HelpCtx getHelp() { 56 return new HelpCtx(DeployableWizardPanel.class); 57 } 58 59 public boolean isValid() { 60 getComponent(); 61 return component.valid(wizardDescriptor); 62 } 63 64 private final Set listeners = new HashSet (1); 65 public final void addChangeListener(ChangeListener l) { 66 synchronized (listeners) { 67 listeners.add(l); 68 } 69 } 70 public final void removeChangeListener(ChangeListener l) { 71 synchronized (listeners) { 72 listeners.remove(l); 73 } 74 } 75 protected final void fireChangeEvent() { 76 Iterator it; 77 synchronized (listeners) { 78 it = new HashSet (listeners).iterator(); 79 } 80 ChangeEvent ev = new ChangeEvent (this); 81 while (it.hasNext()) { 82 ((ChangeListener ) it.next()).stateChanged(ev); 83 } 84 } 85 86 public void readSettings(Object settings) { 87 wizardDescriptor = (WizardDescriptor) settings; 88 component.read(wizardDescriptor); 89 } 90 91 public void storeSettings(Object settings) { 92 WizardDescriptor d = (WizardDescriptor) settings; 93 component.store(d); 94 } 95 96 public boolean isFinishPanel() { 97 return true; 98 } 99 100 public void validate() throws WizardValidationException { 101 getComponent(); 102 component.validate(wizardDescriptor); 103 } 104 105 } 106 | Popular Tags |