From 06ec8c88556b02782c7b91a233de91eaf4a1439d Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 09 Jun 2009 12:28:05 +0000
Subject: [PATCH] Fix for issue 3550 (Consider making the control panel able to manage remote servers)

---
 opends/src/guitools/org/opends/guitools/controlpanel/ui/ControlCenterMainPane.java |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/ControlCenterMainPane.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/ControlCenterMainPane.java
index e70d462..0f6435b 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/ControlCenterMainPane.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/ControlCenterMainPane.java
@@ -178,7 +178,7 @@
    * Returns the login dialog used to ask authentication to the user.
    * @return the login dialog used to ask authentication to the user.
    */
-  public GenericDialog getLoginDialog()
+  private GenericDialog getLoginDialog()
   {
     return statusPane.getLoginDialog();
   }
@@ -207,10 +207,60 @@
             INFO_CTRL_PANEL_NOT_AUTHENTICATED.get().toString());
       }
     }
-    else
+    else if (server.isLocal())
     {
       lAuthenticatedAs.setText(
          INFO_CTRL_PANEL_NOT_AUTHENTICATED_SERVER_NOT_RUNNING.get().toString());
     }
+    else
+    {
+      lAuthenticatedAs.setText(
+          INFO_CTRL_PANEL_NOT_AUTHENTICATED_SERVER_REMOTE.get(
+              server.getHostname()).toString());
+    }
+  }
+
+  private static GenericDialog localOrRemoteDlg;
+  private static GenericDialog loginDlg;
+
+  /**
+   * Returns the dialog that is in charge of asking the user the server
+   * to be administer.  This method will return always the same dialog.  The
+   * dialog will do all the logic of updating the ControlPanelInfo object.
+   * @param info the control panel information object.
+   * @return the dialog that is in charge of asking the user the server
+   * to be administer.
+   */
+  public static GenericDialog getLocalOrRemoteDialog(ControlPanelInfo info)
+  {
+    if (localOrRemoteDlg == null)
+    {
+      LocalOrRemotePanel localOrRemotePanel = new LocalOrRemotePanel();
+      localOrRemotePanel.setInfo(info);
+      localOrRemoteDlg = new GenericDialog(null, localOrRemotePanel);
+      localOrRemoteDlg.setModal(true);
+      localOrRemoteDlg.pack();
+    }
+    return localOrRemoteDlg;
+  }
+
+  /**
+   * Returns the dialog that is in charge of asking the user the authentication
+   * for the local server.  This method will return always the same dialog.
+   * @param info the control panel information object.  The
+   * dialog will do all the logic of updating the ControlPanelInfo object.
+   * @return the dialog that is in charge of asking the user the authentication
+   * for the local server.
+   */
+  public static GenericDialog getLocalServerLoginDialog(ControlPanelInfo info)
+  {
+    if (loginDlg == null)
+    {
+      LoginPanel loginPanel = new LoginPanel();
+      loginDlg = new GenericDialog(null, loginPanel);
+      loginPanel.setInfo(info);
+      loginDlg.setModal(true);
+    }
+    return loginDlg;
   }
 }

--
Gitblit v1.10.0