1 19 20 package org.netbeans.modules.java.freeform.ui; 21 22 import java.awt.Component ; 23 import java.util.Collection ; 24 import java.util.HashSet ; 25 import java.util.Set ; 26 import javax.swing.JComponent ; 27 import javax.swing.event.ChangeEvent ; 28 import javax.swing.event.ChangeListener ; 29 import org.openide.WizardDescriptor; 30 import org.openide.util.HelpCtx; 31 import org.openide.util.NbBundle; 32 33 36 public class ClasspathWizardPanel implements WizardDescriptor.Panel { 37 38 private ClasspathPanel component; 39 private WizardDescriptor wizardDescriptor; 40 41 public ClasspathWizardPanel() { 42 getComponent().setName(NbBundle.getMessage (NewJ2SEFreeformProjectWizardIterator.class, "TXT_NewJ2SEFreeformProjectWizardIterator_Classpath")); 43 } 44 45 public Component getComponent() { 46 if (component == null) { 47 component = new ClasspathPanel(); 48 ((JComponent )component).getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage(ClasspathWizardPanel.class, "ACSD_ClasspathWizardPanel")); } 50 return component; 51 } 52 53 public HelpCtx getHelp() { 54 return new HelpCtx( ClasspathWizardPanel.class ); 55 } 56 57 public boolean isValid() { 58 getComponent(); 59 return true; 60 } 61 62 private final Set <ChangeListener > listeners = new HashSet <ChangeListener >(1); 63 public final void addChangeListener(ChangeListener l) { 64 synchronized (listeners) { 65 listeners.add(l); 66 } 67 } 68 public final void removeChangeListener(ChangeListener l) { 69 synchronized (listeners) { 70 listeners.remove(l); 71 } 72 } 73 protected final void fireChangeEvent() { 74 Collection <ChangeListener > ls; 75 synchronized (listeners) { 76 ls = new HashSet <ChangeListener >(listeners); 77 } 78 ChangeEvent ev = new ChangeEvent (this); 79 for (ChangeListener l : ls) { 80 l.stateChanged(ev); 81 } 82 } 83 84 public void readSettings(Object settings) { 85 wizardDescriptor = (WizardDescriptor)settings; 86 ProjectModel pm = (ProjectModel) wizardDescriptor.getProperty(NewJ2SEFreeformProjectWizardIterator.PROP_PROJECT_MODEL); 87 component.setModel(pm); 88 wizardDescriptor.putProperty("NewProjectWizard_Title", component.getClientProperty("NewProjectWizard_Title")); } 90 91 public void storeSettings(Object settings) { 92 wizardDescriptor = (WizardDescriptor)settings; 93 wizardDescriptor.putProperty("NewProjectWizard_Title", null); } 95 96 } 97 | Popular Tags |