1 19 20 package org.netbeans.modules.j2ee.common; 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 import org.openide.util.NbBundle; 29 30 43 public class DelegatingWizardDescriptorPanel implements WizardDescriptor.Panel, WizardDescriptor.FinishablePanel { 44 45 private final WizardDescriptor.Panel delegate; 46 47 private WizardDescriptor wizardDescriptor; 48 private Project project; 49 50 public DelegatingWizardDescriptorPanel(WizardDescriptor.Panel delegate) { 51 this.delegate = delegate; 52 } 53 54 public Component getComponent() { 55 return delegate.getComponent(); 56 } 57 58 public HelpCtx getHelp() { 59 return delegate.getHelp(); 60 } 61 62 public void readSettings(Object settings) { 63 if (wizardDescriptor == null) { 64 wizardDescriptor = (WizardDescriptor)settings; 65 project = Templates.getProject((WizardDescriptor)settings); 66 } 67 delegate.readSettings(settings); 68 } 69 70 public void storeSettings(Object settings) { 71 delegate.storeSettings(settings); 72 } 73 74 public boolean isValid() { 75 return delegate.isValid(); 76 } 77 78 public void addChangeListener(ChangeListener l) { 79 delegate.addChangeListener(l); 80 } 81 82 public void removeChangeListener(ChangeListener l) { 83 delegate.removeChangeListener(l); 84 } 85 86 public boolean isFinishPanel() { 87 if (delegate instanceof WizardDescriptor.FinishablePanel) { 88 return ((WizardDescriptor.FinishablePanel)delegate).isFinishPanel(); 89 } 90 return false; 91 } 92 93 protected WizardDescriptor getWizardDescriptor() { 94 return wizardDescriptor; 95 } 96 97 protected Project getProject() { 98 return project; 99 } 100 } 101 | Popular Tags |