Source Code Cross Referenced for AddToPaletteWizard.java in  » IDE-Netbeans » form » org » netbeans » modules » form » palette » 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 » form » org.netbeans.modules.form.palette 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.form.palette;
043:
044:        import java.util.ArrayList;
045:        import java.util.List;
046:        import javax.swing.event.ChangeListener;
047:
048:        import org.openide.*;
049:
050:        import org.netbeans.modules.form.project.ClassSource;
051:
052:        /**
053:         * A wizard allowing the user to add components to palette from a JAR file,
054:         * library, or a project. This class manages the whole wizard depending on the
055:         * type of source the user wants to choose from. There are three steps in the
056:         * wizard - selecting source, selecting components, and selecting palette
057:         * category.
058:         *
059:         * @author Tomas Pavek
060:         */
061:
062:        class AddToPaletteWizard extends WizardDescriptor {
063:
064:            ATPWizardIterator wizardIterator;
065:
066:            private List<? extends ClassSource.Entry> selectedFiles;
067:            private BeanInstaller.ItemInfo[] selectedBeans;
068:            private String selectedCategory;
069:            private Class<? extends ClassSource.Entry> sourceType;
070:
071:            private java.awt.Dialog dialog;
072:
073:            // ---------
074:
075:            public AddToPaletteWizard() {
076:                this (new ATPWizardIterator());
077:            }
078:
079:            private AddToPaletteWizard(ATPWizardIterator iterator) {
080:                wizardIterator = iterator;
081:
082:                putProperty("WizardPanel_autoWizardStyle", Boolean.TRUE); // NOI18N
083:                putProperty("WizardPanel_contentDisplayed", Boolean.TRUE); // NOI18N
084:                putProperty("WizardPanel_contentNumbered", Boolean.TRUE); // NOI18N
085:
086:                setTitle(PaletteUtils
087:                        .getBundleString("CTL_AddToPaletteWizard_Title")); // NOI18N
088:                setTitleFormat(new java.text.MessageFormat("{0}")); // NOI18N
089:            }
090:
091:            public boolean show(Class<? extends ClassSource.Entry> sourceType) {
092:                String firstStep_key;
093:                this .sourceType = sourceType;
094:                if (sourceType == ClassSource.JarEntry.class)
095:                    firstStep_key = "CTL_SelectJAR_Step"; // NOI18N
096:                else if (sourceType == ClassSource.LibraryEntry.class)
097:                    firstStep_key = "CTL_SelectLibrary_Step"; // NOI18N
098:                else if (sourceType == ClassSource.ProjectEntry.class)
099:                    firstStep_key = "CTL_SelectProject_Step"; // NOI18N
100:                else
101:                    throw new IllegalArgumentException();
102:
103:                putProperty(
104:                        "WizardPanel_contentData", // NOI18N
105:                        new String[] {
106:                                PaletteUtils.getBundleString(firstStep_key),
107:                                PaletteUtils
108:                                        .getBundleString("CTL_SelectBeans_Step"), // NOI18N
109:                                PaletteUtils
110:                                        .getBundleString("CTL_SelectCategory_Step") }); // NOI18N
111:
112:                wizardIterator.setSourceType(sourceType);
113:                setPanelsAndSettings(wizardIterator, this );
114:                updateState();
115:
116:                if (dialog == null)
117:                    dialog = DialogDisplayer.getDefault().createDialog(this );
118:                dialog.setVisible(true);
119:                dialog.dispose();
120:
121:                return getValue() == FINISH_OPTION;
122:            }
123:
124:            // -------
125:
126:            void stepToNext() {
127:                if (wizardIterator.hasNext()) {
128:                    wizardIterator.nextPanel();
129:                    updateState();
130:                }
131:            }
132:
133:            void setJARFiles(List<? extends ClassSource.Entry> files) {
134:                selectedFiles = files;
135:            }
136:
137:            /** @return the JAR files representing the selected source in the first
138:             * step of the wizard (i.e. a JAR file directly, library, or project) */
139:            List<? extends ClassSource.Entry> getJARFiles() {
140:                return selectedFiles;
141:            }
142:
143:            void setSelectedBeans(BeanInstaller.ItemInfo[] beans) {
144:                selectedBeans = beans;
145:            }
146:
147:            BeanInstaller.ItemInfo[] getSelectedBeans() {
148:                return selectedBeans;
149:            }
150:
151:            void setSelectedCategory(String name) {
152:                selectedCategory = name;
153:            }
154:
155:            String getSelectedCategory() {
156:                return selectedCategory;
157:            }
158:
159:            Class<? extends ClassSource.Entry> getSourceType() {
160:                return sourceType;
161:            }
162:
163:            // -------
164:
165:            /** Wizard iterator implementation for Add to Palette wizard */
166:            static class ATPWizardIterator implements 
167:                    WizardDescriptor.Iterator<AddToPaletteWizard> {
168:
169:                List<WizardDescriptor.Panel<AddToPaletteWizard>> panels = new ArrayList<WizardDescriptor.Panel<AddToPaletteWizard>>();
170:                int stage;
171:
172:                void setSourceType(Class<? extends ClassSource.Entry> sourceType) {
173:                    panels.clear();
174:                    if (sourceType == ClassSource.JarEntry.class)
175:                        panels.add(new ChooseJARWizardPanel());
176:                    else if (sourceType == ClassSource.LibraryEntry.class)
177:                        panels.add(new ChooseLibraryWizardPanel());
178:                    else if (sourceType == ClassSource.ProjectEntry.class)
179:                        panels.add(new ChooseProjectWizardPanel());
180:                    else
181:                        throw new IllegalArgumentException();
182:
183:                    panels.add(new ChooseBeansWizardPanel());
184:                    panels.add(new ChooseCategoryWizardPanel());
185:
186:                    stage = 1;
187:                }
188:
189:                static int getPanelsCount() {
190:                    return 3;
191:                }
192:
193:                // ------
194:                // WizardDescriptor.Iterator implementation
195:
196:                public WizardDescriptor.Panel<AddToPaletteWizard> current() {
197:                    return panels.get(stage - 1);
198:                }
199:
200:                public boolean hasNext() {
201:                    return stage < getPanelsCount();
202:                }
203:
204:                public boolean hasPrevious() {
205:                    return stage > 1;
206:                }
207:
208:                public java.lang.String name() {
209:                    return ""; // NOI18N
210:                }
211:
212:                public void nextPanel() {
213:                    if (stage < getPanelsCount())
214:                        stage++;
215:                }
216:
217:                public void previousPanel() {
218:                    if (stage > 1)
219:                        stage--;
220:                }
221:
222:                public void addChangeListener(ChangeListener listener) {
223:                }
224:
225:                public void removeChangeListener(ChangeListener listener) {
226:                }
227:            }
228:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.