1 19 20 package org.netbeans.modules.web.wizards; 21 22 import java.util.HashSet ; 23 import java.util.Iterator ; 24 import java.util.Set ; 25 import javax.swing.JPanel ; 26 import javax.swing.event.ChangeEvent ; 27 import javax.swing.event.ChangeListener ; 28 import org.openide.util.HelpCtx; 29 30 abstract class BaseWizardPanel extends JPanel { 31 32 private final Set listeners = new HashSet (1); 34 private static final long serialVersionUID = -2938499199217476217L; 35 36 public final void addChangeListener(ChangeListener l) { 37 synchronized(listeners) { 38 listeners.add(l); 39 } 40 } 41 public final void removeChangeListener(ChangeListener l) { 42 synchronized(listeners) { 43 listeners.remove(l); 44 } 45 } 46 protected final void fireChangeEvent() { 47 Iterator it; 48 synchronized(listeners) { 49 it = new HashSet (listeners).iterator(); 50 } 51 ChangeEvent ev = new ChangeEvent (this); 52 while (it.hasNext()) { 53 ((ChangeListener )it.next()).stateChanged (ev); 54 } 55 } 56 abstract void setData(); 57 abstract HelpCtx getHelp(); 58 } 59 | Popular Tags |