From ff7ed17007414fbb17984b2daf5f380606ca8496 Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Thu, 28 Apr 2016 08:34:11 +0000
Subject: [PATCH] OPENDJ-2971 Resurect graphical setup methods
---
opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetup.java | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 60 insertions(+), 0 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetup.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetup.java
index 209ccda3..1906550 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetup.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetup.java
@@ -33,11 +33,13 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.opends.quicksetup.Application;
import org.opends.quicksetup.CurrentInstallStatus;
import org.opends.quicksetup.Installation;
import org.opends.quicksetup.ProgressDescriptor;
import org.opends.quicksetup.ProgressStep;
import org.opends.quicksetup.Step;
+import org.opends.quicksetup.TempLogFile;
import org.opends.quicksetup.UserDataCertificateException;
import org.opends.quicksetup.UserDataConfirmationException;
import org.opends.quicksetup.UserDataException;
@@ -47,6 +49,8 @@
import org.opends.quicksetup.event.ProgressUpdateEvent;
import org.opends.quicksetup.event.ProgressUpdateListener;
import org.opends.quicksetup.util.BackgroundTask;
+import org.opends.quicksetup.util.HtmlProgressMessageFormatter;
+import org.opends.quicksetup.util.ProgressMessageFormatter;
import org.opends.server.util.SetupUtils;
/**
@@ -81,6 +85,56 @@
private static final String MAC_APPLICATIONS_OPENER = "/usr/bin/open";
/**
+ * This method creates the install/uninstall dialogs and to check the current
+ * install status. This method must be called outside the event thread because
+ * it can perform long operations which can make the user think that the UI is
+ * blocked.
+ *
+ * @param tempLogFile
+ * temporary log file where messages will be logged.
+ * @param args
+ * for the moment this parameter is not used but we keep it in order
+ * to (in case of need) pass parameters through the command line.
+ */
+ public void initialize(final TempLogFile tempLogFile, String[] args)
+ {
+ ProgressMessageFormatter formatter = new HtmlProgressMessageFormatter();
+
+ installStatus = new CurrentInstallStatus();
+
+ application = Application.create();
+ application.setProgressMessageFormatter(formatter);
+ application.setCurrentInstallStatus(installStatus);
+ application.setTempLogFile(tempLogFile);
+ if (args != null)
+ {
+ application.setUserArguments(args);
+ }
+ else
+ {
+ application.setUserArguments(new String[] {});
+ }
+ try
+ {
+ initLookAndFeel();
+ }
+ catch (Throwable t)
+ {
+ // This is likely a bug.
+ t.printStackTrace();
+ }
+
+ /* In the calls to setCurrentStep the dialog will be created */
+ setCurrentStep(application.getFirstWizardStep());
+ }
+
+ /** This method displays the setup dialog. This method must be called from the event thread. */
+ public void display()
+ {
+ getDialog().packAndShow();
+ }
+
+ /**
* ButtonActionListener implementation. It assumes that we are called in the
* event thread.
*
@@ -562,6 +616,12 @@
getDialog().displayFieldInvalid(fieldName, invalid);
}
+ /** A method to initialize the look and feel. */
+ private void initLookAndFeel() throws Throwable
+ {
+ UIFactory.initialize();
+ }
+
/**
* A methods that creates an ProgressDescriptor based on the value of a
* ProgressUpdateEvent.
--
Gitblit v1.10.0