1 19 package org.netbeans.modules.apisupport.metainfservices; 20 21 import java.awt.Component ; 22 import java.util.NoSuchElementException ; 23 import javax.swing.JComponent ; 24 import javax.swing.event.ChangeListener ; 25 import org.openide.WizardDescriptor; 26 27 public final class ExportWizardIterator implements WizardDescriptor.Iterator { 28 29 46 47 private int index; 48 49 private WizardDescriptor.Panel[] panels; 50 51 55 private WizardDescriptor.Panel[] getPanels() { 56 if (panels == null) { 57 panels = new WizardDescriptor.Panel[] { 58 new ExportWizardPanel1(), 59 }; 60 String [] steps = new String [panels.length]; 61 for (int i = 0; i < panels.length; i++) { 62 Component c = panels[i].getComponent(); 63 steps[i] = c.getName(); 65 if (c instanceof JComponent ) { JComponent jc = (JComponent ) c; 67 jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer (i)); 69 jc.putClientProperty("WizardPanel_contentData", steps); 71 jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE); 73 jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE); 75 jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE); 77 } 78 } 79 } 80 return panels; 81 } 82 83 public WizardDescriptor.Panel current() { 84 return getPanels()[index]; 85 } 86 87 public String name() { 88 return index + 1 + ". from " + getPanels().length; 89 } 90 91 public boolean hasNext() { 92 return index < getPanels().length - 1; 93 } 94 95 public boolean hasPrevious() { 96 return index > 0; 97 } 98 99 public void nextPanel() { 100 if (!hasNext()) { 101 throw new NoSuchElementException (); 102 } 103 index++; 104 } 105 106 public void previousPanel() { 107 if (!hasPrevious()) { 108 throw new NoSuchElementException (); 109 } 110 index--; 111 } 112 113 public void addChangeListener(ChangeListener l) {} 115 public void removeChangeListener(ChangeListener l) {} 116 117 143 144 } 145 | Popular Tags |