From 4cd4ffb2771ea2d133b30273b1ffea0fef6b4552 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Tue, 17 Apr 2007 20:23:12 +0000
Subject: [PATCH] This commit introduces preliminary versions of the upgrader tool's GUI wizard panels. Effort has been made to make the panels conform to the design at
---
opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties | 71 +
opends/src/quicksetup/org/opends/quicksetup/ui/ReviewPanel.java | 295 -------
opends/src/quicksetup/org/opends/quicksetup/ui/CurrentStepPanel.java | 8
opends/src/quicksetup/org/opends/quicksetup/ui/ConfirmUninstallPanel.java | 27
opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java | 3
opends/src/quicksetup/org/opends/quicksetup/ui/ButtonsPanel.java | 80 +-
opends/src/quicksetup/org/opends/quicksetup/Step.java | 15
opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java | 183 +++++
opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/WelcomePanel.java | 208 +++++
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java | 13
opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java | 303 ++++++++
opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java | 23
opends/src/quicksetup/org/opends/quicksetup/ui/Utilities.java | 76 ++
opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java | 44 -
opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupPanel.java | 15
opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java | 92 ++
opends/src/quicksetup/org/opends/quicksetup/DefaultDataOptions.java | 56 +
opends/src/quicksetup/org/opends/quicksetup/ui/ServerSettingsPanel.java | 15
opends/src/quicksetup/org/opends/quicksetup/ui/InstallWelcomePanel.java | 6
opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupDialog.java | 18
opends/src/quicksetup/org/opends/quicksetup/ui/StepsPanel.java | 7
opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java | 61 -
opends/src/quicksetup/org/opends/quicksetup/ui/DataOptionsPanel.java | 41
opends/src/quicksetup/org/opends/quicksetup/ui/ProgressPanel.java | 5
opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java | 6
opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupErrorPanel.java | 6
opends/resource/upgrade | 5
opends/src/quicksetup/org/opends/quicksetup/SplashScreen.java | 4
opends/src/quicksetup/org/opends/quicksetup/ui/FieldName.java | 3
opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/UpgraderReviewPanel.java | 138 +++
opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java | 4
opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java | 166 ++++
opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java | 65 +
opends/src/quicksetup/org/opends/quicksetup/Application.java | 11
34 files changed, 1,517 insertions(+), 556 deletions(-)
diff --git a/opends/resource/upgrade b/opends/resource/upgrade
index b8b2872..db99987 100644
--- a/opends/resource/upgrade
+++ b/opends/resource/upgrade
@@ -141,13 +141,10 @@
# Configure the appropriate CLASSPATH.
# Unlike BuildExtractor, the Upgrader uses
# the newly extracted build's jars.
- CLASSPATH=${INSTANCE_ROOT}/tmp/upgrade/classes
for JAR in ${INSTANCE_ROOT}/tmp/upgrade/lib/*.jar
do
- CLASSPATH=${CLASSPATH}:${JAR}
+ CLASSPATH=${JAR}:${CLASSPATH}
done
- export CLASSPATH
- echo ${CLASSPATH}
# Launch the upgrade process.
"${JAVA_BIN}" org.opends.quicksetup.upgrader.UpgradeLauncher "${@}"
diff --git a/opends/src/quicksetup/org/opends/quicksetup/Application.java b/opends/src/quicksetup/org/opends/quicksetup/Application.java
index 8c66069..520361f 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Application.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Application.java
@@ -34,6 +34,7 @@
import org.opends.quicksetup.util.Utils;
import org.opends.quicksetup.util.ProgressMessageFormatter;
import org.opends.quicksetup.i18n.ResourceProvider;
+import org.opends.quicksetup.ui.GuiApplication;
import java.io.PrintStream;
import java.io.ByteArrayOutputStream;
@@ -518,6 +519,16 @@
}
/**
+ * Returns whether the installer has finished or not.
+ * @return <CODE>true</CODE> if the install is finished or <CODE>false
+ * </CODE> if not.
+ */
+ public boolean isFinished()
+ {
+ return getCurrentProgressStep().isLast();
+ }
+
+ /**
* This class is used to notify the ProgressUpdateListeners of events
* that are written to the standard error. It is used in WebStartInstaller
* and in OfflineInstaller. These classes just create a ErrorPrintStream and
diff --git a/opends/src/quicksetup/org/opends/quicksetup/DefaultDataOptions.java b/opends/src/quicksetup/org/opends/quicksetup/DefaultDataOptions.java
new file mode 100644
index 0000000..cfd094c
--- /dev/null
+++ b/opends/src/quicksetup/org/opends/quicksetup/DefaultDataOptions.java
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+
+package org.opends.quicksetup;
+
+/**
+ * This class is just used to specify which are the default values that will be
+ * proposed to the user in the Data Options panel of the Installation wizard.
+ *
+ */
+class DefaultDataOptions extends DataOptions
+{
+ /**
+ * Default constructor.
+ *
+ */
+ public DefaultDataOptions()
+ {
+ super(Type.CREATE_BASE_ENTRY, "dc=example,dc=com");
+ }
+
+ /**
+ * Get the number of entries that will be automatically generated.
+ *
+ * @return the number of entries that will be automatically generated.
+ */
+ public int getNumberEntries()
+ {
+ return 2000;
+ }
+
+}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/SplashScreen.java b/opends/src/quicksetup/org/opends/quicksetup/SplashScreen.java
index fd64e12..c28db89 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/SplashScreen.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/SplashScreen.java
@@ -206,7 +206,7 @@
{
try
{
- quickSetupClass = Class.forName("org.opends.quicksetup.QuickSetup");
+ quickSetupClass = Class.forName("org.opends.quicksetup.ui.QuickSetup");
quickSetup = quickSetupClass.newInstance();
quickSetupClass.getMethod("initialize", new Class[]
{ String[].class }).invoke(quickSetup, new Object[]
@@ -222,7 +222,7 @@
/**
* This method displays the QuickSetup dialog.
- * @see QuickSetup#display
+ * @see org.opends.quicksetup.ui.QuickSetup#display
* This method assumes that is being called outside the event thread.
* This method can be overwritten by subclasses to construct other objects
* different than the Quick Setup.
diff --git a/opends/src/quicksetup/org/opends/quicksetup/Step.java b/opends/src/quicksetup/org/opends/quicksetup/Step.java
index 5569240..aa47899 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Step.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Step.java
@@ -39,26 +39,31 @@
* Welcome step for the installation.
*/
WELCOME("welcome-step"),
+
+ /**
+ * Confirmation panel for the uninstallation.
+ */
+ CONFIRM_UNINSTALL("confirm-uninstall-step"),
+
/**
* Server Settings step (path, port, etc.).
*/
SERVER_SETTINGS("server-settings-step"),
+
/**
* Data Options panel (suffix dn, LDIF path, etc.).
*/
DATA_OPTIONS("data-options-step"),
+
/**
* Review panel for the install.
*/
REVIEW("review-step"),
+
/**
* Progress panel.
*/
- PROGRESS("progress-step"),
- /**
- * Confirmation panel for the uninstallation.
- */
- CONFIRM_UNINSTALL("confirm-uninstall-step");
+ PROGRESS("progress-step");
private String msgKey;
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
index 11c1c20..75184f9 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -36,6 +36,7 @@
import org.opends.quicksetup.ui.*;
import org.opends.quicksetup.util.Utils;
import org.opends.quicksetup.*;
+import org.opends.quicksetup.installer.ui.InstallReviewPanel;
import org.opends.server.util.SetupUtils;
import javax.swing.*;
@@ -268,15 +269,15 @@
public QuickSetupStepPanel createWizardStepPanel(WizardStep step) {
QuickSetupStepPanel p = null;
if (step == WELCOME) {
- p = new InstallWelcomePanel();
+ p = new InstallWelcomePanel(this);
} else if (step == SERVER_SETTINGS) {
- p = new ServerSettingsPanel(getUserData());
+ p = new ServerSettingsPanel(this);
} else if (step == DATA_OPTIONS) {
- p = new DataOptionsPanel(getUserData());
+ p = new DataOptionsPanel(this);
} else if (step == REVIEW) {
- p = new ReviewPanel(getUserData());
+ p = new InstallReviewPanel(this);
} else if (step == PROGRESS) {
- p = new ProgressPanel();
+ p = new ProgressPanel(this);
}
return p;
}
@@ -697,7 +698,7 @@
* valid.
*
*/
- protected void updateUserData(WizardStep cStep, QuickSetup qs)
+ public void updateUserData(WizardStep cStep, QuickSetup qs)
throws UserDataException
{
if (cStep == SERVER_SETTINGS) {
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java
new file mode 100644
index 0000000..5adcdff
--- /dev/null
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java
@@ -0,0 +1,303 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+
+package org.opends.quicksetup.installer.ui;
+
+import org.opends.quicksetup.DataOptions;
+import org.opends.quicksetup.UserData;
+import org.opends.quicksetup.ui.*;
+
+import javax.swing.*;
+import javax.swing.text.JTextComponent;
+import java.awt.*;
+import java.util.HashMap;
+
+/**
+ * This is the panel that contains the Review Panel.
+ *
+ */
+public class InstallReviewPanel extends ReviewPanel {
+
+ private static final long serialVersionUID = -7356174829193265699L;
+
+ private boolean displayServerLocation;
+
+ private HashMap<FieldName, JLabel> hmLabels =
+ new HashMap<FieldName, JLabel>();
+
+ private HashMap<FieldName, JTextComponent> hmFields =
+ new HashMap<FieldName, JTextComponent>();
+
+ /**
+ * Constructor of the panel.
+ * @param application Application represented by this panel
+ * the fields of the panel.
+ */
+ public InstallReviewPanel(GuiApplication application)
+ {
+ super(application);
+ this.displayServerLocation = isWebStart();
+ populateLabelAndFieldsMap();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void beginDisplay(UserData userData)
+ {
+ if (displayServerLocation)
+ {
+ setFieldValue(FieldName.SERVER_LOCATION, userData.getServerLocation());
+ }
+ setFieldValue(FieldName.SERVER_PORT, String.valueOf(userData
+ .getServerPort()));
+ setFieldValue(FieldName.DIRECTORY_MANAGER_DN, userData
+ .getDirectoryManagerDn());
+ setFieldValue(FieldName.DIRECTORY_BASE_DN, userData.getDataOptions()
+ .getBaseDn());
+ setFieldValue(FieldName.DATA_OPTIONS, getDisplayString(userData
+ .getDataOptions()));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object getFieldValue(FieldName fieldName)
+ {
+ Object value = null;
+ if (fieldName == FieldName.SERVER_START)
+ {
+ value = getCheckBox().isSelected();
+ }
+ return value;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected String getInstructions()
+ {
+ return getMsg("review-panel-instructions");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected String getTitle()
+ {
+ return getMsg("review-panel-title");
+ }
+
+ /**
+ * Create the components and populate the Maps.
+ */
+ private void populateLabelAndFieldsMap()
+ {
+ HashMap<FieldName, LabelFieldDescriptor> hm =
+ new HashMap<FieldName, LabelFieldDescriptor>();
+
+ if (displayServerLocation)
+ {
+ hm.put(FieldName.SERVER_LOCATION, new LabelFieldDescriptor(
+ getMsg("server-location-label"), getMsg("server-port-tooltip"),
+ LabelFieldDescriptor.FieldType.READ_ONLY,
+ LabelFieldDescriptor.LabelType.PRIMARY, 0));
+ }
+
+ hm.put(FieldName.SERVER_PORT, new LabelFieldDescriptor(
+ getMsg("server-port-label"), getMsg("server-port-tooltip"),
+ LabelFieldDescriptor.FieldType.READ_ONLY,
+ LabelFieldDescriptor.LabelType.PRIMARY, 0));
+
+ hm.put(FieldName.DIRECTORY_MANAGER_DN, new LabelFieldDescriptor(
+ getMsg("server-directory-manager-dn-label"),
+ getMsg("server-directory-manager-dn-tooltip"),
+ LabelFieldDescriptor.FieldType.READ_ONLY,
+ LabelFieldDescriptor.LabelType.PRIMARY, 0));
+
+ hm.put(FieldName.DIRECTORY_BASE_DN, new LabelFieldDescriptor(
+ getMsg("base-dn-label"), getMsg("base-dn-tooltip"),
+ LabelFieldDescriptor.FieldType.READ_ONLY,
+ LabelFieldDescriptor.LabelType.PRIMARY, 0));
+
+ hm.put(FieldName.DATA_OPTIONS, new LabelFieldDescriptor(
+ getMsg("directory-data-label"), null,
+ LabelFieldDescriptor.FieldType.READ_ONLY,
+ LabelFieldDescriptor.LabelType.PRIMARY, 0));
+ for (FieldName fieldName : hm.keySet())
+ {
+ LabelFieldDescriptor desc = hm.get(fieldName);
+
+ JTextComponent field = UIFactory.makeJTextComponent(desc, null);
+ field.setOpaque(false);
+ JLabel label = makeJLabel(desc);
+
+ hmFields.put(fieldName, field);
+ label.setLabelFor(field);
+
+ hmLabels.put(fieldName, label);
+ }
+ }
+
+ /**
+ * Returns the label associated with the given field name.
+ * @param fieldName the field name for which we want to retrieve the JLabel.
+ * @return the label associated with the given field name.
+ */
+ private JLabel getLabel(FieldName fieldName)
+ {
+ return hmLabels.get(fieldName);
+ }
+
+ /**
+ * Returns the JTextComponent associated with the given field name.
+ * @param fieldName the field name for which we want to retrieve the
+ * JTextComponent.
+ * @return the JTextComponent associated with the given field name.
+ */
+ private JTextComponent getField(FieldName fieldName)
+ {
+ return hmFields.get(fieldName);
+ }
+
+ /**
+ * Updates the JTextComponent associated with a FieldName with a text value.
+ * @param fieldName the field name of the JTextComponent that we want to
+ * update.
+ * @param value the value to be set.
+ */
+ private void setFieldValue(FieldName fieldName, String value)
+ {
+ getField(fieldName).setText(value);
+ }
+
+ /**
+ * Returns the localized string describing the DataOptions chosen by the user.
+ * @param options the DataOptions of the user.
+ * @return the localized string describing the DataOptions chosen by the user.
+ */
+ private String getDisplayString(DataOptions options)
+ {
+ String msg;
+
+ switch (options.getType())
+ {
+ case CREATE_BASE_ENTRY:
+ msg = getMsg("review-create-base-entry-label", new String[]
+ { options.getBaseDn() });
+
+ break;
+
+ case LEAVE_DATABASE_EMPTY:
+ msg = getMsg("review-leave-database-empty-label");
+ break;
+
+ case IMPORT_FROM_LDIF_FILE:
+ msg = getMsg("review-import-ldif", new String[]
+ { options.getLDIFPath() });
+ break;
+
+ case IMPORT_AUTOMATICALLY_GENERATED_DATA:
+ msg = getMsg("review-import-automatically-generated", new String[]
+ { String.valueOf(options.getNumberEntries()) });
+ break;
+
+ default:
+ throw new IllegalArgumentException("Unknow type: " + options.getType());
+
+ }
+
+ return msg;
+ }
+
+ /**
+ * Returns and creates the fields panel.
+ * @return the fields panel.
+ */
+ protected JPanel createFieldsPanel()
+ {
+ JPanel panel = new JPanel(new GridBagLayout());
+ panel.setOpaque(false);
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ FieldName[] fieldNames;
+ if (displayServerLocation)
+ {
+ fieldNames =
+ new FieldName[]
+ { FieldName.SERVER_LOCATION, FieldName.SERVER_PORT,
+ FieldName.DIRECTORY_MANAGER_DN,
+ FieldName.DIRECTORY_BASE_DN,
+ FieldName.DATA_OPTIONS };
+ } else
+ {
+ fieldNames =
+ new FieldName[]
+ { FieldName.SERVER_PORT, FieldName.DIRECTORY_MANAGER_DN,
+ FieldName.DIRECTORY_BASE_DN, FieldName.DATA_OPTIONS };
+ }
+
+ for (int i = 0; i < fieldNames.length; i++)
+ {
+ gbc.gridwidth = GridBagConstraints.RELATIVE;
+ gbc.weightx = 0.0;
+ if (i > 0)
+ {
+ gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
+ } else
+ {
+ gbc.insets.top = 0;
+ }
+ gbc.insets.left = 0;
+ gbc.anchor = GridBagConstraints.NORTHWEST;
+ panel.add(getLabel(fieldNames[i]), gbc);
+
+ JPanel auxPanel = new JPanel(new GridBagLayout());
+ auxPanel.setOpaque(false);
+ gbc.weightx = 1.0;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ if (i > 0)
+ {
+ gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
+ } else
+ {
+ gbc.insets.top = 0;
+ }
+ gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
+
+ gbc.gridwidth = GridBagConstraints.REMAINDER;
+ panel.add(auxPanel, gbc);
+
+ gbc.insets = UIFactory.getEmptyInsets();
+ gbc.gridwidth = GridBagConstraints.REMAINDER;
+ gbc.weightx = 1.0;
+ auxPanel.add(getField(fieldNames[i]), gbc);
+ }
+
+ return panel;
+ }
+}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties b/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
index b0feaf7..2c473e8 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
+++ b/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
@@ -159,15 +159,12 @@
#
upgrade-launcher-description=This utility may be used to upgrade the Directory \
Server to a newer version.
-upgrade-launcher-usage=This utility may be used to upgrade the \
-Directory Server to a newer version.\n\
-Usage: {0} {options}\n where {options} include:\n\
---cli\n\ Specifies to use the command line upgrade. If not specified the \
-graphical\n\ interface will be launched.\n\
--H, --help\n Displays usage information for this program.\n\n\
-The following options will only be taken into account if the option --cli \n\
-(command line) is specified\n\
--s, --silentUpgrade\n Perform a silent upgrade.
+upgrade-launcher-usage=This utility may be used to upgrade the Directory Server \
+ to a newer version.\nUsage: {0} {options} where {options} \
+ include:\n\n -f, --file\n Specifies an existing OpenDS package (.zip) \
+ file to which the\n current build will be upgraded.\n\n -c, --cli\n \
+ Use the command line upgrade. If not specified the graphical\n interface \
+ will be launched.\n
upgrade-launcher-launching-gui=Launching graphical upgrade...
upgrade-launcher-launching-cli=Launching command line upgrade...
upgrade-launcher-gui-launched-failed=\n\nThe graphical upgrade launch \
@@ -705,4 +702,58 @@
upgrade-mod-no-schema=Processed server modifications \
(schema checking disabled): {0}
upgrade-mod=Processed server modifications: {0}
-upgrade-mod-ignore=Attribute or value already exists: {0}
\ No newline at end of file
+upgrade-mod-ignore=Attribute or value already exists: {0}
+
+#
+# Upgrader Panels
+#
+#
+# Welcome Panel specific labels
+#
+upgrade-welcome-panel-title=Welcome
+# The following line contains some HTML tags. translators should respect them.
+# Concerning the URL, depending on how works the product page translators
+# have to modify it or not: if the server uses the locale of the browser to display
+# a language there is no translation to be done but if we have specific URL for
+# each language the URL must be localized.
+upgrade-welcome-panel-offline-instructions=The OpenDS Upgrade tool will upgrade \
+ an existing build in place.<br><br> \
+ Additional information on this tool is available in the <a href="https://opends.dev.java.net/public/docs/index.html"> \
+ Documentation Depot</a> section of OpenDS project web site.
+upgrade-welcome-panel-webstart-instructions=The OpenDS Upgrade tool will upgrade \
+ an existing build in place.<br><br>You can also use this tool to set up a build you have \
+ downloaded manually. To run Upgrade in this case, use the {0} command at \
+ the top level of the OpenDS directory.<br><br> \
+ Additional information on this tool is available in the <a href="https://opends.dev.java.net/public/docs/index.html"> \
+ Documentation Depot</a> section of OpenDS project web site.<br><br>
+upgrade-location-label=Server to Upgrade:
+upgrade-location-tooltip=File system location of the build that will be upgraded
+upgrade-build-id-label=Build Version:
+upgrade-build-id-tooltip=The ID of the build version installed in the above location
+
+#
+# Upgrader Choose Version Panel
+#
+upgrade-choose-version-panel-title=Choose New Version
+upgrade-choose-version-panel-instructions=Choose a new version or reference \
+ build to use for the upgrading.
+upgrade-choose-version-remote-label=Choose New Version from opends.dev.java.net
+upgrade-choose-version-remote-tooltip=Download and upgrade to a build publicly \
+ available on the OpenDS website.
+upgrade-choose-version-remote-weekly=Weekly Builds
+upgrade-choose-version-remote-nightly=Nightly Builds
+upgrade-choose-version-local-label=Upgrade Based on Downloaded Weekly Build (.zip)
+upgrade-choose-version-local-tooltip=Upgrade to a build whose .zip file you have\
+ already downloaded.
+upgrade-choose-version-local-path=Path:
+
+upgrade-review-panel-title=Review
+upgrade-review-panel-instructions=Review your settings and click Finish if they \
+ are correct.
+upgrade-review-panel-server-label=Server to Upgrade:
+upgrade-review-panel-server-tooltip=File system location of the build that will be upgraded
+upgrade-review-panel-old-version-label=Old Version:
+upgrade-review-panel-old-version-tooltip=The current version of the server
+upgrade-review-panel-new-version-label=New Version:
+upgrade-review-panel-new-version-tooltip=The target version of the server
+upgrade-review-panel-start-server=Start Server when the Upgrade has Completed
\ No newline at end of file
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/ButtonsPanel.java b/opends/src/quicksetup/org/opends/quicksetup/ui/ButtonsPanel.java
index bab0173..e5fe9ec 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/ButtonsPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/ButtonsPanel.java
@@ -27,24 +27,18 @@
package org.opends.quicksetup.ui;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import java.util.HashSet;
-
-import javax.swing.Box;
-import javax.swing.JButton;
-import javax.swing.JPanel;
-
import org.opends.quicksetup.ButtonName;
import org.opends.quicksetup.WizardStep;
-import org.opends.quicksetup.GuiApplication;
-import org.opends.quicksetup.uninstaller.Uninstaller;
-import org.opends.quicksetup.installer.Installer;
import org.opends.quicksetup.event.ButtonActionListener;
import org.opends.quicksetup.event.ButtonEvent;
+import org.opends.quicksetup.installer.Installer;
+import org.opends.quicksetup.uninstaller.Uninstaller;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.HashSet;
/**
* This class contains the buttons in the bottom of the Install/Uninstall
@@ -71,8 +65,6 @@
private JButton cancelButton;
- private GuiApplication application;
-
/**
* Default constructor.
* @param application Application running in QuickSetup
@@ -80,7 +72,7 @@
*/
public ButtonsPanel(GuiApplication application)
{
- this.application = application;
+ super(application);
createButtons();
layoutButtons();
}
@@ -112,6 +104,7 @@
*/
public void setDisplayedStep(WizardStep step)
{
+ GuiApplication application = getApplication();
previousButton.setVisible(application.canGoBack(step));
nextButton.setVisible(application.canGoForward(step));
finishButton.setVisible(application.canFinish(step));
@@ -128,35 +121,36 @@
public JButton getButton(ButtonName buttonName)
{
JButton b = null;
- switch (buttonName)
- {
- case NEXT:
- b = nextButton;
- break;
+ if (buttonName != null) {
+ switch (buttonName) {
+ case NEXT:
+ b = nextButton;
+ break;
- case PREVIOUS:
- b = previousButton;
- break;
+ case PREVIOUS:
+ b = previousButton;
+ break;
- case QUIT:
- b = quitButton;
- break;
+ case QUIT:
+ b = quitButton;
+ break;
- case CLOSE:
- b = closeButton;
- break;
+ case CLOSE:
+ b = closeButton;
+ break;
- case FINISH:
- b = finishButton;
- break;
+ case FINISH:
+ b = finishButton;
+ break;
- case CANCEL:
- b = cancelButton;
- break;
+ case CANCEL:
+ b = cancelButton;
+ break;
- default:
- throw new IllegalArgumentException("Unknown button name: " +
- buttonName);
+ default:
+ throw new IllegalArgumentException("Unknown button name: " +
+ buttonName);
+ }
}
return b;
@@ -181,6 +175,8 @@
quitButton =
createButton("quit-button-label", tooltip, ButtonName.QUIT);
+ GuiApplication application = getApplication();
+
tooltip = application.getCloseButtonToolTip();
closeButton = createButton("close-button-label", tooltip, ButtonName.CLOSE);
@@ -228,7 +224,7 @@
nextFinishPanel.add(nextButton, gbcAux);
// TODO: remove this hack
- if (application instanceof Installer) {
+ if (getApplication() instanceof Installer) {
nextFinishPanel.add(finishButton, gbcAux);
}
width =
@@ -249,7 +245,7 @@
gbc.insets.left = UIFactory.HORIZONTAL_INSET_BETWEEN_BUTTONS;
// TODO: remove this hack
- if (application instanceof Uninstaller) {
+ if (getApplication() instanceof Uninstaller) {
gbc.insets.right = UIFactory.HORIZONTAL_INSET_BETWEEN_BUTTONS;
add(finishButton, gbc);
gbc.insets.right = 0;
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/ConfirmUninstallPanel.java b/opends/src/quicksetup/org/opends/quicksetup/ui/ConfirmUninstallPanel.java
index 7245fd9..12231a9 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/ConfirmUninstallPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/ConfirmUninstallPanel.java
@@ -27,25 +27,16 @@
package org.opends.quicksetup.ui;
-import java.awt.Component;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
+import org.opends.quicksetup.CurrentInstallStatus;
+import org.opends.quicksetup.util.Utils;
+
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import java.awt.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
-import javax.swing.Box;
-import javax.swing.DefaultListModel;
-import javax.swing.JCheckBox;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.border.EmptyBorder;
-
-import org.opends.quicksetup.CurrentInstallStatus;
-import org.opends.quicksetup.installer.FieldName;
-import org.opends.quicksetup.util.Utils;
-
/**
* This is the panel displayed when the user is uninstalling Open DS. It is
* basically a panel with the text informing of the consequences of uninstalling
@@ -65,13 +56,15 @@
/**
* The constructor of this class.
+ * @param application Application this panel represents
* @param installStatus the object describing the current installation status.
*
*/
- public ConfirmUninstallPanel(CurrentInstallStatus installStatus)
+ public ConfirmUninstallPanel(GuiApplication application,
+ CurrentInstallStatus installStatus)
{
+ super(application);
this.installStatus = installStatus;
- createLayout();
}
/**
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/CurrentStepPanel.java b/opends/src/quicksetup/org/opends/quicksetup/ui/CurrentStepPanel.java
index 0d754df..9ce692a 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/CurrentStepPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/CurrentStepPanel.java
@@ -34,7 +34,6 @@
import java.util.Set;
import org.opends.quicksetup.event.ButtonActionListener;
-import org.opends.quicksetup.installer.FieldName;
import org.opends.quicksetup.installer.Installer;
import org.opends.quicksetup.*;
@@ -58,15 +57,13 @@
private HashMap<WizardStep, QuickSetupStepPanel> hmPanels =
new HashMap<WizardStep, QuickSetupStepPanel>();
- private Application application;
-
/**
* The constructor of this class.
* @param app Application used to create panels for populating the layout
*/
public CurrentStepPanel(GuiApplication app)
{
- this.application = app;
+ super(app);
createLayout(app);
}
@@ -127,6 +124,7 @@
for (WizardStep step : steps) {
QuickSetupStepPanel panel = app.createWizardStepPanel(step);
if (panel != null) {
+ panel.initialize();
hmPanels.put(step, panel);
}
}
@@ -144,7 +142,7 @@
// For aesthetical reasons we add a little bit of height
// TODO: remove this hack
- if (application instanceof Installer)
+ if (getApplication() instanceof Installer)
{
minHeight += UIFactory.EXTRA_DIALOG_HEIGHT;
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/DataOptionsPanel.java b/opends/src/quicksetup/org/opends/quicksetup/ui/DataOptionsPanel.java
index 7134845..86143a0 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/DataOptionsPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/DataOptionsPanel.java
@@ -46,7 +46,6 @@
import org.opends.quicksetup.event.BrowseActionListener;
import org.opends.quicksetup.DataOptions;
-import org.opends.quicksetup.installer.FieldName;
import org.opends.quicksetup.UserData;
/**
@@ -75,16 +74,16 @@
/**
* Constructor of the panel.
- * @param defaultUserData the default values that must be used to initialize
+ * @param application Application represented by this panel
* the fields of the panel.
*/
- public DataOptionsPanel(UserData defaultUserData)
+ public DataOptionsPanel(GuiApplication application)
{
- this.defaultUserData = defaultUserData;
+ super(application);
+ this.defaultUserData = application.getUserData();
populateComponentMaps();
addDocumentListeners();
addFocusListeners();
- createLayout();
}
/**
@@ -288,30 +287,10 @@
private JPanel createBrowseButtonPanel(FieldName fieldName,
JButton browseButton)
{
- GridBagConstraints gbc = new GridBagConstraints();
-
- JPanel panel = new JPanel(new GridBagLayout());
- panel.setOpaque(false);
- gbc.insets = UIFactory.getEmptyInsets();
- gbc.gridwidth = 4;
- gbc.weightx = 0.0;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- panel.add(getLabel(fieldName), gbc);
-
- gbc.insets.left = UIFactory.LEFT_INSET_SECONDARY_FIELD;
- gbc.gridwidth--;
- gbc.weightx = 0.1;
- panel.add(getField(fieldName), gbc);
-
- gbc.insets.left = UIFactory.LEFT_INSET_BROWSE;
- gbc.gridwidth = GridBagConstraints.RELATIVE;
- panel.add(browseButton, gbc);
-
- gbc.weightx = 1.0;
- gbc.gridwidth = GridBagConstraints.REMAINDER;
- panel.add(Box.createHorizontalGlue(), gbc);
-
- return panel;
+ return Utilities.createBrowseButtonPanel(
+ getLabel(fieldName),
+ getField(fieldName),
+ browseButton);
}
/**
@@ -430,11 +409,11 @@
LabelFieldDescriptor desc = hm.get(fieldName);
String defaultValue = getDefaultStringValue(fieldName);
- field = makeJTextComponent(desc, defaultValue);
+ field = UIFactory.makeJTextComponent(desc, defaultValue);
hmFields.put(fieldName, field);
- JLabel l = makeJLabel(desc);
+ JLabel l = UIFactory.makeJLabel(desc);
l.setLabelFor(field);
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/FieldName.java b/opends/src/quicksetup/org/opends/quicksetup/ui/FieldName.java
similarity index 98%
rename from opends/src/quicksetup/org/opends/quicksetup/installer/FieldName.java
rename to opends/src/quicksetup/org/opends/quicksetup/ui/FieldName.java
index 937721e..0fa8164 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/FieldName.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/FieldName.java
@@ -25,7 +25,7 @@
* Portions Copyright 2006-2007 Sun Microsystems, Inc.
*/
-package org.opends.quicksetup.installer;
+package org.opends.quicksetup.ui;
/**
* This is an enumeration used to identify the different fields that we have
@@ -111,4 +111,5 @@
* The value associated with this is a Set of String.
*/
EXTERNAL_LOG_FILES
+
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/GuiApplication.java b/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
similarity index 94%
rename from opends/src/quicksetup/org/opends/quicksetup/GuiApplication.java
rename to opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
index f078087..18f42f4 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/GuiApplication.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
@@ -25,11 +25,9 @@
* Portions Copyright 2007 Sun Microsystems, Inc.
*/
-package org.opends.quicksetup;
+package org.opends.quicksetup.ui;
-import org.opends.quicksetup.ui.FramePanel;
-import org.opends.quicksetup.ui.QuickSetupDialog;
-import org.opends.quicksetup.ui.QuickSetupStepPanel;
+import org.opends.quicksetup.*;
import javax.swing.*;
import java.awt.event.WindowEvent;
@@ -65,16 +63,6 @@
abstract public String getFrameTitle();
/**
- * Returns whether the installer has finished or not.
- * @return <CODE>true</CODE> if the install is finished or <CODE>false
- * </CODE> if not.
- */
- public boolean isFinished()
- {
- return getCurrentProgressStep().isLast();
- }
-
- /**
* Returns the initial wizard step.
* @return Step representing the first step to show in the wizard
*/
@@ -89,7 +77,7 @@
* @param userData UserData representing the data specified by the user
* @param dlg QuickSetupDialog hosting the wizard
*/
- protected void setDisplayedWizardStep(WizardStep step,
+ public void setDisplayedWizardStep(WizardStep step,
UserData userData,
QuickSetupDialog dlg) {
this.displayedStep = step;
@@ -301,9 +289,10 @@
* values found in QuickSetup.
* @param cStep current wizard step
* @param qs QuickSetup controller
- * @throws UserDataException if there is a problem with the data
+ * @throws org.opends.quicksetup.UserDataException if there is a problem with
+ * the data
*/
- abstract protected void updateUserData(WizardStep cStep, QuickSetup qs)
+ public abstract void updateUserData(WizardStep cStep, QuickSetup qs)
throws UserDataException;
/**
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/InstallWelcomePanel.java b/opends/src/quicksetup/org/opends/quicksetup/ui/InstallWelcomePanel.java
index 1c61aff..651a131 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/InstallWelcomePanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/InstallWelcomePanel.java
@@ -42,11 +42,11 @@
/**
* Default constructor.
- *
+ * @param app Application this panel represents
*/
- public InstallWelcomePanel()
+ public InstallWelcomePanel(GuiApplication app)
{
- createLayout();
+ super(app);
}
/**
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressPanel.java b/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressPanel.java
index b71c835..d4d7073 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/ProgressPanel.java
@@ -65,10 +65,11 @@
/**
* ProgressPanel constructor.
+ * @param application Application this panel represents
*/
- public ProgressPanel()
+ public ProgressPanel(GuiApplication application)
{
- createLayout();
+ super(application);
}
/**
diff --git a/opends/src/quicksetup/org/opends/quicksetup/QuickSetup.java b/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
similarity index 95%
rename from opends/src/quicksetup/org/opends/quicksetup/QuickSetup.java
rename to opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
index f5b6351..1f198c9 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/QuickSetup.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
@@ -25,25 +25,23 @@
* Portions Copyright 2006-2007 Sun Microsystems, Inc.
*/
-package org.opends.quicksetup;
+package org.opends.quicksetup.ui;
import org.opends.quicksetup.event.ButtonActionListener;
+import org.opends.quicksetup.event.ProgressUpdateListener;
import org.opends.quicksetup.event.ButtonEvent;
import org.opends.quicksetup.event.ProgressUpdateEvent;
-import org.opends.quicksetup.event.ProgressUpdateListener;
+import org.opends.quicksetup.*;
import org.opends.quicksetup.i18n.ResourceProvider;
-import org.opends.quicksetup.installer.FieldName;
-import org.opends.quicksetup.ui.QuickSetupDialog;
-import org.opends.quicksetup.ui.UIFactory;
-import org.opends.quicksetup.util.BackgroundTask;
import org.opends.quicksetup.util.ProgressMessageFormatter;
-import org.opends.quicksetup.util.Utils;
import org.opends.quicksetup.util.HtmlProgressMessageFormatter;
+import org.opends.quicksetup.util.BackgroundTask;
+import org.opends.quicksetup.util.Utils;
import javax.swing.*;
-import java.util.*;
-import java.util.logging.Level;
import java.util.logging.Logger;
+import java.util.logging.Level;
+import java.util.Map;
/**
* This class is responsible for doing the following:
@@ -220,7 +218,7 @@
* of flickering. So the idea here is to have a minimal time between 2 updates
* of the progress dialog (specified by UPDATE_PERIOD).
*
- * @see #progressUpdate(ProgressUpdateEvent)
+ * @see #progressUpdate(org.opends.quicksetup.event.ProgressUpdateEvent)
*/
private void runDisplayUpdater()
{
@@ -650,29 +648,3 @@
return Utils.isWebStart();
}
}
-/**
- * This class is just used to specify which are the default values that will be
- * proposed to the user in the Data Options panel of the Installation wizard.
- *
- */
-class DefaultDataOptions extends DataOptions
-{
- /**
- * Default constructor.
- *
- */
- public DefaultDataOptions()
- {
- super(Type.CREATE_BASE_ENTRY, "dc=example,dc=com");
- }
-
- /**
- * Get the number of entries that will be automatically generated.
- *
- * @return the number of entries that will be automatically generated.
- */
- public int getNumberEntries()
- {
- return 2000;
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupDialog.java b/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupDialog.java
index 5aaa74e..c956a7f 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupDialog.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupDialog.java
@@ -31,6 +31,8 @@
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.HashSet;
+import java.util.logging.Logger;
+import java.util.logging.Level;
import javax.swing.JButton;
import javax.swing.JFrame;
@@ -43,7 +45,6 @@
import org.opends.quicksetup.event.ButtonEvent;
import org.opends.quicksetup.event.MinimumSizeComponentListener;
import org.opends.quicksetup.i18n.ResourceProvider;
-import org.opends.quicksetup.installer.FieldName;
import org.opends.quicksetup.ProgressDescriptor;
import org.opends.quicksetup.util.ProgressMessageFormatter;
import org.opends.quicksetup.util.Utils;
@@ -61,6 +62,9 @@
*/
public class QuickSetupDialog
{
+ static private final Logger LOG =
+ Logger.getLogger(QuickSetupDialog.class.getName());
+
private JFrame frame;
private QuickSetupErrorPanel installedPanel;
@@ -466,7 +470,13 @@
*/
public void setFocusOnButton(ButtonName buttonName)
{
- getButton(buttonName).requestFocusInWindow();
+ JButton button = getButton(buttonName);
+ if (button != null) {
+ button.requestFocusInWindow();
+ } else {
+ LOG.log(Level.INFO, "Focus requested for unknown button '" +
+ buttonName + "'");
+ }
}
/**
@@ -519,7 +529,9 @@
{
if (installedPanel == null)
{
- installedPanel = new QuickSetupErrorPanel(installStatus);
+ installedPanel = new QuickSetupErrorPanel(
+ application,
+ installStatus);
}
return installedPanel;
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupErrorPanel.java b/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupErrorPanel.java
index 2147985..7599a61 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupErrorPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupErrorPanel.java
@@ -61,11 +61,13 @@
/**
* Constructor of the QuickSetupErrorPanel.
- *
+ * @param application Application this panel represents
* @param installStatus the current install status.
*/
- public QuickSetupErrorPanel(CurrentInstallStatus installStatus)
+ public QuickSetupErrorPanel(GuiApplication application,
+ CurrentInstallStatus installStatus)
{
+ super(application);
JPanel p1 = new JPanel(new GridBagLayout());
p1.setBackground(UIFactory.CURRENT_STEP_PANEL_BACKGROUND);
p1.setBorder(UIFactory.DIALOG_PANEL_BORDER);
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupPanel.java b/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupPanel.java
index 98c1d35..8c2e87e 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupPanel.java
@@ -43,13 +43,16 @@
{
private static final long serialVersionUID = 2096518919339628055L;
+ private GuiApplication application;
+
/**
* The basic constructor to be called by the subclasses.
- *
+ * @param application Application this panel represents
*/
- protected QuickSetupPanel()
+ protected QuickSetupPanel(GuiApplication application)
{
super();
+ this.application = application;
setOpaque(false);
}
@@ -81,6 +84,14 @@
}
/**
+ * Gets the application this panel represents.
+ * @return GuiApplication this panel represents
+ */
+ protected GuiApplication getApplication() {
+ return this.application;
+ }
+
+ /**
* Returns a localized message for a key value. In the properties file we
* have something of type:
* key=value
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java b/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java
index ef04467..4ff3603 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java
@@ -40,11 +40,9 @@
import javax.swing.JPanel;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
-import javax.swing.text.JTextComponent;
import org.opends.quicksetup.event.ButtonActionListener;
import org.opends.quicksetup.event.ButtonEvent;
-import org.opends.quicksetup.installer.FieldName;
import org.opends.quicksetup.ProgressDescriptor;
import org.opends.quicksetup.UserData;
import org.opends.quicksetup.util.HtmlProgressMessageFormatter;
@@ -76,6 +74,22 @@
new HashMap<String, URLWorker>();
/**
+ * Creates a default instance.
+ * @param application Application this panel represents
+ */
+ public QuickSetupStepPanel(GuiApplication application) {
+ super(application);
+ }
+
+ /**
+ * Initializes this panel. Called soon after creation. In general this
+ * is where maps should be populated etc.
+ */
+ public void initialize() {
+ createLayout();
+ }
+
+ /**
* Called just before the panel is shown: used to update the contents of the
* panel with new UserData (used in particular in the review panel).
*
@@ -219,7 +233,7 @@
* Creates the layout of the panel.
*
*/
- protected void createLayout()
+ private void createLayout()
{
setLayout(new GridBagLayout());
@@ -289,47 +303,6 @@
}
/**
- * Commodity method that returns a JTextComponent based on a
- * LabelFieldDescriptor.
- * @param desc the LabelFieldDescriptor describing the JTextField.
- * @param defaultValue the default value used to initialize the
- * JTextComponent.
- * @return a JTextComponent based on a
- * LabelFieldDescriptor.
- */
- protected JTextComponent makeJTextComponent(LabelFieldDescriptor desc,
- String defaultValue)
- {
- JTextComponent field;
- switch (desc.getType())
- {
- case TEXTFIELD:
-
- field =
- UIFactory.makeJTextField(defaultValue, desc.getTooltip(), desc
- .getSize(), UIFactory.TextStyle.TEXTFIELD);
- break;
-
- case PASSWORD:
-
- field =
- UIFactory.makeJPasswordField(defaultValue, desc.getTooltip(), desc
- .getSize(), UIFactory.TextStyle.PASSWORD_FIELD);
- break;
-
- case READ_ONLY:
-
- field =
- UIFactory.makeTextPane(defaultValue, UIFactory.TextStyle.READ_ONLY);
- break;
-
- default:
- throw new IllegalArgumentException("Unknown type: " + desc.getType());
- }
- return field;
- }
-
- /**
* Commodity method that returns a JLabel based on a LabelFieldDescriptor.
* @param desc the LabelFieldDescriptor describing the JLabel.
* @return a JLabel based on a LabelFieldDescriptor.
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/ReviewPanel.java b/opends/src/quicksetup/org/opends/quicksetup/ui/ReviewPanel.java
index 37883f1..1d0be4c 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/ReviewPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/ReviewPanel.java
@@ -27,89 +27,35 @@
package org.opends.quicksetup.ui;
-import java.awt.Component;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.util.HashMap;
-
-import javax.swing.JCheckBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.text.JTextComponent;
-
-import org.opends.quicksetup.DataOptions;
-import org.opends.quicksetup.UserData;
-import org.opends.quicksetup.installer.FieldName;
+import javax.swing.*;
+import java.awt.*;
/**
- * This is the panel that contains the Review Panel.
- *
+ * Abstract class for rendering a review panel with fields and value
+ * that the user can use to confirm an application's operation.
*/
-public class ReviewPanel extends QuickSetupStepPanel
-{
- private static final long serialVersionUID = -7356174829193265699L;
-
- private boolean displayServerLocation;
-
- private UserData defaultUserData;
+public abstract class ReviewPanel extends QuickSetupStepPanel {
private JCheckBox checkBox;
- private HashMap<FieldName, JLabel> hmLabels =
- new HashMap<FieldName, JLabel>();
-
- private HashMap<FieldName, JTextComponent> hmFields =
- new HashMap<FieldName, JTextComponent>();
+ /**
+ * Creates an instance.
+ * @param application GuiApplication this panel represents
+ */
+ public ReviewPanel(GuiApplication application) {
+ super(application);
+ }
/**
- * Constructor of the panel.
- * @param defaultUserData the default values that must be used to initialize
- * the fields of the panel.
+ * Creates the panel containing field names and values.
+ * @return JPanel containing fields and values
*/
- public ReviewPanel(UserData defaultUserData)
- {
- this.defaultUserData = defaultUserData;
- this.displayServerLocation = isWebStart();
- populateLabelAndFieldsMap();
- createLayout();
- }
+ protected abstract JPanel createFieldsPanel();
/**
* {@inheritDoc}
*/
- public void beginDisplay(UserData userData)
- {
- if (displayServerLocation)
- {
- setFieldValue(FieldName.SERVER_LOCATION, userData.getServerLocation());
- }
- setFieldValue(FieldName.SERVER_PORT, String.valueOf(userData
- .getServerPort()));
- setFieldValue(FieldName.DIRECTORY_MANAGER_DN, userData
- .getDirectoryManagerDn());
- setFieldValue(FieldName.DIRECTORY_BASE_DN, userData.getDataOptions()
- .getBaseDn());
- setFieldValue(FieldName.DATA_OPTIONS, getDisplayString(userData
- .getDataOptions()));
- }
-
- /**
- * {@inheritDoc}
- */
- public Object getFieldValue(FieldName fieldName)
- {
- Object value = null;
- if (fieldName == FieldName.SERVER_START)
- {
- value = getCheckBox().isSelected();
- }
- return value;
- }
-
- /**
- * {@inheritDoc}
- */
- protected Component createInputPanel()
+ final protected Component createInputPanel()
{
JPanel panel = new JPanel(new GridBagLayout());
panel.setOpaque(false);
@@ -133,149 +79,11 @@
}
/**
- * {@inheritDoc}
- */
- protected String getInstructions()
- {
- return getMsg("review-panel-instructions");
- }
-
- /**
- * {@inheritDoc}
- */
- protected String getTitle()
- {
- return getMsg("review-panel-title");
- }
-
- /**
- * Create the components and populate the Maps.
- */
- private void populateLabelAndFieldsMap()
- {
- HashMap<FieldName, LabelFieldDescriptor> hm =
- new HashMap<FieldName, LabelFieldDescriptor>();
-
- if (displayServerLocation)
- {
- hm.put(FieldName.SERVER_LOCATION, new LabelFieldDescriptor(
- getMsg("server-location-label"), getMsg("server-port-tooltip"),
- LabelFieldDescriptor.FieldType.READ_ONLY,
- LabelFieldDescriptor.LabelType.PRIMARY, 0));
- }
-
- hm.put(FieldName.SERVER_PORT, new LabelFieldDescriptor(
- getMsg("server-port-label"), getMsg("server-port-tooltip"),
- LabelFieldDescriptor.FieldType.READ_ONLY,
- LabelFieldDescriptor.LabelType.PRIMARY, 0));
-
- hm.put(FieldName.DIRECTORY_MANAGER_DN, new LabelFieldDescriptor(
- getMsg("server-directory-manager-dn-label"),
- getMsg("server-directory-manager-dn-tooltip"),
- LabelFieldDescriptor.FieldType.READ_ONLY,
- LabelFieldDescriptor.LabelType.PRIMARY, 0));
-
- hm.put(FieldName.DIRECTORY_BASE_DN, new LabelFieldDescriptor(
- getMsg("base-dn-label"), getMsg("base-dn-tooltip"),
- LabelFieldDescriptor.FieldType.READ_ONLY,
- LabelFieldDescriptor.LabelType.PRIMARY, 0));
-
- hm.put(FieldName.DATA_OPTIONS, new LabelFieldDescriptor(
- getMsg("directory-data-label"), null,
- LabelFieldDescriptor.FieldType.READ_ONLY,
- LabelFieldDescriptor.LabelType.PRIMARY, 0));
- for (FieldName fieldName : hm.keySet())
- {
- LabelFieldDescriptor desc = hm.get(fieldName);
-
- JTextComponent field = makeJTextComponent(desc, null);
- field.setOpaque(false);
- JLabel label = makeJLabel(desc);
-
- hmFields.put(fieldName, field);
- label.setLabelFor(field);
-
- hmLabels.put(fieldName, label);
- }
- }
-
- /**
- * Returns the label associated with the given field name.
- * @param fieldName the field name for which we want to retrieve the JLabel.
- * @return the label associated with the given field name.
- */
- private JLabel getLabel(FieldName fieldName)
- {
- return hmLabels.get(fieldName);
- }
-
- /**
- * Returns the JTextComponent associated with the given field name.
- * @param fieldName the field name for which we want to retrieve the
- * JTextComponent.
- * @return the JTextComponent associated with the given field name.
- */
- private JTextComponent getField(FieldName fieldName)
- {
- return hmFields.get(fieldName);
- }
-
- /**
- * Updates the JTextComponent associated with a FieldName with a text value.
- * @param fieldName the field name of the JTextComponent that we want to
- * update.
- * @param value the value to be set.
- */
- private void setFieldValue(FieldName fieldName, String value)
- {
- getField(fieldName).setText(value);
- }
-
- /**
- * Returns the localized string describing the DataOptions chosen by the user.
- * @param options the DataOptions of the user.
- * @return the localized string describing the DataOptions chosen by the user.
- */
- private String getDisplayString(DataOptions options)
- {
- String msg;
-
- switch (options.getType())
- {
- case CREATE_BASE_ENTRY:
- msg = getMsg("review-create-base-entry-label", new String[]
- { options.getBaseDn() });
-
- break;
-
- case LEAVE_DATABASE_EMPTY:
- msg = getMsg("review-leave-database-empty-label");
- break;
-
- case IMPORT_FROM_LDIF_FILE:
- msg = getMsg("review-import-ldif", new String[]
- { options.getLDIFPath() });
- break;
-
- case IMPORT_AUTOMATICALLY_GENERATED_DATA:
- msg = getMsg("review-import-automatically-generated", new String[]
- { String.valueOf(options.getNumberEntries()) });
- break;
-
- default:
- throw new IllegalArgumentException("Unknow type: " + options.getType());
-
- }
-
- return msg;
- }
-
- /**
* Returns the start server check box.
* If it does not exist creates the start server check box.
* @return the start server check box.
*/
- private JCheckBox getCheckBox()
+ protected JCheckBox getCheckBox()
{
if (checkBox == null)
{
@@ -283,75 +91,8 @@
UIFactory.makeJCheckBox(getMsg("start-server-label"),
getMsg("start-server-tooltip"), UIFactory.TextStyle.CHECKBOX);
checkBox.setOpaque(false);
- checkBox.setSelected(defaultUserData.getStartServer());
+ checkBox.setSelected(getApplication().getUserData().getStartServer());
}
return checkBox;
}
-
- /**
- * Returns and creates the fields panel.
- * @return the fields panel.
- */
- private JPanel createFieldsPanel()
- {
- JPanel panel = new JPanel(new GridBagLayout());
- panel.setOpaque(false);
- GridBagConstraints gbc = new GridBagConstraints();
-
- FieldName[] fieldNames;
- if (displayServerLocation)
- {
- fieldNames =
- new FieldName[]
- { FieldName.SERVER_LOCATION, FieldName.SERVER_PORT,
- FieldName.DIRECTORY_MANAGER_DN,
- FieldName.DIRECTORY_BASE_DN,
- FieldName.DATA_OPTIONS };
- } else
- {
- fieldNames =
- new FieldName[]
- { FieldName.SERVER_PORT, FieldName.DIRECTORY_MANAGER_DN,
- FieldName.DIRECTORY_BASE_DN, FieldName.DATA_OPTIONS };
- }
-
- for (int i = 0; i < fieldNames.length; i++)
- {
- gbc.gridwidth = GridBagConstraints.RELATIVE;
- gbc.weightx = 0.0;
- if (i > 0)
- {
- gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
- } else
- {
- gbc.insets.top = 0;
- }
- gbc.insets.left = 0;
- gbc.anchor = GridBagConstraints.NORTHWEST;
- panel.add(getLabel(fieldNames[i]), gbc);
-
- JPanel auxPanel = new JPanel(new GridBagLayout());
- auxPanel.setOpaque(false);
- gbc.weightx = 1.0;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- if (i > 0)
- {
- gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
- } else
- {
- gbc.insets.top = 0;
- }
- gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
-
- gbc.gridwidth = GridBagConstraints.REMAINDER;
- panel.add(auxPanel, gbc);
-
- gbc.insets = UIFactory.getEmptyInsets();
- gbc.gridwidth = GridBagConstraints.REMAINDER;
- gbc.weightx = 1.0;
- auxPanel.add(getField(fieldNames[i]), gbc);
- }
-
- return panel;
- }
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/ServerSettingsPanel.java b/opends/src/quicksetup/org/opends/quicksetup/ui/ServerSettingsPanel.java
index 53f4bb1..0bdbf53 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/ServerSettingsPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/ServerSettingsPanel.java
@@ -42,7 +42,6 @@
import javax.swing.text.JTextComponent;
import org.opends.quicksetup.event.BrowseActionListener;
-import org.opends.quicksetup.installer.FieldName;
import org.opends.quicksetup.util.Utils;
import org.opends.quicksetup.UserData;
@@ -77,15 +76,15 @@
/**
* Constructor of the panel.
- * @param defaultUserData the default values that must be used to initialize
+ * @param application Application this panel represents
* the fields of the panel.
*/
- public ServerSettingsPanel(UserData defaultUserData)
+ public ServerSettingsPanel(GuiApplication application)
{
- this.defaultUserData = defaultUserData;
+ super(application);
+ this.defaultUserData = application.getUserData();
this.displayServerLocation = isWebStart();
populateLabelAndFieldMaps();
- createLayout();
addFocusListeners();
}
@@ -368,7 +367,7 @@
{
LabelFieldDescriptor desc = hm.get(fieldName);
String defaultValue = getDefaultValue(fieldName);
- JTextComponent field = makeJTextComponent(desc, defaultValue);
+ JTextComponent field = UIFactory.makeJTextComponent(desc, defaultValue);
JLabel label = makeJLabel(desc);
hmFields.put(fieldName, field);
@@ -384,7 +383,7 @@
LabelFieldDescriptor.FieldType.TEXTFIELD,
LabelFieldDescriptor.LabelType.PRIMARY, UIFactory.PATH_FIELD_SIZE);
lServerLocation = makeJLabel(desc);
- tfServerLocationParent = makeJTextComponent(desc, "");
+ tfServerLocationParent = UIFactory.makeJTextComponent(desc, "");
lServerLocation.setLabelFor(tfServerLocationParent);
desc =
@@ -393,7 +392,7 @@
LabelFieldDescriptor.FieldType.TEXTFIELD,
LabelFieldDescriptor.LabelType.PRIMARY,
UIFactory.RELATIVE_PATH_FIELD_SIZE);
- tfServerLocationRelativePath = makeJTextComponent(desc, "");
+ tfServerLocationRelativePath = UIFactory.makeJTextComponent(desc, "");
String defaultPath = getDefaultValue(FieldName.SERVER_LOCATION);
if (defaultPath != null)
{
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/StepsPanel.java b/opends/src/quicksetup/org/opends/quicksetup/ui/StepsPanel.java
index 1f6c1c6..82301d7 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/StepsPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/StepsPanel.java
@@ -37,7 +37,6 @@
import javax.swing.JLabel;
import javax.swing.JPanel;
-import org.opends.quicksetup.GuiApplication;
import org.opends.quicksetup.WizardStep;
/**
@@ -56,15 +55,13 @@
HashMap<WizardStep, JLabel> hmIcons = new HashMap<WizardStep, JLabel>();
- GuiApplication application = null;
-
/**
* Creates a StepsPanel.
* @param app Application whose steps this class represents
*/
public StepsPanel(GuiApplication app)
{
- this.application = app;
+ super(app);
createLayout(app);
}
@@ -76,7 +73,7 @@
*/
public void setDisplayedStep(WizardStep step)
{
- for (WizardStep s : application.getWizardSteps())
+ for (WizardStep s : getApplication().getWizardSteps())
{
if (s.equals(step))
{
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java b/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
index c4cad53..4b9b33d 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
@@ -36,22 +36,8 @@
import java.awt.Toolkit;
import java.util.HashMap;
-import javax.swing.BorderFactory;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComponent;
-import javax.swing.JEditorPane;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JPasswordField;
-import javax.swing.JRadioButton;
-import javax.swing.JScrollBar;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.ListCellRenderer;
-import javax.swing.UIManager;
+import javax.swing.*;
+import javax.swing.text.JTextComponent;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
@@ -645,6 +631,14 @@
}
/**
+ * Creates a JComboBox.
+ * @return JComboBox a new combo box
+ */
+ static public JComboBox makeJComboBox() {
+ return new JComboBox();
+ }
+
+ /**
* Creates a JButton with the given label and tooltip.
* @param label the text of the button.
* @param tooltip the tooltip of the button.
@@ -670,6 +664,24 @@
}
/**
+ * Commodity method that returns a JLabel based on a LabelFieldDescriptor.
+ * @param desc the LabelFieldDescriptor describing the JLabel.
+ * @return a JLabel based on a LabelFieldDescriptor.
+ */
+ static public JLabel makeJLabel(LabelFieldDescriptor desc)
+ {
+ UIFactory.TextStyle style;
+ if (desc.getLabelType() == LabelFieldDescriptor.LabelType.PRIMARY)
+ {
+ style = UIFactory.TextStyle.PRIMARY_FIELD_VALID;
+ } else
+ {
+ style = UIFactory.TextStyle.SECONDARY_FIELD_VALID;
+ }
+ return makeJLabel(UIFactory.IconType.NO_ICON, desc.getLabel(), style);
+ }
+
+ /**
* Creates a JLabel with the given icon, text and text style.
* @param iconName the icon.
* @param text the label text.
@@ -700,6 +712,47 @@
}
/**
+ * Commodity method that returns a JTextComponent based on a
+ * LabelFieldDescriptor.
+ * @param desc the LabelFieldDescriptor describing the JTextField.
+ * @param defaultValue the default value used to initialize the
+ * JTextComponent.
+ * @return a JTextComponent based on a
+ * LabelFieldDescriptor.
+ */
+ static public JTextComponent makeJTextComponent(LabelFieldDescriptor desc,
+ String defaultValue)
+ {
+ JTextComponent field;
+ switch (desc.getType())
+ {
+ case TEXTFIELD:
+
+ field =
+ makeJTextField(defaultValue, desc.getTooltip(), desc
+ .getSize(), TextStyle.TEXTFIELD);
+ break;
+
+ case PASSWORD:
+
+ field =
+ makeJPasswordField(defaultValue, desc.getTooltip(), desc
+ .getSize(), TextStyle.PASSWORD_FIELD);
+ break;
+
+ case READ_ONLY:
+
+ field =
+ makeTextPane(defaultValue, TextStyle.READ_ONLY);
+ break;
+
+ default:
+ throw new IllegalArgumentException("Unknown type: " + desc.getType());
+ }
+ return field;
+ }
+
+ /**
* Creates a JTextField with the given icon, tooltip text, size and text
* style.
* @param text the text.
@@ -910,6 +963,9 @@
*/
public static ImageIcon getImageIcon(IconType iconType)
{
+ if (iconType == null) {
+ iconType = IconType.NO_ICON;
+ }
ImageIcon icon = hmIcons.get(iconType);
if ((icon == null) && (iconType != IconType.NO_ICON))
{
@@ -979,6 +1035,7 @@
setTextStyle(pane, style);
pane.setEditable(false);
pane.setBorder(new EmptyBorder(0, 0, 0, 0));
+ pane.setOpaque(false);
return pane;
}
@@ -1357,6 +1414,9 @@
*/
private static String getIconTooltip(IconType iconType)
{
+ if (iconType == null) {
+ iconType = IconType.NO_ICON;
+ }
String tooltip;
switch (iconType)
{
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/Utilities.java b/opends/src/quicksetup/org/opends/quicksetup/ui/Utilities.java
new file mode 100644
index 0000000..8431aa3
--- /dev/null
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/Utilities.java
@@ -0,0 +1,76 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+
+package org.opends.quicksetup.ui;
+
+import javax.swing.*;
+import javax.swing.text.JTextComponent;
+import java.awt.*;
+
+/**
+ * A set of utilities specific to GUI QuickSetup applications.
+ */
+public class Utilities {
+
+ /**
+ * Creates a panel with a field and a browse button.
+ * @param lbl JLabel for the field
+ * @param tf JTextField for holding the browsed data
+ * @param but JButton for invoking browse action
+ * @return the created panel.
+ */
+ static public JPanel createBrowseButtonPanel(JLabel lbl,
+ JTextComponent tf,
+ JButton but)
+ {
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ JPanel panel = new JPanel(new GridBagLayout());
+ panel.setOpaque(false);
+ gbc.insets = UIFactory.getEmptyInsets();
+ gbc.gridwidth = 4;
+ gbc.weightx = 0.0;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ panel.add(lbl, gbc);
+
+ gbc.insets.left = UIFactory.LEFT_INSET_SECONDARY_FIELD;
+ gbc.gridwidth--;
+ gbc.weightx = 0.1;
+ panel.add(tf, gbc);
+
+ gbc.insets.left = UIFactory.LEFT_INSET_BROWSE;
+ gbc.gridwidth = GridBagConstraints.RELATIVE;
+ panel.add(but, gbc);
+
+ gbc.weightx = 1.0;
+ gbc.gridwidth = GridBagConstraints.REMAINDER;
+ panel.add(Box.createHorizontalGlue(), gbc);
+
+ return panel;
+ }
+
+}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java b/opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java
index a7a87a4..1032d64 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java
@@ -30,7 +30,7 @@
import org.opends.quicksetup.*;
import static org.opends.quicksetup.Step.PROGRESS;
import static org.opends.quicksetup.Step.REVIEW;
-import org.opends.quicksetup.installer.FieldName;
+import org.opends.quicksetup.ui.FieldName;
import org.opends.quicksetup.ui.*;
import org.opends.quicksetup.util.Utils;
import org.opends.quicksetup.util.BackgroundTask;
@@ -651,9 +651,9 @@
public QuickSetupStepPanel createWizardStepPanel(WizardStep step) {
QuickSetupStepPanel p = null;
if (step == Step.CONFIRM_UNINSTALL) {
- p = new ConfirmUninstallPanel(installStatus);
+ p = new ConfirmUninstallPanel(this, installStatus);
} else if (step == Step.PROGRESS) {
- p = new ProgressPanel();
+ p = new ProgressPanel(this);
}
return p;
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
index b7e90f5..a0a53a5 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
@@ -109,7 +109,8 @@
if (args != null) {
for (int i = 0; i < args.length; i++) {
if (args[i].equals("--" + UpgraderCliHelper.FILE_OPTION_LONG) ||
- args[i].equals("-" + UpgraderCliHelper.FILE_OPTION_SHORT)) {
+ args[i].equalsIgnoreCase(
+ "-" + UpgraderCliHelper.FILE_OPTION_SHORT)) {
if (i < args.length - 1) {
buildFileName = args[i+ 1];
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java
new file mode 100644
index 0000000..15c4bd0
--- /dev/null
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java
@@ -0,0 +1,183 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2007 Sun Microsystems, Inc.
+ */
+
+package org.opends.quicksetup.upgrader;
+
+import org.opends.quicksetup.Application;
+
+import java.net.URL;
+import java.net.Proxy;
+import java.net.URLConnection;
+import java.util.*;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+import java.util.logging.Logger;
+import java.io.*;
+
+/**
+ * Manages listing and retreival of build packages on a remote host.
+ */
+public class RemoteBuildManager {
+
+ static private final Logger LOG =
+ Logger.getLogger(RemoteBuildManager.class.getName());
+
+ /**
+ * Describes build types.
+ */
+ enum BuildType {
+
+ NIGHTLY,
+
+ WEEKLY
+
+ }
+
+ /**
+ * Representation of an OpenDS build package.
+ */
+ public class Build {
+
+ private URL url;
+ private String id;
+
+ /**
+ * Creates an instance.
+ * @param url where the build package can be accessed
+ * @param id of the new build
+ */
+ Build(URL url, String id) {
+ this.url = url;
+ this.id = id;
+ }
+
+ /**
+ * Gets the URL where the build can be accessed.
+ * @return URL representing access to the build package
+ */
+ public URL getUrl() {
+ return url;
+ }
+
+ /**
+ * Gets the builds ID number, a 14 digit number representing the time
+ * the build was created.
+ * @return String represenging the build
+ */
+ public String getId() {
+ return id;
+ }
+
+ }
+
+ private Application app;
+
+ private Proxy proxy;
+
+ private URL url;
+
+ /**
+ * Creates an instance.
+ * @param app using this tool
+ * @param url base context for an OpenDS build repository
+ */
+ public RemoteBuildManager(Application app, URL url) {
+ this.app = app;
+ this.url = url;
+ }
+
+ /**
+ * Gets a list of builds found in the remote repository.
+ * @return List of Build objects representing remote builds
+ * @throws IOException if there was a problem contacting the build
+ * repository
+ */
+ public List<Build> listBuilds() throws IOException {
+ List<Build> buildList = new ArrayList<Build>();
+ String dailyBuildsPage = getDailyBuildsPage();
+ Pattern p = Pattern.compile("\\d{14}");
+ Matcher m = p.matcher(dailyBuildsPage);
+ Set<String> buildIds = new HashSet<String>();
+ while (m.find()) {
+ buildIds.add(dailyBuildsPage.substring(m.start(), m.end()));
+ }
+ for (String buildId : buildIds) {
+ buildList.add(new Build(url, buildId));
+ }
+ return buildList;
+ }
+
+ private String getDailyBuildsPage() throws IOException {
+ URL dailyBuildsUrl = new URL(url, "daily-builds");
+ URLConnection conn;
+ if (proxy == null) {
+ conn = dailyBuildsUrl.openConnection();
+ } else {
+ conn = dailyBuildsUrl.openConnection(proxy);
+ }
+ InputStream in = conn.getInputStream();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(in));
+ StringBuilder builder = new StringBuilder();
+ String line;
+ while (null != (line = reader.readLine())) {
+ builder.append(line);
+ }
+ return builder.toString();
+ }
+
+ /**
+ * Downloads a particular build from the build repository to a specific
+ * location on the local file system.
+ * @param build to download
+ * @param destination directory for the newly downloaded file
+ */
+ public void download(Build build, File destination) {
+
+ }
+
+ /**
+ * For testing only.
+ * @param args command line arguments
+ */
+ public static void main(String[] args) {
+ try {
+ Properties systemSettings = System.getProperties();
+ systemSettings.put("http.proxyHost", "webcache.central.sun.com");
+ systemSettings.put("http.proxyPort", "8080");
+ System.setProperties(systemSettings);
+ URL url = new URL("http://builds.opends.org");
+ RemoteBuildManager rbm = new RemoteBuildManager(null, url);
+ List<Build> builds = rbm.listBuilds();
+ for (Build build : builds) {
+ System.out.println("build " + build.getId());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
index 7c55a5c..88ae62f 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -28,11 +28,13 @@
package org.opends.quicksetup.upgrader;
import org.opends.quicksetup.*;
+import org.opends.quicksetup.upgrader.ui.WelcomePanel;
+import org.opends.quicksetup.upgrader.ui.ChooseVersionPanel;
+import org.opends.quicksetup.upgrader.ui.UpgraderReviewPanel;
import org.opends.quicksetup.util.Utils;
import org.opends.quicksetup.util.FileManager;
import org.opends.quicksetup.util.ServerController;
-import org.opends.quicksetup.ui.QuickSetupDialog;
-import org.opends.quicksetup.ui.QuickSetupStepPanel;
+import org.opends.quicksetup.ui.*;
import org.opends.server.tools.BackUpDB;
import org.opends.server.tools.LDIFDiff;
import org.opends.server.util.*;
@@ -182,11 +184,6 @@
private UpgraderCliHelper cliHelper = null;
/**
- * Directory where we keep files temporarily.
- */
- private File stagingDirectory = null;
-
- /**
* Directory where backup is kept in case the upgrade needs reversion.
*/
private File backupDirectory = null;
@@ -292,21 +289,56 @@
* {@inheritDoc}
*/
public QuickSetupStepPanel createWizardStepPanel(WizardStep step) {
- return null;
+ QuickSetupStepPanel pnl = null;
+ if (UpgradeWizardStep.WELCOME.equals(step)) {
+ pnl = new WelcomePanel(this);
+ } else if (UpgradeWizardStep.CHOOSE_VERSION.equals(step)) {
+ pnl = new ChooseVersionPanel(this);
+ } else if (UpgradeWizardStep.REVIEW.equals(step)) {
+ pnl = new UpgraderReviewPanel(this);
+ } else if (UpgradeWizardStep.PROGRESS.equals(step)) {
+ pnl = new ProgressPanel(this);
+ }
+ return pnl;
}
/**
* {@inheritDoc}
*/
- public Step getNextWizardStep(WizardStep step) {
- return null;
+ public WizardStep getNextWizardStep(WizardStep step) {
+ WizardStep next = null;
+ if (UpgradeWizardStep.WELCOME.equals(step)) {
+ next = UpgradeWizardStep.CHOOSE_VERSION;
+ } else if (UpgradeWizardStep.CHOOSE_VERSION.equals(step)) {
+ next = UpgradeWizardStep.REVIEW;
+ } else if (UpgradeWizardStep.REVIEW.equals(step)) {
+ next = UpgradeWizardStep.PROGRESS;
+ }
+ return next;
}
/**
* {@inheritDoc}
*/
public WizardStep getPreviousWizardStep(WizardStep step) {
- return null;
+ WizardStep prev = null;
+ if (UpgradeWizardStep.PROGRESS.equals(step)) {
+ prev = UpgradeWizardStep.REVIEW;
+ } else if (UpgradeWizardStep.REVIEW.equals(step)) {
+ prev = UpgradeWizardStep.CHOOSE_VERSION;
+ } else if (UpgradeWizardStep.CHOOSE_VERSION.equals(step)) {
+ prev = UpgradeWizardStep.WELCOME;
+ }
+ return prev;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canCancel(WizardStep step) {
+ return UpgradeWizardStep.WELCOME == step ||
+ UpgradeWizardStep.CHOOSE_VERSION == step ||
+ UpgradeWizardStep.REVIEW == step;
}
/**
@@ -318,7 +350,7 @@
/**
* {@inheritDoc}
*/
- protected void updateUserData(WizardStep cStep, QuickSetup qs)
+ public void updateUserData(WizardStep cStep, QuickSetup qs)
throws UserDataException {
}
@@ -350,6 +382,15 @@
* {@inheritDoc}
*/
public void cancelClicked(WizardStep cStep, QuickSetup qs) {
+ // TODO: confirm cancel
+ System.exit(1);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canFinish(WizardStep step) {
+ return UpgradeWizardStep.REVIEW.equals(step);
}
/**
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java
index a1bd1f7..bb35cf8 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java
@@ -45,7 +45,7 @@
public class UpgraderCliHelper extends CliApplicationHelper {
/** Short form of the option for specifying the installation package file. */
- static public final Character FILE_OPTION_SHORT = 'F';
+ static public final Character FILE_OPTION_SHORT = 'f';
/** Long form of the option for specifying the installation package file. */
static public final String FILE_OPTION_LONG = "file";
@@ -85,7 +85,7 @@
} else {
// TODO i18N
throw new UserDataException(null,
- "-F must be present");
+ "-f must be present");
}
} catch (ArgumentException e) {
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java
new file mode 100644
index 0000000..154482e
--- /dev/null
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java
@@ -0,0 +1,166 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2007 Sun Microsystems, Inc.
+ */
+
+package org.opends.quicksetup.upgrader.ui;
+
+import org.opends.quicksetup.ui.QuickSetupStepPanel;
+import org.opends.quicksetup.ui.UIFactory;
+import org.opends.quicksetup.ui.Utilities;
+import org.opends.quicksetup.ui.GuiApplication;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * This panel allows the user to select a remote or local build for upgrade.
+ */
+public class ChooseVersionPanel extends QuickSetupStepPanel {
+
+ private static final long serialVersionUID = -6941309163077121917L;
+
+ /**
+ * Creates an instance.
+ * @param application this panel represents.
+ */
+ public ChooseVersionPanel(GuiApplication application) {
+ super(application);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected Component createInputPanel() {
+ Component c;
+
+ JPanel p = new JPanel();
+
+ JRadioButton rbRemote = UIFactory.makeJRadioButton(
+ getMsg("upgrade-choose-version-remote-label"),
+ getMsg("upgrade-choose-version-remote-tooltip"),
+ UIFactory.TextStyle.SECONDARY_FIELD_VALID);
+
+ JRadioButton rbLocal = UIFactory.makeJRadioButton(
+ getMsg("upgrade-choose-version-local-label"),
+ getMsg("upgrade-choose-version-local-tooltip"),
+ UIFactory.TextStyle.SECONDARY_FIELD_VALID);
+
+ JComboBox cboBuild = UIFactory.makeJComboBox();
+ cboBuild.setModel(createBuildComboBoxModel());
+
+ // TODO: use UIFactory
+ JTextField tfBuild = new JTextField();
+ tfBuild.setColumns(20);
+
+ JPanel pnlBrowse = Utilities.createBrowseButtonPanel(
+ UIFactory.makeJLabel(null,
+ getMsg("upgrade-choose-version-local-path"),
+ UIFactory.TextStyle.SECONDARY_FIELD_VALID),
+ tfBuild,
+ UIFactory.makeJButton(getMsg("browse-button-label"),
+ getMsg("browse-button-tooltip")));
+
+ p.setLayout(new GridBagLayout());
+ // p.setBorder(BorderFactory.createLineBorder(Color.RED));
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.gridwidth = GridBagConstraints.REMAINDER;
+ gbc.insets = UIFactory.getEmptyInsets();
+ gbc.weightx = 1.0;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ gbc.insets = UIFactory.getEmptyInsets();
+ gbc.insets.top = 15; // non-standard but looks better
+ gbc.anchor = GridBagConstraints.FIRST_LINE_START;
+ p.add(rbRemote, gbc);
+
+ gbc.gridy = 1;
+ gbc.gridwidth = 1;
+ gbc.insets = UIFactory.getEmptyInsets();
+ gbc.insets.top = UIFactory.TOP_INSET_RADIO_SUBORDINATE;
+ gbc.insets.left = UIFactory.LEFT_INSET_RADIO_SUBORDINATE;
+ gbc.anchor = GridBagConstraints.LINE_START;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ gbc.weightx = 2;
+ p.add(cboBuild, gbc);
+
+ gbc.gridy = 1;
+ gbc.gridx = 1;
+ gbc.weightx = 1.5;
+ gbc.anchor = GridBagConstraints.CENTER;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ gbc.insets = UIFactory.getEmptyInsets();
+ JPanel fill = new JPanel();
+ // fill.setBorder(BorderFactory.createLineBorder(Color.BLUE));
+ p.add(fill, gbc);
+
+ gbc.gridy = 2;
+ gbc.gridx = 0;
+ gbc.insets = UIFactory.getEmptyInsets();
+ gbc.insets.top = 15; // UIFactory.TOP_INSET_RADIOBUTTON;
+ p.add(rbLocal, gbc);
+
+ gbc.gridy = 3;
+ gbc.insets = UIFactory.getEmptyInsets();
+ gbc.insets.top = UIFactory.TOP_INSET_RADIO_SUBORDINATE;
+ gbc.insets.left = UIFactory.LEFT_INSET_RADIO_SUBORDINATE;
+ p.add(pnlBrowse, gbc);
+
+ gbc.gridy = 4;
+ gbc.weighty = 1.0;
+ gbc.weightx = 1.0;
+ gbc.fill = GridBagConstraints.BOTH;
+ gbc.anchor = GridBagConstraints.LINE_START;
+ JPanel fill2 = new JPanel();
+ //fill.setBorder(BorderFactory.createLineBorder(Color.BLUE));
+ p.add(fill2, gbc);
+
+
+ c = p;
+ return c;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected String getTitle() {
+ return getMsg("upgrade-choose-version-panel-title");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected String getInstructions() {
+ return getMsg("upgrade-choose-version-panel-instructions");
+ }
+
+ private ComboBoxModel createBuildComboBoxModel() {
+ // TODO: populate a list model with builds.
+ ComboBoxModel cbm = new DefaultComboBoxModel(new String[] {"xx","YY","ZZ"});
+ return cbm;
+ }
+
+}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/UpgraderReviewPanel.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/UpgraderReviewPanel.java
new file mode 100644
index 0000000..dae6789
--- /dev/null
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/UpgraderReviewPanel.java
@@ -0,0 +1,138 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+
+package org.opends.quicksetup.upgrader.ui;
+
+import org.opends.quicksetup.ui.ReviewPanel;
+import org.opends.quicksetup.ui.UIFactory;
+import org.opends.quicksetup.ui.LabelFieldDescriptor;
+import org.opends.quicksetup.upgrader.Upgrader;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * Presents upgrade information to the user to confirm before starting the
+ * actual upgrade.
+ */
+public class UpgraderReviewPanel extends ReviewPanel {
+
+ private static final long serialVersionUID = 5942916658585976799L;
+
+ /**
+ * Creates an instance.
+ * @param application Application represented by this panel
+ */
+ public UpgraderReviewPanel(Upgrader application) {
+ super(application);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected String getTitle() {
+ return getMsg("upgrade-review-panel-title");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected String getInstructions() {
+ return getMsg("upgrade-review-panel-instructions");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected JPanel createFieldsPanel() {
+ JPanel p = new JPanel();
+
+ LabelFieldDescriptor serverDescriptor = new LabelFieldDescriptor(
+ getMsg("upgrade-review-panel-server-label"),
+ getMsg("upgrade-review-panel-server-tooltip"),
+ LabelFieldDescriptor.FieldType.READ_ONLY,
+ LabelFieldDescriptor.LabelType.PRIMARY,
+ 0
+ );
+
+ LabelFieldDescriptor oldVersionDescriptor = new LabelFieldDescriptor(
+ getMsg("upgrade-review-panel-old-version-label"),
+ getMsg("upgrade-review-panel-old-version-tooltip"),
+ LabelFieldDescriptor.FieldType.READ_ONLY,
+ LabelFieldDescriptor.LabelType.PRIMARY,
+ 0
+ );
+
+ LabelFieldDescriptor newVersionDescriptor = new LabelFieldDescriptor(
+ getMsg("upgrade-review-panel-new-version-label"),
+ getMsg("upgrade-review-panel-new-version-tooltip"),
+ LabelFieldDescriptor.FieldType.READ_ONLY,
+ LabelFieldDescriptor.LabelType.PRIMARY,
+ 0
+ );
+
+ p.setLayout(new GridBagLayout());
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
+ gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
+ gbc.anchor = GridBagConstraints.NORTHWEST;
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.fill = GridBagConstraints.NONE;
+ p.add(UIFactory.makeJLabel(serverDescriptor), gbc);
+
+ gbc.gridx = 1;
+ gbc.gridy = 0;
+ gbc.weightx = 1.0;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ p.add(UIFactory.makeJTextComponent(serverDescriptor, "/xx/xx/xx"), gbc);
+
+ gbc.gridx = 0;
+ gbc.gridy = 1;
+ gbc.fill = GridBagConstraints.NONE;
+ p.add(UIFactory.makeJLabel(oldVersionDescriptor), gbc);
+
+ gbc.gridx = 1;
+ gbc.gridy = 1;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ p.add(UIFactory.makeJTextComponent(oldVersionDescriptor, "abcdefg"), gbc);
+
+ gbc.gridx = 0;
+ gbc.gridy = 2;
+ gbc.fill = GridBagConstraints.NONE;
+ p.add(UIFactory.makeJLabel(newVersionDescriptor), gbc);
+
+ gbc.gridx = 1;
+ gbc.gridy = 2;
+ gbc.weighty = 1.0;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ p.add(UIFactory.makeJTextComponent(newVersionDescriptor, "1234567"), gbc);
+
+ return p;
+ }
+}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/WelcomePanel.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/WelcomePanel.java
new file mode 100644
index 0000000..7944998
--- /dev/null
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/WelcomePanel.java
@@ -0,0 +1,208 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+
+package org.opends.quicksetup.upgrader.ui;
+
+import org.opends.quicksetup.ui.QuickSetupStepPanel;
+import org.opends.quicksetup.ui.UIFactory;
+import org.opends.quicksetup.ui.Utilities;
+import org.opends.quicksetup.ui.LabelFieldDescriptor;
+import org.opends.quicksetup.util.Utils;
+import org.opends.quicksetup.Installation;
+import org.opends.quicksetup.event.BrowseActionListener;
+import org.opends.quicksetup.upgrader.Upgrader;
+
+import javax.swing.*;
+import javax.swing.text.JTextComponent;
+import java.awt.*;
+import java.util.ArrayList;
+
+/**
+ * This panel is used to show a welcome message.
+ */
+public class WelcomePanel extends QuickSetupStepPanel {
+
+ private static final long serialVersionUID = 8695606871542491768L;
+
+ /**
+ * Default constructor.
+ * @param application Upgrader application
+ */
+ public WelcomePanel(Upgrader application) {
+ super(application);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected String getTitle() {
+ return getMsg("upgrade-welcome-panel-title");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected String getInstructions() {
+ /*
+ * We can use org.opends.server.util.DynamicConstants without problems as it
+ * has been added to quicksetup.jar during build time.
+ */
+ java.util.List<String> args = new ArrayList<String>();
+ String msgKey;
+ if (Utils.isWebStart()) {
+ msgKey = "upgrade-welcome-panel-webstart-instructions";
+ String cmd = Utils.isWindows() ? Installation.WINDOWS_UPGRADE_FILE_NAME :
+ Installation.UNIX_UPGRADE_FILE_NAME;
+ args.add(UIFactory.applyFontToHtml(cmd,
+ UIFactory.INSTRUCTIONS_MONOSPACE_FONT));
+ } else {
+ msgKey = "upgrade-welcome-panel-offline-instructions";
+ }
+ return getMsg(msgKey, args.toArray(new String[0]));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected Component createInputPanel() {
+ Component c;
+
+ JPanel pnlBuildInfo = new JPanel();
+ pnlBuildInfo.setLayout(new GridBagLayout());
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ // The WebStart version of this tool allows the user to
+ // select a build to upgrade. Running the tool from the
+ // command line implies a build.
+ if (!Utils.isWebStart()) {
+
+ LabelFieldDescriptor serverLocationDescriptor =
+ new LabelFieldDescriptor(getMsg("upgrade-location-label"),
+ getMsg("upgrade-location-tooltip"),
+ LabelFieldDescriptor.FieldType.TEXTFIELD,
+ LabelFieldDescriptor.LabelType.PRIMARY,
+ UIFactory.PATH_FIELD_SIZE);
+
+ JTextComponent tfBuild =
+ UIFactory.makeJTextComponent(serverLocationDescriptor, null);
+
+ JButton butBrowse =
+ UIFactory.makeJButton(getMsg("browse-button-label"),
+ getMsg("browse-button-tooltip"));
+
+ BrowseActionListener l =
+ new BrowseActionListener(tfBuild,
+ BrowseActionListener.BrowseType.LOCATION_DIRECTORY,
+ getMainWindow());
+ butBrowse.addActionListener(l);
+
+ JPanel pnlBrowser = Utilities.createBrowseButtonPanel(
+ UIFactory.makeJLabel(serverLocationDescriptor),
+ tfBuild,
+ butBrowse);
+ // pnlBrowser.setBorder(BorderFactory.createLineBorder(Color.GREEN));
+ gbc.insets.top = 15; // non-standard but looks better
+ gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
+ gbc.anchor = GridBagConstraints.FIRST_LINE_START;
+ pnlBuildInfo.add(pnlBrowser, gbc);
+
+ gbc.gridy = 1;
+ gbc.weighty = 1.0;
+ gbc.weightx = 1.0;
+ gbc.fill = GridBagConstraints.BOTH;
+ gbc.anchor = GridBagConstraints.LINE_START;
+ JPanel fill = new JPanel();
+ // fill.setBorder(BorderFactory.createLineBorder(Color.BLUE));
+ pnlBuildInfo.add(fill, gbc);
+
+ } else {
+
+ LabelFieldDescriptor serverLocationDescriptorRO =
+ new LabelFieldDescriptor(getMsg("upgrade-location-label"),
+ getMsg("upgrade-location-tooltip"),
+ LabelFieldDescriptor.FieldType.READ_ONLY,
+ LabelFieldDescriptor.LabelType.PRIMARY,
+ UIFactory.PATH_FIELD_SIZE);
+
+ LabelFieldDescriptor serverBuildDescriptorRO =
+ new LabelFieldDescriptor(getMsg("upgrade-build-id-label"),
+ getMsg("upgrade-build-id-tooltip"),
+ LabelFieldDescriptor.FieldType.READ_ONLY,
+ LabelFieldDescriptor.LabelType.PRIMARY,
+ UIFactory.PATH_FIELD_SIZE);
+
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.anchor = GridBagConstraints.FIRST_LINE_START;
+ gbc.insets.top = 15; // non-standard but looks better
+ gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
+ pnlBuildInfo.add(UIFactory.makeJLabel(serverLocationDescriptorRO), gbc);
+
+ gbc.gridx = 1;
+ gbc.gridy = 0;
+ gbc.weightx = 1.0;
+ gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ gbc.anchor = GridBagConstraints.PAGE_START;
+ String installLocation = Utils.getPath(
+ getApplication().getInstallation().getRootDirectory());
+ pnlBuildInfo.add(
+ UIFactory.makeJTextComponent(
+ serverLocationDescriptorRO, installLocation), gbc);
+
+ gbc.gridx = 0;
+ gbc.gridy = 1;
+ gbc.anchor = GridBagConstraints.LINE_START;
+ gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
+ gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
+ pnlBuildInfo.add(UIFactory.makeJLabel(serverBuildDescriptorRO), gbc);
+
+ gbc.gridx = 1;
+ gbc.gridy = 1;
+ gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ pnlBuildInfo.add(UIFactory.makeJTextComponent(
+ serverBuildDescriptorRO,
+ org.opends.server.util.DynamicConstants.BUILD_ID), gbc);
+
+ gbc.gridy = 2;
+ gbc.weighty = 1.0;
+ gbc.weightx = 1.0;
+ gbc.fill = GridBagConstraints.BOTH;
+ gbc.anchor = GridBagConstraints.LINE_START;
+ JPanel fill = new JPanel();
+ //fill.setBorder(BorderFactory.createLineBorder(Color.BLUE));
+ pnlBuildInfo.add(fill, gbc);
+ }
+
+ c = pnlBuildInfo;
+
+ return c;
+ }
+
+
+}
--
Gitblit v1.10.0