samples/apifest1/infrastructure/testing-template/src/org/netbeans/apifest/testingtemplate/TestingTemplateWizardPanel.java
Adding samples from API fest to the repository, including pieces of their code in the document, not just links
1 package org.netbeans.apifest.testingtemplate;
3 import java.awt.Component;
4 import java.util.HashSet;
5 import java.util.Iterator;
7 import javax.swing.event.ChangeEvent;
8 import javax.swing.event.ChangeListener;
9 import org.openide.WizardDescriptor;
10 import org.openide.WizardValidationException;
11 import org.openide.util.HelpCtx;
12 import org.openide.util.NbBundle;
15 * Panel just asking for basic info.
17 public class TestingTemplateWizardPanel implements WizardDescriptor.Panel,
18 WizardDescriptor.ValidatingPanel, WizardDescriptor.FinishablePanel {
20 private WizardDescriptor wizardDescriptor;
21 private TestingTemplatePanelVisual component;
23 /** Creates a new instance of templateWizardPanel */
24 public TestingTemplateWizardPanel() {
27 public Component getComponent() {
28 if (component == null) {
29 component = new TestingTemplatePanelVisual(this);
30 component.setName(NbBundle.getMessage(TestingTemplateWizardPanel.class, "LBL_CreateProjectStep"));
35 public HelpCtx getHelp() {
36 return new HelpCtx(TestingTemplateWizardPanel.class);
39 public boolean isValid() {
41 return component.valid(wizardDescriptor);
44 private final Set/*<ChangeListener>*/ listeners = new HashSet(1);
45 public final void addChangeListener(ChangeListener l) {
46 synchronized (listeners) {
50 public final void removeChangeListener(ChangeListener l) {
51 synchronized (listeners) {
55 protected final void fireChangeEvent() {
57 synchronized (listeners) {
58 it = new HashSet(listeners).iterator();
60 ChangeEvent ev = new ChangeEvent(this);
61 while (it.hasNext()) {
62 ((ChangeListener) it.next()).stateChanged(ev);
66 public void readSettings(Object settings) {
67 wizardDescriptor = (WizardDescriptor) settings;
68 component.read(wizardDescriptor);
71 public void storeSettings(Object settings) {
72 WizardDescriptor d = (WizardDescriptor) settings;
76 public boolean isFinishPanel() {
80 public void validate() throws WizardValidationException {
82 component.validate(wizardDescriptor);