01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08: *
09: * When distributing Covered Code, include this CDDL Header Notice in each file
10: * and include the License file at http://www.netbeans.org/cddl.txt.
11: * If applicable, add the following below the CDDL Header, with the fields
12: * enclosed by brackets [] replaced by your own identifying information:
13: * "Portions Copyrighted [year] [name of copyright owner]"
14: *
15: * The Original Software is NetBeans. The Initial Developer of the Original
16: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17: * Microsystems, Inc. All Rights Reserved.
18: */
19:
20: package org.netbeans.installer.cluster;
21:
22: import com.installshield.wizard.WizardBeanEvent;
23: import com.installshield.wizard.swing.SwingWizardUI;
24: import com.installshield.wizardx.panels.TextDisplayPanel;
25: import com.installshield.util.Log;
26:
27: import java.awt.Component;
28:
29: import org.netbeans.installer.Util;
30:
31: public class NbWelcomePanel extends TextDisplayPanel {
32:
33: private static final String BUNDLE = "$L(org.netbeans.installer.cluster.Bundle,";
34:
35: public NbWelcomePanel() {
36: setTextSource(TEXT_PROPERTY);
37: setContentType(HTML_CONTENT_TYPE);
38: setDescription("");
39: }
40:
41: public boolean queryEnter(WizardBeanEvent evt) {
42: boolean okay = super .queryEnter(evt);
43: if (isJDKVersionSupported()) {
44: setText(resolveString(BUNDLE + "InstallWelcomePanel.text)"));
45: } else {
46: if (Util.isMacOSX()) {
47: setText(resolveString(BUNDLE
48: + "InstallWelcomePanel.error,"
49: + System.getProperty("java.version") + ","
50: + BUNDLE + "InstallWelcomePanel.jdkURLMacOSX))"));
51: } else {
52: setText(resolveString(BUNDLE
53: + "InstallWelcomePanel.error,"
54: + System.getProperty("java.version") + ","
55: + BUNDLE + "InstallWelcomePanel.jdkURL))"));
56: }
57: }
58: return okay;
59: }
60:
61: public boolean entered(WizardBeanEvent event) {
62: if (!isJDKVersionSupported()) {
63: if (event.getUserInterface() instanceof SwingWizardUI) {
64: SwingWizardUI ui = (SwingWizardUI) event
65: .getUserInterface();
66: Component nextButton = ui.getNavigationController()
67: .next();
68: nextButton.setEnabled(false);
69: ui.getNavigationController().setCancelType(
70: SwingWizardUI.NavigationController.CLOSE);
71: }
72: }
73: return true;
74: }
75:
76: private boolean isJDKVersionSupported() {
77: String javaSpecVer = System
78: .getProperty("java.specification.version");
79: logEvent(this , Log.DBG, "java.specification.version: "
80: + javaSpecVer);
81: if ("1.4".compareTo(javaSpecVer) >= 0) {
82: return false;
83: } else {
84: return true;
85: }
86: }
87:
88: }
|