From eb93a7bf09123d5fe7a8509e4a1421101163b670 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 08 Jun 2007 14:43:45 +0000
Subject: [PATCH] The following commit adds all the code necessary to be able to configure replication using the setup.

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java |   76 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 72 insertions(+), 4 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java
index be58712..c441344 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java
@@ -68,6 +68,7 @@
   private JRadioButton rbStandalone;
   private JRadioButton rbReplicated;
   private JCheckBox cbTopologyExists;
+  private JCheckBox cbRemoteServerPortSecure;
   private HashMap<FieldName, JLabel> hmLabels =
     new HashMap<FieldName, JLabel>();
   private HashMap<FieldName, JTextComponent> hmFields =
@@ -111,6 +112,17 @@
         value = DataReplicationOptions.Type.FIRST_IN_TOPOLOGY;
       }
     }
+    else if (fieldName == FieldName.REMOTE_SERVER_IS_SECURE_PORT)
+    {
+      if (cbRemoteServerPortSecure.isSelected())
+      {
+        value = Boolean.TRUE;
+      }
+      else
+      {
+        value = Boolean.FALSE;
+      }
+    }
     else
     {
       JTextComponent field = getField(fieldName);
@@ -165,10 +177,31 @@
 
     gbc.insets.top = UIFactory.TOP_INSET_SECONDARY_FIELD;
     gbc.insets.left = UIFactory.LEFT_INSET_RADIO_SUBORDINATE;
-    panel.add(cbTopologyExists, gbc);
-
     JPanel auxPanel = new JPanel(new GridBagLayout());
     auxPanel.setOpaque(false);
+    panel.add(auxPanel, gbc);
+    panel.add(cbTopologyExists, gbc);
+    gbc.insets = UIFactory.getEmptyInsets();
+    gbc.gridwidth = 3;
+    gbc.weightx = 0.0;
+    gbc.insets.left = 0;
+    gbc.anchor = GridBagConstraints.WEST;
+    auxPanel.add(getLabel(FieldName.REPLICATION_PORT), gbc);
+
+    gbc.gridwidth = GridBagConstraints.RELATIVE;
+    gbc.insets.left = UIFactory.LEFT_INSET_SECONDARY_FIELD;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.weightx = 0.0;
+    auxPanel.add(getField(FieldName.REPLICATION_PORT), gbc);
+
+    gbc.gridwidth = GridBagConstraints.REMAINDER;
+    gbc.insets.left = 0;
+    gbc.weightx = 1.0;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    auxPanel.add(Box.createHorizontalGlue(), gbc);
+
+    auxPanel = new JPanel(new GridBagLayout());
+    auxPanel.setOpaque(false);
     gbc.insets.left = 2 * UIFactory.LEFT_INSET_RADIO_SUBORDINATE;
     panel.add(auxPanel, gbc);
 
@@ -200,12 +233,26 @@
 
       JPanel aux2Panel = new JPanel(new GridBagLayout());
       aux2Panel.setOpaque(false);
-      gbc.gridwidth = GridBagConstraints.RELATIVE;
+
+      if (fields[i] == FieldName.REMOTE_SERVER_PORT)
+      {
+        gbc.gridwidth = 3;
+      }
+      else
+      {
+        gbc.gridwidth = GridBagConstraints.RELATIVE;
+      }
       gbc.insets.left = UIFactory.LEFT_INSET_SECONDARY_FIELD;
       gbc.fill = GridBagConstraints.HORIZONTAL;
       gbc.weightx = 0.0;
       aux2Panel.add(getField(fields[i]), gbc);
 
+      if (fields[i] == FieldName.REMOTE_SERVER_PORT)
+      {
+        gbc.gridwidth = GridBagConstraints.RELATIVE;
+        aux2Panel.add(cbRemoteServerPortSecure, gbc);
+      }
+
       gbc.gridwidth = GridBagConstraints.REMAINDER;
       gbc.insets.left = 0;
       gbc.weightx = 1.0;
@@ -264,6 +311,10 @@
       defaultUserData.getReplicationOptions().getAuthenticationData();
     switch (fieldName)
     {
+    case REPLICATION_PORT:
+      value = defaultUserData.getReplicationOptions().getReplicationPort();
+      break;
+
     case REMOTE_SERVER_DN:
       value = auth.getDn();
       break;
@@ -324,6 +375,13 @@
     HashMap<FieldName, LabelFieldDescriptor> hm =
         new HashMap<FieldName, LabelFieldDescriptor>();
 
+    hm.put(FieldName.REPLICATION_PORT, new LabelFieldDescriptor(
+        getMsg("replication-port-label"),
+        getMsg("replication-port-tooltip"),
+        LabelFieldDescriptor.FieldType.TEXTFIELD,
+        LabelFieldDescriptor.LabelType.SECONDARY,
+        UIFactory.PORT_FIELD_SIZE));
+
     hm.put(FieldName.REMOTE_SERVER_DN, new LabelFieldDescriptor(
         getMsg("remote-server-dn-label"), getMsg("remote-server-dn-tooltip"),
         LabelFieldDescriptor.FieldType.TEXTFIELD,
@@ -392,6 +450,10 @@
       DataReplicationOptions.Type.STANDALONE);
     cbTopologyExists.setSelected(type ==
       DataReplicationOptions.Type.IN_EXISTING_TOPOLOGY);
+    cbRemoteServerPortSecure = UIFactory.makeJCheckBox(
+        getMsg("remote-server-port-is-secure-label"),
+        getMsg("remote-server-port-is-secure-tooltip"),
+        UIFactory.TextStyle.SECONDARY_FIELD_VALID);
     checkEnablingState();
   }
 
@@ -449,7 +511,10 @@
         if (lastFocusComponent instanceof JTextComponent)
         {
           rbReplicated.setSelected(true);
-          cbTopologyExists.setSelected(true);
+          if (lastFocusComponent != getField(FieldName.REPLICATION_PORT))
+          {
+            cbTopologyExists.setSelected(true);
+          }
         }
       }
 
@@ -515,6 +580,9 @@
     }
 
     cbTopologyExists.setEnabled(rbReplicated.isSelected());
+    getLabel(FieldName.REPLICATION_PORT).setEnabled(rbReplicated.isSelected());
+    getField(FieldName.REPLICATION_PORT).setEnabled(rbReplicated.isSelected());
+    cbRemoteServerPortSecure.setEnabled(enableFields);
   }
 
   /**

--
Gitblit v1.10.0