[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rhq-commits
Subject:    [rhq] modules/enterprise
From:       jshaughn () fedoraproject ! org (Jay Shaughnessy)
Date:       2012-09-27 18:47:59
Message-ID: 20120927184759.7977CA2966 () fedorahosted ! org
[Download RAW message or body]

 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java \
|   24 +++++++---  1 file changed, 17 insertions(+), 7 deletions(-)

New commits:
commit 949ff96d973e2592762204713235cc359d2b63b6
Author: Jay Shaughnessy <jshaughn at jshaughn.csb>
Date:   Thu Sep 27 14:44:59 2012 -0400

    [Bug 814305 - Dealing with singletons in inventory]
    Fix an issue with the previous fix to handle the case where the parent
    did not actually have to worry about singleton children. Also, defer
    calling super's onInit until the subclass is done with it's work.

diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java \
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java
 index 265778b..36e0939 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java
                
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java
 @@ -86,7 +86,6 @@ public class ResourceCompositeSearchView extends \
ResourceSearchView {  
     @Override
     protected void onInit() {
-        super.onInit();
 
         // To properly filter Create Child and Import menus we need existing \
                singleton child resources. If the
         // user has create permission and the parent type has singleton child types \
and creatable or importable child @@ -99,7 +98,19 @@ public class \
ResourceCompositeSearchView extends ResourceSearchView {  importableChildTypes = \
getImportableChildTypes(parentType);  hasCreatableTypes = \
!creatableChildTypes.isEmpty();  hasImportableTypes = \
                !importableChildTypes.isEmpty();
-        refreshSingletons(parentResource, null);
+        refreshSingletons(parentResource, new AsyncCallback<PageList<Resource>>() {
+
+            public void onFailure(Throwable caught) {
+                ResourceCompositeSearchView.super.onInit();
+                initialized = true;
+            }
+
+            public void onSuccess(PageList<Resource> result) {
+                ResourceCompositeSearchView.super.onInit();
+                initialized = true;
+            }
+
+        });
         
     }
     
@@ -117,7 +128,6 @@ public class ResourceCompositeSearchView extends \
ResourceSearchView {  @Override
                 public void onSuccess(PageList<Resource> result) {
                     singletonChildren = result;
-                    initialized = true;
                     if (callback != null) {
                         callback.onSuccess(result);
                     }
@@ -126,14 +136,15 @@ public class ResourceCompositeSearchView extends \
ResourceSearchView {  @Override
                 public void onFailure(Throwable caught) {
                     Log.error("Failed to load child resources for [" + \
                parentResource + "]", caught);
-                    initialized = true;
                     if (callback != null) {
                         callback.onFailure(caught);
                     }
                 }
             });
         } else {
-            initialized = true;
+            if (callback != null) {
+                callback.onSuccess(new PageList<Resource>());
+            }
         }
     }
 
@@ -143,7 +154,7 @@ public class ResourceCompositeSearchView extends \
ResourceSearchView {  }
 
     // suppress unchecked warnings because the superclass has different generic \
                types for the datasource
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings("rawtypes")
     @Override
     protected RPCDataSource getDataSourceInstance() {
         return ResourceCompositeDataSource.getInstance();
@@ -213,7 +224,6 @@ public class ResourceCompositeSearchView extends \
ResourceSearchView {  private void addImportAndCreateButtons(boolean override) {
 
         final Resource parentResource = parentResourceComposite.getResource();
-        ResourceType parentType = parentResource.getResourceType();
 
         // Create Child Menu and Manual Import Menu
         if (canCreate && (hasCreatableTypes || hasImportableTypes)) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic