From 486ffa6d0abfa0b91dc7ab22ee71758b5eecfb88 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 26 Sep 2007 18:57:15 +0000
Subject: [PATCH] Fix for 2306: configure replication encryption on or off in dsreplication and setup-gui

---
 opends/src/quicksetup/org/opends/quicksetup/installer/ui/RemoteReplicationPortsPanel.java |   42 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/RemoteReplicationPortsPanel.java b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/RemoteReplicationPortsPanel.java
index 1d97efc..318e48d 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/RemoteReplicationPortsPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/RemoteReplicationPortsPanel.java
@@ -42,6 +42,7 @@
 import java.util.TreeSet;
 
 import javax.swing.Box;
+import javax.swing.JCheckBox;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
@@ -71,6 +72,8 @@
     new HashMap<String, JLabel>();
   private HashMap<String, JTextComponent> hmFields =
     new HashMap<String, JTextComponent>();
+  private HashMap<String, JCheckBox> hmCbs =
+    new HashMap<String, JCheckBox>();
   private JScrollPane scroll;
   private JPanel fieldsPanel;
   private TreeSet<ServerDescriptor> orderedServers =
@@ -105,6 +108,15 @@
       }
       value = hm;
     }
+    else if (fieldName == FieldName.REMOTE_REPLICATION_SECURE)
+    {
+      Map<String, Boolean> hm = new HashMap<String, Boolean>();
+      for (String id : hmCbs.keySet())
+      {
+        hm.put(id, hmCbs.get(id).isSelected());
+      }
+      value = hm;
+    }
     return value;
   }
 
@@ -243,9 +255,16 @@
       {
         hmOldValues.put(id, hmFields.get(id).getText());
       }
+      HashMap<String, Boolean> hmOldSecureValues =
+        new HashMap<String, Boolean>();
+      for (String id : hmCbs.keySet())
+      {
+        hmOldSecureValues.put(id, hmCbs.get(id).isSelected());
+      }
       orderedServers.clear();
       orderedServers.addAll(array);
       hmFields.clear();
+      hmCbs.clear();
       hmLabels.clear();
       for (ServerDescriptor server : orderedServers)
       {
@@ -264,10 +283,10 @@
                 LabelFieldDescriptor.FieldType.TEXTFIELD,
                 LabelFieldDescriptor.LabelType.PRIMARY,
                 UIFactory.PORT_FIELD_SIZE);
-        Integer defaultValue =
+        AuthenticationData auth =
           data.getRemoteWithNoReplicationPort().get(server);
         JTextComponent field = UIFactory.makeJTextComponent(desc,
-            String.valueOf(defaultValue));
+            String.valueOf(auth.getPort()));
         String oldValue = hmOldValues.get(server.getId());
         if (oldValue != null)
         {
@@ -285,6 +304,18 @@
         }
 
         hmLabels.put(server.getId(), label);
+
+        JCheckBox cb = UIFactory.makeJCheckBox(
+            INFO_SECURE_REPLICATION_LABEL.get(),
+            INFO_SECURE_REPLICATION_TOOLTIP.get(),
+            UIFactory.TextStyle.SECONDARY_FIELD_VALID);
+        cb.setSelected(auth.useSecureConnection());
+        Boolean oldSecureValue = hmOldSecureValues.get(server.getId());
+        if (oldSecureValue != null)
+        {
+          cb.setSelected(oldSecureValue);
+        }
+        hmCbs.put(server.getId(), cb);
       }
       populateFieldsPanel();
     }
@@ -316,11 +347,14 @@
       {
         gbc.insets.top = UIFactory.TOP_INSET_SECONDARY_FIELD;
       }
-      gbc.gridwidth = 3;
+      gbc.gridwidth = 4;
       fieldsPanel.add(hmLabels.get(server.getId()), gbc);
       gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
-      gbc.gridwidth = GridBagConstraints.RELATIVE;
+      gbc.gridwidth--;
       fieldsPanel.add(hmFields.get(server.getId()), gbc);
+      gbc.insets.left = UIFactory.LEFT_INSET_SECONDARY_FIELD;
+      gbc.gridwidth = GridBagConstraints.RELATIVE;
+      fieldsPanel.add(hmCbs.get(server.getId()), gbc);
       gbc.gridwidth = GridBagConstraints.REMAINDER;
       gbc.weightx = 1.0;
       fieldsPanel.add(Box.createHorizontalGlue(), gbc);

--
Gitblit v1.10.0