From 3c1e7fd4d2a7ffa65263e1e84c940c95faf44085 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 04 Nov 2009 12:14:07 +0000
Subject: [PATCH] Fix for issue 4336 (Control Panel: Structural changes won't refresh / no refresh button/menuentry) Refresh the contents when the browser window is re-opened.

---
 opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java
index c981a03..8c887be 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java
@@ -155,6 +155,8 @@
 
   private Thread entryReaderThread;
 
+  private boolean forceRefreshWhenOpening;
+
   /**
    * {@inheritDoc}
    */
@@ -203,6 +205,28 @@
   /**
    * {@inheritDoc}
    */
+  public void toBeDisplayed(boolean visible)
+  {
+    super.toBeDisplayed(visible);
+    boolean isAuthenticated = false;
+    if (getInfo() != null && getInfo().getServerDescriptor() != null)
+    {
+      isAuthenticated = getInfo().getServerDescriptor().isAuthenticated();
+    }
+    if (visible && !isDisposeOnClose() && forceRefreshWhenOpening &&
+        isAuthenticated)
+    {
+      refreshClicked();
+    }
+    if (!visible)
+    {
+      forceRefreshWhenOpening = isAuthenticated;
+    }
+  }
+
+  /**
+   * {@inheritDoc}
+   */
   protected Component createMainPanel()
   {
     JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
@@ -1328,7 +1352,7 @@
       {
         public void actionPerformed(ActionEvent ev)
         {
-          entryPane.getController().startRefresh(null);
+          refreshClicked();
         }
       });
       return menu;
@@ -1555,4 +1579,9 @@
     }
     return isInterruptedException;
   }
+
+  private void refreshClicked()
+  {
+    entryPane.getController().startRefresh(null);
+  }
 }

--
Gitblit v1.10.0