1 19 20 package org.netbeans.modules.web.jsf.wizards; 21 22 import java.awt.Component ; 23 import java.util.HashSet ; 24 import java.util.Iterator ; 25 import java.util.Set ; 26 import javax.swing.JComponent ; 27 import javax.swing.event.ChangeEvent ; 28 import javax.swing.event.ChangeListener ; 29 import org.netbeans.modules.web.spi.webmodule.FrameworkConfigurationPanel; 30 import org.openide.WizardDescriptor; 31 import org.openide.WizardValidationException; 32 import org.openide.util.HelpCtx; 33 34 38 public class JSFConfigurationPanel implements FrameworkConfigurationPanel, WizardDescriptor.FinishablePanel, WizardDescriptor.ValidatingPanel { 39 private WizardDescriptor wizardDescriptor; 40 private JSFConfigurationPanelVisual component; 41 42 43 public JSFConfigurationPanel(boolean customizer) { 44 this.customizer = customizer; 45 getComponent(); 46 } 47 48 private boolean customizer; 49 50 51 52 public boolean isFinishPanel() { 53 return true; 54 } 55 56 public Component getComponent() { 57 if (component == null) 58 component = new JSFConfigurationPanelVisual(this, customizer); 59 60 return component; 61 } 62 63 public HelpCtx getHelp() { 64 return new HelpCtx(JSFConfigurationPanel.class); 65 } 66 67 public boolean isValid() { 68 getComponent(); 69 return component.valid(wizardDescriptor); 70 } 71 72 private final Set listeners = new HashSet (1); 73 74 public final void addChangeListener(ChangeListener l) { 75 synchronized (listeners) { 76 listeners.add(l); 77 } 78 } 79 public final void removeChangeListener(ChangeListener l) { 80 synchronized (listeners) { 81 listeners.remove(l); 82 } 83 } 84 protected final void fireChangeEvent() { 85 Iterator it; 86 synchronized (listeners) { 87 it = new HashSet (listeners).iterator(); 88 } 89 ChangeEvent ev = new ChangeEvent (this); 90 while (it.hasNext()) { 91 ((ChangeListener )it.next()).stateChanged(ev); 92 } 93 } 94 95 public void readSettings(Object settings) { 96 wizardDescriptor = (WizardDescriptor) settings; 97 component.read (wizardDescriptor); 98 99 Object substitute = ((JComponent ) component).getClientProperty("NewProjectWizard_Title"); if (substitute != null) 103 wizardDescriptor.putProperty("NewProjectWizard_Title", substitute); } 105 106 107 public void storeSettings(Object settings) { 108 WizardDescriptor d = (WizardDescriptor) settings; 109 component.store(d); 110 ((WizardDescriptor) d).putProperty("NewProjectWizard_Title", null); } 112 113 public void validate() throws WizardValidationException { 114 getComponent (); 115 component.validate (wizardDescriptor); 116 } 117 118 public void enableComponents(boolean enable) { 119 getComponent(); 120 component.enableComponents(enable); 121 122 } 123 124 public String getServletName(){ 125 return component.getServletName(); 126 } 127 128 public void setServletName(String name){ 129 component.setServletName(name); 130 } 131 132 public String getURLPattern(){ 133 return component.getURLPattern(); 134 } 135 136 public void setURLPattern(String pattern){ 137 component.setURLPattern(pattern); 138 } 139 140 public boolean validateXML(){ 141 return component.validateXML(); 142 } 143 144 public void setValidateXML(boolean ver){ 145 component.setValidateXML(ver); 146 } 147 148 public boolean verifyObjects(){ 149 return component.verifyObjects(); 150 } 151 152 public void setVerifyObjects(boolean val){ 153 component.setVerifyObjects(val); 154 } 155 156 public boolean packageJars(){ 157 return component.packageJars(); 158 } 159 160 } 161 | Popular Tags |