Source Code Cross Referenced for PreCreateBundleSummaryPanel.java in  » IDE-Netbeans » nbi » org » netbeans » installer » wizard » components » panels » 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.panels 
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.panels;
038:
039:        import java.awt.GridBagConstraints;
040:        import java.awt.Insets;
041:        import java.util.List;
042:        import javax.swing.border.EmptyBorder;
043:        import org.netbeans.installer.product.components.Product;
044:        import org.netbeans.installer.product.Registry;
045:        import org.netbeans.installer.utils.ResourceUtils;
046:        import org.netbeans.installer.utils.StringUtils;
047:        import org.netbeans.installer.utils.helper.swing.NbiLabel;
048:        import org.netbeans.installer.utils.helper.swing.NbiPanel;
049:        import org.netbeans.installer.utils.helper.swing.NbiTextPane;
050:        import org.netbeans.installer.wizard.ui.SwingUi;
051:        import org.netbeans.installer.wizard.ui.WizardUi;
052:        import org.netbeans.installer.wizard.components.WizardPanel;
053:        import org.netbeans.installer.wizard.components.WizardPanel.WizardPanelSwingUi;
054:        import org.netbeans.installer.wizard.components.WizardPanel.WizardPanelUi;
055:        import org.netbeans.installer.wizard.containers.SwingContainer;
056:
057:        /**
058:         *
059:         * @author Kirill Sorokin
060:         */
061:        public class PreCreateBundleSummaryPanel extends WizardPanel {
062:            /////////////////////////////////////////////////////////////////////////////////
063:            // Instance
064:            public PreCreateBundleSummaryPanel() {
065:                setProperty(TITLE_PROPERTY, DEFAULT_TITLE);
066:                setProperty(DESCRIPTION_PROPERTY, DEFAULT_DESCRIPTION);
067:
068:                setProperty(MESSAGE_TEXT_PROPERTY, DEFAULT_MESSAGE_TEXT);
069:                setProperty(MESSAGE_CONTENT_TYPE_PROPERTY,
070:                        DEFAULT_MESSAGE_CONTENT_TYPE);
071:                setProperty(COMPONENTS_TO_BUNDLE_LABEL_TEXT_PROPERTY,
072:                        DEFAULT_COMPONENTS_TO_BUNDLE_LABEL_TEXT);
073:                setProperty(COMPONENTS_TO_BUNDLE_TEXT_PROPERTY,
074:                        DEFAULT_COMPONENTS_TO_BUNDLE_TEXT);
075:                setProperty(COMPONENTS_TO_BUNDLE_CONTENT_TYPE_PROPERTY,
076:                        DEFAULT_COMPONENTS_TO_BUNDLE_CONTENT_TYPE);
077:                setProperty(COMPONENTS_LIST_SEPARATOR_PROPERTY,
078:                        DEFAULT_COMPONENTS_LIST_SEPARATOR);
079:                setProperty(DOWNLOAD_SIZE_LABEL_TEXT_PROPERTY,
080:                        DEFAULT_DOWNLOAD_SIZE_LABEL_TEXT);
081:                setProperty(REQUIRED_DISK_SPACE_LABEL_TEXT_PROPERTY,
082:                        DEFAULT_REQUIRED_DISK_SPACE_LABEL_TEXT);
083:                setProperty(CREATE_BUTTON_TEXT_PROPERTY,
084:                        DEFAULT_CREATE_BUTTON_TEXT);
085:            }
086:
087:            @Override
088:            public boolean canExecuteForward() {
089:                return Registry.getInstance().getProductsToInstall().size() > 0;
090:            }
091:
092:            @Override
093:            public boolean canExecuteBackward() {
094:                return Registry.getInstance().getProductsToInstall().size() > 0;
095:            }
096:
097:            @Override
098:            public WizardUi getWizardUi() {
099:                if (wizardUi == null) {
100:                    wizardUi = new PreCreateBundleSummaryPanelUi(this );
101:                }
102:
103:                return wizardUi;
104:            }
105:
106:            /////////////////////////////////////////////////////////////////////////////////
107:            // Inner Classes
108:            public static class PreCreateBundleSummaryPanelUi extends
109:                    WizardPanelUi {
110:                protected PreCreateBundleSummaryPanel component;
111:
112:                public PreCreateBundleSummaryPanelUi(
113:                        PreCreateBundleSummaryPanel component) {
114:                    super (component);
115:
116:                    this .component = component;
117:                }
118:
119:                @Override
120:                public SwingUi getSwingUi(SwingContainer container) {
121:                    if (swingUi == null) {
122:                        swingUi = new PreCreateBundleSummaryPanelSwingUi(
123:                                component, container);
124:                    }
125:
126:                    return super .getSwingUi(container);
127:                }
128:            }
129:
130:            public static class PreCreateBundleSummaryPanelSwingUi extends
131:                    WizardPanelSwingUi {
132:                protected PreCreateBundleSummaryPanel component;
133:
134:                private NbiTextPane messagePane;
135:                private NbiLabel componentsToBundleLabel;
136:                private NbiTextPane componentsToBundlePane;
137:                private NbiLabel downloadSizeLabel;
138:                private NbiLabel requiredDiskSpaceLabel;
139:
140:                private NbiPanel spacer;
141:
142:                public PreCreateBundleSummaryPanelSwingUi(
143:                        final PreCreateBundleSummaryPanel component,
144:                        final SwingContainer container) {
145:                    super (component, container);
146:
147:                    this .component = component;
148:
149:                    initComponents();
150:                }
151:
152:                // protected ////////////////////////////////////////////////////////////////
153:                @Override
154:                protected void initializeContainer() {
155:                    super .initializeContainer();
156:                    container.getNextButton().setText(
157:                            component.getProperty(CREATE_BUTTON_TEXT_PROPERTY));
158:                }
159:
160:                @Override
161:                protected void initialize() {
162:                    final String messageContentType = component
163:                            .getProperty(MESSAGE_CONTENT_TYPE_PROPERTY);
164:                    messagePane.setContentType(messageContentType);
165:
166:                    final String messageText = component
167:                            .getProperty(MESSAGE_TEXT_PROPERTY);
168:                    messagePane.setText(messageText);
169:
170:                    List<Product> componentsToBundle = Registry.getInstance()
171:                            .getProductsToInstall();
172:
173:                    componentsToBundleLabel.setVisible(true);
174:                    componentsToBundlePane.setVisible(true);
175:                    downloadSizeLabel.setVisible(true);
176:                    requiredDiskSpaceLabel.setVisible(true);
177:
178:                    final String componentsToInstallLabelText = component
179:                            .getProperty(COMPONENTS_TO_BUNDLE_LABEL_TEXT_PROPERTY);
180:                    componentsToBundleLabel
181:                            .setText(componentsToInstallLabelText);
182:
183:                    final String componentsToInstallContentType = component
184:                            .getProperty(COMPONENTS_TO_BUNDLE_CONTENT_TYPE_PROPERTY);
185:                    componentsToBundlePane
186:                            .setContentType(componentsToInstallContentType);
187:
188:                    final String componentsToInstallText = StringUtils
189:                            .format(
190:                                    component
191:                                            .getProperty(COMPONENTS_TO_BUNDLE_TEXT_PROPERTY),
192:                                    StringUtils
193:                                            .asString(
194:                                                    componentsToBundle,
195:                                                    component
196:                                                            .getProperty(COMPONENTS_LIST_SEPARATOR_PROPERTY)));
197:                    componentsToBundlePane.setText(componentsToInstallText);
198:
199:                    long downloadSize = 0;
200:                    for (Product component : componentsToBundle) {
201:                        downloadSize += component.getDownloadSize();
202:                    }
203:
204:                    long requiredDiskSpace = 0;
205:                    for (Product component : componentsToBundle) {
206:                        requiredDiskSpace += component.getRequiredDiskSpace();
207:                    }
208:
209:                    final String downloadSizeLabelText = StringUtils
210:                            .format(
211:                                    component
212:                                            .getProperty(DOWNLOAD_SIZE_LABEL_TEXT_PROPERTY),
213:                                    StringUtils.formatSize(downloadSize));
214:                    downloadSizeLabel.setText(downloadSizeLabelText);
215:
216:                    final String requiredDiskSpaceLabelText = StringUtils
217:                            .format(
218:                                    component
219:                                            .getProperty(REQUIRED_DISK_SPACE_LABEL_TEXT_PROPERTY),
220:                                    StringUtils.formatSize(requiredDiskSpace));
221:                    requiredDiskSpaceLabel.setText(requiredDiskSpaceLabelText);
222:                }
223:
224:                // private //////////////////////////////////////////////////////////////////
225:                private void initComponents() {
226:                    // messagePane //////////////////////////////////////////////////////////
227:                    messagePane = new NbiTextPane();
228:
229:                    // componentsToBundlePane ///////////////////////////////////////////////
230:                    componentsToBundlePane = new NbiTextPane();
231:
232:                    // componentsToBundleLabel //////////////////////////////////////////////
233:                    componentsToBundleLabel = new NbiLabel();
234:                    componentsToBundleLabel.setLabelFor(componentsToBundlePane);
235:
236:                    // downloadSizeLabel ////////////////////////////////////////////////////
237:                    downloadSizeLabel = new NbiLabel();
238:                    downloadSizeLabel.setFocusable(true);
239:
240:                    // requiredDiskSpaceLabel ///////////////////////////////////////////////
241:                    requiredDiskSpaceLabel = new NbiLabel();
242:                    requiredDiskSpaceLabel.setFocusable(true);
243:
244:                    // spacer ///////////////////////////////////////////////////////////////
245:                    spacer = new NbiPanel();
246:
247:                    // this /////////////////////////////////////////////////////////////////
248:                    add(messagePane, new GridBagConstraints(0, 0, // x, y
249:                            1, 1, // width, height
250:                            1.0, 0.0, // weight-x, weight-y
251:                            GridBagConstraints.CENTER, // anchor
252:                            GridBagConstraints.BOTH, // fill
253:                            new Insets(11, 11, 0, 11), // padding
254:                            0, 0)); // padx, pady - ???
255:                    add(componentsToBundleLabel, new GridBagConstraints(0, 2, // x, y
256:                            1, 1, // width, height
257:                            1.0, 0.0, // weight-x, weight-y
258:                            GridBagConstraints.CENTER, // anchor
259:                            GridBagConstraints.BOTH, // fill
260:                            new Insets(15, 11, 0, 11), // padding
261:                            0, 0)); // padx, pady - ???
262:                    add(componentsToBundlePane, new GridBagConstraints(0, 3, // x, y
263:                            1, 1, // width, height
264:                            1.0, 0.0, // weight-x, weight-y
265:                            GridBagConstraints.CENTER, // anchor
266:                            GridBagConstraints.BOTH, // fill
267:                            new Insets(3, 11, 0, 11), // padding
268:                            0, 0)); // padx, pady - ???
269:                    add(downloadSizeLabel, new GridBagConstraints(0, 4, // x, y
270:                            1, 1, // width, height
271:                            1.0, 0.0, // weight-x, weight-y
272:                            GridBagConstraints.CENTER, // anchor
273:                            GridBagConstraints.BOTH, // fill
274:                            new Insets(25, 11, 0, 11), // padding
275:                            0, 0)); // padx, pady - ???
276:                    add(requiredDiskSpaceLabel, new GridBagConstraints(0, 5, // x, y
277:                            1, 1, // width, height
278:                            1.0, 0.0, // weight-x, weight-y
279:                            GridBagConstraints.CENTER, // anchor
280:                            GridBagConstraints.BOTH, // fill
281:                            new Insets(3, 11, 0, 11), // padding
282:                            0, 0)); // padx, pady - ???
283:                    add(spacer, new GridBagConstraints(0, 6, // x, y
284:                            1, 1, // width, height
285:                            1.0, 1.0, // weight-x, weight-y
286:                            GridBagConstraints.CENTER, // anchor
287:                            GridBagConstraints.BOTH, // fill
288:                            new Insets(0, 11, 11, 11), // padding
289:                            0, 0)); // padx, pady - ???
290:                }
291:            }
292:
293:            /////////////////////////////////////////////////////////////////////////////////
294:            // Constants
295:            public static final String MESSAGE_TEXT_PROPERTY = "message.text"; // NOI18N
296:            public static final String MESSAGE_CONTENT_TYPE_PROPERTY = "message.content.type"; // NOI18N
297:            public static final String COMPONENTS_TO_BUNDLE_LABEL_TEXT_PROPERTY = "components.to.bundle.label.text"; // NOI18N
298:            public static final String COMPONENTS_TO_BUNDLE_TEXT_PROPERTY = "components.to.bundle.text"; // NOI18N
299:            public static final String COMPONENTS_TO_BUNDLE_CONTENT_TYPE_PROPERTY = "components.to.bundle.content.type"; // NOI18N
300:            public static final String COMPONENTS_LIST_SEPARATOR_PROPERTY = "components.list.separator"; // NOI18N
301:            public static final String DOWNLOAD_SIZE_LABEL_TEXT_PROPERTY = "download.size.label.text"; // NOI18N
302:            public static final String REQUIRED_DISK_SPACE_LABEL_TEXT_PROPERTY = "required.disk.space.label.text"; // NOI18N
303:            public static final String CREATE_BUTTON_TEXT_PROPERTY = "create.button.text"; // NOI18N
304:
305:            public static final String DEFAULT_MESSAGE_TEXT = ResourceUtils
306:                    .getString(PreCreateBundleSummaryPanel.class,
307:                            "PrCBSPmessage.text"); // NOI18N
308:            public static final String DEFAULT_MESSAGE_CONTENT_TYPE = ResourceUtils
309:                    .getString(PreCreateBundleSummaryPanel.class,
310:                            "PrCBSPmessage.content.type"); // NOI18N
311:            public static final String DEFAULT_COMPONENTS_TO_BUNDLE_LABEL_TEXT = ResourceUtils
312:                    .getString(PreCreateBundleSummaryPanel.class,
313:                            "PrCBSPcomponents.to.bundle.label.text"); // NOI18N
314:            public static final String DEFAULT_COMPONENTS_TO_BUNDLE_TEXT = ResourceUtils
315:                    .getString(PreCreateBundleSummaryPanel.class,
316:                            "PrCBSPcomponents.to.bundle.text"); // NOI18N
317:            public static final String DEFAULT_COMPONENTS_TO_BUNDLE_CONTENT_TYPE = ResourceUtils
318:                    .getString(PreCreateBundleSummaryPanel.class,
319:                            "PrCBSPcomponents.to.bundle.content.type"); // NOI18N
320:            public static final String DEFAULT_COMPONENTS_LIST_SEPARATOR = ResourceUtils
321:                    .getString(PreCreateBundleSummaryPanel.class,
322:                            "PrCBSPcomponents.list.separator"); // NOI18N
323:            public static final String DEFAULT_DOWNLOAD_SIZE_LABEL_TEXT = ResourceUtils
324:                    .getString(PreCreateBundleSummaryPanel.class,
325:                            "PrCBSPdownload.size.label.text"); // NOI18N
326:            public static final String DEFAULT_REQUIRED_DISK_SPACE_LABEL_TEXT = ResourceUtils
327:                    .getString(PreCreateBundleSummaryPanel.class,
328:                            "PrCBSPrequired.disk.space.label.text"); // NOI18N
329:            public static final String DEFAULT_CREATE_BUTTON_TEXT = ResourceUtils
330:                    .getString(PreCreateBundleSummaryPanel.class,
331:                            "PrCBSPcreate.button.text");//NOI18N
332:
333:            public static final String DEFAULT_TITLE = ResourceUtils.getString(
334:                    PreCreateBundleSummaryPanel.class, "PrCBSPdialog.title"); // NOI18N
335:            public static final String DEFAULT_DESCRIPTION = ResourceUtils
336:                    .getString(PreCreateBundleSummaryPanel.class,
337:                            "PrCBSPdialog.description"); // NOI18N    
338:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.