Source Code Cross Referenced for JDBCWizardIterator.java in  » IDE-Netbeans » sql.project » org » netbeans » modules » jdbcwizard » wizards » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » sql.project » org.netbeans.modules.jdbcwizard.wizards 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the terms of the Common Development
003:         * and Distribution License (the License). You may not use this file except in
004:         * compliance with the License.
005:         * 
006:         * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007:         * or http://www.netbeans.org/cddl.txt.
008:         * 
009:         * When distributing Covered Code, include this CDDL Header Notice in each file
010:         * and include the License file at http://www.netbeans.org/cddl.txt.
011:         * If applicable, add the following below the CDDL Header, with the fields
012:         * enclosed by brackets [] replaced by your own identifying information:
013:         * "Portions Copyrighted [year] [name of copyright owner]"
014:         * 
015:         * The Original Software is NetBeans. The Initial Developer of the Original
016:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017:         * Microsystems, Inc. All Rights Reserved.
018:         */
019:
020:        /*
021:         * 
022:         * Copyright 2005 Sun Microsystems, Inc.
023:         * 
024:         * Licensed under the Apache License, Version 2.0 (the "License");
025:         * you may not use this file except in compliance with the License.
026:         * You may obtain a copy of the License at
027:         * 
028:         * 	http://www.apache.org/licenses/LICENSE-2.0
029:         * 
030:         * Unless required by applicable law or agreed to in writing, software
031:         * distributed under the License is distributed on an "AS IS" BASIS,
032:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
033:         * See the License for the specific language governing permissions and
034:         * limitations under the License.
035:         * 
036:         */
037:        package org.netbeans.modules.jdbcwizard.wizards;
038:
039:        import java.awt.Component;
040:        import java.io.IOException;
041:        import javax.swing.JComponent;
042:        import org.openide.WizardDescriptor;
043:
044:        import javax.swing.event.ChangeEvent;
045:        import javax.swing.event.ChangeListener;
046:        import java.util.HashSet;
047:        import java.util.Iterator;
048:        import java.util.List;
049:        import java.util.NoSuchElementException;
050:        import java.util.Set;
051:
052:        /**
053:         * A wizard iterator (sequence of panels). Used to create a wizard. Create one or more panels from
054:         * template as needed too.
055:         */
056:        public abstract class JDBCWizardIterator implements 
057:                WizardDescriptor.InstantiatingIterator {
058:
059:            /** Tracks index of current panel */
060:            protected transient int index = 0;
061:
062:            /* Set <ChangeListener> */
063:            private final transient Set listeners = new HashSet(1);
064:
065:            /* Contains panels to be iterated */
066:            private transient WizardDescriptor.Panel[] panels = null;
067:
068:            private transient WizardDescriptor wiz;
069:
070:            private transient WizardDescriptor.Iterator simpleIterator;
071:
072:            /**
073:             * 
074:             *
075:             */
076:            public JDBCWizardIterator() {
077:            }
078:
079:            // If something changes dynamically (besides moving between panels),
080:            // e.g. the number of panels changes in response to user input, then
081:            // implement fireChangeEvent().
082:
083:            /**
084:             * @see org.openide.WizardDescriptor.Iterator#addChangeListener
085:             */
086:            public final void addChangeListener(final ChangeListener l) {
087:
088:                synchronized (this .listeners) {
089:                    this .listeners.add(l);
090:                }
091:                // getSimpleIterator().addChangeListener(l);
092:            }
093:
094:            public int getIndex() {
095:                return this .index;
096:            }
097:
098:            /**
099:             * @see org.openide.WizardDescriptor.Iterator#current
100:             */
101:            public WizardDescriptor.Panel current() {
102:                return this .getPanels(this .wiz)[this .index];
103:                // return getSimpleIterator().current();
104:            }
105:
106:            /**
107:             * @see org.openide.WizardDescriptor.Iterator#hasNext
108:             */
109:            public boolean hasNext() {
110:                return this .index < this .getPanels(this .wiz).length - 1;
111:                // return getSimpleIterator().hasNext();
112:            }
113:
114:            /**
115:             * @see org.openide.WizardDescriptor.Iterator#hasPrevious
116:             */
117:            public boolean hasPrevious() {
118:                return this .index > 0;
119:                // return getSimpleIterator().hasPrevious();
120:            }
121:
122:            /**
123:             * @see org.openide.WizardDescriptor.Iterator#name
124:             */
125:            public abstract String name();
126:
127:            /**
128:             * @see org.openide.WizardDescriptor.Iterator#nextPanel
129:             */
130:            public void nextPanel() {
131:                if (!this .hasNext()) {
132:                    throw new NoSuchElementException();
133:                }
134:
135:                this .index++;
136:                // getSimpleIterator().nextPanel();
137:            }
138:
139:            /**
140:             * @see org.openide.WizardDescriptor.Iterator#previousPanel
141:             */
142:            public void previousPanel() {
143:                if (!this .hasPrevious()) {
144:                    throw new NoSuchElementException();
145:                }
146:
147:                this .index--;
148:                // getSimpleIterator().previousPanel();
149:            }
150:
151:            /**
152:             * @see org.openide.WizardDescriptor.Iterator#removeChangeListener
153:             */
154:            public final void removeChangeListener(final ChangeListener l) {
155:                synchronized (this .listeners) {
156:                    this .listeners.remove(l);
157:                }
158:                // getSimpleIterator().removeChangeListener(l);
159:            }
160:
161:            /**
162:             * Creates list of panels to be displayed.
163:             * 
164:             * @return List of panels
165:             */
166:            protected abstract List createPanels(WizardDescriptor wiz);
167:
168:            /**
169:             * Creates array of step descriptions
170:             * 
171:             * @return array of Strings representing task summaries for each panel
172:             */
173:            protected abstract String[] createSteps();
174:
175:            /**
176:             * Gets panels to be displayed.
177:             * 
178:             * @return array of WizardDescriptor.Panel objects
179:             */
180:            protected final WizardDescriptor.Panel[] getPanels(
181:                    final WizardDescriptor wiz) {
182:                if (this .panels == null) {
183:                    final List myPanels = this .createPanels(wiz);
184:
185:                    final WizardDescriptor.Panel[] pnlArray = new WizardDescriptor.Panel[myPanels
186:                            .size()];
187:                    this .panels = (WizardDescriptor.Panel[]) myPanels
188:                            .toArray(pnlArray);
189:                }
190:                return this .panels;
191:            }
192:
193:            /**
194:             * Gets list of steps corresponding to each panel
195:             * 
196:             * @return array of Strings summarizing the task in each panel
197:             */
198:            protected final String[] getSteps() {
199:                return this .createSteps();
200:            }
201:
202:            public void initialize(final WizardDescriptor wiz) {
203:                this .panels = this .getPanels(wiz);
204:                this .wiz = wiz;
205:
206:                final Object prop = wiz.getProperty("WizardPanel_contentData"); // NOI18N
207:                if (prop != null && prop instanceof  String[]) {
208:                }
209:                final String[] steps = this .createSteps();
210:                for (int i = 0; i < this .panels.length; i++) {
211:                    final Component c = this .panels[i].getComponent();
212:                    if (steps[i] == null) {
213:                        // Default step name to component name of panel.
214:                        // Mainly useful for getting the name of the target
215:                        // chooser to appear in the list of steps.
216:                        steps[i] = c.getName();
217:                    }
218:                    if (c instanceof  JComponent) { // assume Swing components
219:                        final JComponent jc = (JComponent) c;
220:                        // Step #.
221:                        jc.putClientProperty(
222:                                "WizardPanel_contentSelectedIndex", Integer
223:                                        .valueOf(String.valueOf(i))); // NOI18N
224:                        // Step name (actually the whole list for reference).
225:                        jc.putClientProperty("WizardPanel_contentData", steps); // NOI18N
226:                    }
227:                }
228:            }
229:
230:            public void uninitialize(final WizardDescriptor wiz) {
231:                this .wiz = null;
232:                this .panels = null;
233:            }
234:
235:            public Set instantiate() throws IOException {
236:                return new HashSet();
237:            }
238:
239:            protected WizardDescriptor.Iterator getSimpleIterator() {
240:                if (simpleIterator == null) {
241:                    assert (panels != null) && (panels.length > 0);
242:                    simpleIterator = new WizardDescriptor.ArrayIterator(panels);
243:
244:                }
245:
246:                return simpleIterator;
247:            }
248:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.