From 7bb144d1607a73e58d168f79e2de48bc69a9f839 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Thu, 05 Feb 2009 13:05:53 +0000
Subject: [PATCH] Update the code so that the scroll positions are maintained after the contents of the panels are updated. This way, even if configuration or monitoring information are changed, there are no sudden changes of the scroll position which was quite annoying.
---
opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusPanel.java | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusPanel.java
index 2b8aab8..43cfbb8 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusPanel.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008 Sun Microsystems, Inc.
+ * Copyright 2008-2009 Sun Microsystems, Inc.
*/
package org.opends.guitools.controlpanel.ui;
@@ -49,6 +49,7 @@
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
+import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
@@ -64,6 +65,7 @@
import org.opends.guitools.controlpanel.ui.renderer.BaseDNCellRenderer;
import org.opends.guitools.controlpanel.ui.renderer.CustomCellRenderer;
import org.opends.guitools.controlpanel.util.Utilities;
+import org.opends.guitools.controlpanel.util.ViewPositions;
import org.opends.messages.Message;
import org.opends.messages.MessageBuilder;
import org.opends.server.types.DN;
@@ -232,6 +234,17 @@
*/
public void updateContents(ServerDescriptor desc)
{
+ JScrollPane scroll = Utilities.getContainingScroll(this);
+ ViewPositions pos;
+ if (scroll != null)
+ {
+ pos = Utilities.getViewPositions(scroll);
+ }
+ else
+ {
+ pos = Utilities.getViewPositions(this);
+ }
+
Collection<OpenDsException> exceptions = desc.getExceptions();
if (exceptions.size() == 0)
{
@@ -412,6 +425,8 @@
authenticate.setVisible(!isAuthenticated && isRunning);
recalculateSizes();
+
+ Utilities.updateViewPositions(pos);
}
/**
--
Gitblit v1.10.0