Source Code Cross Referenced for GroupIterator.java in  » Portal » Open-Portal » com » sun » portal » ffj » 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 » Portal » Open Portal » com.sun.portal.ffj.wizards 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
003:         * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
004:         */
005:
006:        package com.sun.portal.ffj.wizards;
007:
008:        import java.util.Set;
009:        import java.util.Collections;
010:        import java.util.Enumeration;
011:
012:        import java.io.IOException;
013:        import java.io.ObjectStreamException;
014:        import java.io.File;
015:
016:        import java.awt.Component;
017:
018:        import javax.swing.event.ChangeListener;
019:
020:        import org.openide.WizardDescriptor;
021:        import org.openide.TopManager;
022:        import org.openide.ErrorManager;
023:        import org.openide.NotifyDescriptor;
024:
025:        import org.openide.util.NbBundle;
026:
027:        import org.openide.execution.NbClassPath;
028:
029:        import org.openide.loaders.TemplateWizard;
030:        import org.openide.loaders.DataObject;
031:        import org.openide.loaders.DataFolder;
032:
033:        import org.openide.filesystems.FileSystem;
034:        import org.openide.filesystems.Repository;
035:        import org.openide.filesystems.LocalFileSystem;
036:        import org.openide.filesystems.FileObject;
037:
038:        import com.sun.portal.ffj.filesystems.PSFileSystem;
039:
040:        import com.sun.portal.ffj.util.PSConstants;
041:        import com.sun.portal.ffj.util.PortletWebInf;
042:
043:        /** Iterator implementation which can iterate through three
044:         * panels which forms jar template wizard
045:         */
046:        public final class GroupIterator implements  TemplateWizard.Iterator,
047:                PSConstants {
048:
049:            /** No need to be public, access is provided through singleton()
050:             * method call */
051:            private GroupIterator() {
052:                super ();
053:            }
054:
055:            /** @return Returns singleton instance of this iterator */
056:            public static GroupIterator singleton() {
057:                if (m_Singleton == null) {
058:                    m_Singleton = new GroupIterator();
059:                }
060:                return m_Singleton;
061:            }
062:
063:            //
064:            // WizardDescriptorInterface methods implemented here.
065:            //
066:
067:            public void initialize(TemplateWizard tw) {
068:                if (m_ArrayIterator == null) {
069:                    initializePanelNames();
070:                    Component panel = tw.targetChooser().getComponent();
071:                    if (panel instanceof  javax.swing.JComponent) {
072:                        ((javax.swing.JComponent) panel).putClientProperty(
073:                                "WizardPanel_contentData", m_PanelNames);//NOI18N
074:                    }
075:
076:                    // build the array of panels
077:                    WizardDescriptor.Panel[] panelArray = initializePanels(tw);
078:                    m_ArrayIterator = new WizardDescriptor.ArrayIterator(
079:                            panelArray);
080:                }
081:            }
082:
083:            /** Initializes all panels of jar wizard. */
084:            protected WizardDescriptor.Panel[] initializePanels(
085:                    TemplateWizard tw) {
086:                m_TemplateWizard = tw;
087:                WizardDescriptor.Panel[] panelArray = new WizardDescriptor.Panel[1];
088:                panelArray[0] = tw.targetChooser();
089:                return panelArray;
090:            }
091:
092:            public void initializePanelNames() {
093:                if (m_PanelNames == null) {
094:                    m_PanelNames = new String[1];
095:                    m_PanelNames[0] = "";
096:                }
097:            }
098:
099:            public void uninitialize(TemplateWizard tw) {
100:                m_TemplateWizard = null;
101:                m_ArrayIterator = null;
102:            }
103:
104:            public String name() {
105:                return NbBundle.getMessage(GroupIterator.class,
106:                        "GroupWizard.Title");
107:            }
108:
109:            public Set instantiate(TemplateWizard wiz) throws IOException {
110:
111:                // force creation of filesystem, if it has to happen, before we create.
112:
113:                PSFileSystem.getPSFilesystem(true);
114:
115:                // Just do default template creation, with a name check.
116:
117:                String nm = wiz.getTargetName();
118:                DataFolder fold = wiz.getTargetFolder();
119:                DataObject tpl = wiz.getTemplate();
120:
121:                if (!nameLegal(nm)) {
122:                    TopManager.getDefault().notify(
123:                            new NotifyDescriptor.Message(NbBundle.getMessage(
124:                                    GroupIterator.class,
125:                                    "GroupWizard.NotJavaID"),
126:                                    NotifyDescriptor.INFORMATION_MESSAGE));
127:                    return Collections.singleton(null);
128:                }
129:
130:                DataObject obj = tpl.createFromTemplate(fold, nm);
131:
132:                return java.util.Collections.singleton(obj);
133:            }
134:
135:            //
136:            // WizardDescriptorInterface methods delegated to the ArrayIterator
137:            //
138:
139:            /* The current panel.
140:             */
141:            public WizardDescriptor.Panel current() {
142:                return m_ArrayIterator.current();
143:            }
144:
145:            /* Is there a next panel?
146:             * @return true if so
147:             */
148:            public boolean hasNext() {
149:                return m_ArrayIterator.hasNext();
150:            }
151:
152:            /* Is there a previous panel?
153:             * @return true if so
154:             */
155:            public boolean hasPrevious() {
156:                return m_ArrayIterator.hasNext();
157:            }
158:
159:            /* Moves to the next panel.
160:             * @exception NoSuchElementException if the panel does not exist
161:             */
162:            public synchronized void nextPanel() {
163:                m_ArrayIterator.nextPanel();
164:            }
165:
166:            /* Moves to previous panel.
167:             * @exception NoSuchElementException if the panel does not exist
168:             */
169:            public synchronized void previousPanel() {
170:                m_ArrayIterator.previousPanel();
171:            }
172:
173:            /* Ignores the listener, there are no changes in order of panels.
174:             */
175:            public void addChangeListener(ChangeListener l) {
176:                m_ArrayIterator.addChangeListener(l);
177:            }
178:
179:            /* Ignored.
180:             */
181:            public void removeChangeListener(ChangeListener l) {
182:                m_ArrayIterator.removeChangeListener(l);
183:            }
184:
185:            private boolean nameLegal(String nm) {
186:                if (nm == null) {
187:                    return false;
188:                }
189:                char c1 = nm.charAt(0);
190:                if (!Character.isJavaIdentifierStart(c1)) {
191:                    return false;
192:                }
193:                for (int i = 1; i < nm.length(); ++i) {
194:                    char ci = nm.charAt(i);
195:                    if (!Character.isJavaIdentifierPart(ci)) {
196:                        return false;
197:                    }
198:                }
199:                return true;
200:            }
201:
202:            private transient TemplateWizard m_TemplateWizard = null;
203:            private transient String[] m_PanelNames = null;
204:
205:            //
206:            // This gets created in the call to initialize(TemplateWizard)
207:            //
208:            private WizardDescriptor.ArrayIterator m_ArrayIterator = null;
209:
210:            private static GroupIterator m_Singleton;
211:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.