[rhq] Branch 'release/jon3.1.x' - 2 commits - modules/enterprise

Jay Shaughnessy jshaughn at fedoraproject.org
Thu Aug 9 14:10:36 UTC 2012


 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java |    3 
 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java       |   47 ++++++----
 2 files changed, 32 insertions(+), 18 deletions(-)

New commits:
commit 1e36d521827451188a255dba6bfd885b9a61fd7f
Author: Jay Shaughnessy <jshaughn at redhat.com>
Date:   Thu Aug 9 10:09:51 2012 -0400

    [BZ 827203] prevent infinite auto-switching between auto-group nodes occurs after fast-clicking between two auto-group nodes (https://bugzilla.redhat.com/show_bug.cgi?id=827203)
    
    Conflicts:
    
    	modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
    
    Cherry-pick master a92b7bcace3265964f87fb656b45cf3102ad8708

diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index eee9f61..4718865 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -1,6 +1,6 @@
 /*
-fcontext * RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 Red Hat, Inc.
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -183,17 +183,30 @@ public class ResourceTreeView extends LocatableVLayout {
 
                         AutoGroupTreeNode agNode = (AutoGroupTreeNode) selectedRecord;
                         selectedNodeId = agNode.getID();
-                        getAutoGroupBackingGroup(agNode, new AsyncCallback<ResourceGroup>() {
 
-                            public void onFailure(Throwable caught) {
-                                CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_loadFailed_selection(),
-                                    caught);
-                            }
+                        // [BZ 827203] Disable this view to prevent fast-click issues. It will get re-enabled when
+                        //             the detail resource or group view is done with its async init and calls
+                        //             notifyViewRenderedListeners() on itself.
+                        disable();
 
-                            public void onSuccess(ResourceGroup result) {
-                                renderAutoGroup(result);
-                            }
-                        });
+                        try {
+                            getAutoGroupBackingGroup(agNode, new AsyncCallback<ResourceGroup>() {
+                                public void onSuccess(ResourceGroup result) {
+                                    renderAutoGroup(result);
+                                }
+
+                                public void onFailure(Throwable caught) {
+                                    // Make sure to re-enable ourselves.
+                                    enable();
+                                    CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_loadFailed_selection(),
+                                        caught);
+                                }
+                            });
+                        } catch (RuntimeException re) {
+                            // Make sure to re-enable ourselves.
+                            enable();
+                            CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_loadFailed_selection(), re);
+                        }
                     } else {
                         // TODO: probably clicked on a subcategory, do we need a message?
                         treeGrid.deselectRecord(selectedRecord);
@@ -255,7 +268,7 @@ public class ResourceTreeView extends LocatableVLayout {
     private void getAutoGroupBackingGroup(final AutoGroupTreeNode agNode, final AsyncCallback<ResourceGroup> callback) {
         final ResourceGroupGWTServiceAsync resourceGroupService = GWTServiceLookup.getResourceGroupService();
 
-        // get the children tree nodes and build a child resourceId array 
+        // get the children tree nodes and build a child resourceId array
         TreeNode[] children = treeGrid.getTree().getChildren(agNode);
         final int[] childIds = new int[children.length];
         for (int i = 0, size = children.length; (i < size); ++i) {
@@ -271,13 +284,13 @@ public class ResourceTreeView extends LocatableVLayout {
         resourceGroupService.findResourceGroupsByCriteria(criteria, new AsyncCallback<PageList<ResourceGroup>>() {
 
             public void onFailure(Throwable caught) {
-                CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_loadFailed_node(), caught);
+                callback.onFailure(new RuntimeException(MSG.view_tree_common_loadFailed_node(), caught));
             }
 
             public void onSuccess(PageList<ResourceGroup> result) {
                 if (result.isEmpty()) {
                     // Not found, create new backing group
-                    // the backing group name is a display name using a unique parentResource-resourceType combo 
+                    // the backing group name is a display name using a unique parentResource-resourceType combo
                     final String backingGroupName = agNode.getBackingGroupName();
                     ResourceGroup backingGroup = new ResourceGroup(backingGroupName);
                     backingGroup.setAutoGroupParentResource(agNode.getParentResource());
@@ -286,8 +299,7 @@ public class ResourceTreeView extends LocatableVLayout {
                     resourceGroupService.createPrivateResourceGroup(backingGroup, childIds,
                         new AsyncCallback<ResourceGroup>() {
                             public void onFailure(Throwable caught) {
-                                callback.onFailure(new RuntimeException(MSG.view_tree_common_loadFailed_create(),
-                                    caught));
+                                callback.onFailure(new RuntimeException(MSG.view_tree_common_loadFailed_create(), caught));
                             }
 
                             public void onSuccess(ResourceGroup result) {
@@ -309,8 +321,7 @@ public class ResourceTreeView extends LocatableVLayout {
                     resourceGroupService.setAssignedResources(backingGroup.getId(), childIds, false,
                         new AsyncCallback<Void>() {
                             public void onFailure(Throwable caught) {
-                                callback.onFailure(new RuntimeException(MSG.view_tree_common_loadFailed_update(),
-                                    caught));
+                                callback.onFailure(new RuntimeException(MSG.view_tree_common_loadFailed_update(), caught));
                             }
 
                             public void onSuccess(Void result) {


commit 21458aefaa3bd0ec66fb53d670af38505d6512b8
Author: Jay Shaughnessy <jshaughn at redhat.com>
Date:   Thu Aug 9 09:59:10 2012 -0400

    [Bug 847014 - Resource tree not complete when more than 200 children]
    Allow an unlimited number of children when expanding the tree node. Although
    this may create a large vertical expansion, it may also be what the
    user wants.  See BZ comments for more on the approach and alternatives
    but basically, take this [easy] approach until it's clear that users, or UX,
    want something else.
    
    Cherry-pick of master dd7803912491f2c610baedb0023a9c1c2cc142a4

diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
index c072e13..2a5b827 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
@@ -43,6 +43,7 @@ import org.rhq.core.domain.criteria.ResourceCriteria;
 import org.rhq.core.domain.resource.Resource;
 import org.rhq.core.domain.resource.ResourceSubCategory;
 import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageControl;
 import org.rhq.core.domain.util.PageList;
 import org.rhq.enterprise.gui.coregui.client.CoreGUI;
 import org.rhq.enterprise.gui.coregui.client.Messages;
@@ -152,6 +153,8 @@ public class ResourceTreeDatasource extends DataSource {
 
             ResourceCriteria criteria = new ResourceCriteria();
             criteria.addFilterParentResourceId(Integer.parseInt(parentResourceId));
+            // we don't need sorting since we get everything and the tree nodes are already sorted
+            criteria.setPageControl(PageControl.getUnlimitedInstance());
 
             resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
                 public void onFailure(Throwable caught) {




More information about the rhq-commits mailing list