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/BackupListPanel.java |   46 ++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/BackupListPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/BackupListPanel.java
index 0f4807d..8b9c8f3 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/BackupListPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/BackupListPanel.java
@@ -132,6 +132,8 @@
    */
   protected JTable backupList;
 
+  private JLabel lRemoteFileHelp;
+
   /**
    * Whether the backup parent directory has been initialized with a value or
    * not.
@@ -214,6 +216,15 @@
     gbc.weightx = 0.0;
     add(browse, gbc);
 
+    lRemoteFileHelp = Utilities.createInlineHelpLabel(
+        INFO_CTRL_PANEL_REMOTE_SERVER_PATH.get());
+    gbc.gridx = 1;
+    gbc.gridwidth = 2;
+    gbc.insets.top = 3;
+    gbc.insets.left = 10;
+    gbc.gridy ++;
+    add(lRemoteFileHelp, gbc);
+
     gbc.gridx = 0;
     gbc.gridy ++;
     gbc.insets.top = 10;
@@ -222,6 +233,7 @@
         INFO_CTRL_PANEL_AVAILABLE_BACKUPS_LABEL.get());
     gbc.anchor = GridBagConstraints.NORTHWEST;
     gbc.fill = GridBagConstraints.NONE;
+    gbc.gridwidth = 1;
     add(lAvailableBackups, gbc);
 
     gbc.gridx = 1;
@@ -339,7 +351,7 @@
     verifyBackup.setEnabled(false);
     tableScroll.setVisible(false);
     lRefreshingList.setText(REFRESHING_LIST.toString());
-    lRefreshingList.setVisible(true);
+    lRefreshingList.setVisible(isLocal());
     final int lastSelectedRow = backupList.getSelectedRow();
 
     final String parentPath = parentDirectory.getText();
@@ -428,6 +440,7 @@
           {
             model.fireTableDataChanged();
             lRefreshingList.setText(NO_BACKUPS_FOUND.toString());
+            lRefreshingList.setVisible(isLocal());
           }
           errorPane.setVisible(false);
           // This is done to perform checks against whether we require to
@@ -522,20 +535,41 @@
     if (!backupDirectoryInitialized &&
         (parentDirectory.getText().length() == 0))
     {
-      final String path =
-        org.opends.quicksetup.util.Utils.getPath(
-            new File(desc.getInstancePath(),
-                org.opends.quicksetup.Installation.BACKUPS_PATH_RELATIVE));
+      String path;
+
+      File f = new File(desc.getInstancePath(),
+          org.opends.quicksetup.Installation.BACKUPS_PATH_RELATIVE);
+      try
+      {
+        path = f.getCanonicalPath();
+      }
+      catch (Throwable t)
+      {
+        path = f.getAbsolutePath();
+      }
+      final String fPath = path;
       SwingUtilities.invokeLater(new Runnable()
       {
         public void run()
         {
-          parentDirectory.setText(path);
+          parentDirectory.setText(fPath);
           refreshList();
           backupDirectoryInitialized = true;
         }
       });
     }
+    SwingUtilities.invokeLater(new Runnable()
+    {
+      public void run()
+      {
+        lRemoteFileHelp.setVisible(!isLocal());
+        browse.setVisible(isLocal());
+        lAvailableBackups.setVisible(isLocal());
+        tableScroll.setVisible(isLocal());
+        refreshList.setVisible(isLocal());
+        verifyBackup.setVisible(isLocal());
+      }
+    });
   }
 
   /**

--
Gitblit v1.10.0