1 19 20 package org.netbeans.modules.web.jsf.wizards; 21 22 import java.awt.Component ; 23 import java.io.IOException ; 24 import java.util.Collections ; 25 import java.util.List ; 26 import java.util.NoSuchElementException ; 27 import java.util.Set ; 28 import javax.swing.event.ChangeListener ; 29 import org.netbeans.api.java.project.JavaProjectConstants; 30 import org.netbeans.api.project.Project; 31 import org.netbeans.api.project.ProjectUtils; 32 import org.netbeans.api.project.SourceGroup; 33 import org.netbeans.modules.j2ee.common.DelegatingWizardDescriptorPanel; 34 import org.netbeans.modules.web.api.webmodule.WebModule; 42 import org.netbeans.modules.web.jsf.JSFConfigUtilities; 43 import org.netbeans.spi.project.ui.templates.support.Templates; 44 import org.openide.WizardDescriptor; 45 import org.openide.filesystems.FileObject; 46 import org.openide.loaders.DataFolder; 47 import org.openide.loaders.TemplateWizard; 48 import org.openide.util.HelpCtx; 49 import org.openide.util.NbBundle; 50 51 55 public class PersistenceClientIterator implements TemplateWizard.Iterator { 56 57 private int index; 58 private transient WizardDescriptor.Panel[] panels; 59 60 public Set instantiate(TemplateWizard wizard) throws IOException { 61 return null; 86 } 87 88 public void initialize(TemplateWizard wizard) { 89 } 116 117 private String [] createSteps(String [] before, WizardDescriptor.Panel[] panels) { 118 int diff = 0; 119 if (before == null) { 120 before = new String [0]; 121 } else if (before.length > 0) { 122 diff = ("...".equals (before[before.length - 1])) ? 1 : 0; } 124 String [] res = new String [ (before.length - diff) + panels.length]; 125 for (int i = 0; i < res.length; i++) { 126 if (i < (before.length - diff)) { 127 res[i] = before[i]; 128 } else { 129 res[i] = panels[i - before.length + diff].getComponent ().getName (); 130 } 131 } 132 return res; 133 } 134 135 public void uninitialize(TemplateWizard wiz) { 136 panels = null; 137 } 138 139 public WizardDescriptor.Panel current() { 140 return panels[index]; 141 } 142 143 public String name() { 144 return NbBundle.getMessage (PersistenceClientIterator.class, "LBL_WizardTitle_FromEntity"); 145 } 146 147 public boolean hasNext() { 148 return index < panels.length - 1; 149 } 150 151 public boolean hasPrevious() { 152 return index > 0; 153 } 154 155 public void nextPanel() { 156 if (! hasNext ()) throw new NoSuchElementException (); 157 index++; 158 } 159 160 public void previousPanel() { 161 if (! hasPrevious ()) throw new NoSuchElementException (); 162 index--; 163 } 164 165 public void addChangeListener(ChangeListener l) { 166 } 167 168 public void removeChangeListener(ChangeListener l) { 169 } 170 171 175 private class ValidationPanel extends DelegatingWizardDescriptorPanel { 176 177 private ValidationPanel(WizardDescriptor.Panel delegate) { 178 super(delegate); 179 } 180 181 public boolean isValid() { 182 Project project = getProject(); 183 WizardDescriptor wizardDescriptor = getWizardDescriptor(); 184 185 if (!org.netbeans.modules.j2ee.common.Util.isValidServerInstance(project)) { 187 wizardDescriptor.putProperty("WizardPanel_errorMessage", 188 NbBundle.getMessage(PersistenceClientIterator.class, "ERR_MissingServer")); return false; 190 } 191 192 return super.isValid(); 193 } 194 } 195 } 196 | Popular Tags |