1 19 20 23 24 package org.netbeans.modules.j2ee.sun.ws7.serverresources.wizards; 25 26 import java.awt.Component ; 27 import java.util.Set ; 28 import javax.swing.JComponent ; 29 import java.io.InputStream ; 30 import javax.swing.event.ChangeEvent ; 31 import javax.swing.event.ChangeListener ; 32 33 import org.openide.util.NbBundle; 34 import org.openide.WizardDescriptor; 35 import org.netbeans.api.project.Project; 36 import org.openide.filesystems.FileObject; 37 import org.netbeans.spi.project.ui.templates.support.Templates; 38 import org.openide.WizardDescriptor; 39 40 import org.netbeans.modules.j2ee.sun.sunresources.beans.Wizard; 41 import org.netbeans.modules.j2ee.sun.ws7.serverresources.beans.WS70ResourceUtils; 42 43 47 public class MailResourceWizard extends AbstractResourceWizard{ 48 private static final String DATAFILE = "org/netbeans/modules/j2ee/sun/ws7/serverresources/wizards/MailWizard.xml"; 50 private Wizard wizardInfo; 51 private ResourceConfigHelper helper; 52 private transient WizardDescriptor wizard; 53 private transient String [] steps; 54 private static Project project; 55 56 public static MailResourceWizard create(){ 57 return new MailResourceWizard(); 58 } 59 60 public void initialize(WizardDescriptor wizard){ 61 wizardInfo = getWizardInfo(DATAFILE); 62 this.helper = new ResourceConfigHelperHolder().getMailHelper(); 63 64 this.wizard = wizard; 65 wizard.putProperty("NewFileWizard_Title", 66 NbBundle.getMessage(MailResourceWizard.class, "Templates/SunWS70Resources/JavaMail_Resource")); index = 0; 68 69 project = Templates.getProject(wizard); 70 71 panels = createPanels(); 72 steps = createSteps(); 74 75 try{ 76 FileObject pkgLocation = project.getProjectDirectory(); 77 if (pkgLocation != null) { 78 this.helper.getData().setTargetFileObject(pkgLocation); 79 } 80 }catch (Exception ex){ 81 } 83 84 for (int i = 0; i < panels.length; i++) { 85 Component c = panels[i].getComponent(); 86 if (c instanceof JComponent ) { JComponent jc = (JComponent )c; 88 jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer (i)); jc.putClientProperty("WizardPanel_contentData", steps); } 93 } 94 } 95 public Set instantiate(){ 96 try{ 97 WS70ResourceUtils.saveMailResourceDatatoXml(this.helper.getData()); 98 }catch (Exception ex){ 99 } 101 return java.util.Collections.EMPTY_SET; 102 103 } 104 public void uninitialize(WizardDescriptor wizard){ 105 106 } 107 108 109 110 public String name(){ 111 return NbBundle.getMessage(MailResourceWizard.class, "Templates/SunWS70Resources/JavaMail_Resource"); } 113 114 private WizardDescriptor.Panel[] createPanels() { 115 return new WizardDescriptor.Panel[] { 116 new CommonGeneralFinishPanel(helper, wizardInfo, new String [] {"general", "advanced"}) 118 }; 119 } 120 121 private String [] createSteps() { 122 return new String [] { 123 WS70WizardConstants.__FirstStepChoose, 124 NbBundle.getMessage(MailResourceWizard.class, "TITLE_GeneralAttributes_MAIL"), }; 126 } 127 128 } 129 | Popular Tags |