1 19 20 package org.openide.loaders; 21 22 import javax.swing.event.ChangeListener ; 23 import org.openide.WizardDescriptor; 24 import org.openide.util.HelpCtx; 25 26 30 final class TemplateWizardPanel2 implements WizardDescriptor.FinishablePanel<WizardDescriptor> { 31 private TemplateWizard2 templateWizard2UI; 32 33 private ChangeListener listener; 34 35 private WizardDescriptor settings; 36 37 private TemplateWizard2 getPanelUI () { 38 if (templateWizard2UI == null) { 39 templateWizard2UI = new TemplateWizard2 (); 40 templateWizard2UI.addChangeListener (listener); 41 } 42 return templateWizard2UI; 43 } 44 45 49 public void addChangeListener (ChangeListener l) { 50 if (listener != null) throw new IllegalStateException (); 51 if (templateWizard2UI != null) 52 templateWizard2UI.addChangeListener (l); 53 listener = l; 54 } 55 56 59 public void removeChangeListener (ChangeListener l) { 60 listener = null; 61 if (templateWizard2UI != null) 62 templateWizard2UI.removeChangeListener (l); 63 } 64 65 73 public java.awt.Component getComponent() { 74 return getPanelUI (); 75 } 76 77 82 public HelpCtx getHelp() { 83 return new HelpCtx (TemplateWizard2.class); 84 } 85 86 90 public boolean isValid() { 91 if (templateWizard2UI == null) { 92 return false; 93 } 94 95 String err = getPanelUI().implIsValid(); 96 if (getPanelUI ().isShowing ()) { 98 settings.putProperty("WizardPanel_errorMessage", err); } 100 return err == null; 101 } 102 103 114 public void readSettings(WizardDescriptor settings) { 115 this.settings = (WizardDescriptor)settings; 116 getPanelUI ().implReadSettings (settings); 117 } 118 119 133 public void storeSettings(WizardDescriptor settings) { 134 getPanelUI ().implStoreSettings (settings); 135 this.settings = null; 136 } 137 138 public boolean isFinishPanel() { 139 return true; 140 } 141 142 } 143 | Popular Tags |