1 19 20 package org.netbeans.modules.j2ee.persistence.wizard; 21 22 import java.awt.Component ; 23 import javax.swing.event.ChangeListener ; 24 import org.netbeans.api.project.Project; 25 import org.netbeans.spi.project.ui.templates.support.Templates; 26 import org.openide.WizardDescriptor; 27 import org.openide.util.HelpCtx; 28 29 48 public class DelegatingWizardDescriptorPanel implements WizardDescriptor.Panel, WizardDescriptor.FinishablePanel { 49 50 private final WizardDescriptor.Panel delegate; 51 52 private WizardDescriptor wizardDescriptor; 53 private Project project; 54 55 public DelegatingWizardDescriptorPanel(WizardDescriptor.Panel delegate) { 56 this.delegate = delegate; 57 } 58 59 public Component getComponent() { 60 return delegate.getComponent(); 61 } 62 63 public HelpCtx getHelp() { 64 return delegate.getHelp(); 65 } 66 67 public void readSettings(Object settings) { 68 if (wizardDescriptor == null) { 69 wizardDescriptor = (WizardDescriptor)settings; 70 project = Templates.getProject((WizardDescriptor)settings); 71 } 72 delegate.readSettings(settings); 73 } 74 75 public void storeSettings(Object settings) { 76 delegate.storeSettings(settings); 77 } 78 79 public boolean isValid() { 80 return delegate.isValid(); 81 } 82 83 public void addChangeListener(ChangeListener l) { 84 delegate.addChangeListener(l); 85 } 86 87 public void removeChangeListener(ChangeListener l) { 88 delegate.removeChangeListener(l); 89 } 90 91 public boolean isFinishPanel() { 92 if (delegate instanceof WizardDescriptor.FinishablePanel) { 93 return ((WizardDescriptor.FinishablePanel)delegate).isFinishPanel(); 94 } 95 return false; 96 } 97 98 protected WizardDescriptor getWizardDescriptor() { 99 return wizardDescriptor; 100 } 101 102 protected Project getProject() { 103 return project; 104 } 105 } 106 | Popular Tags |