From b22e47475307d1a44ad7162a2d725b1ba4063b1d Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 11 Nov 2009 14:07:24 +0000
Subject: [PATCH] Fix for issue 4355 (Control Panel: Collapsing a branch while loading aborts loading and caches the incomplete info) Mark the node that is being collapsed (if not completely loaded) to be refreshed on next expand.
---
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java | 21 +++++++++++++++------
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/NodeSearcherQueue.java | 14 +++++++++++++-
2 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java
index a80ee90..46cbd87 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java
@@ -796,7 +796,7 @@
if (recursive) {
// The root cannot be queued directly.
// We need to queue each child individually.
- Enumeration e = rootNode.children();
+ Enumeration<?> e = rootNode.children();
while (e.hasMoreElements()) {
BasicNode child = (BasicNode)e.nextElement();
startRefreshNode(child, null, true);
@@ -807,9 +807,9 @@
refreshQueue.queue(new NodeRefresher(node, this, localEntry, recursive));
// The task does not *see* suffixes.
// So we need to propagate the refresh on
- // the subsuffixes if any.
+ // the sub-suffixes if any.
if (recursive && (node instanceof SuffixNode)) {
- Enumeration e = node.children();
+ Enumeration<?> e = node.children();
while (e.hasMoreElements()) {
BasicNode child = (BasicNode)e.nextElement();
if (child instanceof SuffixNode) {
@@ -834,7 +834,7 @@
refreshQueue.cancelAll();
}
else {
- Enumeration e = node.children();
+ Enumeration<?> e = node.children();
while (e.hasMoreElements()) {
BasicNode child = (BasicNode)e.nextElement();
stopRefreshNode(child);
@@ -850,7 +850,7 @@
* @param parentNode the parent node.
*/
void startRefreshReferralNodes(BasicNode parentNode) {
- Enumeration e = parentNode.children();
+ Enumeration<?> e = parentNode.children();
while (e.hasMoreElements()) {
BasicNode child = (BasicNode)e.nextElement();
if ((child.getReferral() != null) || (child.getRemoteUrl() != null)) {
@@ -914,6 +914,15 @@
if (!(node instanceof RootNode)) {
BasicNode basicNode = (BasicNode)node;
stopRefreshNode(basicNode);
+ synchronized (refreshQueue)
+ {
+ boolean isWorking = refreshQueue.isWorking(basicNode);
+ refreshQueue.cancelForNode(basicNode);
+ if (isWorking)
+ {
+ basicNode.setRefreshNeededOnExpansion(true);
+ }
+ }
}
}
@@ -1462,7 +1471,7 @@
(newState == NodeRefresher.State.SEARCHING_CHILDREN)) {
// The children search is going to start
if (canDoDifferentialUpdate(task)) {
- Enumeration e = node.children();
+ Enumeration<?> e = node.children();
while (e.hasMoreElements()) {
BasicNode child = (BasicNode)e.nextElement();
child.setObsolete(true);
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/NodeSearcherQueue.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/NodeSearcherQueue.java
index 4e36656..d460d12 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/NodeSearcherQueue.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/NodeSearcherQueue.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008 Sun Microsystems, Inc.
+ * Copyright 2008-2009 Sun Microsystems, Inc.
*/
package org.opends.guitools.controlpanel.browser;
@@ -127,6 +127,18 @@
notify();
}
+ /**
+ * Tells whether this node is in the working list.
+ * @param node the node.
+ * @return <CODE>true</CODE> if the provided node is being refreshed and
+ * <CODE>false</CODE> otherwise.
+ */
+ public synchronized boolean isWorking(BasicNode node)
+ {
+ boolean isWorking = workingList.get(node) != null;
+ return isWorking;
+ }
+
/**
* Cancel all the object from this queue.
--
Gitblit v1.10.0