1 19 package org.netbeans.modules.apisupport.metainfservices; 20 21 import java.awt.Component ; 22 import java.util.*; 23 import javax.swing.event.ChangeEvent ; 24 import javax.swing.event.ChangeListener ; 25 import org.openide.WizardDescriptor; 26 import org.openide.util.HelpCtx; 27 import org.openide.filesystems.FileObject; 28 29 public class ExportWizardPanel1 implements WizardDescriptor.Panel { 30 31 35 private ExportVisualPanel1 component; 36 37 private boolean valid; 38 private FileObject target; 39 40 public Component getComponent() { 45 if (component == null) { 46 component = new ExportVisualPanel1(this); 47 } 48 return component; 49 } 50 51 public HelpCtx getHelp() { 52 return HelpCtx.DEFAULT_HELP; 54 } 57 58 final FileObject getTarget() { 59 return target; 60 } 61 62 public boolean isValid() { 63 return valid; 64 } 65 66 final void setValid(boolean b) { 67 this.valid = b; 68 fireChangeEvent(); 69 } 70 private final Set<ChangeListener > listeners = new HashSet<ChangeListener >(11); 71 public final void addChangeListener(ChangeListener l) { 72 synchronized (listeners) { 73 listeners.add(l); 74 } 75 } 76 public final void removeChangeListener(ChangeListener l) { 77 synchronized (listeners) { 78 listeners.remove(l); 79 } 80 } 81 protected final void fireChangeEvent() { 82 Iterator<ChangeListener > it; 83 synchronized (listeners) { 84 it = new HashSet<ChangeListener >(listeners).iterator(); 85 } 86 ChangeEvent ev = new ChangeEvent (this); 87 while (it.hasNext()) { 88 it.next().stateChanged(ev); 89 } 90 } 91 92 @SuppressWarnings ("unchecked") 93 public void readSettings(Object settings) { 94 WizardDescriptor wd = (WizardDescriptor)settings; 95 String impl = (String )wd.getProperty("implName"); Collection<String > interfaces = (Collection<String >)wd.getProperty("interfaceNames"); target = (FileObject)wd.getProperty("target"); 99 if (component != null) { 100 component.fillTable(interfaces); 101 } 102 } 103 public void storeSettings(Object settings) { 104 WizardDescriptor wd = (WizardDescriptor)settings; 105 wd.putProperty("files", component.generatedFiles()); 106 } 107 108 } 109 110 | Popular Tags |