KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openide > loaders > TemplateWizardIteratorWrapper


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.openide.loaders;
21
22 import java.io.IOException JavaDoc;
23 import java.util.Set JavaDoc;
24 import javax.swing.event.ChangeListener JavaDoc;
25 import org.netbeans.api.progress.ProgressHandle;
26 import org.openide.WizardDescriptor;
27
28 /**
29  *
30  * @author Jiri Rechtacek
31  */

32 class TemplateWizardIteratorWrapper implements WizardDescriptor.Iterator<WizardDescriptor>, ChangeListener JavaDoc {
33
34     private TemplateWizardIterImpl iterImpl;
35     
36     /** Creates a new instance of TemplateWizardIteratorWrapper */
37     private TemplateWizardIteratorWrapper (TemplateWizardIterImpl iterImpl) {
38         this.iterImpl = iterImpl;
39     }
40     
41     public TemplateWizardIterImpl getOriginalIterImpl () {
42         return iterImpl;
43     }
44     
45     /** Resets the iterator to first screen.
46     */

47     public void first () {
48         iterImpl.first ();
49     }
50
51     /** Change the additional iterator.
52     */

53     public void setIterator (TemplateWizard.Iterator it, boolean notify) {
54         iterImpl.setIterator (it, notify);
55     }
56
57     /** Getter for current iterator.
58     */

59     public TemplateWizard.Iterator getIterator () {
60         return iterImpl.getIterator ();
61     }
62
63     /** Get the current panel.
64      * @return the panel
65      */

66     public WizardDescriptor.Panel<WizardDescriptor> current() {
67         return iterImpl.current ();
68     }
69
70
71     /** Get the name of the current panel.
72      * @return the name
73      */

74     public String JavaDoc name() {
75         return iterImpl.name ();
76     }
77
78     /** Test whether there is a next panel.
79      * @return <code>true</code> if so
80      */

81     public boolean hasNext() {
82         return iterImpl.hasNext ();
83     }
84
85     /** Test whether there is a previous panel.
86      * @return <code>true</code> if so
87      */

88     public boolean hasPrevious() {
89         return iterImpl.hasPrevious ();
90     }
91
92     /** Move to the next panel.
93      * I.e. increment its index, need not actually change any GUI itself.
94      * @exception NoSuchElementException if the panel does not exist
95      */

96     public void nextPanel() {
97         iterImpl.nextPanel ();
98     }
99
100     /** Move to the previous panel.
101      * I.e. decrement its index, need not actually change any GUI itself.
102      * @exception NoSuchElementException if the panel does not exist
103      */

104     public void previousPanel() {
105         iterImpl.previousPanel ();
106     }
107
108     /** Refires the info to listeners */
109     public void stateChanged(final javax.swing.event.ChangeEvent JavaDoc p1) {
110         iterImpl.stateChanged (p1);
111     }
112
113     /** Registers ChangeListener to receive events.
114      *@param listener The listener to register.
115      */

116     public synchronized void addChangeListener(javax.swing.event.ChangeListener JavaDoc listener) {
117         iterImpl.addChangeListener (listener);
118     }
119     /** Removes ChangeListener from the list of listeners.
120      *@param listener The listener to remove.
121      */

122     public synchronized void removeChangeListener (javax.swing.event.ChangeListener JavaDoc listener) {
123         iterImpl.removeChangeListener (listener);
124     }
125     
126     public void initialize (WizardDescriptor wiz) {
127         iterImpl.initialize (wiz);
128     }
129     
130     public void uninitialize() {
131         iterImpl.uninitialize ();
132     }
133     
134     public void uninitialize (WizardDescriptor wiz) {
135         iterImpl.uninitialize (wiz);
136     }
137     
138     public Set JavaDoc<DataObject> instantiate () throws IOException JavaDoc {
139         return iterImpl.instantiate ();
140     }
141     
142     public Set JavaDoc<DataObject> instantiate (ProgressHandle handle) throws IOException JavaDoc {
143         return iterImpl.instantiate (handle);
144     }
145     
146     static class InstantiatingIterator extends TemplateWizardIteratorWrapper implements WizardDescriptor.InstantiatingIterator<WizardDescriptor> {
147         public InstantiatingIterator (TemplateWizardIterImpl it) {
148             super (it);
149         }
150     }
151     
152     static class AsynchronousInstantiatingIterator extends InstantiatingIterator implements WizardDescriptor.AsynchronousInstantiatingIterator<WizardDescriptor> {
153         public AsynchronousInstantiatingIterator (TemplateWizardIterImpl it) {
154             super (it);
155         }
156     }
157     
158     static class ProgressInstantiatingIterator extends InstantiatingIterator implements WizardDescriptor.ProgressInstantiatingIterator<WizardDescriptor> {
159         private TemplateWizardIterImpl itImpl;
160         public ProgressInstantiatingIterator (TemplateWizardIterImpl it) {
161             super (it);
162             itImpl = it;
163         }
164     }
165     
166 }
167
Popular Tags