01: package org.netbeans.modules.j2ee.persistence.wizard.dao;
02:
03: import java.awt.Component;
04: import javax.swing.event.ChangeEvent;
05: import javax.swing.event.ChangeListener;
06: import org.netbeans.api.project.Project;
07: import org.openide.WizardDescriptor;
08: import org.openide.util.ChangeSupport;
09: import org.openide.util.HelpCtx;
10: import org.openide.util.NbBundle;
11:
12: public class EjbFacadeWizardPanel2 implements WizardDescriptor.Panel,
13: ChangeListener {
14:
15: /**
16: * The visual component that displays this panel. If you need to access the
17: * component from this class, just use getComponent().
18: */
19: private EjbFacadeVisualPanel2 component;
20: private WizardDescriptor wizardDescriptor;
21: private Project project;
22: private final ChangeSupport changeSupport = new ChangeSupport(this );
23:
24: public EjbFacadeWizardPanel2(Project project,
25: WizardDescriptor wizardDescriptor) {
26: this .project = project;
27: this .wizardDescriptor = wizardDescriptor;
28: }
29:
30: public Component getComponent() {
31: if (component == null) {
32: component = new EjbFacadeVisualPanel2(wizardDescriptor);
33: component.addChangeListener(this );
34: }
35: return component;
36: }
37:
38: public HelpCtx getHelp() {
39: return new HelpCtx(EjbFacadeWizardPanel2.class);
40: }
41:
42: public boolean isValid() {
43: getComponent();
44: if (!(component.isRemote() || component.isLocal())) {
45: wizardDescriptor.putProperty("WizardPanel_errorMessage",
46: NbBundle.getMessage(EjbFacadeWizardPanel2.class,
47: "ERR_ChooseInterface")); // NOI18N
48: return false;
49: }
50: wizardDescriptor.putProperty("WizardPanel_errorMessage", ""); // NOI18N
51: return true;
52: }
53:
54: public boolean isFinishPanel() {
55: return true;
56: }
57:
58: public final void addChangeListener(ChangeListener l) {
59: changeSupport.addChangeListener(l);
60: }
61:
62: public final void removeChangeListener(ChangeListener l) {
63: changeSupport.removeChangeListener(l);
64: }
65:
66: public String getPackage() {
67: return component.getPackage();
68: }
69:
70: public void stateChanged(ChangeEvent e) {
71: changeSupport.fireChange();
72: }
73:
74: public void readSettings(Object settings) {
75: wizardDescriptor = (WizardDescriptor) settings;
76: component.read(wizardDescriptor);
77: }
78:
79: public void storeSettings(Object settings) {
80: WizardDescriptor d = (WizardDescriptor) settings;
81: component.store(d);
82: }
83:
84: boolean isRemote() {
85: return component.isRemote();
86: }
87:
88: boolean isLocal() {
89: return component.isLocal();
90: }
91:
92: }
|