modules/core/native-system/src/main/java/org/rhq/core/system/FileSystemInfo.java | 11 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeDatasource.java | 368 ---------- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java | 169 ++-- 3 files changed, 108 insertions(+), 440 deletions(-)
New commits: commit da4d8fd6d57b787c612e829486f0ed83a582680f Author: Ian Springer ian.springer@redhat.com Date: Fri Sep 24 18:13:58 2010 -0400
cleanup/refactor group tree view code; add autotypegroup nodes to cluster group tree (still need to add subcategory nodes); delete unused ResourceGroupTreeDatasource class; add toString() impl to FileSystemInfo class
diff --git a/modules/core/native-system/src/main/java/org/rhq/core/system/FileSystemInfo.java b/modules/core/native-system/src/main/java/org/rhq/core/system/FileSystemInfo.java index f6415ba..2bde8ee 100644 --- a/modules/core/native-system/src/main/java/org/rhq/core/system/FileSystemInfo.java +++ b/modules/core/native-system/src/main/java/org/rhq/core/system/FileSystemInfo.java @@ -35,7 +35,7 @@ import org.hyperic.sigar.SigarProxy; * @author John Mazzitelli */ public class FileSystemInfo { - private final Log log = LogFactory.getLog(FileSystemInfo.class); + private final Log log = LogFactory.getLog(this.getClass());
private final String mountPoint; private FileSystem fs; @@ -91,4 +91,13 @@ public class FileSystemInfo { public FileSystemUsage getFileSystemUsage() { return this.fsUsage; } + + @Override + public String toString() { + return this.getClass().getSimpleName() + "[" + + "mountPoint='" + mountPoint + ''' + + ", fs=" + fs + + ", fsUsage=" + fsUsage + + ']'; + } } \ No newline at end of file diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeDatasource.java deleted file mode 100644 index 76b7b76..0000000 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeDatasource.java +++ /dev/null @@ -1,368 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2010 Red Hat, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail; - -import java.util.ArrayList; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.List; - -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.smartgwt.client.data.DSRequest; -import com.smartgwt.client.data.DSResponse; -import com.smartgwt.client.data.DataSource; -import com.smartgwt.client.data.DataSourceField; -import com.smartgwt.client.data.fields.DataSourceImageField; -import com.smartgwt.client.data.fields.DataSourceTextField; -import com.smartgwt.client.rpc.RPCResponse; -import com.smartgwt.client.types.DSDataFormat; -import com.smartgwt.client.types.DSProtocol; -import com.smartgwt.client.widgets.tree.TreeNode; - -import org.rhq.core.domain.criteria.ResourceCriteria; -import org.rhq.core.domain.measurement.AvailabilityType; -import org.rhq.core.domain.resource.Resource; -import org.rhq.core.domain.resource.ResourceCategory; -import org.rhq.core.domain.resource.ResourceSubCategory; -import org.rhq.core.domain.resource.ResourceType; -import org.rhq.core.domain.util.PageList; -import org.rhq.enterprise.gui.coregui.client.CoreGUI; -import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; -import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync; -import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository; - -/** - * This doesn't extend RPCDataSource because it is tree oriented and - * behaves different from normal list data sources in some places. - * - * @author Greg Hinkle - */ -public class ResourceGroupTreeDatasource extends DataSource { - - private boolean initialized = false; - int rootId; - List<Resource> initialData; - - private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService(); - - public ResourceGroupTreeDatasource(List<Resource> initialData) { - setClientOnly(false); - setDataProtocol(DSProtocol.CLIENTCUSTOM); - setDataFormat(DSDataFormat.CUSTOM); - - this.initialData = initialData; - - this.rootId = rootId; - - DataSourceField idDataField = new DataSourceTextField("id", "ID"); - idDataField.setPrimaryKey(true); - - DataSourceTextField nameDataField = new DataSourceTextField("name", "Name"); - nameDataField.setCanEdit(false); - - DataSourceTextField descriptionDataField = new DataSourceTextField("description", "Description"); - descriptionDataField.setCanEdit(false); - - DataSourceImageField availabilityDataField = new DataSourceImageField("currentAvailability", "Availability"); - descriptionDataField.setCanEdit(false); - - DataSourceTextField parentIdField = new DataSourceTextField("parentId", "Parent ID"); - parentIdField.setForeignKey("id"); - // parentIdField.setRootValue(rootId); - - // DataSourceTextField parentKeyField = new DataSourceTextField("parentKey", "Parent KEY"); - // parentKeyField.setForeignKey("id"); - // parentKeyField.setRootValue(rootId); - - // nameDataField.setType(FieldType.); - - setDropExtraFields(false); - - setFields(idDataField, nameDataField, descriptionDataField, availabilityDataField); - } - - @Override - protected Object transformRequest(DSRequest request) { - String requestId = request.getRequestId(); - DSResponse response = new DSResponse(); - response.setAttribute("clientContext", request.getAttributeAsObject("clientContext")); - // Asume success - response.setStatus(0); - switch (request.getOperationType()) { - case ADD: - //executeAdd(request, response); - break; - case FETCH: - executeFetch(requestId, request, response); - break; - case REMOVE: - //executeRemove(lstRec); - break; - case UPDATE: - //executeAdd(lstRec, false); - break; - - default: - break; - } - - return request.getData(); - } - - - public void executeFetch(final String requestId, final DSRequest request, final DSResponse response) { - final long start = System.currentTimeMillis(); - - String p = request.getCriteria().getAttribute("parentId"); - // System.out.println("All attributes: " + Arrays.toString(request.getCriteria().getAttributes())); - - ResourceCriteria criteria = new ResourceCriteria(); - - if (p == null) { - System.out.println("DataSourceTree: Loading initial data"); - - // criteria.addFilterId(rootId); - - processIncomingData(initialData, response, requestId); - return; - - } else { - System.out.println("DataSourceTree: Loading " + p); - - criteria.addFilterParentResourceId(Integer.parseInt(p)); - } - - // The server is already eager fetch resource type - // * criteria.fetchResourceType(true); - - resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() { - public void onFailure(Throwable caught) { - CoreGUI.getErrorHandler().handleError("Failed to load resource data for tree", caught); - response.setStatus(RPCResponse.STATUS_FAILURE); - processResponse(requestId, response); - } - - public void onSuccess(PageList<Resource> result) { - processIncomingData(result, response, requestId); - } - }); - } - - private void processIncomingData(List<Resource> result, final DSResponse response, final String requestId) { - - ResourceTypeRepository.Cache.getInstance().loadResourceTypes(result, - EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children, ResourceTypeRepository.MetadataType.subCategory), - new ResourceTypeRepository.ResourceTypeLoadedCallback() { - public void onResourceTypeLoaded(List<Resource> result) { - response.setData(build(result)); - processResponse(requestId, response); - - } - }); - } - - /** - * Construct a set of TreeNodes from a list of resources - * - * @param resources - * @return - */ - public static TreeNode[] build(List<Resource> resources) { - ResourceTreeNode[] records = new ResourceTreeNode[resources.size()]; - for (int x = 0; x < resources.size(); x++) { - Resource res = resources.get(x); - ResourceTreeNode record = new ResourceTreeNode(res); - records[x] = record; - } - - return introduceTypeFolders(records); - } - - private static TreeNode[] introduceTypeFolders(ResourceTreeNode[] nodes) { - ArrayList<TreeNode> built = new ArrayList<TreeNode>(); - HashMap<ResourceSubCategory, CategoryTreeNode> categories = new HashMap<ResourceSubCategory, CategoryTreeNode>(); - HashMap<ResourceType, TypeTreeNode> types = new HashMap<ResourceType, TypeTreeNode>(); - - - for (ResourceTreeNode node : nodes) { - built.add(node); - - if (!types.containsKey(node.getResourceType()) - && node.getResourceType().getCategory() != ResourceCategory.PLATFORM) { - - String parentResourceId = String.valueOf(node.getResource().getParentResource().getId()); - - CategoryTreeNode categoryNode = null; - - if (node.getResourceType().getSubCategory() != null) { - ResourceSubCategory category = node.getResourceType().getSubCategory(); - if (category.getName() != null) { - categoryNode = categories.get(category); - - if (categoryNode == null) { - categoryNode = new CategoryTreeNode(parentResourceId, category); - - categories.put(category, categoryNode); - built.add(categoryNode); - } - } - } - - String parentId = null; - if (categoryNode != null) { - parentId = categoryNode.getAttribute("id"); - } else { - parentId = parentResourceId; - } - - TypeTreeNode typeNode = new TypeTreeNode(parentId, parentResourceId, node.getResourceType().getName()); - built.add(typeNode); - types.put(node.getResourceType(), typeNode); - } - } - - return built.toArray(new TreeNode[built.size()]); - - } - - private static boolean sameTypes(ResourceTreeNode[] nodes) { - ResourceType first = nodes[0].getResourceType(); - for (ResourceTreeNode node : nodes) { - if (!first.equals(node)) { - return false; - } - } - return true; - } - - public static class CategoryTreeNode extends TreeNode { - public CategoryTreeNode(String parentId, ResourceSubCategory category) { - setID(parentId + "__" + category.getName()); - setParentID(parentId); - setName(category.getDisplayName()); - - setAttribute("id", parentId + "__" + category.getName()); - setAttribute("parentId", parentId); - setAttribute("name", category.getDisplayName()); - } - - @Override - public String toString() { - StringBuilder buffer = new StringBuilder(); - buffer.append("CategoryTreeNode["); - String id = getAttribute("id"); - buffer.append("id=").append(id); - String parentId = getAttribute("parentId"); - buffer.append(", parentId=").append(parentId); - String name = getAttribute("name"); - buffer.append(", name=").append(name); - buffer.append("]"); - return buffer.toString(); - } - } - - - public static class TypeTreeNode extends TreeNode { - private TypeTreeNode(String parentId, String parentResourceId, String type) { - setID(parentId + "_" + type); - setParentID(parentId); - - setAttribute("id", parentResourceId + "_" + type); - setAttribute("parentId", parentId); - // setAttribute("parentKey", parentId); - setAttribute("name", type); - } - - @Override - public String toString() { - StringBuilder buffer = new StringBuilder(); - buffer.append("TypeTreeNode["); - String id = getAttribute("id"); - buffer.append("id=").append(id); - String parentId = getAttribute("parentId"); - buffer.append(", parentId=").append(parentId); - String name = getAttribute("name"); - buffer.append(", name=").append(name); - buffer.append("]"); - return buffer.toString(); - } - } - - public static class ResourceTreeNode extends TreeNode { - private Resource resource; - - private ResourceTreeNode(Resource resource) { - this.resource = resource; - - String id = String.valueOf(resource.getId()); - String parentId = resource.getParentResource() == null ? null - : (resource.getParentResource().getId() + "_" + resource.getResourceType().getName()); - - // System.out.println(id + " / " + parentId); - - setID(id); - setParentID(parentId); - - setAttribute("id", id); - setAttribute("parentId", parentId); - - // setAttribute("parentKey", resource.getParentResource() == null ? 0 : (resource.getParentResource().getId() + resource.getResourceType().getName())); - - setAttribute("name", resource.getName()); - setAttribute("description", resource.getDescription()); - setAttribute( - "currentAvailability", - resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "/images/icons/availability_green_16.png" - : "/images/icons/availability_red_16.png"); - - setIsFolder((resource.getResourceType().getChildResourceTypes() != null && !resource.getResourceType() - .getChildResourceTypes().isEmpty())); - } - - public Resource getResource() { - return resource; - } - - public void setResource(Resource resource) { - this.resource = resource; - } - - public ResourceType getResourceType() { - return resource.getResourceType(); - } - - public String getParentId() { - return getAttribute("parentId"); - } - - @Override - public String toString() { - StringBuilder buffer = new StringBuilder(); - buffer.append("ResourceTreeNode["); - String id = getAttribute("id"); - buffer.append("id=").append(id); - String parentId = getAttribute("parentId"); - buffer.append(", parentId=").append(parentId); - String name = getAttribute("name"); - buffer.append(", name=").append(name); - buffer.append("]"); - return buffer.toString(); - } - } -} \ No newline at end of file diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java index acaca4a..aa854f8 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java @@ -25,6 +25,7 @@ package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set;
@@ -55,9 +56,11 @@ import org.rhq.enterprise.gui.coregui.client.ViewId; import org.rhq.enterprise.gui.coregui.client.ViewPath; import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository; +import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
/** * @author Greg Hinkle + * @author Ian Springer */ public class ResourceGroupTreeView extends VLayout implements BookmarkableView {
@@ -143,7 +146,7 @@ public class ResourceGroupTreeView extends VLayout implements BookmarkableView { new AsyncCallback<PageList<ResourceGroup>>() { @Override public void onFailure(Throwable caught) { - CoreGUI.getErrorHandler().handleError("Failed to load group", caught); + CoreGUI.getErrorHandler().handleError("Failed to load group with id [" + groupId + "].", caught); }
@Override @@ -151,64 +154,56 @@ public class ResourceGroupTreeView extends VLayout implements BookmarkableView { ResourceGroup group = result.get(0); ResourceGroupTreeView.this.selectedGroup = group;
- if (GroupCategory.MIXED == group.getGroupCategory()) { - ResourceGroupTreeView.this.rootResourceGroup = group; - ResourceGroupTreeView.this.rootGroupId = rootResourceGroup.getId(); - TreeNode fakeRoot = new TreeNode("fakeRootNode"); - TreeNode rootNode = new TreeNode(rootResourceGroup.getName()); - rootNode.setID(String.valueOf(rootResourceGroup.getId())); //getClusterKey().toString()); - fakeRoot.setChildren(new TreeNode[] { rootNode }); - Tree tree = new Tree(); - tree.setRoot(fakeRoot); - treeGrid.setData(tree); - treeGrid.markForRedraw(); - } else { - if (group.getClusterResourceGroup() == null) { + GroupCategory groupCategory = group.getGroupCategory(); + switch (groupCategory) { + case MIXED: ResourceGroupTreeView.this.rootResourceGroup = group; - // This is a straight up group - loadGroup(groupId); - } else { - // Someone select a cluster group beneath a real recursive compatible group - - ResourceGroup rootGroup = group.getClusterResourceGroup(); - ResourceGroupTreeView.this.rootResourceGroup = rootGroup; - - loadGroup(rootGroup.getId()); - } + ResourceGroupTreeView.this.rootGroupId = rootResourceGroup.getId(); + TreeNode fakeRoot = new TreeNode("fakeRootNode"); + TreeNode rootNode = new TreeNode(rootResourceGroup.getName()); + rootNode.setID(String.valueOf(rootResourceGroup.getId())); //getClusterKey().toString()); + fakeRoot.setChildren(new TreeNode[] { rootNode }); + Tree tree = new Tree(); + tree.setRoot(fakeRoot); + treeGrid.setData(tree); + treeGrid.markForRedraw(); + break; + case COMPATIBLE: + if (group.getClusterResourceGroup() == null) { + // This is a straight up compatible group. + ResourceGroupTreeView.this.rootResourceGroup = group; + } else { + // This is a cluster group beneath a real recursive compatible group. + ResourceGroupTreeView.this.rootResourceGroup = group.getClusterResourceGroup(); + } + loadGroup(ResourceGroupTreeView.this.rootResourceGroup.getId()); + break; } - } }); - }
private void loadGroup(int groupId) { - if (groupId == this.rootGroupId) { // Still looking at the same compat-recursive tree
// TODO reselect tree to selected node + TreeNode selectedNode; if (this.selectedGroup.getClusterKey() != null) { - TreeNode selectedNode = treeGrid.getTree().findById(this.selectedGroup.getClusterKey()); - TreeNode[] parents = treeGrid.getTree().getParents(selectedNode); - treeGrid.getTree().openFolders(parents); - treeGrid.getTree().openFolder(selectedNode); - - treeGrid.selectRecord(selectedNode); + selectedNode = treeGrid.getTree().findById(this.selectedGroup.getClusterKey()); } else { - TreeNode selectedNode = treeGrid.getTree().findById(String.valueOf(this.selectedGroup.getId())); - TreeNode[] parents = treeGrid.getTree().getParents(selectedNode); - treeGrid.getTree().openFolders(parents); - treeGrid.getTree().openFolder(selectedNode); - - treeGrid.selectRecord(selectedNode); + selectedNode = treeGrid.getTree().findById(String.valueOf(this.selectedGroup.getId())); } + TreeNode[] parents = treeGrid.getTree().getParents(selectedNode); + treeGrid.getTree().openFolders(parents); + treeGrid.getTree().openFolder(selectedNode); + treeGrid.selectRecord(selectedNode);
} else { this.rootGroupId = groupId; GWTServiceLookup.getClusterService().getClusterTree(groupId, new AsyncCallback<ClusterFlyweight>() { public void onFailure(Throwable caught) { - CoreGUI.getErrorHandler().handleError("Failed to load tree", caught); + CoreGUI.getErrorHandler().handleError("Failed to load group tree.", caught); }
public void onSuccess(ClusterFlyweight result) { @@ -216,11 +211,10 @@ public class ResourceGroupTreeView extends VLayout implements BookmarkableView { } }); } - }
private void loadTreeTypes(final ClusterFlyweight root) { - HashSet<Integer> typeIds = new HashSet<Integer>(); + Set<Integer> typeIds = new HashSet<Integer>(); typeIds.add(this.rootResourceGroup.getResourceType().getId()); getTreeTypes(root, typeIds);
@@ -235,7 +229,6 @@ public class ResourceGroupTreeView extends VLayout implements BookmarkableView { }
private void selectClusterGroup(ClusterKey key) { - GWTServiceLookup.getClusterService().createAutoClusterBackingGroup(key, true, new AsyncCallback<ResourceGroup>() { @Override @@ -249,7 +242,6 @@ public class ResourceGroupTreeView extends VLayout implements BookmarkableView { History.newItem("ResourceGroup/" + groupId); } }); - }
private void loadTree(ClusterFlyweight root) { @@ -276,44 +268,79 @@ public class ResourceGroupTreeView extends VLayout implements BookmarkableView { treeGrid.markForRedraw(); }
- public void loadTree(TreeNode parent, ClusterFlyweight parentNode, ClusterKey parentKey) { - if (!parentNode.getChildren().isEmpty()) { - - // TODO Introduce type groups (Do we still like this model for recursive compatibles?) - - ArrayList<TreeNode> childNodes = new ArrayList<TreeNode>(); - - HashMap<Integer, TreeNode> typeNodes = new HashMap<Integer, TreeNode>(); - - for (ClusterFlyweight child : parentNode.getChildren()) { - TreeNode node = new TreeNode(child.getName()); - + public void loadTree(TreeNode parentNode, ClusterFlyweight parentClusterGroup, ClusterKey parentKey) { + if (!parentClusterGroup.getChildren().isEmpty()) { + // First pass - group the children by type. + Map<ResourceType, List<ClusterFlyweight>> childrenByType = new HashMap<ResourceType, List<ClusterFlyweight>>(); + for (ClusterFlyweight child : parentClusterGroup.getChildren()) { ClusterKeyFlyweight keyFlyweight = child.getClusterKey(); - ClusterKey key = new ClusterKey(parentKey, keyFlyweight.getResourceTypeId(), keyFlyweight - .getResourceKey());
ResourceType type = this.typeMap.get(keyFlyweight.getResourceTypeId()); + List<ClusterFlyweight> children = childrenByType.get(type); + if (children == null) { + children = new ArrayList<ClusterFlyweight>(); + childrenByType.put(type, children); + } + children.add(child); + }
- String icon = "types/" + type.getCategory().getDisplayName() + "_up_16.png"; - - node.setIcon(icon); + // Second pass - process each of the sets of like-typed children created in the first pass. + List<TreeNode> childNodes = new ArrayList<TreeNode>(); + for (ResourceType type : childrenByType.keySet()) { + List<ClusterFlyweight> children = childrenByType.get(type); + List<TreeNode> nodesByType = new ArrayList<TreeNode>(); + for (ClusterFlyweight child : children) { + TreeNode node = createClusterGroupNode(parentKey, type, child); + nodesByType.add(node); + + if (!child.getChildren().isEmpty()) { + // Recurse. + ClusterKey key = (ClusterKey)node.getAttributeAsObject("key"); + loadTree(node, child, key); + } + }
- node.setID(key.getKey()); - node.setAttribute("key", key); - node.setAttribute("resourceType", type); - childNodes.add(node); + // TODO (ips): Insert subcategory nodes.
- if (child.getChildren().isEmpty()) { - node.setIsFolder(false); - } else { - node.setIsFolder(true); - loadTree(node, child, key); + if (type.isSingleton()) { + // If it's a singleton type, just insert the cluster group node as is. + childNodes.addAll(nodesByType); + } + else { + // Otherwise insert an autoTypeGroup folder node to group all cluster groups of this type. + TreeNode autoTypeGroupNode = createAutoTypeGroupNode(type, nodesByType); + childNodes.add(autoTypeGroupNode); } } - parent.setChildren(childNodes.toArray(new TreeNode[childNodes.size()])); + parentNode.setChildren(childNodes.toArray(new TreeNode[childNodes.size()])); } }
+ private TreeNode createClusterGroupNode(ClusterKey parentKey, ResourceType type, ClusterFlyweight child) { + TreeNode node = new TreeNode(child.getName()); + + ClusterKeyFlyweight keyFlyweight = child.getClusterKey(); + ClusterKey key = new ClusterKey(parentKey, keyFlyweight.getResourceTypeId(), keyFlyweight + .getResourceKey()); + String id = key.getKey(); + node.setID(id); + node.setAttribute("key", key); + node.setAttribute("resourceType", type); + node.setIsFolder(!child.getChildren().isEmpty()); + + String icon = "types/" + type.getCategory().getDisplayName() + "_up_16.png"; + node.setIcon(icon); + return node; + } + + private TreeNode createAutoTypeGroupNode(ResourceType type, List<TreeNode> memberNodes) { + String name = StringUtility.pluralize(type.getName()); + TreeNode autoTypeGroupNode = new TreeNode(name); + autoTypeGroupNode.setIsFolder(true); + autoTypeGroupNode.setChildren(memberNodes.toArray(new TreeNode[memberNodes.size()])); + return autoTypeGroupNode; + } + public void renderView(ViewPath viewPath) { currentViewId = viewPath.getCurrent(); int groupId = Integer.parseInt(currentViewId.getPath());
rhq-commits@lists.fedorahosted.org