1 19 package org.netbeans.modules.apisupport.feedreader; 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 31 34 public class FeedReaderWizardPanel implements WizardDescriptor.Panel, 35 WizardDescriptor.ValidatingPanel, WizardDescriptor.FinishablePanel { 36 37 private WizardDescriptor wizardDescriptor; 38 private FeedReaderPanelVisual component; 39 40 public Component getComponent() { 41 if (component == null) { 42 component = new FeedReaderPanelVisual(this); 43 } 44 return component; 45 } 46 47 public HelpCtx getHelp() { 48 return new HelpCtx( FeedReaderWizardPanel.class ); 49 } 50 51 public boolean isValid() { 52 getComponent(); 53 return component.valid( wizardDescriptor ); 54 } 55 56 private final Set listeners = new HashSet (1); 57 public final void addChangeListener(ChangeListener l) { 58 synchronized (listeners) { 59 listeners.add(l); 60 } 61 } 62 public final void removeChangeListener(ChangeListener l) { 63 synchronized (listeners) { 64 listeners.remove(l); 65 } 66 } 67 protected final void fireChangeEvent() { 68 Iterator it; 69 synchronized (listeners) { 70 it = new HashSet (listeners).iterator(); 71 } 72 ChangeEvent ev = new ChangeEvent (this); 73 while (it.hasNext()) { 74 ((ChangeListener )it.next()).stateChanged(ev); 75 } 76 } 77 78 public void readSettings(Object settings) { 79 wizardDescriptor = (WizardDescriptor)settings; 80 component.read(wizardDescriptor); 81 82 } 89 90 public void storeSettings(Object settings) { 91 WizardDescriptor d = (WizardDescriptor)settings; 92 component.store(d); 93 } 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 |