Source Code Cross Referenced for WizardPanel.java in  » IDE-Netbeans » nbi » org » netbeans » installer » wizard » components » 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 » nbi » org.netbeans.installer.wizard.components 
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 General
007:         * Public License Version 2 only ("GPL") or the Common Development and Distribution
008:         * License("CDDL") (collectively, the "License"). You may not use this file except in
009:         * compliance with the License. You can obtain a copy of the License at
010:         * http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
011:         * License for the specific language governing permissions and limitations under the
012:         * License.  When distributing the software, include this License Header Notice in
013:         * each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP.  Sun
014:         * designates this particular file as subject to the "Classpath" exception as
015:         * provided by Sun in the GPL Version 2 section of the License file that
016:         * accompanied this code. If applicable, add the following below the License Header,
017:         * with the fields enclosed by brackets [] replaced by your own identifying
018:         * information: "Portions Copyrighted [year] [name of copyright owner]"
019:         * 
020:         * Contributor(s):
021:         * 
022:         * The Original Software is NetBeans. The Initial Developer of the Original Software
023:         * is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
024:         * Rights Reserved.
025:         * 
026:         * If you wish your version of this file to be governed by only the CDDL or only the
027:         * GPL Version 2, indicate your decision by adding "[Contributor] elects to include
028:         * this software in this distribution under the [CDDL or GPL Version 2] license." If
029:         * you do not indicate a single choice of license, a recipient has the option to
030:         * distribute your version of this file under either the CDDL, the GPL Version 2 or
031:         * to extend the choice of license to its licensees as provided above. However, if
032:         * you add GPL Version 2 code and therefore, elected the GPL Version 2 license, then
033:         * the option applies only if the new code is made subject to such option by the
034:         * copyright holder.
035:         */
036:
037:        package org.netbeans.installer.wizard.components;
038:
039:        import org.netbeans.installer.utils.ErrorManager;
040:        import org.netbeans.installer.utils.helper.UiMode;
041:        import org.netbeans.installer.wizard.containers.SwingContainer;
042:        import org.netbeans.installer.wizard.ui.SwingUi;
043:        import org.netbeans.installer.wizard.ui.WizardUi;
044:
045:        /**
046:         * This class is a specialization of the {@link WizardComponent} which defines 
047:         * behavior specific to panels.
048:         * 
049:         * <p>
050:         * A panel is the most typical wizard component. It's behavioral capabilities are 
051:         * extremely limited and hence the only thing that a anel can do is to display a 
052:         * bunch of input fields requiing to enter some data. On the other hand a panel can 
053:         * be used to inform the user about an event and require him to perform some action 
054:         * before the wizard proceeds.
055:         * 
056:         * @author Kirill Sorokin
057:         * @since 1.0
058:         */
059:        public abstract class WizardPanel extends WizardComponent {
060:            /////////////////////////////////////////////////////////////////////////////////
061:            // Instance
062:            /**
063:             * UI of the panel.
064:             */
065:            protected WizardUi wizardUi;
066:
067:            /**
068:             * Creates a new instance of {@link WizardPanel}. This is the default 
069:             * <code>protected</code> constructor which must be called by the concrete
070:             * implementations.
071:             */
072:            protected WizardPanel() {
073:                // does nothing
074:            }
075:
076:            /**
077:             * Executes the panel when it is read via a call to 
078:             * {@link org.netbeans.installer.wizard.Wizard#next()}. When the wizard is run 
079:             * in a GUI mode, no action is taken as all the functionality of a panel is 
080:             * contained in its UI. When the wizard is run in a silent mode, running this 
081:             * method automatically calls 
082:             * {@link org.netbeans.installer.wizard.Wizard#next()}.
083:             * 
084:             * @see WizardComponent#executeForward()
085:             */
086:            public final void executeForward() {
087:                // since silent mode does not assume any user interaction we just move 
088:                // forward
089:                if (UiMode.getCurrentUiMode() == UiMode.SILENT) {
090:                    getWizard().next();
091:                }
092:            }
093:
094:            /**
095:             * Executes the panel when it is read via a call to 
096:             * {@link org.netbeans.installer.wizard.Wizard#previous()}. When the wizard is 
097:             * run in a GUI mode, no action is taken as all the functionality of a panel is 
098:             * contained in its UI.
099:             * 
100:             * @see WizardComponent#executeForward()
101:             */
102:            public final void executeBackward() {
103:                // does nothing
104:            }
105:
106:            /**
107:             * The default implementation of this method for {@link WizardPanel} has an 
108:             * empty body. Concrete implementations are expected to override this method
109:             * if they require any custom initialization.
110:             * 
111:             * @see WizardComponent#initialize()
112:             */
113:            public void initialize() {
114:                // does nothing
115:            }
116:
117:            /**
118:             * {@inheritDoc}
119:             */
120:            public WizardUi getWizardUi() {
121:                if (wizardUi == null) {
122:                    wizardUi = new WizardPanelUi(this );
123:                }
124:
125:                return wizardUi;
126:            }
127:
128:            /////////////////////////////////////////////////////////////////////////////////
129:            // Inner Classes
130:            /**
131:             * Implementation of the {@link WizardUi} for {@link WizardPanel}.
132:             * 
133:             * @author Kirill Sorokin
134:             * @since 1.0
135:             */
136:            public static class WizardPanelUi extends WizardComponentUi {
137:                /**
138:                 * Current {@link WizardPanel} for this UI.
139:                 */
140:                protected WizardPanel panel;
141:
142:                /**
143:                 * Creates a new instance of {@link WizardPanelUi}, initializing it with
144:                 * the specified instance of {@link WizardPanel}.
145:                 * 
146:                 * @param panel Instance of {@link WizardPanel} which should be used 
147:                 *      by this UI.
148:                 */
149:                public WizardPanelUi(final WizardPanel panel) {
150:                    super (panel);
151:
152:                    this .panel = panel;
153:                }
154:
155:                /**
156:                 * {@inheritDoc}
157:                 */
158:                @Override
159:                public SwingUi getSwingUi(final SwingContainer container) {
160:                    if (swingUi == null) {
161:                        swingUi = new WizardPanelSwingUi(panel, container);
162:                    }
163:
164:                    return super .getSwingUi(container);
165:                }
166:            }
167:
168:            /**
169:             * Implementation of {@link SwingUi} for {@link WizardPanel}.
170:             * 
171:             * @author Kirill Sorokin
172:             * @since 1.0
173:             */
174:            public static class WizardPanelSwingUi extends
175:                    WizardComponentSwingUi {
176:                /**
177:                 * Current {@link WizardPanel} for this UI.
178:                 */
179:                protected WizardPanel panel;
180:
181:                /**
182:                 * Creates a new instance of {@link WizardPanelSwingUi}, initializing it 
183:                 * with the specified instances of {@link WizardPanel} and 
184:                 * {@link SwingContainer}.
185:                 * 
186:                 * @param panel Instance of {@link WizardPanel} which should be used 
187:                 *      by this UI.
188:                 * @param container Instance of {@link SwingContainer} which should be used 
189:                 *      by this UI.
190:                 */
191:                public WizardPanelSwingUi(final WizardPanel panel,
192:                        final SwingContainer container) {
193:                    super (panel, container);
194:
195:                    this .panel = panel;
196:                }
197:
198:                /**
199:                 * {@inheritDoc}
200:                 */
201:                @Override
202:                public void evaluateBackButtonClick() {
203:                    if (validateInput() == null) {
204:                        saveInput();
205:                    }
206:
207:                    component.getWizard().previous();
208:                }
209:
210:                /**
211:                 * {@inheritDoc}
212:                 */
213:                @Override
214:                public void evaluateNextButtonClick() {
215:                    String errorMessage = validateInput();
216:
217:                    if (errorMessage == null) {
218:                        saveInput();
219:                        component.getWizard().next();
220:                    } else {
221:                        ErrorManager.notifyError(errorMessage);
222:                    }
223:                }
224:
225:                // protected ////////////////////////////////////////////////////////////////
226:                /**
227:                 * Saves the user input to the wizard's property container. This method does
228:                 * not perform any additional validation of the input as it will be
229:                 * validated prior to calling this method - in {@link #validateInput()}
230:                 */
231:                protected void saveInput() {
232:                    // does nothing
233:                }
234:
235:                /**
236:                 * Validates the user input. This method performs the validatation of the
237:                 * data input by the user on this panel. It either passed the input data to
238:                 * the component for validation, or takes the risk and validates the data
239:                 * itself.
240:                 *
241:                 * @return Error message which describes what is incorrect with the user
242:                 *      input, or <code>null</code> if the user input is correct.
243:                 */
244:                protected String validateInput() {
245:                    return null; // null means that everything is OK
246:                }
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.