modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
| 7
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ClusterKey.java
| 237 ++++
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ClusterFlyweight.java
| 99 +
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ClusterKeyFlyweight.java
| 62 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
| 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
| 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
| 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
| 17
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
| 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
| 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionEditorView.java
| 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
| 93 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleSubjectSelector.java
| 83 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
| 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
| 22
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRoleSelector.java
| 86 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRolesEditorItem.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
| 155 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
| 26
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
| 18
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleSelector.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
| 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleStep.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java
| 15
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
| 286 +++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java
| 18
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ClusterGWTService.java
| 68 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RoleGWTService.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
| 28
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
| 130 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeDataSource.java
| 360 +++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java
| 514 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
| 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
| 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
| 57 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java
| 283 -----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java
| 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
| 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/DropDownMenuBarView.java
| 247 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
| 222 ----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
| 370 +++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TagCloudView.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ClusterGWTServiceImpl.java
| 69 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RoleGWTServiceImpl.java
| 6
modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
| 8
modules/enterprise/gui/coregui/src/main/webapp/images/global/Agent_16.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/Agent_24.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/Cloud_16.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/Cloud_24.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/Locked_16.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/Locked_24.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/Plugin_16.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/Plugin_24.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/Recent_16.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/Recent_24.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/Role_16.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/Unlocked_16.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/Unlocked_32.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/User_16.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/User_24.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/global/cloud_24.png
|binary
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeContextMenuUIBean.java
| 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeModelUIBean.java
| 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeNode.java
| 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeStateAdvisor.java
| 5
modules/enterprise/gui/portal-war/src/main/webapp/common/Login.jsp
| 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
| 68 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerLocal.java
| 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerRemote.java
| 9
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterKey.java
| 275 -----
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerBean.java
| 79 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerLocal.java
| 28
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerRemote.java
| 79 +
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerBeanTest.java
| 1
modules/pom.xml
| 16
79 files changed, 3308 insertions(+), 953 deletions(-)
New commits:
commit 054ce11b07031a30a00afb04316b4ee5065b6b43
Merge: 6e303ec... 4c30f50...
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 17:08:30 2010 -0400
Merge branch 'master' of
ssh://git.fedorahosted.org/git/rhq/rhq
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
diff --cc
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index a8bd44a,396aa0e..a902bc5
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@@ -279,11 -255,8 +255,10 @@@ public class ResourceGroupDetailView ex
}
}
-
public void renderView(ViewPath viewPath) {
- // TODO: Implement this method.
+
+ Integer groupId = Integer.parseInt(viewPath.getCurrent().getPath());
+
if (viewPath.isEnd()) {
// default
commit 6e303ec5c6fa7916b9e83d88f6a7c9e3f6c0b8d0
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 16:57:24 2010 -0400
Missing cloud png, report top view cleanup
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
index 8024902..a842474 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
@@ -89,8 +89,8 @@ public class ReportTopView extends HLayout implements BookmarkableView
{
treeGrids.put("Inventory", buildInventorySection());
- treeGrids.put("Configuration", buildSystemConfigurationSection());
- treeGrids.put("Cluster", buildManagementClusterSection());
+// treeGrids.put("Configuration", buildSystemConfigurationSection());
+// treeGrids.put("Cluster", buildManagementClusterSection());
treeGrids.put("Reports", buildReportsSection());
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/Cloud_24.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Cloud_24.png
new file mode 100644
index 0000000..a147dde
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Cloud_24.png differ
commit fb02185b1a48ad560a5dfd9c20ca1415a6d64e62
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 13:13:48 2010 -0400
Add missing tagcloud icon
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/Cloud_16.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Cloud_16.png
new file mode 100644
index 0000000..e64577c
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Cloud_16.png differ
commit 2ef1d6aba1a5ebd549293d0d74f7edea84c862f6
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 13:12:57 2010 -0400
Some performance tests on the resource tree (Attempts to precache the entire tree)
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeDataSource.java
new file mode 100644
index 0000000..939c519
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeDataSource.java
@@ -0,0 +1,360 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+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;
+
+/**
+ * @author Greg Hinkle
+ */
+public class NewResourceTreeDataSource extends DataSource {
+
+ int rootId;
+
+ private ResourceGWTServiceAsync resourceService =
GWTServiceLookup.getResourceService();
+
+ public NewResourceTreeDataSource() {
+ setClientOnly(false);
+ setDataProtocol(DSProtocol.CLIENTCUSTOM);
+ setDataFormat(DSDataFormat.CUSTOM);
+
+
+ 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");
+
+ ResourceCriteria criteria = new ResourceCriteria();
+
+ if (p == null) {
+ System.out.println("DataSourceTree: Loading initial data");
+
+ criteria.addFilterId(rootId);
+
+ } 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(int rootId, Map<Integer, Resource> resources) {
+ Resource root = resources.get(rootId);
+
+ TreeNode rootNode = new ResourceTreeNode(root);
+
+ buildTree(rootNode, root, 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 rootNode;
+// return introduceTypeFolders(records);
+ }
+
+ private static void buildTree(TreeNode parent, Resource parentResource,
Map<Integer, Resource> resources) {
+
+ HashMap<ResourceType, TypeTreeNode> types = new HashMap<ResourceType,
TypeTreeNode>();
+
+
+ ArrayList<ResourceTreeNode> childNodes = new
ArrayList<ResourceTreeNode>();
+
+ for (Resource res : resources.values()) {
+ if (res.getParentResource() != null &&
res.getParentResource().getId() == parentResource.getId()) {
+
+// parent.setChildren();
+
+ ResourceTreeNode child = new ResourceTreeNode(res);
+
+ childNodes.add(child);
+
+ buildTree(child, res, resources);
+
+ }
+ }
+
+ parent.setChildren(childNodes.toArray(new TreeNode[childNodes.size()]));
+
+ }
+
+
+
+
+ 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());
+ }
+ }
+
+
+ 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);
+ }
+
+ }
+
+ 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");
+ }
+ }
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java
new file mode 100644
index 0000000..3c72ba7
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java
@@ -0,0 +1,514 @@
+/*
+ * 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.resource.detail;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.List;
+
+import com.google.gwt.user.client.History;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.SelectionStyle;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
+import com.smartgwt.client.widgets.events.CloseClientEvent;
+import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionEvent;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.menu.Menu;
+import com.smartgwt.client.widgets.menu.MenuItem;
+import com.smartgwt.client.widgets.menu.MenuItemSeparator;
+import com.smartgwt.client.widgets.menu.events.ClickHandler;
+import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
+import com.smartgwt.client.widgets.tree.Tree;
+import com.smartgwt.client.widgets.tree.TreeGrid;
+import com.smartgwt.client.widgets.tree.TreeNode;
+import com.smartgwt.client.widgets.tree.events.DataArrivedEvent;
+import com.smartgwt.client.widgets.tree.events.DataArrivedHandler;
+import com.smartgwt.client.widgets.tree.events.NodeContextClickEvent;
+import com.smartgwt.client.widgets.tree.events.NodeContextClickHandler;
+
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.criteria.ResourceTypeCriteria;
+import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceCategory;
+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.Breadcrumb;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import
org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.resource.graph.GraphPortlet;
+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.gwt.ResourceTypeGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
+import
org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.OperationCreateWizard;
+import
org.rhq.enterprise.gui.coregui.client.inventory.resource.factory.ResourceFactoryCreateWizard;
+import
org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+
+
+/**
+ * @author Greg Hinkle
+ */
+public class NewResourceTreeView extends VLayout {
+ private Resource selectedResource;
+ private Resource rootResource;
+
+ private TreeGrid treeGrid;
+ private Menu contextMenu;
+
+ private ViewId currentViewId;
+
+ private ArrayList<ResourceSelectListener> selectListeners = new
ArrayList<ResourceSelectListener>();
+
+ private boolean initialSelect = false;
+
+ public NewResourceTreeView() {
+ super();
+
+ setWidth("250");
+ setHeight100();
+
+ setShowResizeBar(true);
+ }
+
+ public void onInit() {
+
+ }
+
+ private void buildTree() {
+
+ treeGrid = new CustomResourceTreeGrid();
+
+ treeGrid.setOpenerImage("resources/dir.png");
+ treeGrid.setOpenerIconSize(16);
+
+// treeGrid.setAutoFetchData(true);
+ treeGrid.setAnimateFolders(false);
+ treeGrid.setSelectionType(SelectionStyle.SINGLE);
+ treeGrid.setShowRollOver(false);
+ treeGrid.setSortField("name");
+ treeGrid.setShowHeader(false);
+
+ treeGrid.setLeaveScrollbarGap(false);
+
+
+ contextMenu = new Menu();
+ MenuItem item = new MenuItem("Expand node");
+
+
+ treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ if (!selectionEvent.isRightButtonDown() &&
selectionEvent.getState()) {
+ if (treeGrid.getSelectedRecord() instanceof
ResourceTreeDatasource.ResourceTreeNode) {
+ ResourceTreeDatasource.ResourceTreeNode node =
(ResourceTreeDatasource.ResourceTreeNode) treeGrid.getSelectedRecord();
+ System.out.println("Resource selected in tree: " +
node.getResource());
+
+ String newToken = "Resource/" +
node.getResource().getId();
+ String currentToken = History.getToken();
+ if (!currentToken.startsWith(newToken)) {
+
+ String ending =
currentToken.replaceFirst("^[^\\/]*\\/[^\\/]*", "");
+
+ History.newItem("Resource/" +
node.getResource().getId() + ending);
+
+ }
+ }
+
+ }
+ }
+ });
+
+
+ // This constructs the context menu for the resource at the time of the click.
+ setContextMenu(contextMenu);
+
+
+ treeGrid.addNodeContextClickHandler(new NodeContextClickHandler() {
+ public void onNodeContextClick(final NodeContextClickEvent event) {
+ event.getNode();
+ event.cancel();
+
+ if (event.getNode() instanceof ResourceTreeDatasource.TypeTreeNode) {
+ showContextMenu((ResourceTreeDatasource.TypeTreeNode)
event.getNode());
+ } else if (event.getNode() instanceof
ResourceTreeDatasource.ResourceTreeNode) {
+ showContextMenu((ResourceTreeDatasource.ResourceTreeNode)
event.getNode());
+ }
+ }
+ });
+ }
+
+
+ private void showContextMenu(ResourceTreeDatasource.TypeTreeNode node) {
+
+ contextMenu.setItems(new MenuItem(node.getName()));
+ contextMenu.showContextMenu();
+
+ }
+
+ private void showContextMenu(final ResourceTreeDatasource.ResourceTreeNode node) {
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ node.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations,
ResourceTypeRepository.MetadataType.children,
ResourceTypeRepository.MetadataType.subCategory,
+
ResourceTypeRepository.MetadataType.pluginConfigurationDefinition,
ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ buildResourceContextMenu(node.getResource(), type);
+ contextMenu.showContextMenu();
+ }
+ });
+ }
+
+
+ private void buildResourceContextMenu(final Resource resource, final ResourceType
resourceType) {
+ contextMenu.setItems(new MenuItem(resource.getName()));
+
+ contextMenu.addItem(new MenuItem("Type: " + resourceType.getName()));
+
+
+ MenuItem editPluginConfiguration = new MenuItem("Plugin
Configuration");
+ editPluginConfiguration.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ int resourceId = resource.getId();
+ int resourceTypeId = resourceType.getId();
+
+ Window configEditor = new Window();
+ configEditor.setTitle("Edit " + resource.getName() + "
plugin configuration");
+ configEditor.setWidth(800);
+ configEditor.setHeight(800);
+ configEditor.setIsModal(true);
+ configEditor.setShowModalMask(true);
+ configEditor.setCanDragResize(true);
+ configEditor.centerInPage();
+ configEditor.addItem(new ConfigurationEditor(resourceId, resourceTypeId,
ConfigurationEditor.ConfigType.plugin));
+ configEditor.show();
+
+ }
+ });
+
editPluginConfiguration.setEnabled(resourceType.getPluginConfigurationDefinition() !=
null);
+ contextMenu.addItem(editPluginConfiguration);
+
+
+ MenuItem editResourceConfiguration = new MenuItem("Resource
Configuration");
+ editResourceConfiguration.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ int resourceId = resource.getId();
+ int resourceTypeId = resourceType.getId();
+
+ final Window configEditor = new Window();
+ configEditor.setTitle("Edit " + resource.getName() + "
resource configuration");
+ configEditor.setWidth(800);
+ configEditor.setHeight(800);
+ configEditor.setIsModal(true);
+ configEditor.setShowModalMask(true);
+ configEditor.setCanDragResize(true);
+ configEditor.setShowResizer(true);
+ configEditor.centerInPage();
+ configEditor.addCloseClickHandler(new CloseClickHandler() {
+ public void onCloseClick(CloseClientEvent closeClientEvent) {
+ configEditor.destroy();
+ }
+ });
+ configEditor.addItem(new ConfigurationEditor(resourceId, resourceTypeId,
ConfigurationEditor.ConfigType.resource));
+ configEditor.show();
+
+ }
+ });
+
editResourceConfiguration.setEnabled(resourceType.getResourceConfigurationDefinition() !=
null);
+ contextMenu.addItem(editResourceConfiguration);
+
+ contextMenu.addItem(new MenuItemSeparator());
+
+
+ // Operations Menu
+ MenuItem operations = new MenuItem("Operations");
+ Menu opSubMenu = new Menu();
+ for (final OperationDefinition operationDefinition :
resourceType.getOperationDefinitions()) {
+ MenuItem operationItem = new MenuItem(operationDefinition.getDisplayName());
+ operationItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ new OperationCreateWizard(selectedResource,
operationDefinition).startOperationWizard();
+ }
+ });
+ opSubMenu.addItem(operationItem);
+ // todo action
+ }
+ operations.setEnabled(!resourceType.getOperationDefinitions().isEmpty());
+ operations.setSubmenu(opSubMenu);
+ contextMenu.addItem(operations);
+
+
+ contextMenu.addItem(buildMetricsMenu(resourceType));
+
+
+ // Create Menu
+ MenuItem createChildMenu = new MenuItem("Create Child");
+ Menu createChildSubMenu = new Menu();
+ for (final ResourceType childType : resourceType.getChildResourceTypes()) {
+ if (childType.isCreatable()) {
+ MenuItem createItem = new MenuItem(childType.getName());
+ createChildSubMenu.addItem(createItem);
+ createItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ ResourceFactoryCreateWizard.showCreateWizard(resource,
childType);
+ }
+ });
+
+ }
+ }
+ createChildMenu.setSubmenu(createChildSubMenu);
+ createChildMenu.setEnabled(createChildSubMenu.getItems().length > 0);
+ contextMenu.addItem(createChildMenu);
+
+
+ // Manually Add Menu
+ MenuItem importChildMenu = new MenuItem("Import");
+ Menu importChildSubMenu = new Menu();
+ for (ResourceType childType : resourceType.getChildResourceTypes()) {
+ if (childType.isSupportsManualAdd()) {
+ importChildSubMenu.addItem(new MenuItem(childType.getName()));
+ //todo action
+ }
+ }
+ if (resourceType.getCategory() == ResourceCategory.PLATFORM) {
+ loadManuallyAddServersToPlatforms(importChildSubMenu);
+ }
+ importChildMenu.setSubmenu(importChildSubMenu);
+ importChildMenu.setEnabled(importChildSubMenu.getItems().length > 0);
+ contextMenu.addItem(importChildMenu);
+ }
+
+
+ private void loadManuallyAddServersToPlatforms(final Menu manuallyAddMenu) {
+ ResourceTypeGWTServiceAsync rts = GWTServiceLookup.getResourceTypeGWTService();
+
+ ResourceTypeCriteria criteria = new ResourceTypeCriteria();
+ criteria.addFilterSupportsManualAdd(true);
+ criteria.fetchParentResourceTypes(true);
+ rts.findResourceTypesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceType>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load
platform manual add children", caught);
+ }
+
+ public void onSuccess(PageList<ResourceType> result) {
+ for (ResourceType type : result) {
+ if (type.getParentResourceTypes() == null ||
type.getParentResourceTypes().isEmpty()) {
+ MenuItem item = new MenuItem(type.getName());
+ manuallyAddMenu.addItem(item);
+ }
+ }
+ }
+ });
+ }
+
+
+ private MenuItem buildMetricsMenu(final ResourceType type) {
+ MenuItem measurements = new MenuItem("Measurements");
+ final Menu measurementsSubMenu = new Menu();
+
+
+ GWTServiceLookup.getDashboardService().findDashboardsForSubject(new
AsyncCallback<List<Dashboard>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load user
dashboards", caught);
+ }
+
+ public void onSuccess(List<Dashboard> result) {
+
+ for (final MeasurementDefinition def : type.getMetricDefinitions()) {
+
+ MenuItem defItem = new MenuItem(def.getDisplayName());
+ measurementsSubMenu.addItem(defItem);
+ Menu defSubItem = new Menu();
+ defItem.setSubmenu(defSubItem);
+
+
+ for (final Dashboard d : result) {
+ MenuItem addToDBItem = new MenuItem("Add chart to Dashboard:
" + d.getName());
+ defSubItem.addItem(addToDBItem);
+
+ addToDBItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent menuItemClickEvent) {
+
+ DashboardPortlet p = new
DashboardPortlet(def.getDisplayName() + " Chart", GraphPortlet.KEY, 250);
+ p.getConfiguration().put(new
PropertySimple(GraphPortlet.CFG_RESOURCE_ID, selectedResource.getId()));
+ p.getConfiguration().put(new
PropertySimple(GraphPortlet.CFG_DEFINITION_ID, def.getId()));
+
+ d.addPortlet(p, 0, 0);
+
+ GWTServiceLookup.getDashboardService().storeDashboard(d,
new AsyncCallback<Dashboard>() {
+ public void onFailure(Throwable caught) {
+
CoreGUI.getErrorHandler().handleError("Failed to save dashboard to server",
caught);
+ }
+
+ public void onSuccess(Dashboard result) {
+ CoreGUI.getMessageCenter().notify(new
Message("Saved dashboard " + result.getName() + " to server",
Message.Severity.Info));
+ }
+ });
+
+ }
+ });
+
+ }
+
+
+ }
+
+ }
+ });
+ measurements.setSubmenu(measurementsSubMenu);
+ return measurements;
+ }
+
+ Resource getResource(int resourceId) {
+ if (this.treeGrid != null && this.treeGrid.getTree() != null) {
+ ResourceTreeDatasource.ResourceTreeNode treeNode =
+ (ResourceTreeDatasource.ResourceTreeNode)
this.treeGrid.getTree().findById(String.valueOf(resourceId));
+ if (treeNode != null) {
+ return treeNode.getResource();
+ }
+ }
+ return null;
+ }
+
+ private void setRootResource(Resource rootResource) {
+ this.rootResource = rootResource;
+ }
+
+ public void setSelectedResource(final Resource selectedResource, final ViewId viewId)
{
+ this.selectedResource = selectedResource;
+
+ TreeNode node = null;
+ if (treeGrid != null && treeGrid.getTree() != null
+ && (node =
treeGrid.getTree().findById(String.valueOf(selectedResource.getId()))) != null) {
+
+ // This is the case where the tree was previously loaded and we get fired to
look at a different
+ // node in the same tree and just have to switch the selection
+
+ TreeNode[] parents = treeGrid.getTree().getParents(node);
+ treeGrid.getTree().openFolders(parents);
+ treeGrid.getTree().openFolder(node);
+
+ treeGrid.deselectAllRecords();
+ treeGrid.selectRecord(node);
+
+
+ // Update breadcrumbs
+ viewId.getBreadcrumbs().clear();
+ for (int i = parents.length - 1; i >= 0; i--) {
+ TreeNode n = parents[i];
+ adjustBreadcrumb(n, viewId);
+ }
+ adjustBreadcrumb(node, viewId);
+
+ CoreGUI.refreshBreadCrumbTrail();
+
+ } else {
+
+ // Data not yet loaded or a node in a different tree
+
+ final ResourceGWTServiceAsync resourceService =
GWTServiceLookup.getResourceService();
+
+
+ resourceService.getPlatformForResource(selectedResource.getId(), new
AsyncCallback<Resource>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("adasdf", caught);
+ }
+
+ public void onSuccess(Resource result) {
+ rootResource = result;
+
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterRootResourceId(rootResource.getId());
+ criteria.setPageControl(PageControl.getUnlimitedInstance());
+
+ resourceService.findResourcesByCriteria(criteria,
+ new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+
CoreGUI.getErrorHandler().handleError("lkasldf", caught);
+ }
+
+ public void onSuccess(PageList<Resource> result) {
+
+ loadTree(rootResource.getId(), result);
+ }
+ });
+ }
+ });
+
+ }
+ }
+
+ private void loadTree(int rootId, PageList<Resource> result) {
+ if (this.treeGrid != null) {
+ this.treeGrid.destroy();
+ }
+ this.buildTree();
+
+ HashMap<Integer,Resource> data = new HashMap<Integer, Resource>();
+ for (Resource res : result) {
+ data.put(res.getId(),res);
+ }
+
+ Tree tree = new Tree();
+
+ tree.setRoot(NewResourceTreeDataSource.build(rootId, data));
+ treeGrid.setData(tree);
+ addMember(this.treeGrid);
+ }
+
+
+ private void adjustBreadcrumb(TreeNode node, ViewId viewId) {
+ if (node instanceof ResourceTreeDatasource.ResourceTreeNode) {
+
+ Resource nr = ((ResourceTreeDatasource.ResourceTreeNode)
node).getResource();
+ String display = node.getName() + " <span
class=\"subtitle\">" + nr.getResourceType().getName() +
"</span>";
+ String icon = "types/" +
nr.getResourceType().getCategory().getDisplayName() + "_up_16.png";
+
+
+ viewId.getBreadcrumbs().add(new
Breadcrumb(node.getAttribute("id"),
+ display, icon, true));
+
+ } else {
+
+// if (node.getName() != null) {
+// viewId.getBreadcrumbs().add(new
Breadcrumb(node.getAttribute("id"), node.getName(), null, true));
+// }
+ }
+ }
+
+
+ public void addResourceSelectListener(ResourceSelectListener listener) {
+ this.selectListeners.add(listener);
+ }
+
+ public void renderView(ViewPath viewPath) {
+ currentViewId = viewPath.getCurrent();
+ }
+}
\ No newline at end of file
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 701c176..02570b6 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
@@ -50,6 +50,8 @@ import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.events.CloseClickHandler;
import com.smartgwt.client.widgets.events.CloseClientEvent;
+import com.smartgwt.client.widgets.events.ShowContextMenuEvent;
+import com.smartgwt.client.widgets.events.ShowContextMenuHandler;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.VLayout;
@@ -121,7 +123,7 @@ public class ResourceTreeView extends VLayout {
treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (selectionEvent.getState()) {
+ if (!selectionEvent.isRightButtonDown() &&
selectionEvent.getState()) {
if (treeGrid.getSelectedRecord() instanceof
ResourceTreeDatasource.ResourceTreeNode) {
ResourceTreeDatasource.ResourceTreeNode node =
(ResourceTreeDatasource.ResourceTreeNode) treeGrid.getSelectedRecord();
System.out.println("Resource selected in tree: " +
node.getResource());
@@ -144,9 +146,13 @@ public class ResourceTreeView extends VLayout {
// This constructs the context menu for the resource at the time of the click.
setContextMenu(contextMenu);
+
+
+
treeGrid.addNodeContextClickHandler(new NodeContextClickHandler() {
public void onNodeContextClick(final NodeContextClickEvent event) {
event.getNode();
+ event.cancel();
if (event.getNode() instanceof ResourceTreeDatasource.TypeTreeNode) {
showContextMenu((ResourceTreeDatasource.TypeTreeNode)
event.getNode());
@@ -406,6 +412,9 @@ public class ResourceTreeView extends VLayout {
if (treeGrid != null && treeGrid.getTree() != null
&& (node =
treeGrid.getTree().findById(String.valueOf(selectedResource.getId()))) != null) {
+ // This is the case where the tree was previously loaded and we get fired to
look at a different
+ // node in the same tree and just have to switch the selection
+
TreeNode[] parents = treeGrid.getTree().getParents(node);
treeGrid.getTree().openFolders(parents);
treeGrid.getTree().openFolder(node);
commit 3bf778a65f84daf3e39514cd87ad269558c1257e
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 13:12:19 2010 -0400
Slim down the selectors in height
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java
index 28830da..f2c02f5 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java
@@ -4,18 +4,23 @@
* 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.
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
*
* 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.
+ * GNU General Public License and the GNU Lesser 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.
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
package org.rhq.enterprise.gui.coregui.client.components.form;
import java.util.ArrayList;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
index 8b13207..8fc14b0 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
@@ -102,7 +102,7 @@ public abstract class AbstractSelector<T> extends VLayout {
// LEFT SIDE
availableGrid = new ListGrid();
- availableGrid.setHeight(350);
+ availableGrid.setHeight(300);
availableGrid.setCanDragRecordsOut(true);
availableGrid.setDragTrackerMode(DragTrackerMode.ICON);
availableGrid.setTrackerImage(new
ImgProperties("types/Service_up_16.png", 16, 16));
@@ -157,7 +157,7 @@ public abstract class AbstractSelector<T> extends VLayout {
// RIGHT SIDE
assignedGrid = new ListGrid();
- assignedGrid.setHeight(350);
+ assignedGrid.setHeight(300);
assignedGrid.setCanReorderRecords(true);
assignedGrid.setCanDragRecordsOut(true);
commit 7048f423e2f90def4e4abb13d559940ad0bb796f
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 13:03:15 2010 -0400
Ability to use <enter> twice on the login form to use autofill values
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
index c28d77e..d534aca 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
@@ -26,7 +26,6 @@ import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
-import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Alignment;
@@ -102,7 +101,7 @@ public class LoginView extends Canvas {
TextItem user = new TextItem("user", "User");
user.setRequired(true);
user.setAttribute("autoComplete", "native");
- PasswordItem password = new PasswordItem("password",
"Password");
+ final PasswordItem password = new PasswordItem("password",
"Password");
password.setRequired(true);
password.setAttribute("autoComplete", "native");
@@ -110,6 +109,13 @@ public class LoginView extends Canvas {
loginButton.setAlign(Alignment.CENTER);
loginButton.setColSpan(2);
+ user.addKeyPressHandler(new KeyPressHandler() {
+ public void onKeyPress(KeyPressEvent event) {
+ if ((event.getCharacterValue() != null) &&
(event.getCharacterValue() == KeyCodes.KEY_ENTER)) {
+ password.focusInItem(); // Work around the form not getting
auto-fill values until the field is focused
+ }
+ }
+ });
password.addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
if ((event.getCharacterValue() != null) &&
(event.getCharacterValue() == KeyCodes.KEY_ENTER)) {
commit cdf8afe540f894b61147721f67def6e90a2a004a
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 12:59:46 2010 -0400
Improve bundle tree reloading so that it doesn't always close the entire tree
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
index cce46a3..5ea41cf 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
@@ -93,8 +93,14 @@ public class BundleTopView extends HLayout implements BookmarkableView
{
public void renderView(ViewPath viewPath) {
+ if (viewPath.isRefresh()) {
+ bundleTreeView.refresh();
+ }
+
+
bundleTreeView.selectPath(viewPath);
+
if (viewPath.isEnd()) {
if (currentNextPath == null && bundlesListView != null) {
// refresh
@@ -117,6 +123,5 @@ public class BundleTopView extends HLayout implements BookmarkableView
{
bundleView.renderView(viewPath.next());
}
}
- bundleTreeView.refresh();//refresh the tree in all cases.
}
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
index 3dabe7e..000af5f 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
@@ -46,9 +46,7 @@ public class BundleTreeView extends TreeGrid {
setWidth100();
setHeight100();
-
- setWidth100();
- setHeight100();
+ setLeaveScrollbarGap(false);
// setShowRoot(true);
setAutoFetchData(true);
setAnimateFolders(false);
commit c650a717ee4a21354d83e34f73f03705b5f72fbf
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 12:59:14 2010 -0400
Fix selector repackaging
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleStep.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleStep.java
index 271ca59..771e51d 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleStep.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleStep.java
@@ -25,8 +25,8 @@ import com.smartgwt.client.widgets.Canvas;
import org.rhq.core.domain.bundle.Bundle;
import org.rhq.enterprise.gui.coregui.client.bundle.BundleSelector;
+import org.rhq.enterprise.gui.coregui.client.components.selector.AbstractSelector;
import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
-import
org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.AbstractSelector;
public class SelectBundleStep extends AbstractWizardStep {
commit b59013caf09787898c3a5efb863f0dfcf852f8d4
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 12:42:18 2010 -0400
Better admin tree L&F
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index c2ebe9b..6eead0b 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -121,6 +121,7 @@ public class AdministrationView extends HLayout implements
BookmarkableView {
private TreeGrid buildSecuritySection() {
final TreeGrid securityTreeGrid = new TreeGrid();
+ securityTreeGrid.setLeaveScrollbarGap(false);
securityTreeGrid.setShowHeader(false);
Tree tree = new Tree();
@@ -151,6 +152,7 @@ public class AdministrationView extends HLayout implements
BookmarkableView {
private TreeGrid buildManagementClusterSection() {
final TreeGrid mgmtClusterTreeGrid = new TreeGrid();
+ mgmtClusterTreeGrid.setLeaveScrollbarGap(false);
mgmtClusterTreeGrid.setShowHeader(false);
Tree tree = new Tree();
@@ -174,6 +176,7 @@ public class AdministrationView extends HLayout implements
BookmarkableView {
private TreeGrid buildSystemConfigurationSection() {
final TreeGrid systemConfigTreeGrid = new TreeGrid();
+ systemConfigTreeGrid.setLeaveScrollbarGap(false);
systemConfigTreeGrid.setShowHeader(false);
Tree tree = new Tree();
@@ -195,6 +198,7 @@ public class AdministrationView extends HLayout implements
BookmarkableView {
private TreeGrid buildReportsSection() {
final TreeGrid reportsTreeGrid = new TreeGrid();
+ reportsTreeGrid.setLeaveScrollbarGap(false);
reportsTreeGrid.setShowHeader(false);
Tree tree = new Tree();
commit 64354925b00bfedb4fbbba1626c942b88e0eaf4c
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 12:41:47 2010 -0400
Support for tracking refreshes explicitely in the viewpath
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
index 0a1253b..e0b7991 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
@@ -29,6 +29,8 @@ public class ViewPath {
private int index = 0;
+ private boolean refresh = false;
+
public ViewPath() {
}
@@ -84,4 +86,12 @@ public class ViewPath {
public int viewsLeft() {
return viewPath.size() - index - 1;
}
+
+ public boolean isRefresh() {
+ return refresh;
+ }
+
+ public void setRefresh(boolean refresh) {
+ this.refresh = refresh;
+ }
}
commit d18f68e412fb929443b7edc23deeab2473281119
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 12:41:27 2010 -0400
Reports top level category
tag cloud display, recent alerts, recent operations
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 8fb1f0b..7cd621b 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -53,6 +53,7 @@ import
org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGro
import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceView;
import org.rhq.enterprise.gui.coregui.client.menu.MenuBarView;
+import org.rhq.enterprise.gui.coregui.client.report.ReportTopView;
import org.rhq.enterprise.gui.coregui.client.report.tag.TaggedView;
import org.rhq.enterprise.gui.coregui.client.util.ErrorHandler;
import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenter;
@@ -248,6 +249,7 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
public static void refresh() {
currentViewPath = new ViewPath(currentPath);
+ currentViewPath.setRefresh(true);
coreGUI.rootCanvas.renderView(currentViewPath);
}
@@ -275,6 +277,8 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
canvas = new TaggedView();
} else if (breadcrumbName.equals("Subsystems")) {
canvas = new AlertsView();
+ } else if (breadcrumbName.equals("Reports")) {
+ canvas = new ReportTopView();
} else {
canvas = null;
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
new file mode 100644
index 0000000..8024902
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
@@ -0,0 +1,370 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.report;
+
+import java.util.LinkedHashMap;
+
+import com.smartgwt.client.types.VisibilityMode;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionEvent;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.SectionStack;
+import com.smartgwt.client.widgets.layout.SectionStackSection;
+import com.smartgwt.client.widgets.tree.Tree;
+import com.smartgwt.client.widgets.tree.TreeGrid;
+import com.smartgwt.client.widgets.tree.TreeNode;
+
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.admin.agent.install.RemoteAgentInstallView;
+import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
+import org.rhq.enterprise.gui.coregui.client.admin.users.UsersView;
+import org.rhq.enterprise.gui.coregui.client.alert.AlertsView;
+import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
+import
org.rhq.enterprise.gui.coregui.client.dashboard.portlets.platform.PlatformPortletView;
+import
org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView;
+import
org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.ResourceAutodiscoveryView;
+import org.rhq.enterprise.gui.coregui.client.report.tag.TagCloudView;
+import org.rhq.enterprise.gui.coregui.client.report.tag.TaggedView;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ReportTopView extends HLayout implements BookmarkableView {
+
+ public static final String VIEW_PATH = "Reports";
+
+
+ private ViewId currentSectionViewId;
+ private ViewId currentPageViewId;
+
+
+ private SectionStack sectionStack;
+
+ private Canvas contentCanvas;
+ private Canvas currentContent;
+ private LinkedHashMap<String, TreeGrid> treeGrids = new
LinkedHashMap<String, TreeGrid>();
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ setWidth100();
+ setHeight100();
+
+ contentCanvas = new Canvas();
+ contentCanvas.setWidth("*");
+ contentCanvas.setHeight100();
+
+ sectionStack = new SectionStack();
+ sectionStack.setShowResizeBar(true);
+ sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
+ sectionStack.setWidth(250);
+ sectionStack.setHeight100();
+
+
+ treeGrids.put("Inventory", buildInventorySection());
+ treeGrids.put("Configuration", buildSystemConfigurationSection());
+ treeGrids.put("Cluster", buildManagementClusterSection());
+ treeGrids.put("Reports", buildReportsSection());
+
+
+ for (final String name : treeGrids.keySet()) {
+ TreeGrid grid = treeGrids.get(name);
+
+ grid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ CoreGUI.goTo("Reports/" + name + "/" +
selectionEvent.getRecord().getAttribute("name"));
+ }
+ });
+
+
+ SectionStackSection section = new SectionStackSection(name);
+ section.setExpanded(true);
+ section.addItem(grid);
+
+ sectionStack.addSection(section);
+ }
+
+
+ addMember(sectionStack);
+ addMember(contentCanvas);
+
+ }
+
+
+ private HTMLFlow defaultView() {
+ String contents = "<h1>Reports</h1>\n" +
+ "This section provides access to global reports.";
+ HTMLFlow flow = new HTMLFlow(contents);
+ flow.setPadding(20);
+ return flow;
+ }
+
+
+ private TreeGrid buildInventorySection() {
+
+ final TreeGrid inventoryTreeGrid = new TreeGrid();
+ inventoryTreeGrid.setLeaveScrollbarGap(false);
+ inventoryTreeGrid.setShowHeader(false);
+
+ Tree tree = new Tree();
+ final TreeNode tagCloud = new TreeNode("Tag Cloud");
+ tagCloud.setIcon("global/Cloud_16.png");
+
+ final TreeNode suspectMetrics = new TreeNode("Suspect Metrics");
+ suspectMetrics.setIcon("subsystems/monitor/Monitor_failed_16.png");
+
+ final TreeNode recentConfigurationChanges = new TreeNode("Recent
Configuration Changes");
+
recentConfigurationChanges.setIcon("subsystems/configure/Configure_16.png");
+
+ final TreeNode recentOperations = new TreeNode("Recent Operations");
+ recentOperations.setIcon("subsystems/control/Operation_16.png");
+
+ final TreeNode recentAlerts = new TreeNode("Recent Alerts");
+ recentAlerts.setIcon("subsystems/alert/Alert_LOW_16.png");
+
+ final TreeNode alertDefinitions = new TreeNode("Alert Definitions");
+ alertDefinitions.setIcon("subsystems/alert/Alerts_16.png");
+
+ final TreeNode platforms = new TreeNode("Platforms");
+ platforms.setIcon("types/Platform_up_16.png");
+
+
+ tree.setRoot(new TreeNode("inventory",
+ tagCloud,
+ suspectMetrics,
+ recentConfigurationChanges,
+ recentOperations,
+ recentAlerts,
+ alertDefinitions,
+ platforms));
+
+ inventoryTreeGrid.setData(tree);
+
+ return inventoryTreeGrid;
+ }
+
+
+ private TreeGrid buildManagementClusterSection() {
+
+ final TreeGrid mgmtClusterTreeGrid = new TreeGrid();
+ mgmtClusterTreeGrid.setLeaveScrollbarGap(false);
+ mgmtClusterTreeGrid.setShowHeader(false);
+
+ Tree tree = new Tree();
+ final TreeNode manageServersNode = new TreeNode("Servers");
+ final TreeNode manageAgentsNode = new TreeNode("Agents");
+ final TreeNode manageAffinityGroupsNode = new TreeNode("Affinity
Groups");
+ final TreeNode managePartitionEventsNode = new TreeNode("Partition
Events");
+
+ tree.setRoot(new TreeNode("clustering",
+ manageServersNode,
+ manageAgentsNode,
+ manageAffinityGroupsNode,
+ managePartitionEventsNode));
+
+ mgmtClusterTreeGrid.setData(tree);
+
+ return mgmtClusterTreeGrid;
+ }
+
+
+ private TreeGrid buildSystemConfigurationSection() {
+
+ final TreeGrid systemConfigTreeGrid = new TreeGrid();
+ systemConfigTreeGrid.setLeaveScrollbarGap(false);
+ systemConfigTreeGrid.setShowHeader(false);
+
+ Tree tree = new Tree();
+ final TreeNode manageSettings = new TreeNode("System Settings");
+ final TreeNode manageTemplates = new TreeNode("Templates");
+ final TreeNode manageDownloads = new TreeNode("Downloads");
+ final TreeNode manageLicense = new TreeNode("License");
+ final TreeNode managePlugins = new TreeNode("Plugins");
+
+ tree.setRoot(new TreeNode("System Configuration",
+ manageSettings, manageTemplates, manageDownloads, manageLicense,
managePlugins));
+
+ systemConfigTreeGrid.setData(tree);
+
+ return systemConfigTreeGrid;
+ }
+
+
+ private TreeGrid buildReportsSection() {
+
+ final TreeGrid reportsTreeGrid = new TreeGrid();
+ reportsTreeGrid.setLeaveScrollbarGap(false);
+ reportsTreeGrid.setShowHeader(false);
+
+ Tree tree = new Tree();
+ final TreeNode inventorySummaryNode = new TreeNode("Inventory
Summary");
+
+ TreeNode reportsNode = new TreeNode("Reports", inventorySummaryNode);
+ tree.setRoot(reportsNode);
+
+ reportsTreeGrid.setData(tree);
+
+ return reportsTreeGrid;
+ }
+
+
+ public void setContent(Canvas newContent) {
+
+ if (contentCanvas.getChildren().length > 0)
+ contentCanvas.getChildren()[0].destroy();
+
+ contentCanvas.addChild(newContent);
+ contentCanvas.markForRedraw();
+ this.currentContent = newContent;
+ }
+
+
+ private void renderContentView(ViewPath viewPath) {
+
+ currentSectionViewId = viewPath.getCurrent();
+ currentPageViewId = viewPath.getNext();
+
+ String section = currentSectionViewId.getPath();
+ String page = currentPageViewId.getPath();
+
+
+ Canvas content = null;
+ if ("Inventory".equals(section)) {
+
+ if ("Tag Cloud".equals(page)) {
+ content = new TaggedView();
+ } else if ("Suspect Metrics".equals(page)) {
+// todo
+ } else if ("Recent Configuration Changes".equals(page)) {
+ // todo
+ } else if ("Recent Operations".equals(page)) {
+ content = new OperationHistoryView();
+ } else if ("Recent Alerts".equals(page)) {
+ content = new AlertsView();
+ } else if ("Alert Definitions".equals(page)) {
+ //todo
+ } else if ("Platforms".equals(page)) {
+ content = new PlatformPortletView();
+ }
+
+
+ } else if ("Security".equals(section)) {
+
+ if ("Manage Users".equals(page)) {
+ content = new UsersView();
+ } else if ("Manage Roles".equals(page)) {
+ content = new RolesView();
+ } else if ("Auto Discovery Queue".equals(page)) {
+ content = new ResourceAutodiscoveryView();
+ } else if ("Remote Agent Install".equals(page)) {
+ content = new RemoteAgentInstallView();
+ }
+ } else if ("Configuration".equals(section)) {
+
+ String url = null;
+ if ("System Settings".equals(page)) {
+ url = "/admin/config/Config.do?mode=edit";
+ } else if ("Templates".equals(page)) {
+ url =
"/admin/config/EditDefaults.do?mode=monitor&viewMode=all";
+ } else if ("Downloads".equals(page)) {
+ url = "/rhq/admin/downloads-body.xhtml";
+ } else if ("License".equals(page)) {
+ url = "/admin/license/LicenseAdmin.do?mode=view";
+ } else if ("Plugins".equals(page)) {
+ url = "/rhq/admin/plugin/plugin-list.xhtml";
+ }
+ url = addQueryStringParam(url, "nomenu=true");
+ content = new FullHTMLPane(url);
+
+
+ } else if ("Cluster".equals(section)) {
+ String url = null;
+ if ("Servers".equals(page)) {
+ url = "/rhq/ha/listServers.xhtml";
+ } else if ("Agents".equals(page)) {
+ url = "/rhq/ha/listAgents.xhtml";
+ } else if ("Affinity Groups".equals(page)) {
+ url = "/rhq/ha/listAffinityGroups.xhtml";
+ } else if ("Partition Events".equals(page)) {
+ url = "/rhq/ha/listPartitionEvents.xhtml";
+ }
+ url = addQueryStringParam(url, "nomenu=true");
+ content = new FullHTMLPane(url);
+ }
+
+
+ for (String name : treeGrids.keySet()) {
+
+ TreeGrid treeGrid = treeGrids.get(name);
+ if (name.equals(section)) {
+// treeGrid.setSelectedPaths(page);
+ } else {
+ treeGrid.deselectAllRecords();
+ }
+ }
+
+
+
+ setContent(content);
+
+
+ if (content instanceof BookmarkableView) {
+ ((BookmarkableView) content).renderView(viewPath.next().next());
+ }
+
+
+ }
+
+
+ public void renderView(ViewPath viewPath) {
+
+ if (!viewPath.isCurrent(currentSectionViewId) ||
!viewPath.isNext(currentPageViewId)) {
+
+ if (viewPath.isEnd()) {
+ // Display default view
+ setContent(defaultView());
+ } else {
+ renderContentView(viewPath);
+ }
+ } else {
+ if (this.currentContent instanceof BookmarkableView) {
+ ((BookmarkableView)
this.currentContent).renderView(viewPath.next().next());
+ }
+
+ }
+
+
+ }
+
+ private static String addQueryStringParam(String url, String param) {
+ char separatorChar = (url.indexOf('?') == -1) ? '?' :
'&';
+ return url + separatorChar + param;
+ }
+}
\ No newline at end of file
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TagCloudView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TagCloudView.java
index 9e183fb..0a78e50 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TagCloudView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TagCloudView.java
@@ -109,7 +109,7 @@ public class TagCloudView extends VLayout {
int font = (int) ((((double) tag.getTotal()) / (double) max) * (maxFont -
minFont)) + minFont;
- buf.append("<a href=\"#Tag/" + tag.getTag().toString() +
"\" style=\"font-size: " + font + "pt; margin:
8px;\"");
+ buf.append("<a href=\"#Reports/Inventory/Tag Cloud/" +
tag.getTag().toString() + "\" style=\"font-size: " + font + "pt;
margin: 8px;\"");
buf.append(" title=\"Tag used " + tag.getTotal() + "
times\"");
commit 1b99ddfec45e3d718937f839fd998ddc118a5d2a
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 12:40:23 2010 -0400
Role create/edit with working group and subject assignments
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionEditorView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionEditorView.java
index 123e47d..74b9c34 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionEditorView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/PermissionEditorView.java
@@ -54,11 +54,6 @@ public class PermissionEditorView extends CanvasItem {
setCanvas(new SimpleCollapsiblePanel("Permissions", buildForm()));
}
- @Override
- public Canvas getCanvas() {
- System.out.println("ANythinglksjgalksdjfalskdjfalkdjflaksjdfl?");
- return super.getCanvas(); // TODO: Implement this method.
- }
public Canvas buildForm() {
System.out.println("Building permissions canvas");
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
index 523c822..cca86be 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
@@ -18,14 +18,15 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.roles;
+import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.resource.group.ResourceGroup;
-import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import
org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceGroupSelector;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSCallback;
@@ -34,8 +35,10 @@ import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.DSOperationType;
import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.types.TitleOrientation;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.events.SubmitValuesEvent;
import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
@@ -67,19 +70,20 @@ public class RoleEditView extends VLayout {
private HeaderLabel editLabel;
private DynamicForm form;
private PermissionEditorView permissionEditorItem;
- private CanvasItem selectorItem;
+
+ private CanvasItem groupSelectorItem;
private ResourceGroupSelector groupSelector;
+ private CanvasItem subjectSelectorItem;
+ private RoleSubjectSelector subjectSelector;
+
+ private Window editorWindow;
+
+
public RoleEditView() {
super();
setPadding(10);
setOverflow(Overflow.AUTO);
- }
-
- @Override
- protected void onInit() {
- super.onInit();
-
addMember(message);
@@ -91,6 +95,8 @@ public class RoleEditView extends VLayout {
private Canvas buildRoleForm() {
this.editCanvas = new VLayout();
+ this.editCanvas.setWidth100();
+ this.editCanvas.setHeight100();
editLabel = new HeaderLabel("Create User");
// TODO create header css style and set
@@ -98,6 +104,8 @@ public class RoleEditView extends VLayout {
editCanvas.addMember(editLabel);
form = new DynamicForm();
+ form.setWidth100();
+
form.setDataSource(RolesDataSource.getInstance());
TextItem idItem = new TextItem("id", "Id");
@@ -108,10 +116,17 @@ public class RoleEditView extends VLayout {
permissionEditorItem.setShowTitle(false);
permissionEditorItem.setColSpan(2);
- selectorItem = new CanvasItem("groupSelectionCanvas");
+ groupSelectorItem = new CanvasItem("groupSelectionCanvas",
"Assigned Resource Groups");
+ groupSelectorItem.setCanvas(new Label("loading...")); //new
RoleResourceGroupSelector(null));
+ groupSelectorItem.setTitleOrientation(TitleOrientation.TOP);
+ groupSelectorItem.setColSpan(2);
+
+
+ subjectSelectorItem = new CanvasItem("subjectSelectionCanvas",
"Assigned Subjects");
+ subjectSelectorItem.setCanvas(new Label("loading...")); //new
RoleSubjectSelector(null));
+ subjectSelectorItem.setTitleOrientation(TitleOrientation.TOP);
+ subjectSelectorItem.setColSpan(2);
- selectorItem.setShowTitle(false);
- selectorItem.setColSpan(2);
SubmitItem saveButton = new SubmitItem("save", "Save");
@@ -134,7 +149,8 @@ public class RoleEditView extends VLayout {
idItem,
nameItem,
permissionEditorItem,
- selectorItem,
+ groupSelectorItem,
+ subjectSelectorItem,
saveButton, new ResetItem("reset", "Reset"));
editCanvas.addMember(form);
@@ -153,19 +169,23 @@ public class RoleEditView extends VLayout {
permissionEditorItem.setPermissions((Set<Permission>)
record.getAttributeAsObject("permissions"));
groupSelector = new
RoleResourceGroupSelector((Collection<ResourceGroup>)
record.getAttributeAsObject("resourceGroups"));
- selectorItem.setCanvas(groupSelector);
+ groupSelectorItem.setCanvas(groupSelector);
+
+
+ subjectSelector = new RoleSubjectSelector((Collection<Subject>)
record.getAttributeAsObject("subjects"));
+ subjectSelectorItem.setCanvas(subjectSelector);
} catch (Throwable t) {
t.printStackTrace();
}
- markForRedraw();
+// markForRedraw();
}
public void editNone() {
message.show();
editCanvas.hide();
- markForRedraw();
+// markForRedraw();
}
public void editNew() {
@@ -174,6 +194,19 @@ public class RoleEditView extends VLayout {
form.setSaveOperationType(DSOperationType.ADD);
editLabel.setContents("Create Role");
+
+
+ editorWindow = new Window();
+ editorWindow.setTitle("Create Role");
+ editorWindow.setWidth(800);
+ editorWindow.setHeight(800);
+ editorWindow.setIsModal(true);
+ editorWindow.setShowModalMask(true);
+ editorWindow.setCanDragResize(true);
+ editorWindow.centerInPage();
+ editorWindow.addItem(this);
+ editorWindow.show();
+
}
@@ -190,7 +223,7 @@ public class RoleEditView extends VLayout {
}
int roleId;
- if (roleBeingEdited != null) {
+ if (roleBeingEdited != null && roleBeingEdited.getId() != null)
{
roleId = roleBeingEdited.getId();
} else {
// new role
@@ -202,13 +235,37 @@ public class RoleEditView extends VLayout {
roleId, groupIds,
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to
update role's assigned groups",caught);
+ CoreGUI.getErrorHandler().handleError("Failed to
update role's assigned groups", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new
Message("Updated assigned groups", Message.Severity.Info));
+ }
+ });
+
+ HashSet<Integer> selectedSubjects =
subjectSelector.getSelection();
+ int[] subjectIds = new int[selectedSubjects.size()];
+ i = 0;
+ for (Integer id : selectedSubjects) {
+ subjectIds[i++] = id;
+ }
+
+
+ GWTServiceLookup.getRoleService().setAssignedSubjects(
+ roleId, subjectIds,
+ new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to
update role's assigned subjects", caught);
}
public void onSuccess(Void result) {
- // TODO: Implement this method.
+ CoreGUI.getMessageCenter().notify(new
Message("Updated role assigned subjects", Message.Severity.Info));
}
});
+
+ if (editorWindow != null) {
+ editorWindow.destroy();
+ }
}
});
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleSubjectSelector.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleSubjectSelector.java
new file mode 100644
index 0000000..4b8e940
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleSubjectSelector.java
@@ -0,0 +1,83 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.admin.roles;
+
+import java.util.Collection;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.enterprise.gui.coregui.client.admin.users.UsersDataSource;
+import org.rhq.enterprise.gui.coregui.client.components.selector.AbstractSelector;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author Greg Hinkle
+ */
+public class RoleSubjectSelector extends AbstractSelector<Subject> {
+
+
+
+ public RoleSubjectSelector(Collection<Subject> subjects) {
+ super();
+ if (subjects != null) {
+ ListGridRecord[] data = (new UsersDataSource()).buildRecords(subjects);
+ setAssigned(data);
+ }
+ }
+
+
+
+ @Override
+ protected DynamicForm getAvailableFilterForm() {
+ return null; // TODO: Implement this method.
+ }
+
+ @Override
+ protected RPCDataSource<Subject> getDataSource() {
+ return new SelectedSubjectsDataSource();
+ }
+
+ @Override
+ protected Criteria getLatestCriteria(DynamicForm availableFilterForm) {
+ return null; // TODO: Implement this method.
+ }
+
+
+ public class SelectedSubjectsDataSource extends UsersDataSource {
+
+ @Override
+ public ListGridRecord[] buildRecords(Collection<Subject> subjects) {
+ ListGridRecord[] records = super.buildRecords(subjects);
+ for (ListGridRecord record : records) {
+ if (selection.contains(record.getAttributeAsInt("id"))) {
+ record.setEnabled(false);
+ }
+ }
+ return records;
+ }
+ }
+
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
index 644b02d..5ddbde2 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
@@ -63,8 +63,7 @@ public class RolesDataSource extends RPCDataSource<Role> {
return INSTANCE;
}
- private RolesDataSource() {
- super("Roles");
+ public RolesDataSource() {
DataSourceField idDataField = new DataSourceIntegerField("id",
"ID");
idDataField.setPrimaryKey(true);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
index dc36ee6..7c0f175 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.roles;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
@@ -33,7 +35,8 @@ import com.smartgwt.client.widgets.layout.VLayout;
/**
* @author Greg Hinkle
*/
-public class RolesView extends VLayout {
+public class RolesView extends VLayout implements BookmarkableView {
+
@Override
@@ -104,17 +107,12 @@ public class RolesView extends VLayout {
RoleEditView editView = new RoleEditView();
- final Window roleEditor = new Window();
- roleEditor.setTitle("Create Role");
- roleEditor.setWidth(800);
- roleEditor.setHeight(800);
- roleEditor.setIsModal(true);
- roleEditor.setShowModalMask(true);
- roleEditor.setCanDragResize(true);
- roleEditor.centerInPage();
- roleEditor.addItem(editView);
- roleEditor.show();
-
editView.editNew();
}
+
+ public void renderView(ViewPath viewPath) {
+
+ System.out.println("Display role list");
+
+ }
}
\ No newline at end of file
commit 6990d0ed3763c09166b0771429a96cfa9a204010
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 11:50:07 2010 -0400
Exposing subject roles assignments
fixed bugs in set role groups assignments and set role subject assignments
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RoleGWTService.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RoleGWTService.java
index 768b8f4..932ceb8 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RoleGWTService.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/RoleGWTService.java
@@ -41,4 +41,6 @@ public interface RoleGWTService extends RemoteService {
void setAssignedResourceGroups(int roleId, int[] resourceGroupIds);
void setAssignedSubjects(int roleId, int[] subjectIds);
+
+ void setAssignedSubjectRoles(int subjectId, int[] roleIds);
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RoleGWTServiceImpl.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RoleGWTServiceImpl.java
index 1414025..87d9132 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RoleGWTServiceImpl.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/RoleGWTServiceImpl.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
+import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.criteria.RoleCriteria;
import org.rhq.core.domain.util.PageList;
@@ -60,4 +61,9 @@ public class RoleGWTServiceImpl extends AbstractGWTServiceImpl
implements RoleGW
public void setAssignedSubjects(int roleId, int[] subjectIds) {
roleManager.setAssignedSubjects(getSessionSubject(), roleId, subjectIds);
}
+
+
+ public void setAssignedSubjectRoles(int subjectId, int[] roleIds) {
+ roleManager.setAssignedSubjectRoles(getSessionSubject(), subjectId, roleIds);
+ }
}
\ No newline at end of file
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
index 30feae3..c53d399 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
@@ -76,7 +76,7 @@ public class RoleManagerBean implements RoleManagerLocal,
RoleManagerRemote {
private AlertNotificationManagerLocal alertNotificationManager;
/**
- * @see
org.rhq.enterprise.server.authz.RoleManagerLocal#findRolesBySubject(Subject,PageControl)
+ * @see org.rhq.enterprise.server.authz.RoleManagerLocal#findRolesBySubject(int
subjectId,PageControl pageControl)
*/
@SuppressWarnings("unchecked")
// the first param, subject, is not the subject making the request, its the subject
whose roles are to be returned.
@@ -262,6 +262,41 @@ public class RoleManagerBean implements RoleManagerLocal,
RoleManagerRemote {
return;
}
+
+ @RequiredPermission(Permission.MANAGE_SECURITY)
+ public void setAssignedSubjectRoles(Subject subject, int subjectId, int[] roleIds) {
+
+ Subject subjectToModify = subjectManager.getSubjectById(subjectId); // attach it
+ List<Integer> currentRoles = new ArrayList<Integer>();
+ for (Role role : subjectToModify.getRoles()) {
+ currentRoles.add(role.getId());
+ }
+
+ List<Integer> newRoles = ArrayUtils.wrapInList(roleIds); // members needing
addition
+ newRoles.removeAll(currentRoles);
+ if (newRoles.size() > 0) {
+ int[] newRoleIds = new int[newRoles.size()];
+ int i = 0;
+ for (Integer id : newRoles) {
+ newRoleIds[i++] = id;
+ }
+ addRolesToSubject(subject, subjectId, newRoleIds);
+ }
+
+ List<Integer> extraMembers = new ArrayList<Integer>(currentRoles); //
members needing removal
+ extraMembers.removeAll(ArrayUtils.wrapInList(roleIds));
+ if (extraMembers.size() > 0) {
+ int[] extraMemberIds = new int[extraMembers.size()];
+ int i = 0;
+ for (Integer id : extraMembers) {
+ extraMemberIds[i++] = id;
+ }
+ removeRolesFromSubject(subject, subjectId, extraMemberIds);
+ }
+ }
+
+
+
/**
* @see org.rhq.enterprise.server.authz.RoleManagerLocal#getRoleById(Integer)
*/
@@ -306,7 +341,7 @@ public class RoleManagerBean implements RoleManagerLocal,
RoleManagerRemote {
}
/**
- * @see
org.rhq.enterprise.server.authz.RoleManagerRemote#findSubjectsByRole(Subject,Integer,PageControl)
+ * @see org.rhq.enterprise.server.authz.RoleManagerLocal#findSubjectsByRole(Integer
roleId,PageControl pageControl)
*/
public PageList<Subject> findSubjectsByRole(Subject subject, Integer roleId,
PageControl pc) {
return findSubjectsByRole(roleId, pc);
@@ -464,13 +499,24 @@ public class RoleManagerBean implements RoleManagerLocal,
RoleManagerRemote {
List<Integer> newMembers = ArrayUtils.wrapInList(groupIds); // members
needing addition
newMembers.removeAll(currentMembers);
if (newMembers.size() > 0) {
- addResourceGroupsToRole(subject, roleId, groupIds);
+ int[] newMemberInts = new int[newMembers.size()];
+ int i = 0;
+ for (Integer id : newMembers) {
+ newMemberInts[i++] = id;
+ }
+ addResourceGroupsToRole(subject, roleId, newMemberInts);
}
List<Integer> extraMembers = new ArrayList<Integer>(currentMembers);
// members needing removal
extraMembers.removeAll(ArrayUtils.wrapInList(groupIds));
if (extraMembers.size() > 0) {
- removeResourceGroupsFromRole(subject, roleId, groupIds);
+ int[] removeMemberInts = new int[extraMembers.size()];
+ int i = 0;
+ for (Integer id : extraMembers) {
+ removeMemberInts[i++] = id;
+ }
+
+ removeResourceGroupsFromRole(subject, roleId, removeMemberInts);
}
}
@@ -520,13 +566,23 @@ public class RoleManagerBean implements RoleManagerLocal,
RoleManagerRemote {
List<Integer> newMembers = ArrayUtils.wrapInList(subjectIds); // members
needing addition
newMembers.removeAll(currentMembers);
if (newMembers.size() > 0) {
- addSubjectsToRole(subject, roleId, subjectIds);
+ int[] newMemberIds = new int[newMembers.size()];
+ int i = 0;
+ for (Integer id : newMembers) {
+ newMemberIds[i++] = id;
+ }
+ addSubjectsToRole(subject, roleId, newMemberIds);
}
List<Integer> extraMembers = new ArrayList<Integer>(currentMembers);
// members needing removal
extraMembers.removeAll(ArrayUtils.wrapInList(subjectIds));
if (extraMembers.size() > 0) {
- removeSubjectsFromRole(subject, roleId, subjectIds);
+ int[] removeMemberIds = new int[extraMembers.size()];
+ int i = 0;
+ for (Integer id : extraMembers) {
+ removeMemberIds[i++] = id;
+ }
+ removeSubjectsFromRole(subject, roleId, removeMemberIds);
}
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerLocal.java
index 3b6e6e2..496d607 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerLocal.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerLocal.java
@@ -184,6 +184,9 @@ public interface RoleManagerLocal {
*/
void removeRolesFromSubject(Subject subject, int subjectId, int[] roleIds);
+ void setAssignedSubjectRoles(Subject subject, int subjectId, int[] roleIds);
+
+
void addSubjectsToRole(Subject subject, int roleId, int[] subjectIds);
void removeSubjectsFromRole(Subject subject, int roleId, int[] subjectIds);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerRemote.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerRemote.java
index e0008cc..4755b36 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerRemote.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerRemote.java
@@ -166,6 +166,15 @@ public interface RoleManagerRemote {
@WebParam(name = "subjectIds") int[] subjectIds);
/**
+ * Sets the set of roles assigned to a subject. Requires SECURITY_ADMIN
+ * @param subject
+ * @param subjectId
+ * @param roleIds
+ */
+ @WebMethod
+ void setAssignedSubjectRoles(Subject subject, int subjectId, int[] roleIds);
+
+ /**
* Adds the given resource groups to the given role.
*
* @param subject The logged in user's subject.
commit c84efa61e275be2e79b37a994bef5d4b9ef35afe
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 11:48:10 2010 -0400
User create/edit with working role assignments
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRoleSelector.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRoleSelector.java
new file mode 100644
index 0000000..e554fef
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRoleSelector.java
@@ -0,0 +1,86 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.admin.users;
+
+import java.util.Collection;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import org.rhq.core.domain.authz.Role;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesDataSource;
+import org.rhq.enterprise.gui.coregui.client.components.selector.AbstractSelector;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author Greg Hinkle
+ */
+public class SubjectRoleSelector extends AbstractSelector<Role> {
+
+
+ public SubjectRoleSelector(Collection<Role> roles) {
+ super();
+ if (roles != null) {
+ ListGridRecord[] data = (new RolesDataSource()).buildRecords(roles);
+ setAssigned(data);
+ }
+ }
+
+
+
+ @Override
+ protected DynamicForm getAvailableFilterForm() {
+ return null; // TODO: Implement this method.
+ }
+
+ @Override
+ protected RPCDataSource<Role> getDataSource() {
+ return new SelectedRolesDataSource();
+
+ }
+
+ @Override
+ protected Criteria getLatestCriteria(DynamicForm availableFilterForm) {
+ return null; // TODO: Implement this method.
+ }
+
+
+ public class SelectedRolesDataSource extends RolesDataSource {
+
+ @Override
+ public ListGridRecord[] buildRecords(Collection<Role> roles) {
+ ListGridRecord[] records = super.buildRecords(roles);
+ for (ListGridRecord record : records) {
+ if (selection.contains(record.getAttributeAsInt("id"))) {
+ record.setEnabled(false);
+ }
+ }
+ return records;
+ }
+ }
+
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRolesEditorItem.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRolesEditorItem.java
index 72fc465..38f0e7a 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRolesEditorItem.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRolesEditorItem.java
@@ -56,7 +56,7 @@ public class SubjectRolesEditorItem extends CanvasItem {
super(name, title);
setShowTitle(false);
setColSpan(2);
- setWidth("90%");
+// setWidth("90%");
setCanvas(new SimpleCollapsiblePanel("Assigned Roles", buildForm()));
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
index edfddbd..334315b 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
@@ -20,13 +20,25 @@ package org.rhq.enterprise.gui.coregui.client.admin.users;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.DSOperationType;
+import com.smartgwt.client.types.TitleOrientation;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.ResetItem;
import com.smartgwt.client.widgets.form.fields.SectionItem;
import com.smartgwt.client.widgets.form.fields.SubmitItem;
@@ -34,8 +46,10 @@ import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
+import java.util.HashSet;
import java.util.Set;
/**
@@ -46,28 +60,33 @@ public class UserEditView extends VLayout {
private Label message = new Label("Select a user to edit...");
- private SubjectRolesEditorItem subjectRolesEditorItem ;
+// private SubjectRolesEditorItem subjectRolesEditorItem ;
private VLayout editCanvas;
private HeaderLabel editLabel;
private DynamicForm form;
+ CanvasItem roleSelectionItem;
+
private UsersDataSource dataSource;
private Subject subject;
- @Override
- protected void onInit() {
- super.onInit();
+ private Window editorWindow;
+ private SubjectRoleSelector roleSelector;
+
+ public UserEditView() {
+ dataSource = UsersDataSource.getInstance();
+
setWidth100();
setHeight100();
buildSubjectEditor();
- form.hide();
+ editCanvas.hide();
addMember(message);
- addMember(form);
+ addMember(editCanvas);
}
@@ -75,6 +94,9 @@ public class UserEditView extends VLayout {
form = new DynamicForm();
form.setWidth100();
+ form.setHiliteRequiredFields(true);
+ form.setRequiredTitleSuffix("* :");
+
SectionItem userEditSection = new SectionItem("userEditSection",
"Edit User");
@@ -97,43 +119,109 @@ public class UserEditView extends VLayout {
// form.setField//s(userEditSection);
- dataSource = UsersDataSource.getInstance();
form.setUseAllDataSourceFields(true);
form.setDataSource(dataSource);
- subjectRolesEditorItem = new
SubjectRolesEditorItem("rolesEditor","Assigned Roles");
- TextItem departmentItem = new TextItem("department");
+ this.roleSelectionItem = new CanvasItem("selectRoles", "Select
Roles");
+ this.roleSelectionItem.setTitleOrientation(TitleOrientation.TOP);
+ this.roleSelectionItem.setColSpan(2);
+// roleSelectionItem.setCanvas(new SubjectRoleSelector(null));
- SubmitItem saveButton = new SubmitItem("save", "Save");
+ TextItem departmentItem = new TextItem("department");
+ departmentItem.setRequired(false);
+
+
+ IButton saveButton = new IButton("Save");
+ saveButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler()
{
+ public void onClick(com.smartgwt.client.widgets.events.ClickEvent clickEvent)
{
+ if (form.validate()) {
+ save();
+ if (editorWindow != null) {
+ editorWindow.destroy();
+ CoreGUI.refresh();
+ }
+ }
+ }
+ });
- saveButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- form.saveData();
- System.out.println("Save is done");
+ IButton resetButton = new IButton("Reset");
+ resetButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler()
{
+ public void onClick(com.smartgwt.client.widgets.events.ClickEvent clickEvent)
{
+ form.reset();
}
});
+ IButton cancelButton = new IButton("Cancel");
+ cancelButton.addClickHandler(new
com.smartgwt.client.widgets.events.ClickHandler() {
+ public void onClick(com.smartgwt.client.widgets.events.ClickEvent clickEvent)
{
+ if (editorWindow != null) {
+ editorWindow.destroy();
+ } else {
+ form.reset();
+ }
+ }
+ });
+
+ HLayout buttonLayout = new HLayout(10);
+ buttonLayout.setAlign(Alignment.CENTER);
+ buttonLayout.addMember(saveButton);
+ buttonLayout.addMember(resetButton);
+ buttonLayout.addMember(cancelButton);
+
+
- ResetItem resetButton = new ResetItem("reset", "Reset");
+ form.setItems(departmentItem, roleSelectionItem);
- form.setItems(departmentItem, subjectRolesEditorItem, saveButton, resetButton);
- return form;
+ editCanvas = new VLayout();
+ editCanvas.addMember(form);
+ editCanvas.addMember(buttonLayout);
+
+ return editCanvas;
}
+ private void save() {
+ final HashSet<Integer> roles = roleSelector.getSelection();
+ form.saveData(new DSCallback() {
+ public void execute(DSResponse dsResponse, Object o, DSRequest dsRequest) {
+
+ int subjectId = Integer.parseInt(new
ListGridRecord(dsRequest.getData()).getAttribute("id"));
+
+ int[] roleIds = new int[roles.size()];
+ int i = 0;
+ for (Integer id : roles) {
+ roleIds[i++] = id;
+ }
+
+ GWTServiceLookup.getRoleService().setAssignedSubjectRoles(subjectId,
roleIds,
+ new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to set
subject role assignments.",caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new
Message("Succesfully saved new user roles.", Message.Severity.Info));
+ }
+ });
+
+ }
+ });
+ }
+
public void editRecord(Record record) {
-
form.getDataSource().getField("username").setCanEdit(record.getAttribute("id")
== null);
+// form.getDataSource().getField("username").setCanEdit(true );
- subjectRolesEditorItem.setSubject((Subject)
record.getAttributeAsObject("entity"));
- subjectRolesEditorItem.setRoles((Set<Role>)
record.getAttributeAsObject("roles"));
+
+ roleSelector = new SubjectRoleSelector((Set<Role>)
record.getAttributeAsObject("roles"));
+ roleSelectionItem.setCanvas(roleSelector);
try {
form.editRecord(record);
@@ -141,7 +229,7 @@ public class UserEditView extends VLayout {
t.printStackTrace();
}
message.hide();
- form.show();
+ editCanvas.show();
form.setSaveOperationType(DSOperationType.UPDATE);
markForRedraw();
@@ -149,17 +237,36 @@ public class UserEditView extends VLayout {
public void editNone() {
message.show();
- form.hide();
+ editCanvas.hide();
markForRedraw();
}
- public void editNew() {
- form.getDataSource().getField("username").setCanEdit(true);
+ private void editNewInternal() {
subject = new Subject();
ListGridRecord r = dataSource.copyValues(subject);
editRecord(r);
+// form.getDataSource().getField("username").setCanEdit(false);
form.setSaveOperationType(DSOperationType.ADD);
+ editorWindow = new Window();
+ editorWindow.setTitle("Create User");
+ editorWindow.setWidth(800);
+ editorWindow.setHeight(800);
+ editorWindow.setIsModal(true);
+ editorWindow.setShowModalMask(true);
+ editorWindow.setCanDragResize(true);
+ editorWindow.centerInPage();
+ editorWindow.addItem(this);
+ editorWindow.show();
+
+ }
+
+ public static void editNew() {
+ UserEditView editView = new UserEditView();
+ editView.editNewInternal();
+
+
+
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
index b76788b..578d2b6 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
@@ -70,14 +70,13 @@ public class UsersDataSource extends RPCDataSource<Subject> {
}
- private UsersDataSource() {
- super("Users");
-
+ public UsersDataSource() {
+
DataSourceField idDataField = new DataSourceIntegerField("id",
"ID");
idDataField.setPrimaryKey(true);
idDataField.setCanEdit(false);
- DataSourceTextField usernameField = new DataSourceTextField("username",
"User Name", 100, true);
+ DataSourceTextField usernameField = new DataSourceTextField("name",
"User Name", 100, true);
DataSourceTextField firstName = new DataSourceTextField("firstName",
"First Name", 100, true);
@@ -101,11 +100,11 @@ public class UsersDataSource extends RPCDataSource<Subject> {
passwordVerify.setValidators(passwordsEqualValidator);
- DataSourceTextField email = new DataSourceTextField("email",
"Email Address", 100, true);
+ DataSourceTextField emailAddress = new
DataSourceTextField("emailAddress", "Email Address", 100, true);
- DataSourceTextField phone = new DataSourceTextField("phoneNumber",
"Phone");
+ DataSourceTextField phone = new DataSourceTextField("phoneNumber",
"Phone", 15, false);
- DataSourceTextField department = new DataSourceTextField("department",
"Department");
+ DataSourceTextField department = new DataSourceTextField("department",
"Department", 100, false);
DataSourceField roles = new DataSourceField();
roles.setForeignKey("Roles.id");
@@ -113,7 +112,7 @@ public class UsersDataSource extends RPCDataSource<Subject> {
roles.setMultiple(true);
- setFields(idDataField, usernameField, firstName, lastName, password,
passwordVerify, phone, email, department);
+ setFields(idDataField, usernameField, firstName, lastName, password,
passwordVerify, phone, emailAddress, department);
}
@@ -122,6 +121,7 @@ public class UsersDataSource extends RPCDataSource<Subject> {
SubjectCriteria criteria = new SubjectCriteria();
criteria.setPageControl(getPageControl(request));
+ criteria.fetchRoles(true);
subjectService.findSubjectsByCriteria(criteria, new
AsyncCallback<PageList<Subject>>() {
public void onFailure(Throwable caught) {
@@ -158,7 +158,7 @@ public class UsersDataSource extends RPCDataSource<Subject> {
public void onFailure(Throwable caught) {
// TODO better exceptions so we can set the right validation errors
Map<String, String> errors = new HashMap<String, String>();
- errors.put("username", "A user with this name already
exists.");
+ errors.put("name", "A user with this name already
exists.");
response.setErrors(errors);
// CoreGUI.getErrorHandler().handleError("Failed to create
role",caught);
response.setStatus(RPCResponse.STATUS_VALIDATION_ERROR);
@@ -243,13 +243,13 @@ public class UsersDataSource extends RPCDataSource<Subject> {
public Subject copyValues(ListGridRecord from) {
Subject to = new Subject();
to.setId(from.getAttributeAsInt("id"));
- to.setName(from.getAttributeAsString("username"));
+ to.setName(from.getAttributeAsString("name"));
to.setFirstName(from.getAttributeAsString("firstName"));
to.setLastName(from.getAttributeAsString("lastName"));
to.setFactive(from.getAttributeAsBoolean("factive"));
to.setDepartment(from.getAttributeAsString("department"));
to.setPhoneNumber(from.getAttributeAsString("phoneNumber"));
- to.setEmailAddress(from.getAttributeAsString("email"));
+ to.setEmailAddress(from.getAttributeAsString("emailAddress"));
to.setRoles((Set<Role>) from.getAttributeAsObject("roles"));
return to;
@@ -258,13 +258,13 @@ public class UsersDataSource extends RPCDataSource<Subject> {
public ListGridRecord copyValues(Subject from) {
ListGridRecord to = new ListGridRecord();
to.setAttribute("id", from.getId());
- to.setAttribute("username", from.getName());
+ to.setAttribute("name", from.getName());
to.setAttribute("firstName", from.getFirstName());
to.setAttribute("lastName", from.getLastName());
to.setAttribute("factive", from.getFactive());
to.setAttribute("department", from.getDepartment());
to.setAttribute("phoneNumber", from.getPhoneNumber());
- to.setAttribute("email", from.getEmailAddress());
+ to.setAttribute("emailAddress", from.getEmailAddress());
to.setAttribute("roles", from.getRoles());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index a574eb2..bc070bf 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@ -59,9 +59,9 @@ public class UsersView extends VLayout {
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
- ListGridField nameField = new ListGridField("username",
"Name", 100);
+ ListGridField nameField = new ListGridField("name", "User
Name", 100);
- ListGridField emailField = new ListGridField("email", "Email
Address");
+ ListGridField emailField = new ListGridField("emailAddress",
"Email Address");
table.getListGrid().setFields(idField, nameField, emailField);
@@ -110,19 +110,7 @@ public class UsersView extends VLayout {
public void createUser() {
- UserEditView editView = new UserEditView();
- final Window roleEditor = new Window();
- roleEditor.setTitle("Create User");
- roleEditor.setWidth(800);
- roleEditor.setHeight(800);
- roleEditor.setIsModal(true);
- roleEditor.setShowModalMask(true);
- roleEditor.setCanDragResize(true);
- roleEditor.centerInPage();
- roleEditor.addItem(editView);
- roleEditor.show();
-
- editView.editNew();
+ UserEditView.editNew();
}
}
commit df86722f3ea043ae0169601b8a4c4a31113d004f
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 11:17:07 2010 -0400
Moved the abstract selector to the components package as its a generic utility
component
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleSelector.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleSelector.java
index e1b94f0..aaca7be 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleSelector.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleSelector.java
@@ -35,9 +35,9 @@ import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.bundle.list.BundlesDataSource;
+import org.rhq.enterprise.gui.coregui.client.components.selector.AbstractSelector;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import
org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.AbstractSelector;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
/**
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
new file mode 100644
index 0000000..8b13207
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
@@ -0,0 +1,286 @@
+/*
+ * 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.components.selector;
+
+import java.util.HashSet;
+
+import com.google.gwt.user.client.Timer;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.DragDataAction;
+import com.smartgwt.client.types.DragTrackerMode;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.widgets.ImgProperties;
+import com.smartgwt.client.widgets.TransferImgButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.events.DoubleClickEvent;
+import com.smartgwt.client.widgets.events.DoubleClickHandler;
+import com.smartgwt.client.widgets.events.KeyPressEvent;
+import com.smartgwt.client.widgets.events.KeyPressHandler;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.events.ItemChangedEvent;
+import com.smartgwt.client.widgets.form.events.ItemChangedHandler;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.RecordDropEvent;
+import com.smartgwt.client.widgets.grid.events.RecordDropHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionEvent;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.layout.VStack;
+
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+/**
+ * @author Greg Hinkle
+ */
+public abstract class AbstractSelector<T> extends VLayout {
+
+ protected HashSet<Integer> selection = new HashSet<Integer>();
+
+ protected ListGridRecord[] initialSelection;
+
+ protected ListGrid availableGrid;
+ protected ListGrid assignedGrid;
+
+ protected TransferImgButton addButton;
+ protected TransferImgButton removeButton;
+ protected TransferImgButton addAllButton;
+ protected TransferImgButton removeAllButton;
+
+ protected Criteria latestCriteria;
+
+ public AbstractSelector() {
+ }
+
+ public void setAssigned(ListGridRecord[] assignedRecords) {
+ initialSelection = assignedRecords;
+ }
+
+ public HashSet<Integer> getSelection() {
+ return selection;
+ }
+
+ protected abstract DynamicForm getAvailableFilterForm();
+
+ protected abstract RPCDataSource<T> getDataSource();
+
+ protected abstract Criteria getLatestCriteria(DynamicForm availableFilterForm);
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ final DynamicForm availableFilterForm = getAvailableFilterForm();
+
+ if (availableFilterForm != null) {
+ addMember(availableFilterForm);
+ }
+
+ HLayout hlayout = new HLayout();
+ hlayout.setAlign(VerticalAlignment.BOTTOM);
+
+ // LEFT SIDE
+ availableGrid = new ListGrid();
+ availableGrid.setHeight(350);
+ availableGrid.setCanDragRecordsOut(true);
+ availableGrid.setDragTrackerMode(DragTrackerMode.ICON);
+ availableGrid.setTrackerImage(new
ImgProperties("types/Service_up_16.png", 16, 16));
+ availableGrid.setDragDataAction(DragDataAction.COPY);
+ availableGrid.setDataSource(getDataSource());
+ availableGrid.setFetchDelay(700);
+
+ availableGrid.setAutoFetchData(true);
+ availableGrid.setFields(new ListGridField("icon", 50), new
ListGridField("name"));
+
+ hlayout.addMember(availableGrid);
+
+ if (availableFilterForm != null) {
+ availableFilterForm.addItemChangedHandler(new ItemChangedHandler() {
+ public void onItemChanged(ItemChangedEvent itemChangedEvent) {
+ latestCriteria = getLatestCriteria(availableFilterForm);
+
+ Timer t = new Timer() {
+ @Override
+ public void run() {
+ if (latestCriteria != null) {
+ Criteria c = latestCriteria;
+ latestCriteria = null;
+ availableGrid.fetchData(c);
+ }
+ }
+ };
+ t.schedule(500);
+ }
+ });
+ }
+ // CENTER BUTTONS
+ VStack moveButtonStack = new VStack(6);
+ moveButtonStack.setAlign(VerticalAlignment.CENTER);
+ moveButtonStack.setWidth(40);
+
+ addButton = new TransferImgButton(TransferImgButton.RIGHT);
+ addButton.setDisabled(true);
+ removeButton = new TransferImgButton(TransferImgButton.LEFT);
+ removeButton.setDisabled(true);
+ addAllButton = new TransferImgButton(TransferImgButton.RIGHT_ALL);
+ removeAllButton = new TransferImgButton(TransferImgButton.LEFT_ALL);
+ removeAllButton.setDisabled(true);
+
+ moveButtonStack.addMember(addButton);
+ moveButtonStack.addMember(removeButton);
+ moveButtonStack.addMember(addAllButton);
+ moveButtonStack.addMember(removeAllButton);
+
+ hlayout.addMember(moveButtonStack);
+
+ // RIGHT SIDE
+
+ assignedGrid = new ListGrid();
+ assignedGrid.setHeight(350);
+ assignedGrid.setCanReorderRecords(true);
+ assignedGrid.setCanDragRecordsOut(true);
+
+ assignedGrid.setCanAcceptDroppedRecords(true);
+ ListGridField iconField = new ListGridField("icon", 50);
+ iconField.setType(ListGridFieldType.ICON);
+ assignedGrid.setFields(iconField, new ListGridField("name"));
+
+ hlayout.addMember(assignedGrid);
+
+ addButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ assignedGrid.transferSelectedData(availableGrid);
+ select(assignedGrid.getSelection());
+ updateButtons();
+ }
+ });
+ removeButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ deselect(assignedGrid.getSelection());
+ assignedGrid.removeSelectedData();
+ updateButtons();
+ }
+ });
+ addAllButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ availableGrid.selectAllRecords();
+ assignedGrid.transferSelectedData(availableGrid);
+ select(availableGrid.getSelection());
+ updateButtons();
+ }
+ });
+ removeAllButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ assignedGrid.selectAllRecords();
+ deselect(assignedGrid.getSelection());
+ assignedGrid.removeSelectedData();
+ updateButtons();
+ }
+ });
+
+ availableGrid.addDoubleClickHandler(new DoubleClickHandler() {
+ public void onDoubleClick(DoubleClickEvent event) {
+ assignedGrid.transferSelectedData(availableGrid);
+ select(assignedGrid.getSelection());
+ updateButtons();
+ }
+ });
+
+ assignedGrid.addDoubleClickHandler(new DoubleClickHandler() {
+ public void onDoubleClick(DoubleClickEvent event) {
+ deselect(assignedGrid.getSelection());
+ assignedGrid.removeSelectedData();
+ updateButtons();
+ }
+ });
+
+ availableGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ updateButtons();
+ }
+ });
+
+ assignedGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ updateButtons();
+ }
+ });
+
+ assignedGrid.addKeyPressHandler(new KeyPressHandler() {
+ public void onKeyPress(KeyPressEvent event) {
+ if ("Delete".equals(event.getKeyName())) {
+ deselect(assignedGrid.getSelection());
+ assignedGrid.removeSelectedData();
+ }
+ }
+ });
+
+ assignedGrid.addRecordDropHandler(new RecordDropHandler() {
+ public void onRecordDrop(RecordDropEvent recordDropEvent) {
+ select(recordDropEvent.getDropRecords());
+ }
+ });
+
+ if (initialSelection != null) {
+ assignedGrid.setData(initialSelection);
+ for (ListGridRecord record : initialSelection) {
+ selection.add(record.getAttributeAsInt("id"));
+ }
+ }
+
+ addMember(hlayout);
+
+ }
+
+ protected void updateButtons() {
+ addButton.setDisabled(!availableGrid.anySelected() ||
availableGrid.getTotalRows() == 0);
+ removeButton.setDisabled(!assignedGrid.anySelected() ||
assignedGrid.getTotalRows() == 0);
+ addAllButton.setDisabled(availableGrid.getTotalRows() == 0);
+ removeAllButton.setDisabled(assignedGrid.getTotalRows() == 0);
+ }
+
+ protected void select(ListGridRecord[] records) {
+ availableGrid.deselectAllRecords();
+ for (ListGridRecord record : records) {
+ record.setEnabled(false);
+ selection.add(record.getAttributeAsInt("id"));
+ }
+ }
+
+ protected void deselect(ListGridRecord[] records) {
+ HashSet<Integer> toRemove = new HashSet<Integer>();
+ for (ListGridRecord record : records) {
+ toRemove.add(record.getAttributeAsInt("id"));
+ }
+ selection.removeAll(toRemove);
+
+ for (Integer id : toRemove) {
+ Record r = availableGrid.getDataAsRecordList().find("id", id);
+ if (r != null) {
+ ((ListGridRecord) r).setEnabled(true);
+ }
+ }
+ availableGrid.markForRedraw();
+ }
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java
deleted file mode 100644
index d51fe2a..0000000
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/AbstractSelector.java
+++ /dev/null
@@ -1,283 +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.resource.selection;
-
-import java.util.HashSet;
-
-import com.google.gwt.user.client.Timer;
-import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.data.Record;
-import com.smartgwt.client.types.DragDataAction;
-import com.smartgwt.client.types.DragTrackerMode;
-import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.VerticalAlignment;
-import com.smartgwt.client.widgets.ImgProperties;
-import com.smartgwt.client.widgets.TransferImgButton;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.events.DoubleClickEvent;
-import com.smartgwt.client.widgets.events.DoubleClickHandler;
-import com.smartgwt.client.widgets.events.KeyPressEvent;
-import com.smartgwt.client.widgets.events.KeyPressHandler;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.events.ItemChangedEvent;
-import com.smartgwt.client.widgets.form.events.ItemChangedHandler;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.RecordDropEvent;
-import com.smartgwt.client.widgets.grid.events.RecordDropHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.layout.VStack;
-
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
-
-/**
- * @author Greg Hinkle
- */
-public abstract class AbstractSelector<T> extends VLayout {
-
- protected HashSet<Integer> selection = new HashSet<Integer>();
-
- protected ListGridRecord[] initialSelection;
-
- protected ListGrid availableGrid;
- protected ListGrid assignedGrid;
-
- protected TransferImgButton addButton;
- protected TransferImgButton removeButton;
- protected TransferImgButton addAllButton;
- protected TransferImgButton removeAllButton;
-
- protected Criteria latestCriteria;
-
- public AbstractSelector() {
- }
-
- public void setAssigned(ListGridRecord[] assignedRecords) {
- initialSelection = assignedRecords;
- }
-
- public HashSet<Integer> getSelection() {
- return selection;
- }
-
- protected abstract DynamicForm getAvailableFilterForm();
-
- protected abstract RPCDataSource<T> getDataSource();
-
- protected abstract Criteria getLatestCriteria(DynamicForm availableFilterForm);
-
- @Override
- protected void onDraw() {
- super.onDraw();
-
- final DynamicForm availableFilterForm = getAvailableFilterForm();
-
- addMember(availableFilterForm);
-
- HLayout hlayout = new HLayout();
- hlayout.setAlign(VerticalAlignment.BOTTOM);
-
- // LEFT SIDE
- availableGrid = new ListGrid();
- availableGrid.setHeight(350);
- availableGrid.setCanDragRecordsOut(true);
- availableGrid.setDragTrackerMode(DragTrackerMode.ICON);
- availableGrid.setTrackerImage(new
ImgProperties("types/Service_up_16.png", 16, 16));
- availableGrid.setDragDataAction(DragDataAction.COPY);
- availableGrid.setDataSource(getDataSource());
- availableGrid.setFetchDelay(700);
-
- availableGrid.setAutoFetchData(true);
- availableGrid.setFields(new ListGridField("icon", 50), new
ListGridField("name"));
-
- hlayout.addMember(availableGrid);
-
- availableFilterForm.addItemChangedHandler(new ItemChangedHandler() {
- public void onItemChanged(ItemChangedEvent itemChangedEvent) {
- latestCriteria = getLatestCriteria(availableFilterForm);
-
- Timer t = new Timer() {
- @Override
- public void run() {
- if (latestCriteria != null) {
- Criteria c = latestCriteria;
- latestCriteria = null;
- availableGrid.fetchData(c);
- }
- }
- };
- t.schedule(500);
- }
- });
-
- // CENTER BUTTONS
- VStack moveButtonStack = new VStack(6);
- moveButtonStack.setAlign(VerticalAlignment.CENTER);
- moveButtonStack.setWidth(40);
-
- addButton = new TransferImgButton(TransferImgButton.RIGHT);
- addButton.setDisabled(true);
- removeButton = new TransferImgButton(TransferImgButton.LEFT);
- removeButton.setDisabled(true);
- addAllButton = new TransferImgButton(TransferImgButton.RIGHT_ALL);
- removeAllButton = new TransferImgButton(TransferImgButton.LEFT_ALL);
- removeAllButton.setDisabled(true);
-
- moveButtonStack.addMember(addButton);
- moveButtonStack.addMember(removeButton);
- moveButtonStack.addMember(addAllButton);
- moveButtonStack.addMember(removeAllButton);
-
- hlayout.addMember(moveButtonStack);
-
- // RIGHT SIDE
-
- assignedGrid = new ListGrid();
- assignedGrid.setHeight(350);
- assignedGrid.setCanReorderRecords(true);
- assignedGrid.setCanDragRecordsOut(true);
-
- assignedGrid.setCanAcceptDroppedRecords(true);
- ListGridField iconField = new ListGridField("icon", 50);
- iconField.setType(ListGridFieldType.ICON);
- assignedGrid.setFields(iconField, new ListGridField("name"));
-
- hlayout.addMember(assignedGrid);
-
- addButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- assignedGrid.transferSelectedData(availableGrid);
- select(assignedGrid.getSelection());
- updateButtons();
- }
- });
- removeButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- deselect(assignedGrid.getSelection());
- assignedGrid.removeSelectedData();
- updateButtons();
- }
- });
- addAllButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- availableGrid.selectAllRecords();
- assignedGrid.transferSelectedData(availableGrid);
- select(availableGrid.getSelection());
- updateButtons();
- }
- });
- removeAllButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- assignedGrid.selectAllRecords();
- deselect(assignedGrid.getSelection());
- assignedGrid.removeSelectedData();
- updateButtons();
- }
- });
-
- availableGrid.addDoubleClickHandler(new DoubleClickHandler() {
- public void onDoubleClick(DoubleClickEvent event) {
- assignedGrid.transferSelectedData(availableGrid);
- select(assignedGrid.getSelection());
- updateButtons();
- }
- });
-
- assignedGrid.addDoubleClickHandler(new DoubleClickHandler() {
- public void onDoubleClick(DoubleClickEvent event) {
- deselect(assignedGrid.getSelection());
- assignedGrid.removeSelectedData();
- updateButtons();
- }
- });
-
- availableGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- updateButtons();
- }
- });
-
- assignedGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- updateButtons();
- }
- });
-
- assignedGrid.addKeyPressHandler(new KeyPressHandler() {
- public void onKeyPress(KeyPressEvent event) {
- if ("Delete".equals(event.getKeyName())) {
- deselect(assignedGrid.getSelection());
- assignedGrid.removeSelectedData();
- }
- }
- });
-
- assignedGrid.addRecordDropHandler(new RecordDropHandler() {
- public void onRecordDrop(RecordDropEvent recordDropEvent) {
- select(recordDropEvent.getDropRecords());
- }
- });
-
- if (initialSelection != null) {
- assignedGrid.setData(initialSelection);
- for (ListGridRecord record : initialSelection) {
- selection.add(record.getAttributeAsInt("id"));
- }
- }
-
- addMember(hlayout);
-
- }
-
- protected void updateButtons() {
- addButton.setDisabled(!availableGrid.anySelected() ||
availableGrid.getTotalRows() == 0);
- removeButton.setDisabled(!assignedGrid.anySelected() ||
assignedGrid.getTotalRows() == 0);
- addAllButton.setDisabled(availableGrid.getTotalRows() == 0);
- removeAllButton.setDisabled(assignedGrid.getTotalRows() == 0);
- }
-
- protected void select(ListGridRecord[] records) {
- availableGrid.deselectAllRecords();
- for (ListGridRecord record : records) {
- record.setEnabled(false);
- selection.add(record.getAttributeAsInt("id"));
- }
- }
-
- protected void deselect(ListGridRecord[] records) {
- HashSet<Integer> toRemove = new HashSet<Integer>();
- for (ListGridRecord record : records) {
- toRemove.add(record.getAttributeAsInt("id"));
- }
- selection.removeAll(toRemove);
-
- for (Integer id : toRemove) {
- Record r = availableGrid.getDataAsRecordList().find("id", id);
- if (r != null) {
- ((ListGridRecord) r).setEnabled(true);
- }
- }
- availableGrid.markForRedraw();
- }
-}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java
index 5c3c007..7731067 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java
@@ -32,6 +32,7 @@ import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.enterprise.gui.coregui.client.components.selector.AbstractSelector;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
index a692a2f..1274e14 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
@@ -32,6 +32,7 @@ import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.components.selector.AbstractSelector;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
import
org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypePluginTreeDataSource;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
commit 84d3db34645fd839d4d47e2cf4d84b40164d0fdb
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 11:14:54 2010 -0400
Fix platform view for ResourceDatasoruce changes
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java
index eb14394..ea30685 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java
@@ -53,6 +53,7 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.MeasurementDataGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceTypeGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField;
/**
* @author Greg Hinkle
@@ -70,13 +71,21 @@ public class PlatformPortletView extends ListGrid implements Portlet
{
public PlatformPortletView() {
+ setWidth100();
+ setHeight100();
+
+ prefetch();
+
+
setShowRecordComponents(true);
setShowRecordComponentsByCell(true);
+ setUseAllDataSourceFields(true);
+ setAutoFitData(Autofit.HORIZONTAL);
+
setDataSource(new PlatformMetricDataSource(this));
- setInitialCriteria(new Criteria("category",
ResourceCategory.PLATFORM.name()));
+ setInitialCriteria(new Criteria(ResourceDataSourceField.CATEGORY.propertyName(),
ResourceCategory.PLATFORM.name()));
- prefetch();
}
@@ -104,9 +113,7 @@ public class PlatformPortletView extends ListGrid implements Portlet
{
private void buildUI() {
- setAutoFetchData(true);
- setUseAllDataSourceFields(true);
- setAutoFitData(Autofit.HORIZONTAL);
+
ListGridField nameField = new ListGridField("name", "Name",
250);
nameField.setCellFormatter(new CellFormatter() {
@@ -126,6 +133,7 @@ public class PlatformPortletView extends ListGrid implements Portlet
{
hideField("currentAvailability");
+ this.fetchData(new Criteria(ResourceDataSourceField.CATEGORY.propertyName(),
ResourceCategory.PLATFORM.name()));
}
commit 01dcd82e397ad2019489b69d883a89ec1c7341d9
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Jul 27 10:43:18 2010 -0400
Global recent operations view
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
index b6f6702..de4bd1e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryDataSource.java
@@ -54,6 +54,9 @@ public class OperationHistoryDataSource extends
RPCDataSource<ResourceOperationH
DataSourceTextField nameField = new
DataSourceTextField("operationName");
addField(nameField);
+ DataSourceTextField resourceField = new
DataSourceTextField("resource");
+ addField(resourceField);
+
DataSourceTextField statusField = new DataSourceTextField("status");
addField(statusField);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
index a54d0ac..ad2d156 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
@@ -38,6 +38,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.widgets.events.DoubleClickEvent;
import com.smartgwt.client.widgets.events.DoubleClickHandler;
+import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.RecordDoubleClickEvent;
import com.smartgwt.client.widgets.grid.events.RecordDoubleClickHandler;
@@ -66,6 +67,8 @@ public class OperationHistoryView extends VLayout {
}
public OperationHistoryView() {
+ setWidth100();
+ setHeight100();
}
public OperationHistoryView(Resource resource) {
@@ -90,12 +93,24 @@ public class OperationHistoryView extends VLayout {
table.getListGrid().getField("status").setWidth(100);
table.getListGrid().getField("startedTime").setWidth(120);
+ if (this.resource == null) {
+ table.getListGrid().getField("resource").setWidth(300);
+ table.getListGrid().getField("resource").setCellFormatter(new
CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int
i1) {
+ Resource res = (Resource) o;
+ return "<a href=\"#Resource/" + res.getId() +
"\">" + res.getName() + "</a>";
+ }
+ });
+ } else {
+ table.getListGrid().hideField("resource");
+ }
table.getListGrid().addRecordDoubleClickHandler(new RecordDoubleClickHandler() {
public void onRecordDoubleClick(RecordDoubleClickEvent
recordDoubleClickEvent) {
ResourceOperationHistory history = (ResourceOperationHistory)
recordDoubleClickEvent.getRecord().getAttributeAsObject("entity");
- showDetails(history); }
+ showDetails(history);
+ }
});
@@ -108,27 +123,29 @@ public class OperationHistoryView extends VLayout {
});
- final Menu operationMenu = new Menu();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- resource.getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.operations),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- for (final OperationDefinition od :
type.getOperationDefinitions()) {
- MenuItem menuItem = new MenuItem(od.getDisplayName());
- operationMenu.addItem(menuItem);
- menuItem.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent event) {
- new OperationCreateWizard(resource,
od).startOperationWizard();
- }
- });
+ if (resource != null) {
+ final Menu operationMenu = new Menu();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ resource.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ for (final OperationDefinition od :
type.getOperationDefinitions()) {
+ MenuItem menuItem = new MenuItem(od.getDisplayName());
+ operationMenu.addItem(menuItem);
+ menuItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ new OperationCreateWizard(resource,
od).startOperationWizard();
+ }
+ });
+ }
}
- }
- });
+ });
- IMenuButton operationsButton = new IMenuButton("Run Operation",
operationMenu);
- operationsButton.setShowMenuBelow(false);
- table.addExtraWidget(operationsButton);
+ IMenuButton operationsButton = new IMenuButton("Run Operation",
operationMenu);
+ operationsButton.setShowMenuBelow(false);
+ table.addExtraWidget(operationsButton);
+ }
addMember(table);
commit 52476886663a8d99b94e1b9e15246fe6ea173c22
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Jul 26 12:28:14 2010 -0400
Fix debug error message due to unsupported clipping model on breadcrumb pane
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
index 29377cd..17e9237 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
@@ -41,7 +41,7 @@ public class BreadcrumbTrailPane extends ToolStrip {
setWidth100();
setMembersMargin(15);
- setOverflow(Overflow.CLIP_V);
+ setOverflow(Overflow.HIDDEN);
}
commit e38b19c067b0d880f48d257bdea7c6522e089295
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Jul 26 12:22:03 2010 -0400
Fix bug with overlaying one top pane on another
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 7dfd9df..8fb1f0b 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -49,6 +49,7 @@ import org.rhq.enterprise.gui.coregui.client.alert.AlertsView;
import org.rhq.enterprise.gui.coregui.client.bundle.BundleTopView;
import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardsView;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import
org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.ResourceGroupTopView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceView;
import org.rhq.enterprise.gui.coregui.client.menu.MenuBarView;
@@ -262,6 +263,8 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
canvas = new InventoryView();
} else if (breadcrumbName.equals("Resource")) {
canvas = new ResourceView();
+ } else if (breadcrumbName.equals("ResourceGroup")) {
+ canvas = new ResourceGroupTopView();
} else if (breadcrumbName.equals("Dashboard")) {
canvas = new DashboardsView();
} else if (breadcrumbName.equals("Bundles")) {
@@ -308,9 +311,9 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
public static void setContent(Canvas newContent) {
Canvas contentCanvas = Canvas.getById(CONTENT_CANVAS_ID);
- if (contentCanvas.getChildren().length > 0)
- contentCanvas.getChildren()[0].destroy();
-
+ for (Canvas child : contentCanvas.getChildren()) {
+ child.destroy();
+ }
if (newContent != null) {
content = newContent;
contentCanvas.addChild(newContent);
commit 5e8b7a6ae42e61fe9fe2a617baf473c857a188ef
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Jul 26 12:21:41 2010 -0400
Initial resource group tree view work
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index 4e9f17a..a8bd44a 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -281,7 +281,9 @@ public class ResourceGroupDetailView extends VLayout implements
BookmarkableView
public void renderView(ViewPath viewPath) {
- // TODO: Implement this method.
+
+ Integer groupId = Integer.parseInt(viewPath.getCurrent().getPath());
+
if (viewPath.isEnd()) {
// default
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
index 37c492c..3aade28 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
@@ -22,15 +22,19 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.HLayout;
-import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ClusterFlyweight;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
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.gwt.ResourceGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceTreeView;
/**
* @author Greg Hinkle
@@ -39,10 +43,10 @@ public class ResourceGroupTopView extends HLayout implements
BookmarkableView {
private Canvas contentCanvas;
- private Resource currentResource;
+ private ResourceGroup currentGroup;
//private Resource resourcePlatform;
-// private ResourceTreeView treeView;
+ private ResourceGroupTreeView treeView;
private ResourceGroupDetailView detailView = new ResourceGroupDetailView();
private ResourceGWTServiceAsync resourceService =
GWTServiceLookup.getResourceService();
@@ -60,15 +64,15 @@ public class ResourceGroupTopView extends HLayout implements
BookmarkableView {
setHeight100();
-// treeView = new ResourceTreeView();
-// addMember(treeView);
+ treeView = new ResourceGroupTreeView();
+ addMember(treeView);
contentCanvas = new Canvas();
addMember(contentCanvas);
// created above
-// detailView = new ResourceDetailView();
+ detailView = new ResourceGroupDetailView();
// treeView.addResourceSelectListener(detailView);
@@ -128,13 +132,19 @@ public class ResourceGroupTopView extends HLayout implements
BookmarkableView {
viewPath.getViewPath().add(new ViewId("Overview"));
}
- Integer resourceId = Integer.parseInt(viewPath.getCurrent().getPath());
+ Integer groupId = Integer.parseInt(viewPath.getCurrent().getPath());
- if (currentResource == null || currentResource.getId() != resourceId) {
+
+
+
+ if (currentGroup == null || currentGroup.getId() != groupId) {
// setSelectedResource(resourceId, viewPath);
-// this.treeView.renderView(viewPath);
+ this.treeView.setSelectedGroup(groupId);
+
+
+
viewPath.next();
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
new file mode 100644
index 0000000..ef5406d
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
@@ -0,0 +1,130 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.tree.Tree;
+import com.smartgwt.client.widgets.tree.TreeGrid;
+import com.smartgwt.client.widgets.tree.TreeNode;
+
+import org.rhq.core.domain.resource.group.composite.ClusterFlyweight;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceGroupTreeView extends VLayout {
+
+
+ private int groupId;
+
+ private TreeGrid treeGrid;
+
+ public ResourceGroupTreeView() {
+ setWidth(250);
+ setHeight100();
+ }
+
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+
+ this.treeGrid = new TreeGrid();
+ this.treeGrid.setWidth100();
+ this.treeGrid.setHeight100();
+ treeGrid.setShowRoot(true);
+
+ addMember(this.treeGrid);
+
+
+ }
+
+ public void setSelectedGroup(int groupId) {
+ this.groupId = groupId;
+ GWTServiceLookup.getClusterService().getClusterTree(groupId,
+ new AsyncCallback<ClusterFlyweight>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load
tree", caught);
+ }
+
+ public void onSuccess(ClusterFlyweight result) {
+ loadTree(result);
+ }
+ });
+
+
+ }
+
+
+
+
+ private void loadTree(ClusterFlyweight root) {
+
+
+ TreeNode rootNode = new TreeNode(root.getName());
+
+ loadTree(rootNode, root);
+
+ Tree tree = new Tree();
+ tree.setRoot(rootNode);
+
+ treeGrid.setData(tree);
+ markForRedraw();
+
+ }
+
+ public void loadTree(TreeNode parent, ClusterFlyweight parentNode) {
+ if (!parentNode.getChildren().isEmpty()) {
+
+ 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());
+ childNodes.add(node);
+
+ if (child.getChildren().isEmpty()) {
+ node.setIsFolder(false);
+ } else {
+ node.setIsFolder(true);
+ loadTree(node, child);
+ }
+ }
+ parent.setChildren(childNodes.toArray(new TreeNode[childNodes.size()]));
+ }
+ }
+}
commit 5a91a74f90333a1efbc8ec69b8b86bab7ae4a919
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Jul 23 12:53:13 2010 -0400
Admin view tree icons
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index 20ebafc..c2ebe9b 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -125,9 +125,17 @@ public class AdministrationView extends HLayout implements
BookmarkableView {
Tree tree = new Tree();
final TreeNode manageUsersNode = new TreeNode("Manage Users");
+ manageUsersNode.setIcon("global/User_16.png");
+
final TreeNode manageRolesNode = new TreeNode("Manage Roles");
+ manageRolesNode.setIcon("global/Role_16.png");
+
final TreeNode discoveryQueue = new TreeNode("Auto Discovery Queue");
+ discoveryQueue.setIcon("global/Recent_16.png");
+
final TreeNode remoteAgentInstall = new TreeNode("Remote Agent
Install");
+ remoteAgentInstall.setIcon("global/Agent_16.png");
+
tree.setRoot(new TreeNode("security",
manageUsersNode,
manageRolesNode,
@@ -277,7 +285,7 @@ public class AdministrationView extends HLayout implements
BookmarkableView {
TreeGrid treeGrid = treeGrids.get(name);
if (name.equals(section)) {
- treeGrid.setSelectedPaths(page);
+// treeGrid.setSelectedPaths(page);
} else {
treeGrid.deselectAllRecords();
}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/Agent_16.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Agent_16.png
new file mode 100644
index 0000000..225bde6
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Agent_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/Agent_24.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Agent_24.png
new file mode 100644
index 0000000..61e1d68
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Agent_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/Locked_16.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Locked_16.png
new file mode 100644
index 0000000..e5e3bae
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Locked_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/Locked_24.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Locked_24.png
new file mode 100644
index 0000000..c8daa89
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Locked_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/Plugin_16.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Plugin_16.png
new file mode 100644
index 0000000..7e15427
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Plugin_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/Plugin_24.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Plugin_24.png
new file mode 100644
index 0000000..4a31006
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Plugin_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/Recent_16.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Recent_16.png
new file mode 100644
index 0000000..9b75027
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Recent_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/Recent_24.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Recent_24.png
new file mode 100644
index 0000000..39ddbd8
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Recent_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/Role_16.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Role_16.png
new file mode 100644
index 0000000..e10a3b9
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Role_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/Unlocked_16.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Unlocked_16.png
new file mode 100644
index 0000000..4f2e1b1
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Unlocked_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/Unlocked_32.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Unlocked_32.png
new file mode 100644
index 0000000..9d6916f
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/Unlocked_32.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/User_16.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/User_16.png
new file mode 100644
index 0000000..5dfcada
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/User_16.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/User_24.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/User_24.png
new file mode 100644
index 0000000..c86cd80
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/User_24.png differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/global/cloud_24.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/cloud_24.png
new file mode 100644
index 0000000..a147dde
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/global/cloud_24.png differ
commit 6f028fdaca0e2c698f4fcc013d1e6acba5c817f0
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Jul 23 12:52:11 2010 -0400
Expose "cluster" service features which will be the center of all future
group, autogroup and recursive group views
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ClusterFlyweight.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ClusterFlyweight.java
new file mode 100644
index 0000000..a156804
--- /dev/null
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ClusterFlyweight.java
@@ -0,0 +1,99 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.resource.group.composite;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.rhq.core.domain.resource.group.ClusterKey;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ClusterFlyweight implements Serializable {
+
+ private int groupId;
+
+ private ClusterKeyFlyweight clusterKey;
+
+ private String name;
+
+ private List<ClusterFlyweight> children;
+
+ private int members;
+
+ public ClusterFlyweight() {
+ }
+
+ public ClusterFlyweight(int groupId) {
+ this.groupId = groupId;
+ }
+
+ public ClusterFlyweight(ClusterKeyFlyweight clusterKey) {
+ this.clusterKey = clusterKey;
+ }
+
+ public void addResource(String s) {
+ if (name == null) {
+ name = s;
+ } else if (!name.equals(s)) {
+ name = "?";
+ }
+ }
+
+ public int getMembers() {
+ return members;
+ }
+
+ public void setMembers(int members) {
+ this.members = members;
+ }
+
+ public void setChildren(List<ClusterFlyweight> clusterKeyFlyweights) {
+ this.children = clusterKeyFlyweights;
+ }
+
+ public int getGroupId() {
+ return groupId;
+ }
+
+ public ClusterKeyFlyweight getClusterKey() {
+ return clusterKey;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public List<ClusterFlyweight> getChildren() {
+ return children;
+ }
+
+
+
+
+
+
+
+
+}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ClusterKeyFlyweight.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ClusterKeyFlyweight.java
new file mode 100644
index 0000000..6d3d488
--- /dev/null
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ClusterKeyFlyweight.java
@@ -0,0 +1,62 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.resource.group.composite;
+
+import java.io.Serializable;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ClusterKeyFlyweight implements Serializable {
+
+ private int resourceTypeId;
+ private String resourceKey;
+
+ public ClusterKeyFlyweight() {
+ }
+
+ public ClusterKeyFlyweight(int resourceTypeId, String resourceKey) {
+ this.resourceTypeId = resourceTypeId;
+ this.resourceKey = resourceKey;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ClusterKeyFlyweight node = (ClusterKeyFlyweight) o;
+
+ if (resourceTypeId != node.resourceTypeId) return false;
+ if (resourceKey != null ? !resourceKey.equals(node.resourceKey) :
node.resourceKey != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = resourceTypeId;
+ result = 31 * result + (resourceKey != null ? resourceKey.hashCode() : 0);
+ return result;
+ }
+}
\ No newline at end of file
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerRemote.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerRemote.java
new file mode 100644
index 0000000..c052c58
--- /dev/null
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerRemote.java
@@ -0,0 +1,79 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.server.resource.cluster;
+
+import java.util.List;
+
+import javax.ejb.Remote;
+
+import org.jetbrains.annotations.Nullable;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.group.ClusterKey;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ClusterFlyweight;
+
+/**
+ * @author Greg Hinkle
+ */
+@Remote
+public interface ClusterManagerRemote {
+
+ /**
+ * Given a cluster key create a backing group.
+ * @param clusterKey
+ * @param addResources If true, the new group will be assigned the current resources
defined by the clusterKey.
+ * Otherwise no resources will be assigned to the new group.
+ * @throws IllegalArgumentException if a backing group exists for this clusterKey
+ */
+ ResourceGroup createAutoClusterBackingGroup(Subject subject, ClusterKey clusterKey,
boolean addResources);
+
+ /**
+ * Return the backing group for the supplied cluster key. Resource membership will
represent the resources
+ * last set for the group and may not reflect current membership. See {@link
#getAutoClusterResources(String)}
+ * @param clusterKey
+ * @return The backing group, or null if the key does not have a backing group.
+ */
+ @Nullable
+ ResourceGroup getAutoClusterBackingGroup(Subject subject, ClusterKey clusterKey);
+
+ /**
+ * Given a cluster key get the auto cluster resource membership. The membership is
always determined
+ * at call time, regardless of whether a backing group exists. To get the backing
group, if it exists,
+ * for a cluster key then call {@link #getAutoClusterBackingGroup(String)}.
+ */
+ List<Resource> getAutoClusterResources(Subject subject, ClusterKey
clusterKey);
+
+
+ /**
+ * Load a fully populated tree view of the "cluster nodes" for a cluster
group. These are
+ * summary nodes and do not contain the actual resources in the group.
+ *
+ * @param subject
+ * @param groupId
+ * @return
+ */
+ ClusterFlyweight getClusterTree(Subject subject, int groupId);
+
+}
commit 35ec18e4ddeae903986bf56c453a90907f7a6f6d
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Jul 23 12:50:32 2010 -0400
A new build profile that will build just domain,server and coregui (useful for core
api development)
diff --git a/modules/pom.xml b/modules/pom.xml
index e363555..ef98301 100644
--- a/modules/pom.xml
+++ b/modules/pom.xml
@@ -72,6 +72,22 @@
</profile>
<profile>
+ <id>model</id>
+ <activation>
+ <property>
+ <name>model</name>
+ </property>
+ </activation>
+ <modules>
+ <module>core/domain</module>
+ <module>enterprise/server/jar</module>
+ <module>enterprise/gui/coregui</module>
+ </modules>
+ </profile>
+
+
+
+ <profile>
<id>plugins</id>
<activation>
<property>
commit 6b757721e31722740c602563b39ea3e54e5cbefe
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Jul 23 12:49:28 2010 -0400
Expose "cluster" service features which will be the center of all future
group, autogroup and recursive group views
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index a3db099..f26acb7 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -71,5 +71,6 @@
<servlet path="/ContentGWTService"
class="org.rhq.enterprise.gui.coregui.server.gwt.ContentGWTServiceImpl"/>
<servlet path="/DashboardGWTService"
class="org.rhq.enterprise.gui.coregui.server.gwt.DashboardGWTServiceImpl"/>
<servlet path="/EventGWTService"
class="org.rhq.enterprise.gui.coregui.server.gwt.EventGWTServiceImpl"/>
+ <servlet path="/ClusterGWTService"
class="org.rhq.enterprise.gui.coregui.server.gwt.ClusterGWTServiceImpl"/>
</module>
\ No newline at end of file
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ClusterGWTService.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ClusterGWTService.java
new file mode 100644
index 0000000..20d32d5
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ClusterGWTService.java
@@ -0,0 +1,68 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.gwt;
+
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.group.ClusterKey;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ClusterFlyweight;
+
+/**
+ * @author Greg Hinkle
+ */
+public interface ClusterGWTService extends RemoteService {
+
+
+ /**
+ * Given a cluster key create a backing group.
+ * @param clusterKey
+ * @param addResources If true, the new group will be assigned the current resources
defined by the clusterKey.
+ * Otherwise no resources will be assigned to the new group.
+ * @throws IllegalArgumentException if a backing group exists for this clusterKey
+ */
+ ResourceGroup createAutoClusterBackingGroup(ClusterKey clusterKey, boolean
addResources);
+
+ /**
+ * Return the backing group for the supplied cluster key. Resource membership will
represent the resources
+ * last set for the group and may not reflect current membership. See {@link
#getAutoClusterResources(String)}
+ * @param clusterKey
+ * @return The backing group, or null if the key does not have a backing group.
+ */
+ ResourceGroup getAutoClusterBackingGroup(ClusterKey clusterKey);
+
+ /**
+ * Given a cluster key get the auto cluster resource membership. The membership is
always determined
+ * at call time, regardless of whether a backing group exists. To get the backing
group, if it exists,
+ * for a cluster key then call {@link #getAutoClusterBackingGroup(String)}.
+ */
+ List<Resource> getAutoClusterResources(ClusterKey clusterKey);
+
+
+ ClusterFlyweight getClusterTree(int groupId);
+
+
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
index b0cc8d9..9965430 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
@@ -120,6 +120,10 @@ public class GWTServiceLookup {
return secure(EventGWTServiceAsync.Util.getInstance());
}
+ public static ClusterGWTServiceAsync getClusterService() {
+ return secure(ClusterGWTServiceAsync.Util.getInstance());
+ }
+
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ClusterGWTServiceImpl.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ClusterGWTServiceImpl.java
new file mode 100644
index 0000000..f3f8323
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ClusterGWTServiceImpl.java
@@ -0,0 +1,69 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.server.gwt;
+
+import java.util.List;
+
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.group.ClusterKey;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ClusterFlyweight;
+import org.rhq.enterprise.gui.coregui.client.gwt.ClusterGWTService;
+import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
+import org.rhq.enterprise.server.resource.cluster.ClusterManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ClusterGWTServiceImpl extends AbstractGWTServiceImpl implements
ClusterGWTService {
+
+
+ private ClusterManagerLocal clusterManager = LookupUtil.getClusterManager();
+
+
+ public ResourceGroup createAutoClusterBackingGroup(ClusterKey clusterKey, boolean
addResources) {
+ return SerialUtility.prepare(
+ clusterManager.createAutoClusterBackingGroup(getSessionSubject(),
clusterKey, addResources),
+ "ClusterGWTServiceImpl.createAutoClusterBackingGroup");
+ }
+
+ public ResourceGroup getAutoClusterBackingGroup(ClusterKey clusterKey) {
+ return SerialUtility.prepare(
+ clusterManager.getAutoClusterBackingGroup(getSessionSubject(),
clusterKey),
+ "ClusterGWTServiceImpl.getAutoClusterBackingGroup");
+ }
+
+ public List<Resource> getAutoClusterResources(ClusterKey clusterKey) {
+ return SerialUtility.prepare(
+ clusterManager.getAutoClusterResources(getSessionSubject(), clusterKey),
+ "ClusterGWTServiceImpl.getAutoClusterResources");
+ }
+
+ public ClusterFlyweight getClusterTree(int groupId) {
+ return SerialUtility.prepare(
+ clusterManager.getClusterTree(getSessionSubject(), groupId),
+ "ClusterGWTServiceImpl.getClusterTree");
+
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
index b89ece9..a86b217 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
@@ -104,6 +104,10 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI
EventGWTService</servlet-name>
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.EventGWTServiceImpl</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI
ClusterGWTService</servlet-name>
+
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.ClusterGWTServiceImpl</servlet-class>
+ </servlet>
<servlet-mapping>
@@ -206,4 +210,8 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI
EventGWTService</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/EventGWTService</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI
ClusterGWTService</servlet-name>
+
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/ClusterGWTService</url-pattern>
+ </servlet-mapping>
</web-app>
commit c1352afdaef3eb9011c3365c51949ea14e1dc8a1
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Jul 23 12:48:21 2010 -0400
Switch back to future UXD design for top menubar
Move user login info to footer
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
index 65fc203..8a6fcc4 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
@@ -60,7 +60,14 @@ public class Footer extends ToolStrip {
protected void onDraw() {
super.onDraw();
- addMember(new Label("Welcome to RHQ"));
+
+ Label loggedInAs = new Label("Logged in as " +
CoreGUI.getSessionSubject().getName());
+ loggedInAs.setWrap(false);
+ loggedInAs.setMargin(5);
+ loggedInAs.setValign(VerticalAlignment.CENTER);
+
+
+ addMember(loggedInAs);
addMember(new ToolStripSeparator());
recentMessage = new MessageCenterView();
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/DropDownMenuBarView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/DropDownMenuBarView.java
new file mode 100644
index 0000000..c98c16d
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/DropDownMenuBarView.java
@@ -0,0 +1,247 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.menu;
+
+import com.google.gwt.user.client.History;
+import com.google.gwt.user.client.Window;
+import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.menu.Menu;
+import com.smartgwt.client.widgets.menu.MenuBar;
+import com.smartgwt.client.widgets.menu.MenuItem;
+import com.smartgwt.client.widgets.menu.MenuItemSeparator;
+import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
+
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.AboutModalWindow;
+
+/**
+ * @author Greg Hinkle
+ */
+public class DropDownMenuBarView extends VLayout {
+
+ private AboutModalWindow aboutModalWindow;
+
+ public DropDownMenuBarView() {
+ super(5);
+ setHeight(50);
+ setWidth100();
+
+
+ }
+
+
+ protected void onDraw3() {
+ super.onDraw();
+
+ this.aboutModalWindow = new AboutModalWindow();
+
+ HLayout topBar = new HLayout();
+ topBar.setHeight(28);
+ topBar.setStyleName("topMenuBar");
+// url("./images/cssButton/button_stretch.png") repeat-x scroll 0 0
#DDDDDD
+// topBar.setBackgroundImage("[SKIN]/cssButton/button_stretch.png");
+// topBar.setBackgroundRepeat(BkgndRepeat.REPEAT_X);
+
+
+ Img logo = new Img("header/rhq_logo_28px.png", 80, 28);
+ logo.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
+ public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
+ DropDownMenuBarView.this.aboutModalWindow.show();
+ }
+ });
+
+
+ topBar.addMember(logo);
+
+
+ // Create a menu bar
+ final MenuBar menu = new MenuBar();
+ menu.setHeight(28);
+
+
+
+ Menu subsystemsMenu = new Menu();
+
+ subsystemsMenu.setTitle("Subsystems");
+ subsystemsMenu.addItem(new EMenuItem("Configuration Changes",
LinkManager.getSubsystemConfigurationLink(),
"subsystems/configure/Configure_16.png"));//, new
LinkCommand("#config"));
+ subsystemsMenu.addItem(new EMenuItem("Suspect Metrics",
LinkManager.getSubsystemSuspectMetricsLink(),
"subsystems/monitor/Monitor_failed_16.png"));//, new
LinkCommand("#config"));
+ subsystemsMenu.addItem(new EMenuItem("Operations",
LinkManager.getSubsystemOperationHistoryLink(),
"subsystems/control/Operation_16.png"));//, new
LinkCommand("#config"));
+ subsystemsMenu.addItem(new EMenuItem("Alerts",
LinkManager.getSubsystemAlertHistoryLink(),
"subsystems/alert/Alert_HIGH_16.png"));//, new
LinkCommand("#config"));
+ subsystemsMenu.addItem(new EMenuItem("Alert Definitions",
LinkManager.getSubsystemAlertDefsLink(), "subsystems/alert/Alerts_16.png"));//,
new LinkCommand("#config"));
+
+
+ final Menu overviewMenu = new Menu();
+ overviewMenu.setTitle("Overview");
+ overviewMenu.setStyleName("SimpleMenuBarButton");
+ overviewMenu.setBorder("none");
+ com.smartgwt.client.widgets.menu.MenuItem subsystemsSubMenuItem = new
com.smartgwt.client.widgets.menu.MenuItem("Subsystems");
+ subsystemsSubMenuItem.setSubmenu(subsystemsMenu);
+ overviewMenu.addItem(subsystemsSubMenuItem);
+ overviewMenu.addItem(new EMenuItem("AutoDiscovery
Queue",LinkManager.getAutodiscoveryQueueLink()));//,new
LinkCommand("#cofng"));
+ overviewMenu.addItem(new
EMenuItem("Dashboard",LinkManager.getDashboardLink()));//,new
LinkCommand("#cofng"));
+
+
+ Menu resourcesMenu = new Menu();
+ resourcesMenu.setTitle("Resources");
+ resourcesMenu.setStyleName("SimpleMenuBarButton");
+ resourcesMenu.setBorder("none");
+ resourcesMenu.setStyleName("menuBarMenuButton");
+ resourcesMenu.addItem(new EMenuItem("All Resources",
LinkManager.getHubAllResourcesLink()));//, new LinkCommand("#fsdf"));
+ resourcesMenu.addItem(new EMenuItem("Platforms",
LinkManager.getHubPlatformsLink(),"types/Platform_up_16.png"));//, new
LinkCommand("#fsdf"));
+ resourcesMenu.addItem(new EMenuItem("Servers",
LinkManager.getHubServerssLink(), "types/Server_up_16.png"));//, new
LinkCommand("#fsdf"));
+ resourcesMenu.addItem(new EMenuItem("Services",
LinkManager.getHubServicesLink(), "types/Service_up_16.png"));//, new
LinkCommand("#fsdf"));
+ resourcesMenu.addItem(new MenuItemSeparator());
+
+ final FavoritesMenu favoritesMenu = new FavoritesMenu();
+ resourcesMenu.addItem(favoritesMenu);
+ menu.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ System.out.println("over here");
+ favoritesMenu.refresh();
+ }
+ });
+
+ Menu groupsMenu = new Menu();
+ groupsMenu.setStyleName("menuBarMenuButton");
+ groupsMenu.setTitle("Groups");
+ groupsMenu.addItem(new EMenuItem("All Groups",
LinkManager.getHubAllGroupsLink())); //, new LinkCommand("#sf"));
+ groupsMenu.addItem(new EMenuItem("Compatible Groups",
LinkManager.getHubCompatibleGroupsLink())); //, new LinkCommand("#sf"));
+ groupsMenu.addItem(new EMenuItem("Mixed Groups",
LinkManager.getHubMixedGroupsLink())); //, new LinkCommand("#sf"));
+ groupsMenu.addItem(new EMenuItem("Group Definitions",
LinkManager.getHubGroupDefinitionsLink())); //, new LinkCommand("#sf"));
+ groupsMenu.addItem(new MenuItemSeparator());
+ groupsMenu.addItem(new EMenuItem("New Group",
LinkManager.getHubNewGroupLink())); //, new LinkCommand("#sf"));
+ groupsMenu.addItem(new EMenuItem("New Group Definition",
LinkManager.getHubNewGroupDefLink())); //, new LinkCommand("#sf"));
+ groupsMenu.addItem(new MenuItemSeparator());
+// groupsMenu.addItem(new MenuItem("Favorites")); //, new
LinkCommand("#sf"));
+
+
+ Menu securityMenu = new Menu();
+ securityMenu.setTitle("Security");
+ securityMenu.addItem(new
EMenuItem("Users",LinkManager.getAdminUsersLink()));
+ securityMenu.addItem(new
EMenuItem("Roles",LinkManager.getAdminRolesLink()));
+ MenuItem securitySubMenuItem = new MenuItem("Security");
+ securitySubMenuItem.setSubmenu(securityMenu);
+
+
+ Menu sysConfigMenu = new Menu();
+ sysConfigMenu.setTitle("System Configuration");
+ sysConfigMenu.addItem(new
EMenuItem("Settings",LinkManager.getAdminSysConfigLink()));
+ sysConfigMenu.addItem(new
EMenuItem("Plugins",LinkManager.getAdminPluginsLink()));
+ sysConfigMenu.addItem(new
EMenuItem("Templates",LinkManager.getAdminTemplatesLink()));
+ MenuItem sysConfigSubMenuItem = new MenuItem("System Configuration");
+ sysConfigSubMenuItem.setSubmenu(sysConfigMenu);
+
+
+ Menu contentMenu = new Menu();
+ contentMenu.setTitle("Content");
+ contentMenu.addItem(new EMenuItem("Bundles","#Bundles"));
+ contentMenu.addItem(new EMenuItem("Content
Providers",LinkManager.getAdminContentProvidersLink()));
+ contentMenu.addItem(new EMenuItem("Content
Repositories",LinkManager.getAdminContentReposLink()));
+ MenuItem contentSubMenuItem = new MenuItem("Content");
+ contentSubMenuItem.setSubmenu(contentMenu);
+
+
+ Menu haMenu = new Menu();
+ haMenu.setTitle("High Availability");
+ haMenu.addItem(new
EMenuItem("Servers",LinkManager.getHAServersLink()));
+ haMenu.addItem(new EMenuItem("Agents",LinkManager.getHAAgentsLink()));
+ haMenu.addItem(new EMenuItem("Affinity
Groups",LinkManager.getHAAffinityGroupsLink()));
+ haMenu.addItem(new EMenuItem("Partition
Events",LinkManager.getHAEventsLink()));
+ MenuItem haSubMentItem = new MenuItem("High Availability");
+ haSubMentItem.setSubmenu(haMenu);
+
+
+ Menu reportsMenu = new Menu();
+ reportsMenu.setTitle("Reports");
+ reportsMenu.addItem(new EMenuItem("Resource Version Inventory Report",
LinkManager.getReportsInventoryLink()));
+ MenuItem reportsSubMenuItem = new MenuItem("Reports");
+ reportsSubMenuItem.setSubmenu(reportsMenu);
+
+
+ Menu adminMenu = new Menu();
+ adminMenu.setTitle("Administration");
+ adminMenu.addItem(securitySubMenuItem);
+ adminMenu.addItem(sysConfigSubMenuItem);
+ adminMenu.addItem(contentSubMenuItem);
+ adminMenu.addItem(haSubMentItem);
+ adminMenu.addItem(reportsSubMenuItem);
+ adminMenu.addItem(new EMenuItem("Downloads",
LinkManager.getAdminDownloadsLink()));
+ adminMenu.addItem(new EMenuItem("License",
LinkManager.getAdminLicenseLink()));
+
+
+
+
+
+ Menu helpMenu = new Menu();
+ helpMenu.setStyleName("menuBarMenuButton");
+ helpMenu.setTitle("Help");
+ helpMenu.addItem(new EMenuItem("Online Documentation",
"http://www.rhq-project.org")); //, new LinkCommand("#sdfs"));
+ helpMenu.addItem(new EMenuItem("Open a support case",
"http://www.rhq-project.org")); //, new LinkCommand("#sdfs"));
+// helpMenu.addItem(new MenuItem("About")); //, new
LinkCommand("#sdfs"));
+
+ menu.setMenus(overviewMenu, resourcesMenu, groupsMenu, adminMenu, helpMenu);
+
+
+ topBar.addMember(menu);
+
+
+ addMember(topBar);
+ addMember(new SearchBarPane());
+
+ }
+
+
+ public static class EMenuItem extends com.smartgwt.client.widgets.menu.MenuItem {
+
+ String link;
+
+ public EMenuItem(String title, String link) {
+ super(title);
+ this.link = link;
+ init();
+ }
+
+ public EMenuItem(String title, String link, String icon) {
+ super(title, icon);
+ this.link = link;
+ init();
+ }
+
+ private void init() {
+ addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
+ public void onClick(MenuItemClickEvent menuItemClickEvent) {
+ if (link.startsWith("#")) {
+ History.newItem(link.substring(1));
+ } else {
+ Window.Location.assign(link);
+ }
+ }
+ });
+ }
+ }
+
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index 55a7d47..9d354f4 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@ -57,196 +57,16 @@ public class MenuBarView extends VLayout {
private AboutModalWindow aboutModalWindow;
- public static final String[] SECTIONS = {"Dashboard", "Demo",
"Inventory", "Bundles", "Administration"};
+ public static final String[] SECTIONS = {"Dashboard",
"Inventory", "Reports", "Bundles",
"Administration"};
private String selected = "Dashboard";
private HTMLFlow linksPane;
- public MenuBarView() {
- super(5);
- setHeight(50);
- setWidth100();
-
-
- }
-
protected void onDraw() {
super.onDraw();
- this.aboutModalWindow = new AboutModalWindow();
-
- HLayout topBar = new HLayout();
- topBar.setHeight(28);
- topBar.setStyleName("topMenuBar");
-// url("./images/cssButton/button_stretch.png") repeat-x scroll 0 0
#DDDDDD
-// topBar.setBackgroundImage("[SKIN]/cssButton/button_stretch.png");
-// topBar.setBackgroundRepeat(BkgndRepeat.REPEAT_X);
-
-
- Img logo = new Img("header/rhq_logo_28px.png", 80, 28);
- logo.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
- public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
- MenuBarView.this.aboutModalWindow.show();
- }
- });
-
-
- topBar.addMember(logo);
-
-
- // Create a menu bar
- final MenuBar menu = new MenuBar();
- menu.setHeight(28);
-
-
-
- Menu subsystemsMenu = new Menu();
-
- subsystemsMenu.setTitle("Subsystems");
- subsystemsMenu.addItem(new EMenuItem("Configuration Changes",
LinkManager.getSubsystemConfigurationLink(),
"subsystems/configure/Configure_16.png"));//, new
LinkCommand("#config"));
- subsystemsMenu.addItem(new EMenuItem("Suspect Metrics",
LinkManager.getSubsystemSuspectMetricsLink(),
"subsystems/monitor/Monitor_failed_16.png"));//, new
LinkCommand("#config"));
- subsystemsMenu.addItem(new EMenuItem("Operations",
LinkManager.getSubsystemOperationHistoryLink(),
"subsystems/control/Operation_16.png"));//, new
LinkCommand("#config"));
- subsystemsMenu.addItem(new EMenuItem("Alerts",
LinkManager.getSubsystemAlertHistoryLink(),
"subsystems/alert/Alert_HIGH_16.png"));//, new
LinkCommand("#config"));
- subsystemsMenu.addItem(new EMenuItem("Alert Definitions",
LinkManager.getSubsystemAlertDefsLink(), "subsystems/alert/Alerts_16.png"));//,
new LinkCommand("#config"));
-
-
- final Menu overviewMenu = new Menu();
- overviewMenu.setTitle("Overview");
- overviewMenu.setStyleName("SimpleMenuBarButton");
- overviewMenu.setBorder("none");
- com.smartgwt.client.widgets.menu.MenuItem subsystemsSubMenuItem = new
com.smartgwt.client.widgets.menu.MenuItem("Subsystems");
- subsystemsSubMenuItem.setSubmenu(subsystemsMenu);
- overviewMenu.addItem(subsystemsSubMenuItem);
- overviewMenu.addItem(new EMenuItem("AutoDiscovery
Queue",LinkManager.getAutodiscoveryQueueLink()));//,new
LinkCommand("#cofng"));
- overviewMenu.addItem(new
EMenuItem("Dashboard",LinkManager.getDashboardLink()));//,new
LinkCommand("#cofng"));
-
-
- Menu resourcesMenu = new Menu();
- resourcesMenu.setTitle("Resources");
- resourcesMenu.setStyleName("SimpleMenuBarButton");
- resourcesMenu.setBorder("none");
- resourcesMenu.setStyleName("menuBarMenuButton");
- resourcesMenu.addItem(new EMenuItem("All Resources",
LinkManager.getHubAllResourcesLink()));//, new LinkCommand("#fsdf"));
- resourcesMenu.addItem(new EMenuItem("Platforms",
LinkManager.getHubPlatformsLink(),"types/Platform_up_16.png"));//, new
LinkCommand("#fsdf"));
- resourcesMenu.addItem(new EMenuItem("Servers",
LinkManager.getHubServerssLink(), "types/Server_up_16.png"));//, new
LinkCommand("#fsdf"));
- resourcesMenu.addItem(new EMenuItem("Services",
LinkManager.getHubServicesLink(), "types/Service_up_16.png"));//, new
LinkCommand("#fsdf"));
- resourcesMenu.addItem(new MenuItemSeparator());
-
- final FavoritesMenu favoritesMenu = new FavoritesMenu();
- resourcesMenu.addItem(favoritesMenu);
- menu.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- System.out.println("over here");
- favoritesMenu.refresh();
- }
- });
-
- Menu groupsMenu = new Menu();
- groupsMenu.setStyleName("menuBarMenuButton");
- groupsMenu.setTitle("Groups");
- groupsMenu.addItem(new EMenuItem("All Groups",
LinkManager.getHubAllGroupsLink())); //, new LinkCommand("#sf"));
- groupsMenu.addItem(new EMenuItem("Compatible Groups",
LinkManager.getHubCompatibleGroupsLink())); //, new LinkCommand("#sf"));
- groupsMenu.addItem(new EMenuItem("Mixed Groups",
LinkManager.getHubMixedGroupsLink())); //, new LinkCommand("#sf"));
- groupsMenu.addItem(new EMenuItem("Group Definitions",
LinkManager.getHubGroupDefinitionsLink())); //, new LinkCommand("#sf"));
- groupsMenu.addItem(new MenuItemSeparator());
- groupsMenu.addItem(new EMenuItem("New Group",
LinkManager.getHubNewGroupLink())); //, new LinkCommand("#sf"));
- groupsMenu.addItem(new EMenuItem("New Group Definition",
LinkManager.getHubNewGroupDefLink())); //, new LinkCommand("#sf"));
- groupsMenu.addItem(new MenuItemSeparator());
-// groupsMenu.addItem(new MenuItem("Favorites")); //, new
LinkCommand("#sf"));
-
-
- Menu securityMenu = new Menu();
- securityMenu.setTitle("Security");
- securityMenu.addItem(new
EMenuItem("Users",LinkManager.getAdminUsersLink()));
- securityMenu.addItem(new
EMenuItem("Roles",LinkManager.getAdminRolesLink()));
- MenuItem securitySubMenuItem = new MenuItem("Security");
- securitySubMenuItem.setSubmenu(securityMenu);
-
-
- Menu sysConfigMenu = new Menu();
- sysConfigMenu.setTitle("System Configuration");
- sysConfigMenu.addItem(new
EMenuItem("Settings",LinkManager.getAdminSysConfigLink()));
- sysConfigMenu.addItem(new
EMenuItem("Plugins",LinkManager.getAdminPluginsLink()));
- sysConfigMenu.addItem(new
EMenuItem("Templates",LinkManager.getAdminTemplatesLink()));
- MenuItem sysConfigSubMenuItem = new MenuItem("System Configuration");
- sysConfigSubMenuItem.setSubmenu(sysConfigMenu);
-
-
- Menu contentMenu = new Menu();
- contentMenu.setTitle("Content");
- contentMenu.addItem(new EMenuItem("Bundles","#Bundles"));
- contentMenu.addItem(new EMenuItem("Content
Providers",LinkManager.getAdminContentProvidersLink()));
- contentMenu.addItem(new EMenuItem("Content
Repositories",LinkManager.getAdminContentReposLink()));
- MenuItem contentSubMenuItem = new MenuItem("Content");
- contentSubMenuItem.setSubmenu(contentMenu);
-
-
- Menu haMenu = new Menu();
- haMenu.setTitle("High Availability");
- haMenu.addItem(new
EMenuItem("Servers",LinkManager.getHAServersLink()));
- haMenu.addItem(new EMenuItem("Agents",LinkManager.getHAAgentsLink()));
- haMenu.addItem(new EMenuItem("Affinity
Groups",LinkManager.getHAAffinityGroupsLink()));
- haMenu.addItem(new EMenuItem("Partition
Events",LinkManager.getHAEventsLink()));
- MenuItem haSubMentItem = new MenuItem("High Availability");
- haSubMentItem.setSubmenu(haMenu);
-
-
- Menu reportsMenu = new Menu();
- reportsMenu.setTitle("Reports");
- reportsMenu.addItem(new EMenuItem("Resource Version Inventory Report",
LinkManager.getReportsInventoryLink()));
- MenuItem reportsSubMenuItem = new MenuItem("Reports");
- reportsSubMenuItem.setSubmenu(reportsMenu);
-
-
- Menu adminMenu = new Menu();
- adminMenu.setTitle("Administration");
- adminMenu.addItem(securitySubMenuItem);
- adminMenu.addItem(sysConfigSubMenuItem);
- adminMenu.addItem(contentSubMenuItem);
- adminMenu.addItem(haSubMentItem);
- adminMenu.addItem(reportsSubMenuItem);
- adminMenu.addItem(new EMenuItem("Downloads",
LinkManager.getAdminDownloadsLink()));
- adminMenu.addItem(new EMenuItem("License",
LinkManager.getAdminLicenseLink()));
-
-
-
-
-
- Menu helpMenu = new Menu();
- helpMenu.setStyleName("menuBarMenuButton");
- helpMenu.setTitle("Help");
- helpMenu.addItem(new EMenuItem("Online Documentation",
"http://www.rhq-project.org")); //, new LinkCommand("#sdfs"));
- helpMenu.addItem(new EMenuItem("Open a support case",
"http://www.rhq-project.org")); //, new LinkCommand("#sdfs"));
-// helpMenu.addItem(new MenuItem("About")); //, new
LinkCommand("#sdfs"));
-
- menu.setMenus(overviewMenu, resourcesMenu, groupsMenu, adminMenu, helpMenu);
-
-
- topBar.addMember(menu);
-
-
- addMember(topBar);
- addMember(new SearchBarPane());
-
- }
-
- protected void onDraw2() {
- super.onDraw();
-
- HTMLFlow menu = new HTMLFlow();
- menu.setContentsType(ContentsType.PAGE);
- menu.setContentsURL("/rhq/common/menu/menu.xhtml");
- addMember(menu);
- }
-
-
- // @Override
-
- protected void onDraw3() {
- super.onDraw();
-
History.addValueChangeHandler(new ValueChangeHandler<String>() {
public void onValueChange(ValueChangeEvent<String>
stringValueChangeEvent) {
String first =
stringValueChangeEvent.getValue().split("/")[0];
@@ -285,15 +105,15 @@ public class MenuBarView extends VLayout {
topStrip.addMember(new LayoutSpacer());
HLayout helpLayout = new HLayout();
- Label loggedInAs = new Label("Logged in as " +
CoreGUI.getSessionSubject().getName());
- loggedInAs.setWrap(false);
- loggedInAs.setValign(VerticalAlignment.CENTER);
- helpLayout.addMember(loggedInAs);
- helpLayout.addMember(new Hyperlink("Help", "Help"));
- helpLayout.addMember(new Hyperlink("Preferences",
"Preferences"));
- helpLayout.addMember(new Hyperlink("Log Out", "LogOut"));
- helpLayout.setLayoutAlign(VerticalAlignment.CENTER);
- topStrip.addMember(helpLayout);
+// Label loggedInAs = new Label("Logged in as " +
CoreGUI.getSessionSubject().getName());
+// loggedInAs.setWrap(false);
+// loggedInAs.setValign(VerticalAlignment.CENTER);
+// helpLayout.addMember(loggedInAs);
+ topStrip.addMember(new Hyperlink("Help", "Help"));
+ topStrip.addMember(new Hyperlink("Preferences",
"Preferences"));
+ topStrip.addMember(new Hyperlink("Log Out", "LogOut"));
+// helpLayout.setLayoutAlign(VerticalAlignment.CENTER);
+// topStrip.addMember(helpLayout);
/* DynamicForm links = new DynamicForm();
links.setNumCols(SECTIONS.length * 2);
@@ -355,33 +175,4 @@ public class MenuBarView extends VLayout {
}
- public static class EMenuItem extends com.smartgwt.client.widgets.menu.MenuItem {
-
- String link;
-
- public EMenuItem(String title, String link) {
- super(title);
- this.link = link;
- init();
- }
-
- public EMenuItem(String title, String link, String icon) {
- super(title, icon);
- this.link = link;
- init();
- }
-
- private void init() {
- addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
- public void onClick(MenuItemClickEvent menuItemClickEvent) {
- if (link.startsWith("#")) {
- History.newItem(link.substring(1));
- } else {
- Window.Location.assign(link);
- }
- }
- });
- }
- }
-
}
commit e624bee83c605b20d8411d0b44a8d885460b6262
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Jul 23 12:47:12 2010 -0400
Let login form support native browser autocomplete so user/passwords can be saved
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
index 64d89ca..c28d77e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LoginView.java
@@ -98,14 +98,13 @@ public class LoginView extends Canvas {
HeaderItem header = new HeaderItem();
header.setValue("RHQ Login");
-
+
TextItem user = new TextItem("user", "User");
user.setRequired(true);
- user.setAttribute("canAutocomplete", true);
- user.setAttribute("autoComplete", true);
+ user.setAttribute("autoComplete", "native");
PasswordItem password = new PasswordItem("password",
"Password");
password.setRequired(true);
- password.setAttribute("autocomplete", true);
+ password.setAttribute("autoComplete", "native");
loginButton = new SubmitItem("login", "Login");
loginButton.setAlign(Alignment.CENTER);
commit 94d13c9f83d65c1a9ff8a35a53f5c9e6727e0aa2
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Jul 23 12:46:27 2010 -0400
Moved ClusterKey to the domain module as it will now be part of the public API
Expose ClusterFlyweight Tree api
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerBean.java
index 39e6f4a..10611fa 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerBean.java
@@ -18,7 +18,12 @@
*/
package org.rhq.enterprise.server.resource.cluster;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@@ -33,7 +38,10 @@ import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.group.ClusterKey;
import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ClusterFlyweight;
+import org.rhq.core.domain.resource.group.composite.ClusterKeyFlyweight;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
@@ -48,7 +56,7 @@ import
org.rhq.enterprise.server.resource.group.ResourceGroupUpdateException;
*
*/
@Stateless
-public class ClusterManagerBean implements ClusterManagerLocal {
+public class ClusterManagerBean implements ClusterManagerLocal, ClusterManagerRemote {
private final Log log = LogFactory.getLog(ClusterManagerBean.class);
@PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
@@ -168,6 +176,75 @@ public class ClusterManagerBean implements ClusterManagerLocal {
return rs;
}
+ public ClusterFlyweight getClusterTree(Subject subject, int groupId) {
+ Query query = entityManager.createQuery(
+ "SELECT r.id, r.resourceType.id, r.parentResource.id, r.resourceKey,
r.name, " +
+ "(SELECT count(r2) FROM Resource r2 join r2.explicitGroups
g2 WHERE g2.id = :groupId and r2.id = r.id) " +
+ "FROM Resource r join r.implicitGroups g " +
+ "WHERE g.id = :groupId");
+
+ query.setParameter("groupId", groupId);
+ List<Object[]> rs = query.getResultList();
+
+ Map<Integer, List<Object[]>> dataMap = new HashMap<Integer,
List<Object[]>>();
+ Set<Integer> explicitResources = new HashSet<Integer>();
+
+ for (Object[] d : rs) {
+
+ Integer parentId = (Integer) d[2];
+ List<Object[]> childList = dataMap.get(parentId);
+ if (childList == null) {
+ childList = new ArrayList<Object[]>();
+ dataMap.put(parentId, childList);
+ }
+ childList.add(d);
+ if ((Long) d[5] > 0) {
+ explicitResources.add((Integer) d[0]);
+ }
+ }
+
+
+ ClusterFlyweight key = new ClusterFlyweight(groupId);
+
+ buildTree(groupId, key, explicitResources, dataMap);
+
+ return key;
+ }
+
+ private void buildTree(int groupId, ClusterFlyweight parent, Set<Integer>
parentIds, Map<Integer,List<Object[]>> data) {
+
+ for (Integer parentId : parentIds) {
+
+ Map<ClusterKeyFlyweight, ClusterFlyweight> children = new
HashMap<ClusterKeyFlyweight, ClusterFlyweight>();
+ Map<ClusterKeyFlyweight, Set<Integer>> members = new
HashMap<ClusterKeyFlyweight, Set<Integer>>();
+
+ if (data.get(parentId) != null) {
+ for (Object[] child : data.get(parentId)) {
+ ClusterKeyFlyweight n = new ClusterKeyFlyweight((Integer)child[1],
(String)child[3]);
+ ClusterFlyweight flyweight = children.get(n);
+ Set<Integer> memberList = members.get(n);
+ if (flyweight == null) {
+ flyweight = new ClusterFlyweight(n);
+ children.put(n, flyweight);
+ memberList = new HashSet<Integer>();
+ members.put(n, memberList);
+ }
+ flyweight.addResource((String)child[4]);
+ memberList.add((Integer) child[0]);
+ }
+ }
+
+ parent.setChildren(new
ArrayList<ClusterFlyweight>(children.values()));
+
+
+ for (ClusterFlyweight child : children.values()) {
+ buildTree(groupId, child, members.get(child.getClusterKey()), data);
+ }
+ }
+ }
+
+
+
private String getClusterKeyQuery(ClusterKey clusterKey) {
if (null == clusterKey)
return null;
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerLocal.java
index ce11d33..b13b380 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerLocal.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerLocal.java
@@ -26,37 +26,15 @@ import org.jetbrains.annotations.Nullable;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.group.ClusterKey;
import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ClusterFlyweight;
/*
* @author Jay Shaughnessy
*/
@Local
-public interface ClusterManagerLocal {
+public interface ClusterManagerLocal extends ClusterManagerRemote {
- /**
- * Given a cluster key create a backing group.
- * @param clusterKey
- * @param addResources If true, the new group will be assigned the current resources
defined by the clusterKey.
- * Otherwise no resources will be assigned to the new group.
- * @throws IllegalArgumentException if a backing group exists for this clusterKey
- */
- ResourceGroup createAutoClusterBackingGroup(Subject subject, ClusterKey clusterKey,
boolean addResources);
-
- /**
- * Return the backing group for the supplied cluster key. Resource membership will
represent the resources
- * last set for the group and may not reflect current membership. See {@link
#getAutoClusterResources(String)}
- * @param clusterKey
- * @return The backing group, or null if the key does not have a backing group.
- */
- @Nullable
- ResourceGroup getAutoClusterBackingGroup(Subject subject, ClusterKey clusterKey);
-
- /**
- * Given a cluster key get the auto cluster resource membership. The membership is
always determined
- * at call time, regardless of whether a backing group exists. To get the backing
group, if it exists,
- * for a cluster key then call {@link #getAutoClusterBackingGroup(String)}.
- */
- List<Resource> getAutoClusterResources(Subject subject, ClusterKey
clusterKey);
}
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerBeanTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerBeanTest.java
index ec5177d..3729a60 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerBeanTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/cluster/ClusterManagerBeanTest.java
@@ -30,6 +30,7 @@ import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.group.ClusterKey;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
commit e01dce1066bd008701e7f4cf36db95d5517b0471
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Jul 23 12:45:36 2010 -0400
Moved ClusterKey to the domain module as it will now be part of the public API
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ClusterKey.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ClusterKey.java
new file mode 100644
index 0000000..e6d5369
--- /dev/null
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ClusterKey.java
@@ -0,0 +1,237 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 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.core.domain.resource.group;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * A ClusterKey represents an AutoCluster of resources in a Cluster Hierarchy. Given the
key it is
+ * possible to determine specific membership of the AutoCluster at any time. It
represents the Cluster
+ * Root (a Compatible Group) and the hierarchy of resource cluster nodes. Each level of
the hierarchy
+ * represents a resource cluster node defined by a Plugin|ResourceType|ResourceKey
tuple.<br/>
+ * <br/>
+ * The ClusterKey has the following form:
+ * <pre>
+ * Expressed iteratively:
+ *
+ * CompatibleGroupId::ResourceTypeId1:ResourceKey1::ResourceTypeId2:ResourceKey2:: ...
::ResourceTypeIdN:ResourceKeyN
+ *
+ * Expressed Recursively:
+ *
+ * Depth-1 AutoCluster CompatibleGroupId::ResourceTypeId1:ResourceKey1
+ * Depth-N AutoCluster <ParentClusterKey>::ResourceTypeIdN:ResourceKeyN
+ * </pre>
+ * @author jay shaughnessy
+ *
+ */
+public class ClusterKey implements Serializable {
+ static final String DELIM = ":";
+ static final String DELIM_NODE = "::";
+
+ // Id of the compatible resource group containing the root set of clustered
resources.
+ private int clusterGroupId = 0;
+ private List<ClusterKey.Node> hierarchy;
+ private String key = null;
+ private String namedKey = null;
+
+
+ public ClusterKey() {
+ }
+
+ /** Construct ClusterKey with to-be-defined Hierarcrhy */
+ public ClusterKey(int clusterResourceGroupId) {
+ this.clusterGroupId = clusterResourceGroupId;
+ this.hierarchy = new ArrayList<ClusterKey.Node>();
+ }
+
+ /** Construct ClusterKey for a top level AutoCluster */
+ public ClusterKey(int clusterResourceGroupId, int resourceTypeId, String resourceKey)
{
+ this.clusterGroupId = clusterResourceGroupId;
+ this.hierarchy = new ArrayList<ClusterKey.Node>();
+ this.hierarchy.add(new ClusterKey.Node(resourceTypeId, resourceKey));
+ }
+
+ /** Construct a new ClusterKey for a child AutoCluster of the provided parentKey*/
+ public ClusterKey(ClusterKey parentKey, int childResourceTypeId, String
childResourceKey) {
+ List<ClusterKey.Node> rootClusterNodes = parentKey.getHierarchy();
+
+ this.clusterGroupId = parentKey.getClusterGroupId();
+ this.hierarchy = new ArrayList<ClusterKey.Node>(rootClusterNodes);
//.size() + 1);
+// Collections.copy(this.hierarchy, rootClusterNodes);
+ this.hierarchy.add(new ClusterKey.Node(childResourceTypeId, childResourceKey));
+ }
+
+
+
+ public int getClusterGroupId() {
+ return clusterGroupId;
+ }
+
+ public List<ClusterKey.Node> getHierarchy() {
+ return hierarchy;
+ }
+
+ /**
+ * Increase depth of hierarchy with new child node.
+ * @param childResourceTypeId
+ * @param childResourceKey
+ * @return The updated hierarchy
+ */
+ public List<ClusterKey.Node> addChildToHierarchy(int childResourceTypeId,
String childResourceKey) {
+
+ this.hierarchy.add(new ClusterKey.Node(childResourceTypeId, childResourceKey));
+
+ return hierarchy;
+ }
+
+ /**
+ * @return the depth of the AutoCluster hierarchy. Just another way of getting the
hierarchy size.
+ */
+ public int getDepth() {
+ return hierarchy.size();
+ }
+
+ /**
+ * @param newDepth > 0, keep only the hierarchy up to an including the specified
depth.
+ */
+ public void setDepth(int newDepth) {
+ while ((newDepth > 0) && (this.hierarchy.size() > newDepth)) {
+ this.hierarchy.remove(this.hierarchy.size() - 1);
+ }
+ }
+
+ public String getKey() {
+ if (null == key) {
+ StringBuilder b = new StringBuilder();
+ b.append(clusterGroupId);
+
+ for (ClusterKey.Node node : hierarchy) {
+ b.append(DELIM_NODE);
+ b.append(node.toString());
+ }
+ key = b.toString();
+ }
+
+ return key;
+ }
+
+ /**
+ * format: see class doc, used delimiters ClusterKey.DELIM_NODE and ClusterKey.DELIM
+ */
+ @Override
+ public String toString() {
+ return getKey();
+ }
+
+
+ public static ClusterKey valueOf(String clusterKey) {
+ ClusterKey result = null;
+
+ try {
+ String[] nodes = clusterKey.split(DELIM_NODE);
+ int groupId = Integer.valueOf(nodes[0]);
+
+ result = new ClusterKey(groupId);
+
+ for (int i = 1; i < nodes.length; ++i) {
+ String[] nodeInfo = nodes[i].split(DELIM);
+
+ if ((nodeInfo.length != 2) || "".equals(nodeInfo[0].trim()) ||
"".equals(nodeInfo[1].trim())) {
+ throw new IllegalArgumentException("Invalid cluster key node:
" + nodeInfo);
+ }
+
+ result.addChildToHierarchy(Integer.valueOf(nodeInfo[0]), nodeInfo[1]);
+ }
+ } catch (Exception e) {
+ result = null;
+ }
+
+ return result;
+ }
+
+ /**
+ * @param clusterKey
+ * @return The ResourceType id of the resource group this clusterKey defines.
+ */
+ public static int getResourceType(ClusterKey clusterKey) {
+ List<ClusterKey.Node> nodes = clusterKey.getHierarchy();
+
+ return nodes.get(nodes.size() - 1).getResourceTypeId();
+ }
+
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ClusterKey)) return false;
+
+ ClusterKey that = (ClusterKey) o;
+
+ if (!getKey().equals(that.getKey())) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return getKey().hashCode();
+ }
+
+ /**
+ * Immutable class representing a node in an AutoCluster hierarchy. The node
describes a
+ * Set of like resources (same type and same resource key). By itself the node lacks
any context
+ * and so typically this class is for use within a ClusterKey, which qualifies the
node with
+ * the root group and constraining node ancestry.. */
+ public static class Node implements Serializable {
+ int resourceTypeId;
+ String resourceKey;
+
+ public Node(int resourceTypeId, String resourceKey) {
+ super();
+ this.resourceTypeId = resourceTypeId;
+ this.resourceKey = encode(resourceKey);
+ }
+
+ public int getResourceTypeId() {
+ return resourceTypeId;
+ }
+
+ public String getResourceKey() {
+ return decode(resourceKey);
+ }
+
+ /**
+ * format: resourceTypeId:resourceKey (actual delimiter is ClusterKey.DELIM)
+ */
+ @Override
+ public String toString() {
+ return resourceTypeId + DELIM + resourceKey;
+ }
+
+ private String encode(String info) {
+ return info.replace(":","%3a");
+ }
+ private String decode(String code) {
+ return code.replace("%3a", ":");
+ }
+ }
+}
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeContextMenuUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeContextMenuUIBean.java
index e3da8ca..34fb0a6 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeContextMenuUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeContextMenuUIBean.java
@@ -31,6 +31,7 @@ import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.group.ClusterKey;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.enterprise.gui.navigation.contextmenu.MenuItemDescriptor;
@@ -40,7 +41,6 @@ import
org.rhq.enterprise.gui.navigation.contextmenu.TreeContextMenuBase;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.measurement.MeasurementDefinitionManagerLocal;
import org.rhq.enterprise.server.operation.OperationManagerLocal;
-import org.rhq.enterprise.server.resource.cluster.ClusterKey;
import org.rhq.enterprise.server.resource.cluster.ClusterManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeModelUIBean.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeModelUIBean.java
index 66ef285..ef8f7d0 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeModelUIBean.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeModelUIBean.java
@@ -30,6 +30,7 @@ import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.resource.flyweight.AutoGroupCompositeFlyweight;
import org.rhq.core.domain.resource.flyweight.ResourceFlyweight;
+import org.rhq.core.domain.resource.group.ClusterKey;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageControl;
@@ -38,7 +39,6 @@ import
org.rhq.enterprise.gui.navigation.resource.ResourceTreeModelUIBean;
import org.rhq.enterprise.gui.navigation.resource.ResourceTreeNode;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
-import org.rhq.enterprise.server.resource.cluster.ClusterKey;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.util.HibernatePerformanceMonitor;
import org.rhq.enterprise.server.util.LookupUtil;
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeNode.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeNode.java
index 3a1e482..8f1003a 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeNode.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeNode.java
@@ -20,9 +20,9 @@ package org.rhq.enterprise.gui.navigation.group;
import org.rhq.core.domain.resource.flyweight.AutoGroupCompositeFlyweight;
import org.rhq.core.domain.resource.flyweight.ResourceFlyweight;
+import org.rhq.core.domain.resource.group.ClusterKey;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.util.sort.HumaneStringComparator;
-import org.rhq.enterprise.server.resource.cluster.ClusterKey;
import org.rhq.enterprise.gui.navigation.resource.ResourceTreeNode;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
diff --git
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeStateAdvisor.java
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeStateAdvisor.java
index a803b9c..273e7a2 100644
---
a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeStateAdvisor.java
+++
b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/group/ResourceGroupTreeStateAdvisor.java
@@ -20,7 +20,6 @@ package org.rhq.enterprise.gui.navigation.group;
import java.io.IOException;
import java.util.HashSet;
-import java.util.Map;
import java.util.Set;
import javax.faces.application.FacesMessage;
@@ -35,12 +34,10 @@ import org.richfaces.model.TreeRowKey;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.resource.flyweight.AutoGroupCompositeFlyweight;
-import org.rhq.core.domain.resource.group.composite.AutoGroupComposite;
+import org.rhq.core.domain.resource.group.ClusterKey;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.gui.util.FacesContextUtility;
-import org.rhq.enterprise.gui.navigation.resource.ResourceTreeNode;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
-import org.rhq.enterprise.server.resource.cluster.ClusterKey;
import org.rhq.enterprise.server.resource.cluster.ClusterManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterKey.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterKey.java
deleted file mode 100644
index c2511be..0000000
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/cluster/ClusterKey.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 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.server.resource.cluster;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-
-import org.apache.commons.logging.LogFactory;
-
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.group.ResourceGroup;
-
-/**
- * A ClusterKey represents an AutoCluster of resources in a Cluster Hierarchy. Given the
key it is
- * possible to determine specific membership of the AutoCluster at any time. It
represents the Cluster
- * Root (a Compatible Group) and the hierarchy of resource cluster nodes. Each level of
the hierarchy
- * represents a resource cluster node defined by a Plugin|ResourceType|ResourceKey
tuple.<br/>
- * <br/>
- * The ClusterKey has the following form:
- * <pre>
- * Expressed iteratively:
- *
- * CompatibleGroupId::ResourceTypeId1:ResourceKey1::ResourceTypeId2:ResourceKey2:: ...
::ResourceTypeIdN:ResourceKeyN
- *
- * Expressed Recursively:
- *
- * Depth-1 AutoCluster CompatibleGroupId::ResourceTypeId1:ResourceKey1
- * Depth-N AutoCluster <ParentClusterKey>::ResourceTypeIdN:ResourceKeyN
- * </pre>
- * @author jay shaughnessy
- *
- */
-public class ClusterKey {
- static final String DELIM = ":";
- static final String DELIM_NODE = "::";
-
- // Id of the compatible resource group containing the root set of clustered
resources.
- private int clusterGroupId = 0;
- private List<ClusterKey.Node> hierarchy;
- private String key = null;
- private String namedKey = null;
-
- /** Construct ClusterKey with to-be-defined Hierarcrhy */
- public ClusterKey(int clusterResourceGroupId) {
- this.clusterGroupId = clusterResourceGroupId;
- this.hierarchy = new ArrayList<ClusterKey.Node>();
- }
-
- /** Construct ClusterKey for a top level AutoCluster */
- public ClusterKey(int clusterResourceGroupId, int resourceTypeId, String resourceKey)
{
- this.clusterGroupId = clusterResourceGroupId;
- this.hierarchy = new ArrayList<ClusterKey.Node>();
- this.hierarchy.add(new ClusterKey.Node(resourceTypeId, resourceKey));
- }
-
- /** Construct a new ClusterKey for a child AutoCluster of the provided parentKey*/
- public ClusterKey(ClusterKey parentKey, int childResourceTypeId, String
childResourceKey) {
- List<ClusterKey.Node> rootClusterNodes = parentKey.getHierarchy();
-
- this.clusterGroupId = parentKey.getClusterGroupId();
- this.hierarchy = new ArrayList<ClusterKey.Node>(rootClusterNodes);
//.size() + 1);
-// Collections.copy(this.hierarchy, rootClusterNodes);
- this.hierarchy.add(new ClusterKey.Node(childResourceTypeId, childResourceKey));
- }
-
-
-
- public int getClusterGroupId() {
- return clusterGroupId;
- }
-
- public List<ClusterKey.Node> getHierarchy() {
- return hierarchy;
- }
-
- /**
- * Increase depth of hierarchy with new child node.
- * @param childResourceTypeId
- * @param childResourceKey
- * @return The updated hierarchy
- */
- public List<ClusterKey.Node> addChildToHierarchy(int childResourceTypeId,
String childResourceKey) {
-
- this.hierarchy.add(new ClusterKey.Node(childResourceTypeId, childResourceKey));
-
- return hierarchy;
- }
-
- /**
- * @return the depth of the AutoCluster hierarchy. Just another way of getting the
hierarchy size.
- */
- public int getDepth() {
- return hierarchy.size();
- }
-
- /**
- * @param newDepth > 0, keep only the hierarchy up to an including the specified
depth.
- */
- public void setDepth(int newDepth) {
- while ((newDepth > 0) && (this.hierarchy.size() > newDepth)) {
- this.hierarchy.remove(this.hierarchy.size() - 1);
- }
- }
-
- public String getKey() {
- if (null == key) {
- StringBuilder b = new StringBuilder();
- b.append(clusterGroupId);
-
- for (ClusterKey.Node node : hierarchy) {
- b.append(DELIM_NODE);
- b.append(node.toString());
- }
- key = b.toString();
- }
-
- return key;
- }
-
- /**
- * format: see class doc, used delimiters ClusterKey.DELIM_NODE and ClusterKey.DELIM
- */
- @Override
- public String toString() {
- return getKey();
- }
-
- /**
- * format: see class doc, used delimiters ClusterKey.DELIM_NODE and ClusterKey.DELIM.
- * ResourceTypeId replaced with Plugin:ResourceTypeName tuple.
- */
- public String toNamedString(EntityManager em) {
- if (null == namedKey) {
- ResourceGroup clusterResourceGroup = em.find(ResourceGroup.class,
this.clusterGroupId);
-
- StringBuilder b = new StringBuilder();
- b.append((null == clusterResourceGroup) ? this.clusterGroupId :
clusterResourceGroup.getName());
-
- for (ClusterKey.Node node : hierarchy) {
- b.append(DELIM_NODE);
- b.append(node.toNamedString(em));
- }
- namedKey = b.toString();
- }
-
- return namedKey;
- }
-
- public static ClusterKey valueOf(String clusterKey) {
- ClusterKey result = null;
-
- try {
- String[] nodes = clusterKey.split(DELIM_NODE);
- int groupId = Integer.valueOf(nodes[0]);
-
- result = new ClusterKey(groupId);
-
- for (int i = 1; i < nodes.length; ++i) {
- String[] nodeInfo = nodes[i].split(DELIM);
-
- if ((nodeInfo.length != 2) || "".equals(nodeInfo[0].trim()) ||
"".equals(nodeInfo[1].trim())) {
- throw new IllegalArgumentException("Invalid cluster key node:
" + nodeInfo);
- }
-
- result.addChildToHierarchy(Integer.valueOf(nodeInfo[0]), nodeInfo[1]);
- }
- } catch (Exception e) {
- LogFactory.getLog(ClusterKey.class).error("Invalid clusterKey |" +
clusterKey + "| encountered: " + e);
- result = null;
- }
-
- return result;
- }
-
- /**
- * @param clusterKey
- * @return The ResourceType id of the resource group this clusterKey defines.
- */
- public static int getResourceType(ClusterKey clusterKey) {
- List<ClusterKey.Node> nodes = clusterKey.getHierarchy();
-
- return nodes.get(nodes.size() - 1).getResourceTypeId();
- }
-
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof ClusterKey)) return false;
-
- ClusterKey that = (ClusterKey) o;
-
- if (!getKey().equals(that.getKey())) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return getKey().hashCode();
- }
-
- /**
- * Immutable class representing a node in an AutoCluster hierarchy. The node
describes a
- * Set of like resources (same type and same resource key). By itself the node lacks
any context
- * and so typically this class is for use within a ClusterKey, which qualifies the
node with
- * the root group and constraining node ancestry.. */
- public static class Node {
- int resourceTypeId;
- String resourceKey;
-
- public Node(int resourceTypeId, String resourceKey) {
- super();
- this.resourceTypeId = resourceTypeId;
- this.resourceKey = encode(resourceKey);
- }
-
- public int getResourceTypeId() {
- return resourceTypeId;
- }
-
- public String getResourceKey() {
- return decode(resourceKey);
- }
-
- /**
- * format: resourceTypeId:resourceKey (actual delimiter is ClusterKey.DELIM)
- */
- @Override
- public String toString() {
- return resourceTypeId + DELIM + resourceKey;
- }
-
- /*
- * format: resourceTypePlugin:resourceTypeName:resourceKey (actual delimiter is
ClusterKey.DELIM)
- */
- public String toNamedString(EntityManager em) {
- ResourceType resourceType = em.find(ResourceType.class,
this.resourceTypeId);
- String resourceTypePart = null;
-
- if (null == resourceType) {
- resourceTypePart = this.resourceTypeId + DELIM + this.resourceTypeId;
- } else
- resourceTypePart = resourceType.getPlugin() + DELIM +
resourceType.getName();
-
- return resourceTypePart + DELIM + resourceKey;
- }
-
- private String encode(String info) {
- return info.replace(":","%3a");
- }
- private String decode(String code) {
- return code.replace("%3a", ":");
- }
- }
-}
commit 7ce3f39a8a246e32b1d6183e555b8ec0da051dde
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Jul 23 12:44:51 2010 -0400
Don't take over full screen when portal login page is shown (as it'll always
be in a gwt container now)
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/common/Login.jsp
b/modules/enterprise/gui/portal-war/src/main/webapp/common/Login.jsp
index a9b0844..804ee5f 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/common/Login.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/common/Login.jsp
@@ -28,8 +28,8 @@
<title><fmt:message key="login.title" /></title>
<link rel="stylesheet" href="<html:rewrite
page="/css/win.css"/>" type="text/css">
<script language="JavaScript" type="text/javascript">
- if (top != self)
- top.location.href = self.document.location;
+// if (top != self)
+// top.location.href = self.document.location;
var path = "<html:rewrite page="/images/"/>";
commit f14436b69d270a649125a5eb19b266ef4ca13729
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Fri Jul 23 12:44:05 2010 -0400
Add the ability to filter by the root resource... let's us use criteria to load an
entire platform or search within one
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
index ad52f4c..a332b77 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
@@ -65,6 +65,7 @@ public class ResourceCriteria extends TaggedCriteria {
private List<Integer> filterIds; // needs overrides
private List<Integer> filterExplicitGroupIds; // requires overrides
private List<Integer> filterImplicitGroupIds; // requires overrides
+ private Integer filterRootResourceId; // requires overrides
private boolean fetchResourceType;
private boolean fetchChildResources;
@@ -124,6 +125,8 @@ public class ResourceCriteria extends TaggedCriteria {
+ " FROM Resource ires " //
+ " JOIN ires.implicitGroups implicitGroup " //
+ " WHERE implicitGroup.id IN ( ? ) )");
+ filterOverrides.put("rootResourceId",
+ "agent.id = (SELECT r2.agent.id FROM Resource r2 where r2.id =
?)");
sortOverrides.put("resourceTypeName", "resourceType.name");
sortOverrides.put("resourceCategory",
"resourceType.category");
@@ -222,6 +225,10 @@ public class ResourceCriteria extends TaggedCriteria {
this.filterImplicitGroupIds = Arrays.asList(filterImplicitGroupIds);
}
+ public void addFilterRootResourceId(Integer filterRootResourceId) {
+ this.filterRootResourceId = filterRootResourceId;
+ }
+
public void fetchResourceType(boolean fetchResourceType) {
this.fetchResourceType = fetchResourceType;
}