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