.classpath
| 6
modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/measurement/MeasurementAgentService.java
| 6
modules/core/dbutils/pom.xml
| 2
modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
| 1
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
| 11
modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
| 21
modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceTypeTemplateCountComposite.java
| 14
modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java
| 9
modules/core/domain/src/test/java/org/rhq/core/domain/util/StringUtilsTest.java
| 5
modules/core/pom.xml
| 4
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/CoreGUI.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
| 59 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
| 55 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeNodeBuilder.java
| 233 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
| 445 +++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
| 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
| 134 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
| 488 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
| 381 +++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java
| 44
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertTemplateGWTService.java
| 44
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceTypeGWTService.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
| 38
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupDataSourceField.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
| 33
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
| 32
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
| 67 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
| 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/GroupPluginConfigurationEditView.java
| 228 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
| 60 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDataSourceField.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
| 39
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
| 27
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
| 171 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java
| 19
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/ScheduledOperationsDataSource.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java
| 74 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestConfigurationFactory.java
| 52 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestConfigurationView.java
| 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestGroupConfigurationView.java
| 142 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
| 19
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/Message.java
| 21
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
| 24
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertTemplateGWTServiceImpl.java
| 85 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceTypeGWTServiceImpl.java
| 13
modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
| 4
modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
| 8
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/alert/Edit_Alert.png
|binary
modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/monitor/Edit_Metric.png
|binary
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventAlertJSON.jsp
| 9
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java
| 39
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
| 11
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
| 4
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/EventsInsertPurgeTest.java
| 3
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java
| 1
modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/reporting/ExcelExporter.java
| 5
modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/DatabaseSetupInterceptor.java
| 2
modules/pom.xml
| 5
65 files changed, 2526 insertions(+), 756 deletions(-)
New commits:
commit 981b66fcc3db652f7b9da4f3a6a7eaf4db9ead96
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Wed Oct 27 16:47:45 2010 -0400
fix bug in ldapConfigured check and availableGroups load.
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 3ef327a..891c950 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
@@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSCallback;
@@ -305,32 +306,38 @@ public class RoleEditView extends LocatableVLayout implements
BookmarkableView {
final Record record = new RolesDataSource().copyValues(role);
//if ldap configured
GWTServiceLookup.getLdapService().checkLdapConfiguredStatus(new
AsyncCallback<Boolean>() {
- public void onSuccess(Boolean result) {
- //get available ldap groups
- GWTServiceLookup.getLdapService().findAvailableGroups(
- new AsyncCallback<Set<Map<String,
String>>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- "Failed to retrieve available LDAP
groups.", caught);
- }
-
- public void onSuccess(Set<Map<String,
String>> availableLdapGroups) {
- //get assigned ldap groups
- Set<LdapGroup> availableGroups =
RoleLdapGroupSelector
- .convertToCollection(availableLdapGroups);
- //update record with both objects.
-
record.setAttribute("ldapGroupsAvailable", availableGroups);
- editRecord(record);
-
current.getBreadcrumbs().get(0).setDisplayName("Editing: " + role.getName());
- CoreGUI.refreshBreadCrumbTrail();
- }
- });
+ public void onSuccess(Boolean ldapConfigured) {
+ if (ldapConfigured) {
+ //get available ldap groups
+ GWTServiceLookup.getLdapService().findAvailableGroups(
+ new AsyncCallback<Set<Map<String,
String>>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to retrieve available LDAP
groups.", caught);
+ }
+
+ public void onSuccess(Set<Map<String,
String>> availableLdapGroups) {
+ //get assigned ldap groups
+ Set<LdapGroup> availableGroups =
RoleLdapGroupSelector
+
.convertToCollection(availableLdapGroups);
+ //update record with both objects.
+
record.setAttribute("ldapGroupsAvailable", availableGroups);
+ editRecord(record);
+ current.getBreadcrumbs().get(0)
+ .setDisplayName("Editing: " +
role.getName());
+ CoreGUI.refreshBreadCrumbTrail();
+ }
+ });
+ } else {//ldap not configured, proceed
+ editRecord(record);
+
current.getBreadcrumbs().get(0).setDisplayName("Editing: " + role.getName());
+ CoreGUI.refreshBreadCrumbTrail();
+ }
}
- public void onFailure(Throwable caught) {//ldap not configured,
proceed
- editRecord(record);
- current.getBreadcrumbs().get(0).setDisplayName("Editing:
" + role.getName());
- CoreGUI.refreshBreadCrumbTrail();
+ public void onFailure(Throwable caught) {
+ Log.warn("Failed to determine if ldap configured - Check
server");
+ CoreGUI.getErrorHandler().handleError("Failed to
determine if ldap configured", caught);
}
});
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
index 81aebe8..328150e 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
@@ -85,10 +85,15 @@ public class LdapGroupManagerBean implements LdapGroupManagerLocal {
public Set<Map<String, String>> findAvailableGroups() {
Properties options = systemManager.getSystemConfiguration();
- String groupFilter = (String) options.get(RHQConstants.LDAPGroupFilter);
- String filter = String.format("(%s)", groupFilter);
+ Set<Map<String, String>> emptyAvailableGroups = new
HashSet<Map<String, String>>();
- return buildGroup(options, filter);
+ //retrieve the filters.
+ String groupFilter = (String) options.get(RHQConstants.LDAPGroupFilter);
+ if ((groupFilter != null) && (!groupFilter.trim().isEmpty())) {
+ String filter = String.format("(%s)", groupFilter);
+ return buildGroup(options, filter);
+ }
+ return emptyAvailableGroups;
}
public Set<String> findAvailableGroupsFor(String userName) {
commit 915cae5db66629a388d7395c04d8944047f787b8
Merge: 8be35f2... 5ea3d1e...
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Wed Oct 27 15:27:38 2010 -0400
Merge branch 'master' into gwt-ldap2
commit 5ea3d1e4c383bb4e2592b86494e1c2e56665f0cd
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Oct 27 12:30:59 2010 -0400
implement group plugin config view (group Inventory > Connection Settings subtab);
extract code for building group member labels into ReportDecorator utility class
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 bcef904..2d2c7c8 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
@@ -50,6 +50,7 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import
org.rhq.enterprise.gui.coregui.client.inventory.common.detail.AbstractTwoLevelTabSetView;
import
org.rhq.enterprise.gui.coregui.client.inventory.common.event.EventCompositeHistoryView;
import
org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.configuration.GroupResourceConfigurationEditView;
+import
org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.GroupPluginConfigurationEditView;
import
org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory.ResourceGroupMembershipView;
import
org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.schedules.SchedulesView;
import
org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.traits.TraitsView;
@@ -215,22 +216,26 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
// summaryTab.updateSubTab("Overview", new
DashboardView(resource));
// summaryTab.updateSubTab("Timeline", timelinePane);
// Summary tab is always visible and enabled.
- updateSubTab(this.summaryTab, this.summaryOverview, new
OverviewView(this.summaryTab
- .extendLocatorId("OverviewView"), this.groupComposite), true,
true);
+ updateSubTab(this.summaryTab, this.summaryOverview, new
OverviewView(this.summaryOverview
+ .extendLocatorId("View"), this.groupComposite), true, true);
if (updateTab(this.monitoringTab, groupCategory == GroupCategory.COMPATIBLE,
true)) {
visible = hasMetricsOfType(this.groupComposite, DataType.MEASUREMENT);
canvas = (visible) ? new
FullHTMLPane("/rhq/group/monitor/graphs-plain.xhtml?groupId=" + groupId) :
null;
updateSubTab(this.monitoringTab, this.monitorGraphs, canvas, visible, true);
+
// visible = same test as above
canvas = (visible) ? new
FullHTMLPane("/rhq/group/monitor/tables-plain.xhtml?groupId=" + groupId) :
null;
updateSubTab(this.monitoringTab, this.monitorTables, canvas, visible, true);
+
visible = hasMetricsOfType(this.groupComposite, DataType.TRAIT);
- canvas = (visible) ? new
TraitsView(this.monitoringTab.extendLocatorId("TraitsView"), groupId) : null;
+ canvas = (visible) ? new
TraitsView(this.monitorTraits.extendLocatorId("View"), groupId) : null;
updateSubTab(this.monitoringTab, this.monitorTraits, canvas, visible, true);
+
visible = hasMetricsOfType(this.groupComposite, null);
- canvas = (visible) ? new
SchedulesView(this.monitoringTab.extendLocatorId("SchedulesView"), groupId) :
null;
+ canvas = (visible) ? new
SchedulesView(this.monitorSched.extendLocatorId("View"), groupId) : null;
updateSubTab(this.monitoringTab, this.monitorSched, canvas, visible, true);
+
visible = facets.contains(ResourceTypeFacet.CALL_TIME);
canvas = (visible) ? new
FullHTMLPane("/rhq/group/monitor/response-plain.xhtml?groupId=" + groupId) :
null;
updateSubTab(this.monitoringTab, this.monitorCallTime, canvas, visible,
true);
@@ -238,14 +243,13 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
}
// Inventory tab is always visible and enabled.
- updateSubTab(this.inventoryTab, this.inventoryMembers,
ResourceSearchView.getMembersOf(this.inventoryTab
- .extendLocatorId("MembersView"), groupId), true, true);
- // TODO: Uncomment this once the group config component is done.
- //updateSubTab(this.inventoryTab, this.inventoryConn,
- // new GroupPluginConfigurationEditView(this.group.getId(),
this.group.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin),
- // facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION), true);
+ updateSubTab(this.inventoryTab, this.inventoryMembers,
ResourceSearchView.getMembersOf(this.inventoryMembers
+ .extendLocatorId("View"), groupId), true, true);
+ updateSubTab(this.inventoryTab, this.inventoryConn,
+ new
GroupPluginConfigurationEditView(this.inventoryConn.extendLocatorId("View"),
this.groupComposite),
+ facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION), true);
enabled = globalPermissions.contains(Permission.MANAGE_INVENTORY);
- canvas = (enabled) ? new
ResourceGroupMembershipView(this.inventoryTab.extendLocatorId("MembershipView"),
+ canvas = (enabled) ? new
ResourceGroupMembershipView(this.inventoryMembership.extendLocatorId("View"),
groupId) : null;
updateSubTab(this.inventoryTab, this.inventoryMembership, canvas, true,
enabled);
@@ -263,7 +267,7 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
updateSubTab(this.alertsTab, this.alertHistory,
GroupAlertHistoryView.get(groupComposite), true, true);
// but alert definitions can only be created on compatible groups
visible = (groupCategory == GroupCategory.COMPATIBLE);
- canvas = (visible) ? new
GroupAlertDefinitionsView(alertsTab.extendLocatorId("AlertDefView"),
+ canvas = (visible) ? new
GroupAlertDefinitionsView(alertDef.extendLocatorId("View"),
this.groupComposite) : null;
updateSubTab(this.alertsTab, this.alertDef, canvas, visible, true);
}
@@ -281,8 +285,8 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
visible = groupCategory == GroupCategory.MIXED
|| (groupCategory == GroupCategory.COMPATIBLE &&
facets.contains(ResourceTypeFacet.EVENT));
if (updateTab(this.eventsTab, visible, true)) {
- updateSubTab(this.eventsTab, this.eventHistory,
EventCompositeHistoryView.get(this.eventsTab
- .extendLocatorId("CompositeHistView"), groupComposite), true,
true);
+ updateSubTab(this.eventsTab, this.eventHistory,
EventCompositeHistoryView.get(this.eventHistory
+ .extendLocatorId("View"), groupComposite), true, true);
}
this.show();
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
index 4e9d337..f9ff99e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/configuration/GroupResourceConfigurationEditView.java
@@ -159,11 +159,8 @@ public class GroupResourceConfigurationEditView extends
LocatableVLayout
public void
onSuccess(List<DisambiguationReport<ResourceConfigurationComposite>> results)
{
memberConfigurations = new
ArrayList<GroupMemberConfiguration>(results.size());
for (DisambiguationReport<ResourceConfigurationComposite>
result : results) {
- String parentsHtml =
ReportDecorator.decorateResourceLineage(result.getParents());
int resourceId = result.getOriginal().getResourceId();
- String resourceHtml =
ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL,
- result.getResourceType(), result.getName(), resourceId);
- String label = parentsHtml +
ReportDecorator.DEFAULT_SEPARATOR + resourceHtml;
+ String label =
ReportDecorator.decorateDisambiguationReport(result, resourceId, false);
Configuration configuration =
result.getOriginal().getConfiguration();
GroupMemberConfiguration memberConfiguration = new
GroupMemberConfiguration(resourceId, label,
configuration);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/GroupPluginConfigurationEditView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/GroupPluginConfigurationEditView.java
new file mode 100644
index 0000000..218d663
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/inventory/GroupPluginConfigurationEditView.java
@@ -0,0 +1,228 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.inventory;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.composite.ResourceConfigurationComposite;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
+import org.rhq.core.domain.resource.composite.ResourcePermission;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.RefreshableView;
+import
org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import
org.rhq.enterprise.gui.coregui.client.components.configuration.GroupConfigurationEditor;
+import
org.rhq.enterprise.gui.coregui.client.components.configuration.GroupMemberConfiguration;
+import
org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
+import
org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import
org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.resource.disambiguation.ReportDecorator;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenter;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * A view for editing a group's configuration.
+ *
+ * @author Ian Springer
+ */
+public class GroupPluginConfigurationEditView extends LocatableVLayout
+ implements PropertyValueChangeListener, RefreshableView {
+ private final ConfigurationGWTServiceAsync configurationService =
GWTServiceLookup.getConfigurationService();
+
+ private ResourceGroup group;
+ private ResourcePermission resourcePermission;
+ private ConfigurationDefinition configurationDefinition;
+ private List<GroupMemberConfiguration> memberConfigurations;
+
+ private ConfigurationEditor editor;
+ private IButton saveButton;
+
+ public GroupPluginConfigurationEditView(String locatorId, ResourceGroupComposite
groupComposite) {
+ super(locatorId);
+
+ this.group = groupComposite.getResourceGroup();
+ this.resourcePermission = groupComposite.getResourcePermission();
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setWidth100();
+
+ toolStrip.addMember(new LayoutSpacer());
+
+ this.saveButton = new LocatableIButton(this.extendLocatorId("Save"),
"Save");
+ this.saveButton.setTooltip("Update the connection settings of all group
members.");
+ this.saveButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ save();
+ }
+ });
+ toolStrip.addMember(saveButton);
+
+ addMember(toolStrip);
+ refresh();
+
+ if (!this.resourcePermission.isInventory()) {
+ Message message = new Message("You do not have permission to edit this
group's connection settings.",
+ Message.Severity.Info, EnumSet.of(Message.Option.Transient,
Message.Option.Sticky));
+ CoreGUI.getMessageCenter().notify(message);
+ }
+ }
+
+ @Override
+ public void refresh() {
+ this.saveButton.disable();
+ if (editor != null) {
+ editor.destroy();
+ removeMember(editor);
+ }
+ // TODO (ips): If editor != null, use editor.reload() instead.
+
+ loadConfigurationDefinition();
+ loadConfigurations();
+ }
+
+ private void initEditor() {
+ if (this.configurationDefinition != null && this.memberConfigurations !=
null) {
+ this.editor = new
GroupConfigurationEditor(this.extendLocatorId("Editor"),
this.configurationDefinition,
+ this.memberConfigurations);
+ this.editor.setOverflow(Overflow.AUTO);
+ this.editor.addPropertyValueChangeListener(this);
+ this.editor.setReadOnly(!this.resourcePermission.isConfigureWrite());
+ addMember(this.editor);
+ }
+ }
+
+ private void loadConfigurationDefinition() {
+ if (this.configurationDefinition == null) {
+ final ResourceType type = this.group.getResourceType();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[] {
type.getId() },
+
EnumSet.of(ResourceTypeRepository.MetadataType.pluginConfigurationDefinition),
+ new ResourceTypeRepository.TypesLoadedCallback() {
+ public void onTypesLoaded(Map<Integer, ResourceType> types) {
+ configurationDefinition =
types.get(type.getId()).getPluginConfigurationDefinition();
+ if (configurationDefinition == null) {
+ throw new IllegalStateException("Connection settings are
not supported by this group.");
+ }
+ initEditor();
+ }
+ });
+ }
+ }
+
+ private void loadConfigurations() {
+ this.memberConfigurations = null;
+ this.configurationService.findPluginConfigurationsForGroup(group.getId(), new
AsyncCallback<List<DisambiguationReport<ResourceConfigurationComposite>>>()
{
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to retrieve
member connection settings for " + group + ".", caught);
+ }
+
+ public void
onSuccess(List<DisambiguationReport<ResourceConfigurationComposite>> results)
{
+ memberConfigurations = new
ArrayList<GroupMemberConfiguration>(results.size());
+ for (DisambiguationReport<ResourceConfigurationComposite>
result : results) {
+ int resourceId = result.getOriginal().getResourceId();
+ String label =
ReportDecorator.decorateDisambiguationReport(result, resourceId, false);
+ Configuration configuration =
result.getOriginal().getConfiguration();
+ GroupMemberConfiguration memberConfiguration = new
GroupMemberConfiguration(resourceId, label,
+ configuration);
+ if (configuration == null ||
configuration.getProperties().isEmpty()) {
+ throw new RuntimeException("One or more null or
empty member connection settings was returned by the Server.");
+ }
+ memberConfigurations.add(memberConfiguration);
+ }
+ initEditor();
+ }
+ });
+ }
+
+ private void save() {
+ List<ResourceConfigurationComposite> resourceConfigurations =
convertToCompositeList();
+
GWTServiceLookup.getConfigurationService().updatePluginConfigurationsForGroup(this.group.getId(),
+ resourceConfigurations, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Connection settings
update failed for "
+ + group.getResourceType().getName() + " compatible group
'" + group.getName() + "'.", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Connection settings update initiated.",
+ "Connection settings update initiated for " +
group.getResourceType().getName()
+ + " compatible group '" + group.getName() +
"'.",
+ Message.Severity.Info));
+ refresh();
+ }
+ });
+ }
+
+ private List<ResourceConfigurationComposite> convertToCompositeList() {
+ List<ResourceConfigurationComposite> resourceConfigurations =
+ new
ArrayList<ResourceConfigurationComposite>(this.memberConfigurations.size());
+ for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
+ resourceConfigurations.add(new
ResourceConfigurationComposite(memberConfiguration.getId(),
+ memberConfiguration.getConfiguration()));
+ }
+ return resourceConfigurations;
+ }
+
+ @Override
+ public void propertyValueChanged(PropertyValueChangeEvent event) {
+ MessageCenter messageCenter = CoreGUI.getMessageCenter();
+ Message message;
+ if (event.isValidationStateChanged()) {
+ Set<String> invalidPropertyNames = event.getInvalidPropertyNames();
+ if (invalidPropertyNames.isEmpty()) {
+ this.saveButton.enable();
+ message = new Message("All properties have valid values, so the
connection settings can now be saved.",
+ Message.Severity.Info, EnumSet.of(Message.Option.Transient,
Message.Option.Sticky));
+ } else {
+ this.saveButton.disable();
+ message = new Message("The following properties have invalid values:
"
+ + invalidPropertyNames + ". The values must be corrected before
the connection settings can be saved.",
+ Message.Severity.Error, EnumSet.of(Message.Option.Transient,
Message.Option.Sticky));
+ }
+ messageCenter.notify(message);
+ } else {
+ this.saveButton.enable();
+ }
+ }
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
index 24ada45..62d2ede 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
@@ -188,9 +188,9 @@ public class RecentOperationsDataSource extends
//disambiguated Resource name, decorated with html anchors to problem
resources
record.setAttribute(resource,
ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL,
report.getResourceType(), report.getOriginal().getResourceName(),
report.getOriginal()
- .getResourceId()));
+ .getResourceId(), true));
//disambiguated resource lineage, decorated with html anchors
- record.setAttribute(location,
ReportDecorator.decorateResourceLineage(report.getParents()));
+ record.setAttribute(location,
ReportDecorator.decorateResourceLineage(report.getParents(), true));
//operation name.
record.setAttribute(operation, report.getOriginal().getOperationName());
//timestamp.
@@ -238,8 +238,8 @@ public class RecentOperationsDataSource extends
public ListGridRecord
copyValues(DisambiguationReport<ResourceOperationLastCompletedComposite> from) {
ListGridRecord record = new ListGridRecord();
record.setAttribute(resource,
ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL, from
- .getResourceType(), from.getOriginal().getResourceName(),
from.getOriginal().getResourceId()));
- record.setAttribute(location,
ReportDecorator.decorateResourceLineage(from.getParents()));
+ .getResourceType(), from.getOriginal().getResourceName(),
from.getOriginal().getResourceId(), true));
+ record.setAttribute(location,
ReportDecorator.decorateResourceLineage(from.getParents(), true));
record.setAttribute(operation, from.getOriginal().getOperationName());
record.setAttribute(time, from.getOriginal().getOperationStartTime());
record.setAttribute(status, generateResourceOperationStatusLink(from));
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/ScheduledOperationsDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/ScheduledOperationsDataSource.java
index ab28a8e..770dd0e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/ScheduledOperationsDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/ScheduledOperationsDataSource.java
@@ -181,9 +181,9 @@ public class ScheduledOperationsDataSource extends
//disambiguated Resource name, decorated with html anchors to problem
resources
record.setAttribute(resource,
ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL,
report.getResourceType(), report.getOriginal().getResourceName(),
report.getOriginal()
- .getResourceId()));
+ .getResourceId(), true));
//disambiguated resource lineage, decorated with html anchors
- record.setAttribute(location,
ReportDecorator.decorateResourceLineage(report.getParents()));
+ record.setAttribute(location,
ReportDecorator.decorateResourceLineage(report.getParents(), true));
//operation name.
record.setAttribute(operation, report.getOriginal().getOperationName());
//timestamp.
@@ -204,8 +204,8 @@ public class ScheduledOperationsDataSource extends
public ListGridRecord
copyValues(DisambiguationReport<ResourceOperationScheduleComposite> from) {
ListGridRecord record = new ListGridRecord();
record.setAttribute(resource,
ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL, from
- .getResourceType(), from.getOriginal().getResourceName(),
from.getOriginal().getResourceId()));
- record.setAttribute(location,
ReportDecorator.decorateResourceLineage(from.getParents()));
+ .getResourceType(), from.getOriginal().getResourceName(),
from.getOriginal().getResourceId(), true));
+ record.setAttribute(location,
ReportDecorator.decorateResourceLineage(from.getParents(), true));
record.setAttribute(operation, from.getOriginal().getOperationName());
record.setAttribute(time, from.getOriginal().getOperationNextFireTime());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
index e7c8050..9c0a84c 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/ProblemResourcesDataSource.java
@@ -178,9 +178,9 @@ public class ProblemResourcesDataSource extends
RPCDataSource<DisambiguationRepo
//disambiguated Resource name, decorated with html anchors to problem
resources
record.setAttribute(resource,
ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL,
report.getResourceType(), report.getOriginal().getResourceName(),
report.getOriginal()
- .getResourceId()));
+ .getResourceId(), true));
//disambiguated resource lineage, decorated with html anchors
- record.setAttribute(location,
ReportDecorator.decorateResourceLineage(report.getParents()));
+ record.setAttribute(location,
ReportDecorator.decorateResourceLineage(report.getParents(), true));
//alert cnt.
record.setAttribute(alerts, report.getOriginal().getNumAlerts());
//populate availability icon
@@ -200,8 +200,8 @@ public class ProblemResourcesDataSource extends
RPCDataSource<DisambiguationRepo
public ListGridRecord copyValues(DisambiguationReport<ProblemResourceComposite>
from) {
ListGridRecord record = new ListGridRecord();
record.setAttribute(resource,
ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL, from
- .getResourceType(), from.getOriginal().getResourceName(),
from.getOriginal().getResourceId()));
- record.setAttribute(location,
ReportDecorator.decorateResourceLineage(from.getParents()));
+ .getResourceType(), from.getOriginal().getResourceName(),
from.getOriginal().getResourceId(), true));
+ record.setAttribute(location,
ReportDecorator.decorateResourceLineage(from.getParents(), true));
record.setAttribute(alerts, from.getOriginal().getNumAlerts());
if (from.getOriginal().getAvailabilityType().compareTo(AvailabilityType.DOWN) ==
0) {
record.setAttribute(available,
"/images/icons/availability_red_16.png");
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java
index e7ca4ff..30b68d7 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/resource/disambiguation/ReportDecorator.java
@@ -18,67 +18,103 @@ import
org.rhq.core.domain.resource.composite.DisambiguationReport.ResourceType;
public class ReportDecorator {
//TODO: pull value from more bookmarking/history definition
- public final static String GWT_RESOURCE_URL =
"/coregui/CoreGUI.html#Resource/";
- public final static String GWT_RECENT_OPERATION_URL =
"/coregui/CoreGUI.html#Operation/";
+ public final static String GWT_RESOURCE_URL = "#Resource/";
public static final String DEFAULT_SEPARATOR = " > ";
- /** Generates HTML label from DisambiguationReport data.
+ /**
+ * Generates HTML label that includes hyperlinks to each of the Resources in the
linage from a DisambiguationReport.
+ *
+ * @param disambiguationReport a disambiguation report
+ * @param resourceId the id of the Resource to which the disambiguation report
corresponds
+ * @param makeLink if true, the Resource name will be made into a link to go the
Resource
+ *
+ * @return the HTML label
+ */
+ public static String decorateDisambiguationReport(DisambiguationReport
disambiguationReport, int resourceId,
+ boolean makeLink) {
+ String parentsHtml = decorateResourceLineage(disambiguationReport.getParents(),
true);
+ String resourceHtml =
ReportDecorator.decorateResourceName(ReportDecorator.GWT_RESOURCE_URL,
+ disambiguationReport.getResourceType(), disambiguationReport.getName(),
resourceId, makeLink);
+ String label;
+ if (parentsHtml.length() >= 1) {
+ label = parentsHtml + ReportDecorator.DEFAULT_SEPARATOR + resourceHtml;
+ } else {
+ label = resourceHtml;
+ }
+ return label;
+ }
+
+ /**
+ * Generates HTML label from DisambiguationReport data.
*
- * @param ResourceType type. If !null, the ResourceType name is prepended to
result.
+ * @param type ResourceType - If !null, the ResourceType name is prepended to
result.
* @param resourceName Name of the element from report
* @param resourceId Id for resource
+ * @param makeLink if true, the Resource name will be made into a link to go the
Resource
+ *
* @return String of generated html for a ResourceName.
*/
- public static String decorateResourceName(String specificUrl, ResourceType type,
String resourceName, int resourceId) {
+ public static String decorateResourceName(String specificUrl, ResourceType type,
String resourceName,
+ int resourceId, boolean makeLink) {
String decorated = "";
if (type != null) {
decorated += type.getName();
-
if (type.getPlugin() != null) {
- decorated += " (" + type.getPlugin() + " plugin) ";
+ decorated += " (" + type.getPlugin() + " plugin)";
}
+ decorated += " ";
+ }
+
+ if (makeLink) {
+ decorated += "<a href=\"" + specificUrl + resourceId +
"\">";
+ }
+ decorated += resourceName;
+ if (makeLink) {
+ decorated += "</a>";
}
- decorated += " <a href=\"" + specificUrl + resourceId +
"\">" + resourceName + "</a>";
return decorated;
}
- /** Generates Html label of Resource Lineage for disambiguation.
+ /**
+ * Generates HTML label of Resource Lineage for disambiguation.
*
* @param parents ResourceLineage provided by DisambiguationReport.
+ * @param makeLink if true, the Resource name will be made into a link to go the
Resource
+ *
* @return String of generated html for ResourceLineage.
*/
- public static String decorateResourceLineage(List<Resource> parents) {
- StringBuffer decorated = new StringBuffer();
+ public static String decorateResourceLineage(List<Resource> parents, boolean
makeLink) {
+ StringBuilder decorated = new StringBuilder();
if (parents != null && parents.size() > 0) {
Iterator<DisambiguationReport.Resource> it = parents.iterator();
DisambiguationReport.Resource parent = it.next();
//generate first link
String parentUrl = ReportDecorator.decorateResourceName(GWT_RESOURCE_URL,
null, parent.getName(), parent
- .getId());
- decorated = writeResource(decorated, parentUrl, parent.getName(),
parent.getType());
+ .getId(), true);
+ decorated = writeResource(decorated, parentUrl, parent.getType());
while (it.hasNext()) {
decorated.append(DEFAULT_SEPARATOR);
parent = it.next();
decorated = writeResource(decorated,
ReportDecorator.decorateResourceName(GWT_RESOURCE_URL, null,
- parent.getName(), parent.getId()), parent.getName(),
parent.getType());
+ parent.getName(), parent.getId(), makeLink), parent.getType());
}
}
return decorated.toString();
}
- /** Appends resource lineage details with html anchors.
+ /**
+ * Appends resource lineage details with HTML anchors.
*
- * @param existing
+ * @param existing
* @param url
- * @param resourceName
* @param resourceType
* @return
*/
- private static StringBuffer writeResource(StringBuffer existing, String url, String
resourceName,
- DisambiguationReport.ResourceType resourceType) {
+ private static StringBuilder writeResource(StringBuilder existing, String url,
+ ResourceType resourceType) {
if (!resourceType.isSingleton()) {
existing.append(resourceType.getName()).append(" ");
commit fc09eea942a6d0bf1a6a8b176ec97346af1e62ea
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Oct 27 11:51:33 2010 -0400
Adding logic to parse CPUs into CPUs
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java
index a4dcad4..72e08c1 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java
@@ -82,8 +82,8 @@ public class StringUtils {
// Make sure to not insert spaces in the middle of acronyms or multi-digit
numbers.
if ((previousChar == ' ' && currentChar != ' ')
|| (Character.isDigit(currentChar) &&
!Character.isDigit(previousChar))
- || (Character.isUpperCase(currentChar) &&
- (i < (target.length() - 1)) &&
Character.isLowerCase(target.charAt(i + 1)))
+ || (Character.isUpperCase(currentChar) && (i <
(target.length() - 1)) &&
+ ((i + 1) < target.length() - 1) &&
Character.isLowerCase(target.charAt(i + 1)))
|| (Character.isUpperCase(currentChar) &&
Character.isLowerCase(previousChar))) {
// We're at the start of a new word.
appendWord(result, currentWord.toString());
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/util/StringUtilsTest.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/util/StringUtilsTest.java
index 42a0c84..e0c4e5d 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/util/StringUtilsTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/util/StringUtilsTest.java
@@ -28,7 +28,8 @@ import org.testng.annotations.Test;
*
* @author Ian Springer
*/
-public class StringUtilsTest {
+public class StringUtilsTest {
+
@Test
public void testDeCamelCase() {
testDeCamelCase("RedGreenBlue", "Red Green Blue");
@@ -39,6 +40,7 @@ public class StringUtilsTest {
testDeCamelCase("Blink182", "Blink 182");
testDeCamelCase("SimonAndGarfunkel", "Simon and Garfunkel");
testDeCamelCase("myURL", "My URL");
+ testDeCamelCase("CPUs", "CPUs");
}
private void testDeCamelCase(String input, String expectedResult) {
commit 7df5220ec506bb6d671706d44edf03c5956f9efc
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Oct 27 10:51:19 2010 -0400
Adding logic to handle strings like myURL
Previously myURL was getting parsed into MyURL but it should get parsed
into My URL. This commit adds the necessary logic.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java
index ec52b1e..a4dcad4 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java
@@ -83,7 +83,8 @@ public class StringUtils {
if ((previousChar == ' ' && currentChar != ' ')
|| (Character.isDigit(currentChar) &&
!Character.isDigit(previousChar))
|| (Character.isUpperCase(currentChar) &&
- (i < (target.length() - 1)) &&
Character.isLowerCase(target.charAt(i + 1)))) {
+ (i < (target.length() - 1)) &&
Character.isLowerCase(target.charAt(i + 1)))
+ || (Character.isUpperCase(currentChar) &&
Character.isLowerCase(previousChar))) {
// We're at the start of a new word.
appendWord(result, currentWord.toString());
currentWord = new StringBuilder();
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/util/StringUtilsTest.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/util/StringUtilsTest.java
index fde0c6b..42a0c84 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/util/StringUtilsTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/util/StringUtilsTest.java
@@ -38,6 +38,7 @@ public class StringUtilsTest {
testDeCamelCase("RHQServer", "RHQ Server");
testDeCamelCase("Blink182", "Blink 182");
testDeCamelCase("SimonAndGarfunkel", "Simon and Garfunkel");
+ testDeCamelCase("myURL", "My URL");
}
private void testDeCamelCase(String input, String expectedResult) {
commit 75e5b1b2a50369a4951cdc59c9b2deebe807ea8e
Merge: 3602a25... 6f81d33...
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Oct 27 14:56:14 2010 +0200
Merge branch 'master' of
ssh://git.fedorahosted.org/git/rhq/rhq
commit 6f81d33409dd1c2098ffc7ee7e35ee824d1a2026
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Oct 25 19:11:04 2010 -0400
favor direct attribute access instead of multiple maps to lookup icon/style
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/Message.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/Message.java
index a9e94c2..81f9882 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/Message.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/Message.java
@@ -38,7 +38,26 @@ public class Message {
// TODO: Add Debug severity?
public enum Severity {
- Info, Warning, Error, Fatal
+ Info("InfoBlock", "info/icn_info_blue.png"), //
+ Warning("WarnBlock", "info/icn_info_orange.png"), //
+ Error("ErrorBlock", "info/icn_info_red.png"), //
+ Fatal("FatalBlock", "info/icn_info_red.png");
+
+ private String style;
+ private String icon;
+
+ private Severity(String style, String icon) {
+ this.style = style;
+ this.icon = icon;
+ }
+
+ public String getStyle() {
+ return style;
+ }
+
+ public String getIcon() {
+ return icon;
+ }
};
public enum Option {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
index 04fceff..1f95a24 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageBar.java
@@ -19,9 +19,6 @@
*/
package org.rhq.enterprise.gui.coregui.client.util.message;
-import java.util.HashMap;
-import java.util.Map;
-
import com.google.gwt.user.client.Timer;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.Overflow;
@@ -40,21 +37,6 @@ public class MessageBar extends LocatableHLayout implements
MessageCenter.Messag
private static final String LOCATOR_ID = "MessageBar";
private static final int AUTO_HIDE_DELAY_MILLIS = 15000; // 15 seconds
- private static final Map<Message.Severity, String> SEVERITY_TO_STYLE_NAME_MAP =
new HashMap<Message.Severity, String>();
- static {
- SEVERITY_TO_STYLE_NAME_MAP.put(Message.Severity.Info, "InfoBlock");
- SEVERITY_TO_STYLE_NAME_MAP.put(Message.Severity.Warning, "WarnBlock");
- SEVERITY_TO_STYLE_NAME_MAP.put(Message.Severity.Error, "ErrorBlock");
- SEVERITY_TO_STYLE_NAME_MAP.put(Message.Severity.Fatal, "FatalBlock");
- }
-
- private static final Map<Message.Severity, String> SEVERITY_TO_ICON_MAP = new
HashMap<Message.Severity, String>();
- static {
- SEVERITY_TO_ICON_MAP.put(Message.Severity.Info,
"info/icn_info_blue.png");
- SEVERITY_TO_ICON_MAP.put(Message.Severity.Warning,
"info/icn_info_orange.png");
- SEVERITY_TO_ICON_MAP.put(Message.Severity.Error,
"info/icn_info_red.png");
- }
-
private Label label;
private Message stickyMessage;
@@ -89,7 +71,7 @@ public class MessageBar extends LocatableHLayout implements
MessageCenter.Messag
} else {
Timer hideTimer = new Timer() {
@Override
- public void run() {
+ public void run() {
clearMessage(false);
if (stickyMessage != null) {
displayMessage(stickyMessage);
@@ -130,7 +112,7 @@ public class MessageBar extends LocatableHLayout implements
MessageCenter.Messag
label.setContents(contents);
label.setAlign(Alignment.CENTER);
- String styleName = (contents != null) ?
SEVERITY_TO_STYLE_NAME_MAP.get(message.getSeverity()) : null;
+ String styleName = (contents != null) ? message.getSeverity().getStyle() : null;
label.setStyleName(styleName);
label.setWidth(400);
@@ -139,7 +121,7 @@ public class MessageBar extends LocatableHLayout implements
MessageCenter.Messag
// label.
//label.setShowEdges(true);
- String icon = (contents != null) ?
SEVERITY_TO_ICON_MAP.get(message.getSeverity()) : null;
+ String icon = (contents != null) ? message.getSeverity().getIcon() : null;
label.setIcon(icon);
return label;
commit c6879b2c24e72b676ba4a7b512f3a14b988d8801
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Oct 25 19:10:13 2010 -0400
get rid of unused method
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index d61a308..a129b24 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -122,8 +122,8 @@ public abstract class RPCDataSource<T> extends DataSource {
if (request.getStartRow() == null || request.getEndRow() == null) {
pageControl = new PageControl();
} else {
- pageControl = PageControl.getExplicitPageControl(request.getStartRow(),
request.getEndRow()
- - request.getStartRow());
+ pageControl = PageControl.getExplicitPageControl(request.getStartRow(),
+ request.getEndRow() - request.getStartRow());
}
// Initialize sorting.
@@ -260,12 +260,8 @@ public abstract class RPCDataSource<T> extends DataSource {
return newRecord;
}
- public static <S> S[] getArrayFilter(DSRequest request, String paramName,
Class<S> type) {
- return getArrayFilter(request, paramName, type, null);
- }
-
@SuppressWarnings("unchecked")
- public static <S> S[] getArrayFilter(DSRequest request, String paramName,
Class<S> type, S[] dummy) {
+ public static <S> S[] getArrayFilter(DSRequest request, String paramName,
Class<S> type) {
com.allen_sauer.gwt.log.client.Log.debug("Fetching array " + paramName
+ " (" + type + ")");
Criteria criteria = request.getCriteria();
Map<String, Object> criteriaMap = criteria.getValues();
commit 3602a2549e5278591129f31effe1f6ed53ca8120
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Oct 25 10:03:57 2010 +0200
Small cleanup.
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
index 1c5bbb2..1c35c5f 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
@@ -77,7 +77,6 @@ public class AvailabilityInsertPurgeTest extends
AbstractEJB3PerformanceTest {
@BeforeMethod
public void beforeMethod() {
Date now = new Date();
- System.out.println(">>>>> beforeMethod (AI Purge Test) ===
" + now.getTime());
try {
this.availabilityManager = LookupUtil.getAvailabilityManager();
this.resourceManager = LookupUtil.getResourceManager();
@@ -109,7 +108,6 @@ public class AvailabilityInsertPurgeTest extends
AbstractEJB3PerformanceTest {
Subject overlord = LookupUtil.getSubjectManager().getOverlord();
Date now = new Date();
- System.out.println(">>>>>>> testAlternating (AI Purge
Test) === " + now.getTime());
EntityManager em = getEntityManager();
Query q = em.createQuery("SELECT r FROM Resource r");
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/EventsInsertPurgeTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/EventsInsertPurgeTest.java
index 0332905..1b62820 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/EventsInsertPurgeTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/EventsInsertPurgeTest.java
@@ -80,7 +80,6 @@ public class EventsInsertPurgeTest extends AbstractEJB3PerformanceTest
{
@BeforeMethod
public void beforeMethod() {
Date now = new Date();
- System.out.println(">>>>> beforeMethod (AI Purge Test) ===
" + now.getTime());
try {
this.availabilityManager = LookupUtil.getAvailabilityManager();
this.resourceManager = LookupUtil.getResourceManager();
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java
index 280db19..b38d934 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java
@@ -99,7 +99,6 @@ public class AbstractEJB3PerformanceTest extends AbstractEJB3Test {
@AfterMethod
protected void reportTimings(ITestResult result, Method meth) {
Date now = new Date();
- System.out.println(">>> after " + meth.getName() + "
(AbstraceEJB3PerformanceTest) === " + now.getTime());
printTimings(meth.getName());
diff --git
a/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/DatabaseSetupInterceptor.java
b/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/DatabaseSetupInterceptor.java
index d7f10ef..9efbdff 100644
---
a/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/DatabaseSetupInterceptor.java
+++
b/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/DatabaseSetupInterceptor.java
@@ -78,7 +78,6 @@ public class DatabaseSetupInterceptor implements IInvokedMethodListener
{
}
Date now = new Date();
- System.out.println(">> beforeInvocation(DBInterceptor) " +
method.getTestMethod().getMethodName() + " == " + now.getTime());
try {
@@ -133,7 +132,6 @@ public class DatabaseSetupInterceptor implements
IInvokedMethodListener {
}
Date now = new Date();
- System.out.println(">> afterInvocation(DBInterceptor) == " +
method.getTestMethod().getMethodName() + " === " + now.getTime()); //nothing to
do
try {
IDatabaseConnection connection = new DatabaseDataSourceConnection(new
InitialContext(),
commit e17fe828c93ecadae7cd07ca14ea643c15beac08
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Oct 23 11:58:59 2010 -0400
there was a bug in the resource type repo code such that
if we loaded a resource type in the cache already but the cache
did not load any metadata, the typeCacheLevel map did not
have the type in it, which causes the if-stmt to erroneously conclude
it did not have to add the type to the typesNeeded collection (the containsKey
resulted in false, meaning the else clause got invoked).
This commit changes the if-stmt to cover that additional edge case.
I added a comment above the if-stmt to indicate the three cases in
which we should be adding to the typesNeeded collection.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
index 1c01176..c998010 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
@@ -26,6 +26,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -160,8 +161,17 @@ public class ResourceTypeRepository {
});
}
- public void getResourceTypes(Integer[] resourceTypeIds, final
EnumSet<MetadataType> metadataTypes,
+ public void getResourceTypes(Integer[] resourceTypeIds, EnumSet<MetadataType>
metadataTypesNeeded,
final TypesLoadedCallback callback) {
+
+ // note metadataTypesNeeded == null implies EnumSet.noneOf(MetadataType.class)
+ final EnumSet<MetadataType> metadataTypes;
+ if (metadataTypesNeeded == null) {
+ metadataTypes = EnumSet.noneOf(MetadataType.class);
+ } else {
+ metadataTypes = metadataTypesNeeded;
+ }
+
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
final Map<Integer, ResourceType> cachedTypes = new HashMap<Integer,
ResourceType>();
@@ -172,9 +182,14 @@ public class ResourceTypeRepository {
} else {
for (Integer typeId : resourceTypeIds) {
- if (!typeCache.containsKey(typeId)
- || (metadataTypes != null &&
(typeCacheLevel.containsKey(typeId)) && !typeCacheLevel.get(typeId)
- .containsAll(metadataTypes))) {
+ // we need to query for data if:
+ // 1. we don't have the resource type in our cache at all, or...
+ // 2. we have the basic resource type but no additional metadata, but the
caller is asking for additional metadata
+ // 3. we have the resource type and some additional metadata, but the
caller is asking for metadata that we don't have
+ if (!typeCache.containsKey(typeId) // 1.
+ || (!metadataTypes.isEmpty() &&
(!typeCacheLevel.containsKey(typeId) // 2.
+ || !typeCacheLevel.get(typeId).containsAll(metadataTypes)))) // 3.
+ {
typesNeeded.add(typeId);
} else {
cachedTypes.put(typeId, typeCache.get(typeId));
@@ -193,41 +208,42 @@ public class ResourceTypeRepository {
if (metadataTypes != null) {
for (MetadataType metadataType : metadataTypes) {
switch (metadataType) {
- case children:
- criteria.fetchChildResourceTypes(true);
- break;
- case content:
- criteria.fetchPackageTypes(true);
- break;
- case events:
- criteria.fetchEventDefinitions(true);
- break;
- case measurements:
- criteria.fetchMetricDefinitions(true);
- break;
- case operations:
- criteria.fetchOperationDefinitions(true);
- break;
- case parentTypes:
- criteria.fetchParentResourceTypes(true);
- break;
- case pluginConfigurationDefinition:
- criteria.fetchPluginConfigurationDefinition(true);
- break;
- case processScans:
- criteria.fetchProcessScans(true);
- break;
- case productVersions:
- criteria.fetchProductVersions(true);
- break;
- case resourceConfigurationDefinition:
- criteria.fetchResourceConfigurationDefinition(true);
- break;
- case subCategory:
- criteria.fetchSubCategory(true);
- break;
- default:
- System.err.println("ERROR: metadataType " +
metadataType.name() + " not incorporated into ResourceType criteria.");
+ case children:
+ criteria.fetchChildResourceTypes(true);
+ break;
+ case content:
+ criteria.fetchPackageTypes(true);
+ break;
+ case events:
+ criteria.fetchEventDefinitions(true);
+ break;
+ case measurements:
+ criteria.fetchMetricDefinitions(true);
+ break;
+ case operations:
+ criteria.fetchOperationDefinitions(true);
+ break;
+ case parentTypes:
+ criteria.fetchParentResourceTypes(true);
+ break;
+ case pluginConfigurationDefinition:
+ criteria.fetchPluginConfigurationDefinition(true);
+ break;
+ case processScans:
+ criteria.fetchProcessScans(true);
+ break;
+ case productVersions:
+ criteria.fetchProductVersions(true);
+ break;
+ case resourceConfigurationDefinition:
+ criteria.fetchResourceConfigurationDefinition(true);
+ break;
+ case subCategory:
+ criteria.fetchSubCategory(true);
+ break;
+ default:
+ Log.error("ERROR: metadataType " + metadataType.name()
+ + " not incorporated into ResourceType criteria.");
}
}
}
@@ -249,43 +265,44 @@ public class ResourceTypeRepository {
if (metadataTypes != null) {
for (MetadataType metadataType : metadataTypes) {
switch (metadataType) {
- case children:
-
cachedType.setChildResourceTypes(type.getChildResourceTypes());
- break;
- case content:
-
cachedType.setPackageTypes(type.getPackageTypes());
- break;
- case events:
-
cachedType.setPackageTypes(type.getPackageTypes());
- break;
- case measurements:
-
cachedType.setMetricDefinitions(type.getMetricDefinitions());
- break;
- case operations:
-
cachedType.setOperationDefinitions(type.getOperationDefinitions());
- break;
- case parentTypes:
-
cachedType.setParentResourceTypes(type.getParentResourceTypes());
- break;
- case pluginConfigurationDefinition:
- cachedType
-
.setPluginConfigurationDefinition(type.getPluginConfigurationDefinition());
- break;
- case processScans:
-
cachedType.setProcessScans(type.getProcessScans());
- break;
- case productVersions:
-
cachedType.setProductVersions(type.getProductVersions());
- break;
- case resourceConfigurationDefinition:
-
cachedType.setResourceConfigurationDefinition(type
- .getResourceConfigurationDefinition());
- break;
- case subCategory:
-
cachedType.setSubCategory(type.getSubCategory());
- break;
- default:
- System.err.println("ERROR: metadataType
" + metadataType.name() + " not merged into cached ResourceType.");
+ case children:
+
cachedType.setChildResourceTypes(type.getChildResourceTypes());
+ break;
+ case content:
+ cachedType.setPackageTypes(type.getPackageTypes());
+ break;
+ case events:
+ cachedType.setPackageTypes(type.getPackageTypes());
+ break;
+ case measurements:
+
cachedType.setMetricDefinitions(type.getMetricDefinitions());
+ break;
+ case operations:
+
cachedType.setOperationDefinitions(type.getOperationDefinitions());
+ break;
+ case parentTypes:
+
cachedType.setParentResourceTypes(type.getParentResourceTypes());
+ break;
+ case pluginConfigurationDefinition:
+ cachedType
+
.setPluginConfigurationDefinition(type.getPluginConfigurationDefinition());
+ break;
+ case processScans:
+ cachedType.setProcessScans(type.getProcessScans());
+ break;
+ case productVersions:
+
cachedType.setProductVersions(type.getProductVersions());
+ break;
+ case resourceConfigurationDefinition:
+ cachedType.setResourceConfigurationDefinition(type
+ .getResourceConfigurationDefinition());
+ break;
+ case subCategory:
+ cachedType.setSubCategory(type.getSubCategory());
+ break;
+ default:
+ System.err.println("ERROR: metadataType " +
metadataType.name()
+ + " not merged into cached
ResourceType.");
}
}
}
@@ -295,7 +312,7 @@ public class ResourceTypeRepository {
cachedTypes.put(type.getId(), type);
}
- if (metadataTypes != null) {
+ if (metadataTypes != null && !metadataTypes.isEmpty()) {
if (typeCacheLevel.containsKey(type.getId())) {
typeCacheLevel.get(type.getId()).addAll(metadataTypes);
} else {
commit 3544cc5af47788cb6d7a1b23a82389e2abdd4578
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Oct 23 11:49:51 2010 -0400
add new alert template GWT service to support alert template modifications
complete the alert template component so it calls the new GWT service to manipulate
alert templates in the DB
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 f0916e2..3097982 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
@@ -78,6 +78,7 @@
<servlet path="/AlertGWTService"
class="org.rhq.enterprise.gui.coregui.server.gwt.AlertGWTServiceImpl"/>
<servlet path="/AlertDefinitionGWTService"
class="org.rhq.enterprise.gui.coregui.server.gwt.AlertDefinitionGWTServiceImpl"/>
+ <servlet path="/AlertTemplateGWTService"
class="org.rhq.enterprise.gui.coregui.server.gwt.AlertTemplateGWTServiceImpl"/>
<servlet path="/AuthorizationGWTService"
class="org.rhq.enterprise.gui.coregui.server.gwt.AuthorizationGWTServiceImpl"/>
<servlet path="/AvailabilityGWTService"
class="org.rhq.enterprise.gui.coregui.server.gwt.AvailabilityGWTServiceImpl"/>
<servlet path="/BundleGWTService"
class="org.rhq.enterprise.gui.coregui.server.gwt.BundleGWTServiceImpl"/>
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
index bd0a433..6e6c9c4 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
@@ -18,7 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.templates;
-import com.google.gwt.user.client.rpc.AsyncCallback;
+import java.util.Map;
+
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.SelectionStyle;
@@ -38,10 +39,8 @@ import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeGridField;
import com.smartgwt.client.widgets.tree.TreeNode;
-import org.rhq.core.domain.criteria.ResourceTypeCriteria;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
@@ -50,7 +49,8 @@ import org.rhq.enterprise.gui.coregui.client.ViewPath;
import
org.rhq.enterprise.gui.coregui.client.alert.definitions.TemplateAlertDefinitionsView;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import
org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import
org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository.TypesLoadedCallback;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -205,33 +205,20 @@ public class ResourceTypeTreeView extends LocatableVLayout
implements Bookmarkab
parentCanvas.markForRedraw();
}
- private void editAlertTemplate(final int resourceTypeId, final ViewPath viewPath) {
- ResourceTypeCriteria criteria = new ResourceTypeCriteria();
- criteria.addFilterId(resourceTypeId);
- // TODO we need to fetch some collections here
-
-
GWTServiceLookup.getResourceTypeGWTService().findResourceTypesByCriteria(criteria,
- new AsyncCallback<PageList<ResourceType>>() {
- @Override
- public void onSuccess(PageList<ResourceType> result) {
- if (result != null && result.size() == 1) {
- ResourceType rt = result.get(0);
- Layout alertCanvas = getAlertTemplateCanvas();
- String locatorId =
extendLocatorId("alertTemplateDef");
- TemplateAlertDefinitionsView def = new
TemplateAlertDefinitionsView(locatorId, rt);
- def.renderView(viewPath.next());
- prepareSubCanvas(alertCanvas, def, viewPath.isEnd()); //
don't show our back button if we are going to a template details pane which has its
own back button
- switchToCanvas(ResourceTypeTreeView.this, alertCanvas);
- } else {
- CoreGUI.getErrorHandler().handleError("Failed to get
resource type: " + resourceTypeId);
- }
- }
-
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Error getting resource
type: " + resourceTypeId, caught);
- }
- });
+ private void editAlertTemplate(int resourceTypeId, final ViewPath viewPath) {
+ final Integer[] idArray = new Integer[] { resourceTypeId };
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(idArray, new
TypesLoadedCallback() {
+ @Override
+ public void onTypesLoaded(Map<Integer, ResourceType> types) {
+ ResourceType rt = types.get(idArray[0]);
+ Layout alertCanvas = getAlertTemplateCanvas();
+ String locatorId = extendLocatorId("alertTemplateDef");
+ TemplateAlertDefinitionsView def = new
TemplateAlertDefinitionsView(locatorId, rt);
+ def.renderView(viewPath.next());
+ prepareSubCanvas(alertCanvas, def, viewPath.isEnd()); // don't show
our back button if we are going to a template details pane which has its own back button
+ switchToCanvas(ResourceTypeTreeView.this, alertCanvas);
+ }
+ });
}
private void editMetricTemplate(int resourceTypeId) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
index c26a8f9..ef91200 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
@@ -25,14 +25,18 @@ package org.rhq.enterprise.gui.coregui.client.alert.definitions;
import java.util.EnumSet;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import
org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import
org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository.MetadataType;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
/**
* @author John Mazzitelli
@@ -87,6 +91,16 @@ public class TemplateAlertDefinitionsView extends
AbstractAlertDefinitionsView {
}
@Override
+ public SingleAlertDefinitionView getDetailsView(int id) {
+ SingleAlertDefinitionView view = super.getDetailsView(id);
+ if (id == 0) {
+ // when creating a new alert def, make sure to set this in the new alert def
+ view.getAlertDefinition().setResourceType(resourceType);
+ }
+ return view;
+ }
+
+ @Override
protected boolean isAllowedToModifyAlertDefinitions() {
// TODO: see if user can modify template alerts
return true;
@@ -94,48 +108,122 @@ public class TemplateAlertDefinitionsView extends
AbstractAlertDefinitionsView {
@Override
protected void newButtonPressed(ListGridRecord[] selection) {
- // TODO Auto-generated method stub
- String str = "this is not implemented yet but you selected";
- for (ListGridRecord record : selection) {
- str += ": " + record.getAttribute("name");
- }
- SC.say(str);
+ newDetails();
}
@Override
protected void enableButtonPressed(ListGridRecord[] selection) {
- // TODO Auto-generated method stub
- String str = "this is not implemented yet but you selected";
+ if (selection.length == 0) {
+ return;
+ }
+
+ final Integer[] alertDefIds = new Integer[selection.length];
+ int i = 0;
for (ListGridRecord record : selection) {
- str += ": " + record.getAttribute("name");
+ Integer id =
record.getAttributeAsInt(AbstractAlertDefinitionsDataSource.FIELD_ID);
+ alertDefIds[i++] = id;
}
- SC.say(str);
+
+ GWTServiceLookup.getAlertTemplateService().enableAlertTemplates(alertDefIds, new
AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void v) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("[" + alertDefIds.length + "] alert
templates enabled.", Severity.Info));
+ TemplateAlertDefinitionsView.this.refresh();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to enable alert
templates", caught);
+ }
+ });
}
@Override
protected void disableButtonPressed(ListGridRecord[] selection) {
- // TODO Auto-generated method stub
- String str = "this is not implemented yet but you selected";
+ if (selection.length == 0) {
+ return;
+ }
+
+ final Integer[] alertDefIds = new Integer[selection.length];
+ int i = 0;
for (ListGridRecord record : selection) {
- str += ": " + record.getAttribute("name");
+ Integer id =
record.getAttributeAsInt(AbstractAlertDefinitionsDataSource.FIELD_ID);
+ alertDefIds[i++] = id;
}
- SC.say(str);
+
+ GWTServiceLookup.getAlertTemplateService().disableAlertTemplates(alertDefIds, new
AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void v) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("[" + alertDefIds.length + "] alert
templates disabled.", Severity.Info));
+ TemplateAlertDefinitionsView.this.refresh();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to disable alert
templates", caught);
+ }
+ });
}
@Override
protected void deleteButtonPressed(ListGridRecord[] selection) {
- // TODO Auto-generated method stub
- String str = "this is not implemented yet but you selected";
+ if (selection.length == 0) {
+ return;
+ }
+
+ final Integer[] alertDefIds = new Integer[selection.length];
+ int i = 0;
for (ListGridRecord record : selection) {
- str += ": " + record.getAttribute("name");
+ Integer id =
record.getAttributeAsInt(AbstractAlertDefinitionsDataSource.FIELD_ID);
+ alertDefIds[i++] = id;
}
- SC.say(str);
+
+ GWTServiceLookup.getAlertTemplateService().removeAlertTemplates(alertDefIds, new
AsyncCallback<Void>() {
+ @Override
+ public void onSuccess(Void v) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("[" + alertDefIds.length + "] alert
templates deleted.", Severity.Info));
+ TemplateAlertDefinitionsView.this.refresh();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to delete alert
templates", caught);
+ }
+ });
}
@Override
- protected void commitAlertDefinition(AlertDefinition alertDefinition) {
- // TODO call into server SLSB to store alert def
- // AlertTemplateManagerLocal alertTemplateManager =
LookupUtil.getAlertTemplateManager();
- // alertTemplateManager.updateAlertTemplate(subject, alertDef, true);
+ protected void commitAlertDefinition(final AlertDefinition alertDefinition) {
+ if (alertDefinition.getId() == 0) {
+
GWTServiceLookup.getAlertTemplateService().createAlertTemplate(alertDefinition,
+ Integer.valueOf(this.resourceType.getId()), new
AsyncCallback<Integer>() {
+ @Override
+ public void onSuccess(Integer result) {
+ CoreGUI.getMessageCenter().notify(new Message("Alert
template is created", Severity.Info));
+ alertDefinition.setId(result.intValue());
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to create
alert template.", caught);
+ }
+ });
+ } else {
+
GWTServiceLookup.getAlertTemplateService().updateAlertTemplate(alertDefinition, true,
+ new AsyncCallback<AlertDefinition>() {
+ @Override
+ public void onSuccess(AlertDefinition result) {
+ CoreGUI.getMessageCenter().notify(new Message("Alert
template is updated.", Severity.Info));
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update
alert template.", caught);
+ }
+ });
+ }
}
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertTemplateGWTService.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertTemplateGWTService.java
new file mode 100644
index 0000000..da8bf55
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertTemplateGWTService.java
@@ -0,0 +1,44 @@
+/*
+ * 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.gwt;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+import org.rhq.core.domain.alert.AlertDefinition;
+
+public interface AlertTemplateGWTService extends RemoteService {
+
+ int createAlertTemplate(AlertDefinition alertDefinition, Integer resourceTypeId)
throws Exception;
+
+ /**
+ * Updates a alert template definition.
+ *
+ * @param alertDefinition
+ * @param purgeInternals must be true if you are updating conditions or dampening
settings, can be false otherwise
+ * @return the updated definition
+ * @throws Exception
+ */
+ AlertDefinition updateAlertTemplate(AlertDefinition alertDefinition, boolean
purgeInternals) throws Exception;
+
+ void enableAlertTemplates(Integer[] alertDefinitionIds) throws Exception;
+
+ void disableAlertTemplates(Integer[] alertDefinitionIds) throws Exception;
+
+ void removeAlertTemplates(Integer[] alertDefinitionIds) throws Exception;
+}
\ No newline at end of file
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 92fc25d..67218c5 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
@@ -41,6 +41,10 @@ public class GWTServiceLookup {
return secure(AlertDefinitionGWTServiceAsync.Util.getInstance());
}
+ public static AlertTemplateGWTServiceAsync getAlertTemplateService() {
+ return secure(AlertTemplateGWTServiceAsync.Util.getInstance());
+ }
+
public static GroupAlertDefinitionGWTServiceAsync getGroupAlertDefinitionService() {
return secure(GroupAlertDefinitionGWTServiceAsync.Util.getInstance());
}
@@ -169,7 +173,7 @@ public class GWTServiceLookup {
Log.debug("SessionRpcRequestBuilder is adding sessionId to request:
" + sessionId);
rb.setHeader(UserSessionManager.SESSION_NAME, sessionId);
} else {
- Log.error("SessionRpcRequestBuilder constructed without a value for
" + UserSessionManager.SESSION_NAME);
+ Log.error("SessionRpcRequestBuilder built without a value for "
+ UserSessionManager.SESSION_NAME);
}
return rb;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertTemplateGWTServiceImpl.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertTemplateGWTServiceImpl.java
new file mode 100644
index 0000000..55a24e3
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertTemplateGWTServiceImpl.java
@@ -0,0 +1,85 @@
+/*
+ * 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.server.gwt;
+
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.util.exception.ThrowableUtil;
+import org.rhq.enterprise.gui.coregui.client.gwt.AlertTemplateGWTService;
+import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
+import org.rhq.enterprise.server.alert.AlertTemplateManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+public class AlertTemplateGWTServiceImpl extends AbstractGWTServiceImpl implements
AlertTemplateGWTService {
+ private static final long serialVersionUID = 1L;
+
+ private AlertTemplateManagerLocal alertTemplateManager =
LookupUtil.getAlertTemplateManager();
+
+ @Override
+ public int createAlertTemplate(AlertDefinition alertDefinition, Integer
resourceTypeId) throws Exception {
+ try {
+ int results = alertTemplateManager
+ .createAlertTemplate(getSessionSubject(), alertDefinition,
resourceTypeId);
+ return results;
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+
+ @Override
+ public AlertDefinition updateAlertTemplate(AlertDefinition alertDefinition, boolean
purgeInternals)
+ throws Exception {
+ try {
+ AlertDefinition results =
alertTemplateManager.updateAlertTemplate(getSessionSubject(), alertDefinition,
+ purgeInternals);
+ return SerialUtility.prepare(results,
"AlertTemplateService.updateAlertTemplate");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+
+ @Override
+ public void enableAlertTemplates(Integer[] alertDefinitionIds) throws Exception {
+ try {
+ alertTemplateManager.enableAlertTemplates(getSessionSubject(),
alertDefinitionIds);
+ return;
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+
+ @Override
+ public void disableAlertTemplates(Integer[] alertDefinitionIds) throws Exception {
+ try {
+ alertTemplateManager.disableAlertTemplates(getSessionSubject(),
alertDefinitionIds);
+ return;
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+
+ @Override
+ public void removeAlertTemplates(Integer[] alertDefinitionIds) throws Exception {
+ try {
+ alertTemplateManager.removeAlertTemplates(getSessionSubject(),
alertDefinitionIds);
+ return;
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+}
\ No newline at end of file
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 40e7f16..1202124 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
@@ -49,6 +49,10 @@
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.AlertDefinitionGWTServiceImpl</servlet-class>
</servlet>
<servlet>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI
AlertTemplateGWTService</servlet-name>
+
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.AlertTemplateGWTServiceImpl</servlet-class>
+ </servlet>
+ <servlet>
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI
GroupAlertDefinitionGWTService</servlet-name>
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.GroupAlertDefinitionGWTServiceImpl</servlet-class>
</servlet>
@@ -159,6 +163,10 @@
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/AlertDefinitionGWTService</url-pattern>
</servlet-mapping>
<servlet-mapping>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI
AlertTemplateGWTService</servlet-name>
+
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/AlertTemplateGWTService</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI
GroupAlertDefinitionGWTService</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/GroupAlertDefinitionGWTService</url-pattern>
</servlet-mapping>
commit 2d314c765251509e6a0cf4f075a2f9fad4b8b3bd
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Oct 22 23:07:25 2010 -0400
add support for dynamic/open maps to group config editor; inform user that
viewing/editing of list properties is not currently supported for group configs
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index 163ff47..a46b8bb 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -128,7 +128,6 @@ import
org.rhq.core.domain.configuration.definition.constraint.IntegerRangeConst
import org.rhq.core.domain.configuration.definition.constraint.RegexConstraint;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.components.table.PropertyGrid;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import
org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -406,7 +405,7 @@ public class ConfigurationEditor extends LocatableVLayout {
protected VLayout buildStructuredPane() {
LocatableVLayout layout = new
LocatableVLayout(extendLocatorId("Structured"));
- List<PropertyGroupDefinition> definitions =
configurationDefinition.getGroupDefinitions();
+ List<PropertyGroupDefinition> groupDefinitions =
configurationDefinition.getGroupDefinitions();
final SectionStack sectionStack = new
LocatableSectionStack(layout.extendLocatorId("Sections"));
sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
@@ -415,11 +414,11 @@ public class ConfigurationEditor extends LocatableVLayout {
sectionStack.setScrollSectionIntoView(true);
sectionStack.setOverflow(Overflow.AUTO);
- if (configurationDefinition.getNonGroupedProperties().size() > 0) {
+ if (!configurationDefinition.getNonGroupedProperties().isEmpty()) {
sectionStack.addSection(buildGroupSection(layout.extendLocatorId("NoGroup"),
null));
}
- for (PropertyGroupDefinition definition : definitions) {
+ for (PropertyGroupDefinition definition : groupDefinitions) {
// com.allen_sauer.gwt.log.client.Log.info("building: "
+ definition.getDisplayName());
sectionStack.addSection(buildGroupSection(layout.extendLocatorId(definition.getName()),
definition));
}
@@ -527,15 +526,14 @@ public class ConfigurationEditor extends LocatableVLayout {
form.setColWidths(190, 28, 210);
List<FormItem> fields = new ArrayList<FormItem>();
- addItemsForPropertiesRecursively(locatorId, propertyDefinitions, propertyMap,
fields, firePropertyChangedEvents);
+ addItemsForPropertiesRecursively(locatorId, propertyDefinitions, propertyMap,
fields);
form.setFields(fields.toArray(new FormItem[fields.size()]));
return form;
}
private void addItemsForPropertiesRecursively(String locatorId,
Collection<PropertyDefinition> propertyDefinitions,
- AbstractPropertyMap propertyMap,
List<FormItem> fields,
- boolean firePropertyChangedEvents) {
+ AbstractPropertyMap propertyMap,
List<FormItem> fields) {
boolean odd = true;
List<PropertyDefinition> sortedPropertyDefinitions = new
ArrayList<PropertyDefinition>(propertyDefinitions);
Collections.sort(sortedPropertyDefinitions, new PropertyDefinitionComparator());
@@ -548,7 +546,7 @@ public class ConfigurationEditor extends LocatableVLayout {
}
}
addItemsForPropertyRecursively(locatorId + "_" +
propertyDefinition.getName(), propertyDefinition, property,
- odd, fields, firePropertyChangedEvents);
+ odd, fields);
odd = !odd;
}
}
@@ -556,7 +554,7 @@ public class ConfigurationEditor extends LocatableVLayout {
public void addItemsForPropertyRecursively(String locatorId, PropertyDefinition
propertyDefinition,
Property property,
boolean oddRow,
- List<FormItem> fields, final boolean
firePropertyChangedEvents) {
+ List<FormItem> fields) {
List<FormItem> fieldsForThisProperty;
if (propertyDefinition instanceof PropertyDefinitionSimple) {
@@ -640,8 +638,8 @@ public class ConfigurationEditor extends LocatableVLayout {
SpacerItem unsetItem = new SpacerItem();
fields.add(unsetItem);
- CanvasItem listOfSimplesItem = buildListOfSimplesField(locatorId,
propertyDefinitionList, propertyList,
- oddRow);
+ CanvasItem listOfSimplesItem = buildListOfSimplesField(locatorId,
propertyDefinitionList, propertyList
+ );
fields.add(listOfSimplesItem);
StaticTextItem descriptionItem = buildDescriptionField(propertyDefinition);
@@ -674,7 +672,7 @@ public class ConfigurationEditor extends LocatableVLayout {
return fields;
}
- private StaticTextItem buildNameItem(PropertyDefinition propertyDefinition) {
+ protected StaticTextItem buildNameItem(PropertyDefinition propertyDefinition) {
StaticTextItem nameItem = new StaticTextItem();
nameItem.setStartRow(true);
String title = "<b>"
@@ -693,9 +691,9 @@ public class ConfigurationEditor extends LocatableVLayout {
return descriptionItem;
}
- private void firePropertyChangedEvent(Property property,
- PropertyDefinition propertyDefinition,
- boolean isValid) {
+ protected void firePropertyChangedEvent(Property property,
+ PropertyDefinition propertyDefinition,
+ boolean isValid) {
boolean wasValidBefore = this.invalidPropertyNames.isEmpty();
Property topLevelProperty = getTopLevelProperty(property);
if (isValid) {
@@ -719,76 +717,31 @@ public class ConfigurationEditor extends LocatableVLayout {
private FormItem buildMapField(String parentLocatorId, PropertyDefinitionMap
propertyDefinitionMap,
final PropertyMap propertyMap) {
- Canvas canvas;
- Map<String, PropertyDefinition> memberPropertyDefinitions =
propertyDefinitionMap.getPropertyDefinitions();
String locatorId = parentLocatorId + "_" +
propertyDefinitionMap.getName();
- if (memberPropertyDefinitions == null || memberPropertyDefinitions.isEmpty()) {
- canvas = buildDynamicMapField(locatorId, propertyDefinitionMap,
propertyMap);
- } else {
- canvas = buildStaticMapField(locatorId, propertyDefinitionMap, propertyMap);
+ boolean isDynamic = isDynamic(propertyDefinitionMap);
+ if (isDynamic) {
+ PropertyDefinitionMap propertyDefinitionMapClone = new
PropertyDefinitionMap(propertyDefinitionMap.getName(),
+ propertyDefinitionMap.getDescription(),
propertyDefinitionMap.isRequired());
+
propertyDefinitionMapClone.setConfigurationDefinition(propertyDefinitionMap.getConfigurationDefinition());
+ addMemberPropertyDefinitionsToDynamicPropertyMap(propertyDefinitionMapClone,
propertyMap);
+ propertyDefinitionMap = propertyDefinitionMapClone;
}
- CanvasItem canvasItem = buildComplexPropertyField(canvas);
- canvasItem.setColSpan(3);
- canvasItem.setEndRow(true);
-
- return canvasItem;
- }
-
- private CanvasItem buildComplexPropertyField(Canvas canvas) {
- CanvasItem canvasItem = new CanvasItem();
- canvasItem.setCanvas(canvas);
- canvasItem.setShowTitle(false);
- return canvasItem;
- }
-
- private Canvas buildDynamicMapField(String parentLocatorId, PropertyDefinitionMap
propertyDefinitionMap,
- final PropertyMap propertyMap) {
- Log.debug("Building dynamic map field for " + propertyMap +
"...");
-
- // create the property grid
- final PropertyGrid propertyGrid = new PropertyGrid();
- propertyGrid.getNameField().setName("Name");
- propertyGrid.getValuesField().setName("Value");
-
- // create the editors
- Map<String, FormItem> editorsMap = new HashMap<String, FormItem>();
- TextItem textEditor = new TextItem();
- editorsMap.put("simpleText", textEditor);
-
- // set the editors and attribute name where to find the record type
- propertyGrid.setEditorsMap("fieldType", editorsMap);
+ VLayout layout = new VLayout();
- ListGridRecord[] records = new ListGridRecord[propertyMap.getMap().size()];
- int i = 0;
- for (Property prop : propertyMap.getMap().values()) {
- if (!(prop instanceof PropertySimple)) {
- Log.warn("Unsupported Configuration permutation: PropertyMap "
+ propertyMap
- + " contains non-simple member Property " + prop + " -
skipping...");
- continue;
- }
- PropertySimple propSimple = (PropertySimple)prop;
- ListGridRecord record = new ListGridRecord();
- String propertyName = prop.getName();
- record.setAttribute("Name", propertyName);
- String value = propSimple.getStringValue();
- record.setAttribute("Value", value);
- record.setAttribute("fieldType", "simpleText");
- records[i++] = record;
- }
- propertyGrid.setData(records);
-
- VLayout canvas = new VLayout();
- canvas.addMember(propertyGrid);
+ final PropertyDefinitionMap propertyDefinitionMapFinal = propertyDefinitionMap;
+ Canvas valuesCanvas = buildPropertiesForm(parentLocatorId,
propertyDefinitionMapFinal.getPropertyDefinitions().values(),
+ propertyMap, true);
+ layout.addMember(valuesCanvas);
- if (!isReadOnly(propertyDefinitionMap, propertyMap)) {
+ if (isDynamic && !isReadOnly(propertyDefinitionMap, propertyMap)) {
// Map is not read-only - add footer with New and Delete buttons to allow
user to add or remove members.
- ToolStrip footer = new ToolStrip();
- footer.setPadding(5);
- footer.setWidth100();
- footer.setMembersMargin(15);
- canvas.addMember(footer);
+ ToolStrip buttonBar = new ToolStrip();
+ buttonBar.setPadding(5);
+ buttonBar.setWidth100();
+ buttonBar.setMembersMargin(15);
+ layout.addMember(buttonBar);
- final IButton deleteButton = new
LocatableIButton(extendLocatorId(propertyMap.getName()), "Delete");
+ /*final IButton deleteButton = new
LocatableIButton(extendLocatorId(propertyMap.getName()), "Delete");
deleteButton.setDisabled(true);
deleteButton.addClickHandler(new
com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -815,7 +768,7 @@ public class ConfigurationEditor extends LocatableVLayout {
int count = propertyGrid.getSelection().length;
deleteButton.setDisabled(count < 1);
}
- });
+ });*/
final IButton newButton = new
LocatableIButton(extendLocatorId(propertyMap.getName()), "New");
newButton.addClickHandler(new
com.smartgwt.client.widgets.events.ClickHandler() {
@@ -829,16 +782,11 @@ public class ConfigurationEditor extends LocatableVLayout {
+ "', because the set already contains
a property with that name.",
Message.Severity.Error,
EnumSet.of(Message.Option.Transient)));
} else {
- propertyMap.put(new PropertySimple(propertyName,
null));
-
- ListGridRecord record = new ListGridRecord();
- record.setAttribute("Name", propertyName);
- record.setAttribute("Value", "");
- record.setAttribute("fieldType",
"simpleText");
+ PropertySimple memberPropertySimple = new
PropertySimple(propertyName, null);
+ addPropertyToDynamicMap(memberPropertySimple,
propertyMap);
+ firePropertyChangedEvent(propertyMap,
propertyDefinitionMapFinal, true);
- propertyGrid.addData(record);
- propertyGrid.focus();
- propertyGrid.enableSpecificEditor(record);
+ reload();
CoreGUI.getMessageCenter().notify(new
Message("Added property to the set.", EnumSet.of(
Message.Option.Transient)));
@@ -847,33 +795,103 @@ public class ConfigurationEditor extends LocatableVLayout {
});
}
});
- footer.addMember(newButton);
- }
+ buttonBar.addMember(newButton);
+
+ DynamicForm deleteForm = new DynamicForm();
+ deleteForm.setNumCols(3);
+ buttonBar.addMember(deleteForm);
+
+ final SelectItem selectItem = new SelectItem();
+
selectItem.setValueMap(propertyDefinitionMap.getPropertyDefinitions().keySet().toArray(
+ new String[propertyDefinitionMap.getPropertyDefinitions().size()]));
+ selectItem.setMultiple(true);
+ selectItem.setMultipleAppearance(MultipleAppearance.GRID);
+ selectItem.setTitle("Delete");
+
+ final ButtonItem okButtonItem = new ButtonItem();
+ okButtonItem.setTitle("OK");
+ okButtonItem.setDisabled(true);
+ okButtonItem.setEndRow(true);
+ okButtonItem.addClickHandler(new
com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
+ public void
onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) {
+ SC.confirm("Are you sure you want to delete the selected
properties from the set?", new BooleanCallback() {
+ @Override
+ public void execute(Boolean confirmed) {
+ if (confirmed) {
+ Object value = selectItem.getValue();
+ if (value != null) {
+ String stringValue = value.toString();
+ String[] memberPropertyNames =
stringValue.split(",");
+ for (final String memberPropertyName :
memberPropertyNames) {
+ PropertySimple memberPropertySimple =
propertyMap.getSimple(memberPropertyName);
+
removePropertyFromDynamicMap(memberPropertySimple);
+ firePropertyChangedEvent(propertyMap,
propertyDefinitionMapFinal, true);
+ }
+ }
- propertyGrid.addCellSavedHandler(new CellSavedHandler() {
- @Override
- public void onCellSaved(CellSavedEvent cellSavedEvent) {
- Record record = cellSavedEvent.getRecord();
- String propertyName = record.getAttribute("Name");
- PropertySimple prop = propertyMap.getSimple(propertyName);
- if (prop == null) {
- prop = new PropertySimple(propertyName, null);
- propertyMap.put(prop);
+ reload();
+ CoreGUI.getMessageCenter().notify(new
Message("Removed properties from the set.", EnumSet.of(
+ Message.Option.Transient)));
+ }
+ }
+ });
}
- String value = record.getAttribute("Value");
- prop.setStringValue(value);
- }
- });
+ });
- return canvas;
+ selectItem.addChangedHandler(new ChangedHandler() {
+ @Override
+ public void onChanged(ChangedEvent changedEvent) {
+ Object value = changedEvent.getValue();
+ if (value != null) {
+ String stringValue = value.toString();
+ String[] memberPropertyNames = stringValue.split(",");
+ okButtonItem.setDisabled(memberPropertyNames.length == 0);
+ }
+ }
+ });
+
+ deleteForm.setFields(selectItem, okButtonItem);
+ }
+
+ CanvasItem canvasItem = buildComplexPropertyField(layout);
+ canvasItem.setColSpan(3);
+ canvasItem.setEndRow(true);
+
+ return canvasItem;
}
- private Canvas buildStaticMapField(String parentLocatorId, PropertyDefinitionMap
propertyDefinitionMap,
- PropertyMap propertyMap) {
- Log.debug("Building static map field for " + propertyMap +
"...");
+ protected void addPropertyToDynamicMap(PropertySimple memberPropertySimple,
PropertyMap propertyMap) {
+ memberPropertySimple.setOverride(true);
+ propertyMap.put(memberPropertySimple);
+ }
- return buildPropertiesForm(parentLocatorId,
propertyDefinitionMap.getPropertyDefinitions().values(),
- propertyMap, true);
+ protected void removePropertyFromDynamicMap(PropertySimple propertySimple) {
+ PropertyMap parentMap = propertySimple.getParentMap();
+ parentMap.getMap().remove(propertySimple.getName());
+ }
+
+ private boolean isDynamic(PropertyDefinitionMap propertyDefinitionMap) {
+ Map<String, PropertyDefinition> memberPropertyDefinitions =
propertyDefinitionMap.getPropertyDefinitions();
+ return memberPropertyDefinitions == null || memberPropertyDefinitions.isEmpty();
+ }
+
+ private void addMemberPropertyDefinitionsToDynamicPropertyMap(PropertyDefinitionMap
propertyDefinitionMap,
+ PropertyMap
propertyMap) {
+ for (String propertyName : propertyMap.getMap().keySet()) {
+ PropertySimple memberPropertySimple = propertyMap.getSimple(propertyName);
+ if (memberPropertySimple != null) {
+ PropertyDefinitionSimple memberPropertyDefinitionSimple = new
PropertyDefinitionSimple(propertyName,
+ null, false, PropertySimpleType.STRING);
+ propertyDefinitionMap.put(memberPropertyDefinitionSimple);
+ }
+ }
+ }
+
+ private CanvasItem buildComplexPropertyField(Canvas canvas) {
+ CanvasItem canvasItem = new CanvasItem();
+ canvasItem.setCanvas(canvas);
+ canvasItem.setShowTitle(false);
+ return canvasItem;
}
private CanvasItem buildListOfMapsField(final String locatorId,
@@ -1064,7 +1082,7 @@ public class ConfigurationEditor extends LocatableVLayout {
}
private CanvasItem buildListOfSimplesField(String locatorId, final
PropertyDefinitionList propertyDefinitionList,
- final PropertyList propertyList, boolean
oddRow) {
+ final PropertyList propertyList) {
Log.debug("Building list-of-simples field for " + propertyList +
"...");
LocatableVLayout vLayout = new LocatableVLayout(locatorId);
@@ -1369,14 +1387,14 @@ public class ConfigurationEditor extends LocatableVLayout {
return currentProperty;
}
- protected FormItem buildUnsetItem(PropertyDefinitionSimple propertyDefinition, final
PropertySimple property,
+ protected FormItem buildUnsetItem(final PropertyDefinitionSimple
propertyDefinitionSimple, final PropertySimple propertySimple,
final FormItem valueItem) {
FormItem item;
- if (!propertyDefinition.isRequired()) {
+ if (!propertyDefinitionSimple.isRequired()) {
final CheckboxItem unsetItem = new CheckboxItem();
- boolean unset = isUnset(propertyDefinition, property);
+ boolean unset = isUnset(propertyDefinitionSimple, propertySimple);
unsetItem.setValue(unset);
- unsetItem.setDisabled(isReadOnly(propertyDefinition, property));
+ unsetItem.setDisabled(isReadOnly(propertyDefinitionSimple, propertySimple));
unsetItem.setShowLabel(false);
unsetItem.setShowTitle(false);
unsetItem.setLabelAsTitle(false);
@@ -1387,27 +1405,20 @@ public class ConfigurationEditor extends LocatableVLayout {
Boolean isUnset = (Boolean) changeEvent.getValue();
valueItem.setDisabled(isUnset);
if (isUnset) {
+ updatePropertySimpleValue(null, propertySimple,
propertyDefinitionSimple);
setValue(valueItem, null);
} else {
valueItem.focusInItem();
}
valueItem.redraw();
- property.setValue(valueItem.getValue());
- }
- });
-
-/*
- valueItem.addChangeHandler(new ChangeHandler() {
- public void onChange(ChangeEvent changeEvent) {
- Object value = changeEvent.getValue();
- unsetItem.setDisabled(value == null);
+ propertySimple.setValue(valueItem.getValue());
}
});
-*/
item = unsetItem;
} else {
item = new SpacerItem();
+ item.setShowTitle(false);
}
return item;
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
index c2e2eb7..f544ac6 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
@@ -53,6 +53,7 @@ import org.rhq.core.domain.configuration.PropertyMap;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionList;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -113,6 +114,26 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
}
@Override
+ protected List<FormItem> buildFieldsForPropertyList(String locatorId,
PropertyDefinition propertyDefinition,
+ boolean oddRow,
PropertyDefinitionList propertyDefinitionList,
+ PropertyDefinition
memberDefinition,
+ PropertyList propertyList) {
+ List<FormItem> fields = new ArrayList<FormItem>();
+
+ StaticTextItem nameItem = buildNameItem(propertyDefinition);
+ fields.add(nameItem);
+
+ StaticTextItem staticTextItem = new StaticTextItem();
+ staticTextItem.setShowTitle(false);
+ staticTextItem.setValue("List properties are not currently supported for
group configurations.");
+ staticTextItem.setColSpan(3);
+ staticTextItem.setEndRow(true);
+ fields.add(staticTextItem);
+
+ return fields;
+ }
+
+ @Override
protected FormItem buildSimpleField(final PropertyDefinitionSimple
propertyDefinitionSimple,
final PropertySimple propertySimple) {
final FormItem item = super.buildSimpleField(propertyDefinitionSimple,
propertySimple);
@@ -138,6 +159,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
return item;
}
+
private FormItemIcon buildEditMemberValuesIcon(final PropertyDefinitionSimple
propertyDefinitionSimple,
final PropertySimple propertySimple,
final FormItem dynamicItem) {
FormItemIcon icon = new FormItemIcon();
@@ -161,10 +183,9 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
private void updateMemberProperties(PropertyDefinitionSimple
propertyDefinitionSimple,
PropertySimple propertySimple, Object value
) {
- for (GroupMemberConfiguration memberConfiguration : memberConfigurations) {
+ for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
Configuration configuration = memberConfiguration.getConfiguration();
- PropertySimple memberPropertySimple =
- getPropertySimple(configuration, propertyDefinitionSimple, null);
+ PropertySimple memberPropertySimple =
(PropertySimple)getProperty(configuration, propertySimple, null);
memberPropertySimple.setValue(value);
}
}
@@ -173,7 +194,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
protected FormItem buildUnsetItem(final PropertyDefinitionSimple
propertyDefinitionSimple, final PropertySimple propertySimple,
final FormItem valueItem) {
final FormItem unsetItem = super.buildUnsetItem(propertyDefinitionSimple,
propertySimple, valueItem);
- if (!isHomogeneous(propertySimple) &&
isAggregateProperty(propertySimple)) {
+ if (unsetItem instanceof CheckboxItem && !isHomogeneous(propertySimple)
&& isAggregateProperty(propertySimple)) {
// non-homogeneous aggregate property (i.e. members have mixed values)
unsetItem.setValue(false);
unsetItem.setDisabled(true);
@@ -287,7 +308,8 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
memberItem.setDefaultValue(memberName);
items.add(memberItem);
Configuration configuration = memberConfiguration.getConfiguration();
- PropertySimple memberPropertySimple = getPropertySimple(configuration,
propertyDefinitionSimple, index);
+ PropertySimple memberPropertySimple =
+ (PropertySimple)getProperty(configuration, aggregatePropertySimple,
index);
FormItem valueItem = buildSimpleField(propertyDefinitionSimple,
memberPropertySimple);
valueItems.add(valueItem);
valueItemNameToPropertySimpleMap.put(valueItem.getName(),
memberPropertySimple);
@@ -303,12 +325,15 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
okButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
boolean valuesHomogeneous = true;
+ boolean isValid = true;
+
Object firstValue = valueItems.get(0).getValue();
for (FormItem valueItem : valueItems) {
Object value = valueItem.getValue();
if ((value != null && !value.equals(firstValue)) || (value ==
null && firstValue != null)) {
valuesHomogeneous = false;
}
+ isValid = isValid && valueItem.validate();
PropertySimple memberPropertySimple =
valueItemNameToPropertySimpleMap.get(valueItem.getName());
memberPropertySimple.setValue(value);
memberPropertySimple.setErrorMessage(null);
@@ -332,7 +357,6 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
aggregateValueItem.setDisabled(false);
aggregateStaticItem.hide();
-
} else {
aggregatePropertySimple.setValue(null);
aggregatePropertySimple.setOverride(false);
@@ -342,6 +366,8 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
aggregateStaticItem.show();
}
+ firePropertyChangedEvent(aggregatePropertySimple,
propertyDefinitionSimple, isValid);
+
membersForm.markForRedraw();
popup.destroy();
}
@@ -406,46 +432,79 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
// Update all the member properties.
for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
Configuration configuration = memberConfiguration.getConfiguration();
- PropertySimple memberPropertySimple =
- getPropertySimple(configuration, propertyDefinitionSimple, null);
+ PropertySimple memberPropertySimple =
(PropertySimple)getProperty(configuration, propertySimple, null);
memberPropertySimple.setErrorMessage(null);
memberPropertySimple.setValue(value);
}
}
- private PropertySimple getPropertySimple(Configuration configuration,
- PropertyDefinitionSimple
propertyDefinitionSimple,
- Integer index) {
- LinkedList<PropertyDefinition> propertyDefinitionHierarchy = new
LinkedList<PropertyDefinition>();
- PropertyDefinition currentPropertyDefinition = propertyDefinitionSimple;
- propertyDefinitionHierarchy.add(currentPropertyDefinition);
+ @Override
+ protected void removePropertyFromDynamicMap(PropertySimple propertySimple) {
+ // Remove the aggregate property.
+ super.removePropertyFromDynamicMap(propertySimple);
+
+ // Remove the member properties.
+ for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
+ Configuration configuration = memberConfiguration.getConfiguration();
+ PropertySimple memberPropertySimple =
(PropertySimple)getProperty(configuration, propertySimple, null);
+ PropertyMap parentMap = memberPropertySimple.getParentMap();
+ parentMap.getMap().remove(memberPropertySimple.getName());
+ }
+ }
+
+ @Override
+ protected void addPropertyToDynamicMap(PropertySimple propertySimple, PropertyMap
propertyMap) {
+ // Add the aggregate property.
+ super.addPropertyToDynamicMap(propertySimple, propertyMap);
+
+ // Add the member properties.
+ for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
+ Configuration configuration = memberConfiguration.getConfiguration();
+ // The below call will create the member property and add it to the
appropriate parent property in the member config.
+ PropertySimple memberPropertySimple =
(PropertySimple)getProperty(configuration, propertySimple, null);
+ }
+ }
+
+ private Property getProperty(Configuration configuration,
+ Property referenceProperty,
+ Integer index) {
+ LinkedList<Property> propertyHierarchy = new LinkedList<Property>();
+ Property currentProperty = referenceProperty;
+ propertyHierarchy.add(currentProperty);
do {
- if (currentPropertyDefinition.getParentPropertyMapDefinition() != null) {
- currentPropertyDefinition =
currentPropertyDefinition.getParentPropertyMapDefinition();
- } else if (currentPropertyDefinition.getParentPropertyListDefinition() !=
null) {
- currentPropertyDefinition =
currentPropertyDefinition.getParentPropertyListDefinition();
- } else if (currentPropertyDefinition.getConfigurationDefinition() == null) {
- throw new IllegalStateException(currentPropertyDefinition + " has no
parent.");
+ if (currentProperty.getParentMap() != null) {
+ currentProperty = currentProperty.getParentMap();
+ } else if (currentProperty.getParentList() != null) {
+ currentProperty = currentProperty.getParentList();
+ } else if (currentProperty.getConfiguration() == null) {
+ throw new IllegalStateException(currentProperty + " has no
parent.");
}
- propertyDefinitionHierarchy.addFirst(currentPropertyDefinition);
+ propertyHierarchy.addFirst(currentProperty);
}
- while (currentPropertyDefinition.getConfigurationDefinition() == null);
+ while (currentProperty.getConfiguration() == null);
- Property property =
configuration.get(propertyDefinitionHierarchy.get(0).getName());
- for (int i = 1, propertyDefinitionHierarchySize =
propertyDefinitionHierarchy.size();
- i < propertyDefinitionHierarchySize; i++) {
- PropertyDefinition propertyDefinition = propertyDefinitionHierarchy.get(i);
+ Property property = configuration.get(propertyHierarchy.get(0).getName());
+ for (int i = 1, propertyHierarchySize = propertyHierarchy.size(); i <
propertyHierarchySize; i++) {
+ String childPropertyName = propertyHierarchy.get(i).getName();
if (property instanceof PropertyMap) {
PropertyMap propertyMap = (PropertyMap)property;
- property = propertyMap.get(propertyDefinition.getName());
+ property = propertyMap.get(childPropertyName);
+ if (property == null) {
+ property = new PropertySimple(childPropertyName, null);
+ propertyMap.put(property);
+ }
} else if (property instanceof PropertyList) {
PropertyList propertyList = (PropertyList)property;
- property = propertyList.getList().get(index);
+ if (index < propertyList.getList().size()) {
+ property = propertyList.getList().get(index);
+ } else {
+ property = new PropertySimple(childPropertyName, null);
+ propertyList.add(property);
+ }
}
}
- PropertySimple propertySimple = (PropertySimple)property;
- return propertySimple;
+ return property;
}
private boolean isAggregateProperty(PropertySimple propertySimple) {
commit 3fb1547bb631a16537556ad15ea1cdceaf661c5d
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Oct 22 14:48:13 2010 -0400
fix the links on the summary counts portlet so they go to the correct views; fix bug
that was causing resource search list views from displaying
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java
index 0336a29..90c8bc1 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2010 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -20,13 +20,11 @@
* 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.dashboard.portlets.summary;
import java.util.ArrayList;
import java.util.List;
-import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.DynamicForm;
@@ -44,12 +42,10 @@ import
org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
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.ResourceBossGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
public class InventorySummaryView extends LocatableVLayout implements Portlet {
-
private ResourceBossGWTServiceAsync resourceBossService =
GWTServiceLookup.getResourceBossService();
private LocatableDynamicForm form;
@@ -76,30 +72,32 @@ public class InventorySummaryView extends LocatableVLayout implements
Portlet {
// formItems.add(headerItem);
StaticTextItem platformTotal =
createSummaryRow("platformTotal", "Platform Total", summary
- .getPlatformCount());
+ .getPlatformCount(), "Inventory/Resources/Platforms");
formItems.add(platformTotal);
- StaticTextItem serverTotal = createSummaryRow("serverTotal",
"Server Total", summary.getServerCount());
+ StaticTextItem serverTotal = createSummaryRow("serverTotal",
"Server Total", summary.getServerCount(),
+ "Inventory/Resources/Servers");
formItems.add(serverTotal);
StaticTextItem serviceTotal = createSummaryRow("serviceTotal",
"Service Total", summary
- .getServiceCount());
+ .getServiceCount(), "Inventory/Resources/Services");
formItems.add(serviceTotal);
StaticTextItem compatibleGroupTotal =
createSummaryRow("compatibleGroupTotal",
- "Compatible Group Total",
summary.getCompatibleGroupCount());
+ "Compatible Group Total",
summary.getCompatibleGroupCount(), "Inventory/Groups/CompatibleGroups");
formItems.add(compatibleGroupTotal);
StaticTextItem mixedGroupTotal =
createSummaryRow("mixedGroupTotal", "Mixed Group Total", summary
- .getMixedGroupCount());
+ .getMixedGroupCount(), "Inventory/Groups/MixedGroups");
formItems.add(mixedGroupTotal);
StaticTextItem groupDefinitionTotal =
createSummaryRow("groupDefinitionTotal",
- "Group Definition Total",
summary.getGroupDefinitionCount());
+ "Group Definition Total",
summary.getGroupDefinitionCount(), "Inventory/Groups/DynagroupManager");
formItems.add(groupDefinitionTotal);
StaticTextItem avergeMetricsTotal =
createSummaryRow("averageMetricsTotal",
- "Average Metrics per Minute",
summary.getScheduledMeasurementsPerMinute());
+ "Average Metrics per Minute",
summary.getScheduledMeasurementsPerMinute(),
+ null);
formItems.add(avergeMetricsTotal);
form.setItems(formItems.toArray(new FormItem[formItems.size()]));
@@ -110,16 +108,21 @@ public class InventorySummaryView extends LocatableVLayout
implements Portlet {
});
}
- private StaticTextItem createSummaryRow(String name, String label, int value) {
- final LinkItem item = new LinkItem(name);
+ private StaticTextItem createSummaryRow(String name, String label, int value, final
String viewPath) {
+ final StaticTextItem item;
+ if (viewPath != null) {
+ item = new LinkItem(name);
+ item.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ CoreGUI.goToView(viewPath);
+ }
+ });
+ } else {
+ item = new StaticTextItem(name);
+ }
+
item.setTitle(label);
item.setValue(value);
- item.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- // TODO Figure out to where the click events should be navigating
- History.newItem(InventoryView.VIEW_ID);
- }
- });
return item;
}
@@ -155,5 +158,4 @@ public class InventorySummaryView extends LocatableVLayout implements
Portlet {
return new InventorySummaryView(locatorId);
}
}
-
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
index e55d846..4702e21 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
@@ -51,7 +51,6 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
* @author Greg Hinkle
*/
public class ResourceDatasource extends RPCDataSource<Resource> {
-
private ResourceGWTServiceAsync resourceService =
GWTServiceLookup.getResourceService();
private static ResourceDatasource INSTANCE;
@@ -165,15 +164,15 @@ public class ResourceDatasource extends
RPCDataSource<Resource> {
record.setAttribute(DESCRIPTION.propertyName(), from.getDescription());
record.setAttribute(TYPE.propertyName(), from.getResourceType().getId());
record.setAttribute(PLUGIN.propertyName(), from.getResourceType().getPlugin());
- record.setAttribute(CATEGORY.propertyName(),
from.getResourceType().getCategory().getDisplayName());
+ record.setAttribute(CATEGORY.propertyName(),
from.getResourceType().getCategory().name());
record.setAttribute("icon",
from.getResourceType().getCategory().getDisplayName() + "_"
+ (from.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP
? "up" : "down") + "_16.png");
record
.setAttribute(
AVAILABILITY.propertyName(),
- from.getCurrentAvailability().getAvailabilityType() ==
AvailabilityType.UP ? "/images/icons/availability_green_16.png"
- : "/images/icons/availability_red_16.png");
+ from.getCurrentAvailability().getAvailabilityType() ==
AvailabilityType.UP ?
+ "/images/icons/availability_green_16.png" :
"/images/icons/availability_red_16.png");
return record;
}
commit f3abb55db3af3eb6a0e8674a332b54fc7d6c1c23
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Oct 22 12:08:53 2010 -0400
fix for StringUtils.deCamelCase(); stop using activeByDefault in root and core poms,
since it breaks intellij's maven plugin
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java
index 01a6ddb..ec52b1e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/util/StringUtils.java
@@ -79,11 +79,11 @@ public class StringUtils {
for (int i = 1; i < target.length(); i++) {
currentChar = target.charAt(i);
- // Make sure to insert spaces in the middle of acronyms or multi-digit
numbers.
+ // Make sure to not insert spaces in the middle of acronyms or multi-digit
numbers.
if ((previousChar == ' ' && currentChar != ' ')
|| (Character.isDigit(currentChar) &&
!Character.isDigit(previousChar))
- || (Character.isUpperCase(currentChar) &&
(!Character.isUpperCase(previousChar)
- || ((i < (target.length() - 1)) &&
Character.isLowerCase(target.charAt(i + 1)))))) {
+ || (Character.isUpperCase(currentChar) &&
+ (i < (target.length() - 1)) &&
Character.isLowerCase(target.charAt(i + 1)))) {
// We're at the start of a new word.
appendWord(result, currentWord.toString());
currentWord = new StringBuilder();
@@ -147,4 +147,4 @@ public class StringUtils {
return builder.toString();
}
-}
\ No newline at end of file
+}
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index 5853b59..f6f8289 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -37,7 +37,9 @@
<profile>
<id>default</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <property>
+ <name>java.home</name>
+ </property>
</activation>
<modules>
<module>util</module>
diff --git a/modules/pom.xml b/modules/pom.xml
index ef98301..c7b9224 100644
--- a/modules/pom.xml
+++ b/modules/pom.xml
@@ -22,7 +22,6 @@
</scm>
<properties>
- <scm.module.path>modules/</scm.module.path>
</properties>
<profiles>
@@ -30,7 +29,9 @@
<profile>
<id>default</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <property>
+ <name>java.home</name>
+ </property>
</activation>
<modules>
<module>core</module>
commit dd89c2f58af8a86d06ba171912a4a27387a386f5
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Oct 22 13:35:47 2010 -0400
quick-n-dirty - get metric template functionality back - this reuses the old jsp page.
will have to refactor later with a new GWT impl
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
index 340b8fc..bd0a433 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
@@ -23,7 +23,6 @@ import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.types.VisibilityMode;
-import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.ImgButton;
import com.smartgwt.client.widgets.events.ClickEvent;
@@ -49,6 +48,7 @@ import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import
org.rhq.enterprise.gui.coregui.client.alert.definitions.TemplateAlertDefinitionsView;
+import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
@@ -150,6 +150,7 @@ public class ResourceTypeTreeView extends LocatableVLayout implements
Bookmarkab
LocatableVLayout layout = new
LocatableVLayout(extendLocatorId("alertTemplateLayout"));
layout.setHeight100();
layout.setWidth100();
+ layout.setMargin(5);
this.alertTemplateCanvas = layout;
}
@@ -161,6 +162,7 @@ public class ResourceTypeTreeView extends LocatableVLayout implements
Bookmarkab
LocatableVLayout layout = new
LocatableVLayout(extendLocatorId("metricTemplateLayout"));
layout.setHeight100();
layout.setWidth100();
+ layout.setMargin(5);
this.metricTemplateCanvas = layout;
}
@@ -233,8 +235,12 @@ public class ResourceTypeTreeView extends LocatableVLayout implements
Bookmarkab
}
private void editMetricTemplate(int resourceTypeId) {
- //
http://localhost:7080/admin/platform/monitor/Config.do?nomenu=true&mo...
- SC.say("Metric Template : " + resourceTypeId);
+ // TODO: convert this to GWT
+ Layout metricCanvas = getMetricTemplateCanvas();
+ FullHTMLPane jspPage = new
FullHTMLPane("/admin/platform/monitor/Config.do?nomenu=true&mode=configure&id="
+ + resourceTypeId + "&type=" + resourceTypeId);
+ prepareSubCanvas(metricCanvas, jspPage, true);
+ switchToCanvas(ResourceTypeTreeView.this, metricCanvas);
}
public class CustomResourceTypeListGrid extends LocatableListGrid {
commit 2bf75b1f2f702f38df5fe3e6c694361f19d98f34
Merge: e874b2f... 7ad728b...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Oct 22 13:22:21 2010 -0400
Merge commit 'origin/master'
commit e874b2f1adca6feaafd946daa0f35e49197f7e9f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Oct 22 13:21:13 2010 -0400
get the admin view to correctly select the proper node when directly navigating to an
internal page via a direct URL.
also allow the user to reload the content when clicking an already selected node
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 2d854b3..b28f6a6 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
@@ -21,12 +21,11 @@ package org.rhq.enterprise.gui.coregui.client.admin;
import java.util.LinkedHashMap;
import java.util.Map;
-import com.google.gwt.user.client.History;
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.grid.events.CellClickEvent;
+import com.smartgwt.client.widgets.grid.events.CellClickHandler;
import com.smartgwt.client.widgets.layout.SectionStack;
import com.smartgwt.client.widgets.layout.SectionStackSection;
import com.smartgwt.client.widgets.tree.Tree;
@@ -107,20 +106,21 @@ public class AdministrationView extends LocatableHLayout implements
Bookmarkable
addMember(contentCanvas);
}
- private void addSection(TreeGrid treeGrid) {
+ private void addSection(final TreeGrid treeGrid) {
final String sectionName = treeGrid.getTree().getRoot().getName();
this.treeGrids.put(sectionName, treeGrid);
- treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (selectionEvent.getState()) {
- TreeNode node = (TreeNode) selectionEvent.getRecord();
- String pageName = node.getName();
+ treeGrid.addCellClickHandler(new CellClickHandler() {
+ @Override
+ public void onCellClick(CellClickEvent event) {
+ // we use cell click as opposed to selected changed handler
+ // because we want to be able to refresh even if clicking
+ // on an already selected node
+ TreeNode selectedRecord = (TreeNode) treeGrid.getSelectedRecord();
+ if (selectedRecord != null) {
+ String pageName = selectedRecord.getName();
String viewPath = AdministrationView.VIEW_ID + "/" +
sectionName + "/" + pageName;
- String currentViewPath = History.getToken();
- if (!currentViewPath.startsWith(viewPath)) {
- CoreGUI.goToView(viewPath);
- }
+ CoreGUI.goToView(viewPath);
}
}
});
@@ -276,12 +276,7 @@ public class AdministrationView extends LocatableHLayout implements
Bookmarkable
}
// when changing sections make sure the previous section's selection is
deselected
- for (String name : treeGrids.keySet()) {
- TreeGrid treeGrid = treeGrids.get(name);
- if (!name.equals(sectionName)) {
- treeGrid.deselectAllRecords();
- }
- }
+ selectSectionPageTreeGridNode(sectionName, pageName);
// ignore clicks on subsection folder nodes
if (null != content) {
@@ -308,6 +303,22 @@ public class AdministrationView extends LocatableHLayout implements
Bookmarkable
}
}
+ private void selectSectionPageTreeGridNode(String sectionName, String pageName) {
+ for (String name : treeGrids.keySet()) {
+ TreeGrid treeGrid = treeGrids.get(name);
+ if (!name.equals(sectionName)) {
+ treeGrid.deselectAllRecords();
+ } else {
+ TreeNode node = treeGrid.getTree().find(pageName);
+ if (node != null) {
+ treeGrid.selectSingleRecord(node);
+ } else {
+ CoreGUI.getErrorHandler().handleError("Unknown page name - URL
is incorrect");
+ }
+ }
+ }
+ }
+
private static String addQueryStringParam(String url, String param) {
char separatorChar = (url.indexOf('?') == -1) ? '?' :
'&';
return url + separatorChar + param;
commit 7ad728b11eed2b2cf1117510afdff6c4c4f0b2da
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Oct 22 12:20:11 2010 -0400
Fix issue with resource lists not rendering in debug mode. The issue was
that the ResourceDatsource was setting the listgrid category attribute
to the ResourceCategory object. In non-debug this seemed to render
just fine, using, I guess toString. But in debug it failed silently,
requiring specifically the name string to be set for the attribute.
Unrelated:
- Add support for singleton use of ResourceDatasource and use it for the
ResourceSearchView.
- Use ResourceDataField object where not used and use imports of these
objects where applicable ( just for cleaner code )
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index dab49e6..86f90bc 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -327,8 +327,8 @@ public class Table extends LocatableHLayout implements RefreshableView
{
public void onClick(ClickEvent clickEvent) {
if (tableAction.confirmMessage != null) {
- String message =
tableAction.confirmMessage.replaceAll("\\#",
- String.valueOf(listGrid.getSelection().length));
+ String message =
tableAction.confirmMessage.replaceAll("\\#", String.valueOf(listGrid
+ .getSelection().length));
SC.ask(message, new BooleanCallback() {
public void execute(Boolean confirmed) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
index c2c2e0e..e55d846 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
@@ -54,6 +54,15 @@ public class ResourceDatasource extends RPCDataSource<Resource>
{
private ResourceGWTServiceAsync resourceService =
GWTServiceLookup.getResourceService();
+ private static ResourceDatasource INSTANCE;
+
+ public static ResourceDatasource getInstance() {
+ if (INSTANCE == null) {
+ INSTANCE = new ResourceDatasource();
+ }
+ return INSTANCE;
+ }
+
public ResourceDatasource() {
super();
List<DataSourceField> fields = addDataSourceFields();
@@ -110,12 +119,18 @@ public class ResourceDatasource extends
RPCDataSource<Resource> {
}
public void onSuccess(PageList<Resource> result) {
-
dataRetrieved(result, response, request);
}
});
}
+ protected void dataRetrieved(PageList<Resource> result, DSResponse response,
DSRequest request) {
+ ListGridRecord[] records = buildRecords(result);
+ response.setData(records);
+ response.setTotalRows(result.getTotalSize()); // for paging to work we have to
specify size of full result set
+ processResponse(request.getRequestId(), response);
+ }
+
protected ResourceCriteria getFetchCriteria(final DSRequest request) {
ResourceCriteria criteria = new ResourceCriteria();
criteria.setPageControl(getPageControl(request));
@@ -136,13 +151,6 @@ public class ResourceDatasource extends RPCDataSource<Resource>
{
return criteria;
}
- protected void dataRetrieved(PageList<Resource> result, DSResponse response,
DSRequest request) {
- ListGridRecord[] records = buildRecords(result);
- response.setData(records);
- response.setTotalRows(result.getTotalSize()); // for paging to work we have to
specify size of full result set
- processResponse(request.getRequestId(), response);
- }
-
@Override
public Resource copyValues(ListGridRecord from) {
return new Resource(from.getAttributeAsInt("id"));
@@ -157,13 +165,13 @@ public class ResourceDatasource extends
RPCDataSource<Resource> {
record.setAttribute(DESCRIPTION.propertyName(), from.getDescription());
record.setAttribute(TYPE.propertyName(), from.getResourceType().getId());
record.setAttribute(PLUGIN.propertyName(), from.getResourceType().getPlugin());
- record.setAttribute(CATEGORY.propertyName(),
from.getResourceType().getCategory());
+ record.setAttribute(CATEGORY.propertyName(),
from.getResourceType().getCategory().getDisplayName());
record.setAttribute("icon",
from.getResourceType().getCategory().getDisplayName() + "_"
+ (from.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP
? "up" : "down") + "_16.png");
record
.setAttribute(
- "currentAvailability",
+ AVAILABILITY.propertyName(),
from.getCurrentAvailability().getAvailabilityType() ==
AvailabilityType.UP ? "/images/icons/availability_green_16.png"
: "/images/icons/availability_red_16.png");
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
index 82595af..f0154d3 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
@@ -18,6 +18,13 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.AVAILABILITY;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.CATEGORY;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.DESCRIPTION;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.NAME;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.PLUGIN;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.TYPE;
+
import java.util.ArrayList;
import java.util.List;
@@ -88,7 +95,7 @@ public class ResourceSearchView extends Table {
// searchPanel.setWrapItemTitles(false);
// searchPanel.setFields(searchBox);
- final ResourceDatasource datasource = new ResourceDatasource();
+ final ResourceDatasource datasource = ResourceDatasource.getInstance();
setDataSource(datasource);
}
@@ -99,8 +106,7 @@ public class ResourceSearchView extends Table {
iconField.setType(ListGridFieldType.IMAGE);
iconField.setImageURLPrefix("types/");
- ListGridField nameField = new
ListGridField(ResourceDataSourceField.NAME.propertyName(),
- ResourceDataSourceField.NAME.title(), 250);
+ ListGridField nameField = new ListGridField(NAME.propertyName(), NAME.title(),
250);
nameField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1)
{
return "<a href=\"" +
LinkManager.getResourceLink(listGridRecord.getAttributeAsInt("id")) +
"\">" + o
@@ -108,20 +114,15 @@ public class ResourceSearchView extends Table {
}
});
- ListGridField descriptionField = new
ListGridField(ResourceDataSourceField.DESCRIPTION.propertyName(),
- ResourceDataSourceField.DESCRIPTION.title());
+ ListGridField descriptionField = new ListGridField(DESCRIPTION.propertyName(),
DESCRIPTION.title());
- ListGridField typeNameField = new
ListGridField(ResourceDataSourceField.TYPE.propertyName(),
- ResourceDataSourceField.TYPE.title(), 130);
+ ListGridField typeNameField = new ListGridField(TYPE.propertyName(),
TYPE.title(), 130);
- ListGridField pluginNameField = new
ListGridField(ResourceDataSourceField.PLUGIN.propertyName(),
- ResourceDataSourceField.PLUGIN.title(), 100);
+ ListGridField pluginNameField = new ListGridField(PLUGIN.propertyName(),
PLUGIN.title(), 100);
- ListGridField categoryField = new
ListGridField(ResourceDataSourceField.CATEGORY.propertyName(),
- ResourceDataSourceField.CATEGORY.title(), 60);
+ ListGridField categoryField = new ListGridField(CATEGORY.propertyName(),
CATEGORY.title(), 60);
- ListGridField availabilityField = new
ListGridField(ResourceDataSourceField.AVAILABILITY.propertyName(),
- ResourceDataSourceField.AVAILABILITY.title(), 55);
+ ListGridField availabilityField = new ListGridField(AVAILABILITY.propertyName(),
AVAILABILITY.title(), 55);
availabilityField.setType(ListGridFieldType.IMAGE);
availabilityField.setAlign(Alignment.CENTER);
commit 0a979fb7c481d111dab06cdf06833bc5366fb9d4
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Oct 22 11:30:15 2010 -0400
this doesn't fix anything but it refactors it to look like what AdministrationView
code will look like.
because the authz check is async, the treeGrids collection isn't populated at the
time we need it. this should be fixed in the future
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
index d913229..5ade636 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
@@ -286,18 +286,8 @@ public class InventoryView extends LocatableHLayout implements
BookmarkableView
}
}
- for (String name : treeGrids.keySet()) {
- TreeGrid treeGrid = treeGrids.get(name);
- if (name.equals(sectionName)) {
- for (TreeNode node : treeGrid.getTree().getAllNodes()) {
- if (pageName.equals(node.getName())) {
- treeGrid.selectSingleRecord(node);
- }
- }
- } else {
- treeGrid.deselectAllRecords();
- }
- }
+ // when changing sections make sure the previous section's selection is
deselected
+ selectSectionPageTreeGridNode(sectionName, pageName);
// ignore clicks on subsection folder nodes
if (null != content) {
@@ -309,6 +299,28 @@ public class InventoryView extends LocatableHLayout implements
BookmarkableView
}
}
+ private void selectSectionPageTreeGridNode(String sectionName, String pageName) {
+ // TODO this method works, however, its getting invoked prior to treeGrids
getting populated due to async authz check. need to fix that
+ for (String name : treeGrids.keySet()) {
+ TreeGrid treeGrid = treeGrids.get(name);
+ if (!name.equals(sectionName)) {
+ treeGrid.deselectAllRecords();
+ } else {
+ boolean gotIt = false;
+ for (TreeNode node : treeGrid.getTree().getAllNodes()) {
+ if (node.getName().equals(pageName)) {
+ treeGrid.selectSingleRecord(node);
+ gotIt = true;
+ break;
+ }
+ }
+ if (!gotIt) {
+ CoreGUI.getErrorHandler().handleError("Unknown page name - URL
is incorrect");
+ }
+ }
+ }
+ }
+
public void renderView(ViewPath viewPath) {
if (!viewPath.isCurrent(currentSectionViewId) ||
!viewPath.isNext(currentPageViewId)) {
if (viewPath.isEnd()) {
commit b1200d28b0ac40586602ac469eaf239b84b11ea0
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Oct 22 15:54:25 2010 +0200
Put stuff into target/
diff --git
a/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/reporting/ExcelExporter.java
b/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/reporting/ExcelExporter.java
index 1314ce8..910670d 100644
---
a/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/reporting/ExcelExporter.java
+++
b/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/reporting/ExcelExporter.java
@@ -42,6 +42,7 @@ import java.util.TreeSet;
public class ExcelExporter implements PerformanceReportExporter {
private static final String DOT_XLS = ".xls";
+ static final String TARGET = "target/";
String baseFileName ;
PerformanceReporting.Rolling rolling;
CellStyle integerStyle;
@@ -49,7 +50,9 @@ public class ExcelExporter implements PerformanceReportExporter {
@Override
public void setBaseFile(String fileName) {
- baseFileName = fileName;
+ baseFileName = fileName;
+ if (baseFileName.startsWith(TARGET))
+ baseFileName = TARGET + baseFileName;
}
@Override
commit 548bcc3fc7e81012bed6d8bf38626c1679aa8430
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Oct 22 15:52:56 2010 +0200
Re-enable
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
index 44e61f5..1c5bbb2 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
@@ -57,7 +57,7 @@ import org.testng.annotations.Test;
* @author Heiko W. Rupp
* @author Lukas Krejci
*/
-@Test(groups = "PERF" , enabled = false)
+@Test(groups = "PERF" )
@Listeners({ DatabaseSetupInterceptor.class })
@PerformanceReporting(exporter=ExcelExporter.class)
@DatabaseState(url =
"perftest/AvailabilityInsertPurgeTest-testOne-data.xml.zip",
dbVersion="2.94")
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/EventsInsertPurgeTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/EventsInsertPurgeTest.java
index 3df95dd..0332905 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/EventsInsertPurgeTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/EventsInsertPurgeTest.java
@@ -57,7 +57,7 @@ import java.util.Set;
*
* @author Heiko W. Rupp
*/
-@Test(groups = "PERF", enabled = false)
+@Test(groups = "PERF")
@Listeners({ DatabaseSetupInterceptor.class })
@PerformanceReporting(exporter=ExcelExporter.class)
@DatabaseState(url =
"perftest/AvailabilityInsertPurgeTest-testOne-data.xml.zip",
dbVersion="2.94")
commit bd67b5b987759c5a1057f1b8371ed37923c724e8
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Oct 21 18:52:17 2010 -0400
preliminary work on getting the alert template window to show up.
this exposes some minor problems with AdministrationView that need to be fixed -
mainly dealing with attempting to go back to the main Configuration/Templates URL if we
are already showing it (e.g. clicking "Templates" while it is already selected
does nothing)
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 3888cdc..143045c 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
@@ -258,6 +258,11 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
}
public static void goToView(String viewPath) {
+ // if path starts with "#" (e.g. if caller used LinkManager to obtain
some of the path), strip it off
+ if (viewPath.charAt(0) == '#') {
+ viewPath = viewPath.substring(1);
+ }
+
String currentViewPath = History.getToken();
if (currentViewPath.equals(viewPath)) {
// We're already there - just refresh the view.
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 614ac1e..2d854b3 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
@@ -248,6 +248,7 @@ public class AdministrationView extends LocatableHLayout implements
Bookmarkable
url = "/admin/config/Config.do?mode=edit";
} else if (PAGE_TEMPLATES_VIEW_ID.equals(pageName)) {
content = new
ResourceTypeTreeView(this.extendLocatorId("Templates"));
+ currentPageViewId = null; // we always want to refresh, even if we
renavigate back
} else if (PAGE_DOWNLOADS_VIEW_ID.equals(pageName)) {
url = "/rhq/admin/downloads-body.xhtml";
} else if (PAGE_LICENSE_VIEW_ID.equals(pageName)) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
index ff50be7..340b8fc 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.templates;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.SelectionStyle;
@@ -31,13 +32,25 @@ 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.layout.HLayout;
+import com.smartgwt.client.widgets.layout.Layout;
import com.smartgwt.client.widgets.layout.SectionStack;
import com.smartgwt.client.widgets.layout.SectionStackSection;
import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeGridField;
import com.smartgwt.client.widgets.tree.TreeNode;
+import org.rhq.core.domain.criteria.ResourceTypeCriteria;
import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import
org.rhq.enterprise.gui.coregui.client.alert.definitions.TemplateAlertDefinitionsView;
+import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -46,61 +59,185 @@ import
org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
* @author Greg Hinkle
* @author John Mazzitelli
*/
-public class ResourceTypeTreeView extends LocatableVLayout {
+public class ResourceTypeTreeView extends LocatableVLayout implements BookmarkableView {
+
+ private Layout gridCanvas;
+ private Layout alertTemplateCanvas;
+ private Layout metricTemplateCanvas;
public ResourceTypeTreeView(String locatorId) {
super(locatorId);
setWidth100();
setHeight100();
+ }
+
+ @Override
+ public void renderView(ViewPath viewPath) {
+ if (viewPath.isEnd()) {
+ switchToCanvas(this, getGridCanvas());
+ } else {
+ // we must be asked to go to a specific resource type
+ // the path must be one of "Alert/#####" or
"Metric/#####"
+ // where ##### is a resource type ID
+ ViewId typeOfTemplatePath = viewPath.getCurrent();
+ final boolean isAlertTemplate; // true=alert template; false=metric template
+ if ("Alert".equals(typeOfTemplatePath.getPath())) {
+ isAlertTemplate = true;
+ } else if ("Metric".equals(typeOfTemplatePath.getPath())) {
+ isAlertTemplate = false;
+ } else {
+ CoreGUI.getErrorHandler().handleError(
+ "Invalid URL. Unknown template type: " +
typeOfTemplatePath.getPath());
+ return;
+ }
+
+ viewPath.next();
+ final int resourceTypeId;
+ try {
+ resourceTypeId = viewPath.getCurrentAsInt();
+ } catch (Exception e) {
+ CoreGUI.getErrorHandler().handleError("Invalid URL. Bad resource
type ID: " + viewPath.getCurrent());
+ return;
+ }
+
+ if (isAlertTemplate) {
+ editAlertTemplate(resourceTypeId, viewPath);
+ } else {
+ editMetricTemplate(resourceTypeId);
+ }
+ }
+ }
- SectionStack sectionStack = new SectionStack();
- sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
+ private Canvas getGridCanvas() {
+ if (this.gridCanvas == null) {
+ LocatableVLayout layout = new
LocatableVLayout(extendLocatorId("gridLayout"));
- ListGrid platformsList = new
CustomResourceTypeListGrid(extendLocatorId("platformsList"));
- SectionStackSection platforms = new SectionStackSection("Platforms");
- platforms.setExpanded(true);
- platforms.addItem(platformsList);
+ SectionStack sectionStack = new SectionStack();
+ sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
- ListGrid platformServicesList = new
CustomResourceTypeListGrid(extendLocatorId("platformServicesList"));
- SectionStackSection platformServices = new SectionStackSection("Platform
Services");
- platformServices.setExpanded(true);
- platformServices.addItem(platformServicesList);
+ ListGrid platformsList = new
CustomResourceTypeListGrid(extendLocatorId("platformsList"));
+ SectionStackSection platforms = new
SectionStackSection("Platforms");
+ platforms.setExpanded(true);
+ platforms.addItem(platformsList);
- TreeGrid serversTreeGrid = new
CustomResourceTypeTreeGrid(extendLocatorId("serversTree"));
- SectionStackSection servers = new SectionStackSection("Servers");
- servers.setExpanded(true);
- servers.addItem(serversTreeGrid);
+ ListGrid platformServicesList = new
CustomResourceTypeListGrid(extendLocatorId("platformServicesList"));
+ SectionStackSection platformServices = new SectionStackSection("Platform
Services");
+ platformServices.setExpanded(true);
+ platformServices.addItem(platformServicesList);
- sectionStack.addSection(platforms);
- sectionStack.addSection(platformServices);
- sectionStack.addSection(servers);
+ TreeGrid serversTreeGrid = new
CustomResourceTypeTreeGrid(extendLocatorId("serversTree"));
+ SectionStackSection servers = new SectionStackSection("Servers");
+ servers.setExpanded(true);
+ servers.addItem(serversTreeGrid);
- addMember(sectionStack);
+ sectionStack.addSection(platforms);
+ sectionStack.addSection(platformServices);
+ sectionStack.addSection(servers);
- new ResourceTypeTreeNodeBuilder(platformsList, platformServicesList,
serversTreeGrid);
+ layout.addMember(sectionStack);
+ this.gridCanvas = layout;
+
+ // this will asynchronously populate the grids with the appropriate data
+ new ResourceTypeTreeNodeBuilder(platformsList, platformServicesList,
serversTreeGrid);
+ }
+
+ return this.gridCanvas;
+ }
+
+ private Layout getAlertTemplateCanvas() {
+ if (this.alertTemplateCanvas == null) {
+ LocatableVLayout layout = new
LocatableVLayout(extendLocatorId("alertTemplateLayout"));
+ layout.setHeight100();
+ layout.setWidth100();
+ this.alertTemplateCanvas = layout;
+ }
+
+ return this.alertTemplateCanvas;
}
- private static void editAlertTemplate(Record record) {
- SC.say("Alert Template : " //
- + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_NAME)
- + "==>"
- + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN)
- + "==>"
- + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ private Layout getMetricTemplateCanvas() {
+ if (this.metricTemplateCanvas == null) {
+ LocatableVLayout layout = new
LocatableVLayout(extendLocatorId("metricTemplateLayout"));
+ layout.setHeight100();
+ layout.setWidth100();
+ this.metricTemplateCanvas = layout;
+ }
+
+ return this.metricTemplateCanvas;
}
- private static void editMetricTemplate(Record record) {
+ /**
+ * This will remove all members from the given parent canvas and then add
+ * the canvasToShow as the only member to the parent.
+ *
+ * @param parentCanvas parent to show the given canvas
+ * @param canvasToShow the canvas to show in the parent
+ */
+ private void switchToCanvas(Layout parentCanvas, Canvas canvasToShow) {
+ Canvas[] members = getMembers();
+ if (members != null) {
+ for (Canvas c : members) {
+ parentCanvas.removeMember(c);
+ }
+ }
+ parentCanvas.addMember(canvasToShow);
+ parentCanvas.markForRedraw();
+ }
+
+ private void prepareSubCanvas(Layout parentCanvas, Canvas canvasToShow, boolean
showBackButton) {
+ Canvas[] members = getMembers();
+ if (members != null) {
+ for (Canvas c : members) {
+ parentCanvas.removeMember(c);
+ c.destroy();
+ }
+ }
+
+ if (showBackButton) {
+ String backLink = LinkManager.getAdminTemplatesLink().substring(1); // strip
the #
+ BackButton backButton = new
BackButton(extendLocatorId("BackButton"), "Back to List", backLink);
+ parentCanvas.addMember(backButton);
+ }
+ parentCanvas.addMember(canvasToShow);
+ parentCanvas.markForRedraw();
+ }
+
+ private void editAlertTemplate(final int resourceTypeId, final ViewPath viewPath) {
+ ResourceTypeCriteria criteria = new ResourceTypeCriteria();
+ criteria.addFilterId(resourceTypeId);
+ // TODO we need to fetch some collections here
+
+
GWTServiceLookup.getResourceTypeGWTService().findResourceTypesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceType>>() {
+ @Override
+ public void onSuccess(PageList<ResourceType> result) {
+ if (result != null && result.size() == 1) {
+ ResourceType rt = result.get(0);
+ Layout alertCanvas = getAlertTemplateCanvas();
+ String locatorId =
extendLocatorId("alertTemplateDef");
+ TemplateAlertDefinitionsView def = new
TemplateAlertDefinitionsView(locatorId, rt);
+ def.renderView(viewPath.next());
+ prepareSubCanvas(alertCanvas, def, viewPath.isEnd()); //
don't show our back button if we are going to a template details pane which has its
own back button
+ switchToCanvas(ResourceTypeTreeView.this, alertCanvas);
+ } else {
+ CoreGUI.getErrorHandler().handleError("Failed to get
resource type: " + resourceTypeId);
+ }
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Error getting resource
type: " + resourceTypeId, caught);
+ }
+ });
+ }
+
+ private void editMetricTemplate(int resourceTypeId) {
//
http://localhost:7080/admin/platform/monitor/Config.do?nomenu=true&mo...
- SC.say("Metric Template: " //
- + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_NAME)
- + "==>"
- + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN)
- + "==>"
- + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ SC.say("Metric Template : " + resourceTypeId);
}
- public static class CustomResourceTypeListGrid extends LocatableListGrid {
+ public class CustomResourceTypeListGrid extends LocatableListGrid {
private HLayout rollOverCanvas;
private ListGridRecord rollOverRecord;
@@ -168,7 +305,7 @@ public class ResourceTypeTreeView extends LocatableVLayout {
metricTemplateImg.setWidth(16);
metricTemplateImg.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
- editMetricTemplate(rollOverRecord);
+ CoreGUI.goToView(LinkManager.getAdminTemplatesLink() +
"/Metric/" + getRollOverId());
}
});
@@ -183,7 +320,7 @@ public class ResourceTypeTreeView extends LocatableVLayout {
alertTemplateImg.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- editAlertTemplate(rollOverRecord);
+ CoreGUI.goToView(LinkManager.getAdminTemplatesLink() +
"/Alert/" + getRollOverId());
}
});
@@ -192,9 +329,13 @@ public class ResourceTypeTreeView extends LocatableVLayout {
}
return rollOverCanvas;
}
+
+ private int getRollOverId() {
+ return
Integer.parseInt(rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ }
}
- public static class CustomResourceTypeTreeGrid extends LocatableTreeGrid {
+ public class CustomResourceTypeTreeGrid extends LocatableTreeGrid {
private HLayout rollOverCanvas;
private ListGridRecord rollOverRecord;
@@ -260,7 +401,7 @@ public class ResourceTypeTreeView extends LocatableVLayout {
metricTemplateImg.setWidth(16);
metricTemplateImg.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
- editMetricTemplate(rollOverRecord);
+ CoreGUI.goToView(LinkManager.getAdminTemplatesLink() +
"/Metric/" + getRollOverId());
}
});
@@ -275,7 +416,7 @@ public class ResourceTypeTreeView extends LocatableVLayout {
alertTemplateImg.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- editAlertTemplate(rollOverRecord);
+ CoreGUI.goToView(LinkManager.getAdminTemplatesLink() +
"/Alert/" + getRollOverId());
}
});
@@ -285,6 +426,10 @@ public class ResourceTypeTreeView extends LocatableVLayout {
return rollOverCanvas;
}
+ private int getRollOverId() {
+ return
Integer.parseInt(rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ }
+
@Override
protected String getIcon(Record record, boolean defaultState) {
commit ad3a5abde7fa98bd78caebda87a88d4366bba2ca
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 21 16:33:01 2010 -0400
Fix Selecting from Bundle Tree
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 c795669..236f728 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
@@ -56,7 +56,7 @@ public class BundleTreeView extends LocatableTreeGrid {
addNodeClickHandler(new NodeClickHandler() {
public void onNodeClick(NodeClickEvent event) {
- String path =
event.getNode().getAttribute("id").replaceAll(":", "/");
+ String path =
event.getNode().getAttribute("id").replaceAll("_", "/");
History.newItem("Bundles/Bundle/" + path);
}
});
commit e81f607e26a3d8d260b2bc465e7fa771b0bd34ca
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 21 16:15:15 2010 -0400
Group Fixes
- Avoid NPE and save time by not constructing Group Alert Def subtab for
Mixed Group.
- Fix issue now preventing the user from navigating away from
Group->Inventory->Membership
- Fix Inventory compat and mixed group tree options to actually return the
desired group category
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 0295877..bcef904 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
@@ -45,6 +45,7 @@ import
org.rhq.enterprise.gui.coregui.client.alert.definitions.GroupAlertDefinit
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.components.tab.SubTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
+import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import
org.rhq.enterprise.gui.coregui.client.inventory.common.detail.AbstractTwoLevelTabSetView;
import
org.rhq.enterprise.gui.coregui.client.inventory.common.event.EventCompositeHistoryView;
@@ -107,16 +108,28 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
@Override
public Integer getSelectedItemId() {
+ return this.groupId;
+ }
+
+ @Override
+ public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
// if moving from membership subtab then re-load the detail view as the
membership and
// group type may have changed.
- if (this.inventoryTab.getTitle().equals(currentTab)
+ if ((null != this.groupId) &&
this.inventoryTab.getTitle().equals(currentTab)
&& this.inventoryMembership.getTitle().equals(currentSubTab)) {
+
+ String tabPath = "/" + tabSelectedEvent.getId() + "/" +
tabSelectedEvent.getSubTabId();
+ String path = this.getBaseViewPath() + "/" + getSelectedItemId() +
tabPath;
+
this.currentTab = null;
this.currentSubTab = null;
this.groupId = null;
- }
- return this.groupId;
+ CoreGUI.goToView(path);
+
+ } else {
+ super.onTabSelected(tabSelectedEvent);
+ }
}
@Override
@@ -202,8 +215,8 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
// summaryTab.updateSubTab("Overview", new
DashboardView(resource));
// summaryTab.updateSubTab("Timeline", timelinePane);
// Summary tab is always visible and enabled.
- updateSubTab(this.summaryTab, this.summaryOverview,
- new OverviewView(this.summaryTab.extendLocatorId("OverviewView"),
this.groupComposite), true, true);
+ updateSubTab(this.summaryTab, this.summaryOverview, new
OverviewView(this.summaryTab
+ .extendLocatorId("OverviewView"), this.groupComposite), true,
true);
if (updateTab(this.monitoringTab, groupCategory == GroupCategory.COMPATIBLE,
true)) {
visible = hasMetricsOfType(this.groupComposite, DataType.MEASUREMENT);
@@ -225,8 +238,8 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
}
// Inventory tab is always visible and enabled.
- updateSubTab(this.inventoryTab, this.inventoryMembers,
-
ResourceSearchView.getMembersOf(this.inventoryTab.extendLocatorId("MembersView"),
groupId), true, true);
+ updateSubTab(this.inventoryTab, this.inventoryMembers,
ResourceSearchView.getMembersOf(this.inventoryTab
+ .extendLocatorId("MembersView"), groupId), true, true);
// TODO: Uncomment this once the group config component is done.
//updateSubTab(this.inventoryTab, this.inventoryConn,
// new GroupPluginConfigurationEditView(this.group.getId(),
this.group.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin),
@@ -236,8 +249,8 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
groupId) : null;
updateSubTab(this.inventoryTab, this.inventoryMembership, canvas, true,
enabled);
- if (updateTab(this.operationsTab,
- groupCategory == GroupCategory.COMPATIBLE &&
facets.contains(ResourceTypeFacet.OPERATION), true)) {
+ if (updateTab(this.operationsTab, groupCategory == GroupCategory.COMPATIBLE
+ && facets.contains(ResourceTypeFacet.OPERATION), true)) {
updateSubTab(this.operationsTab, this.opHistory, new FullHTMLPane(
"/rhq/group/operation/groupOperationHistory-plain.xhtml?groupId=" + groupId),
true, true);
updateSubTab(this.operationsTab, this.opSched, new FullHTMLPane(
@@ -249,9 +262,10 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
// alert history is always available
updateSubTab(this.alertsTab, this.alertHistory,
GroupAlertHistoryView.get(groupComposite), true, true);
// but alert definitions can only be created on compatible groups
- updateSubTab(this.alertsTab, this.alertDef,
- new
GroupAlertDefinitionsView(alertsTab.extendLocatorId("AlertDefView"),
this.groupComposite),
- groupCategory == GroupCategory.COMPATIBLE, true);
+ visible = (groupCategory == GroupCategory.COMPATIBLE);
+ canvas = (visible) ? new
GroupAlertDefinitionsView(alertsTab.extendLocatorId("AlertDefView"),
+ this.groupComposite) : null;
+ updateSubTab(this.alertsTab, this.alertDef, canvas, visible, true);
}
visible = groupCategory == GroupCategory.COMPATIBLE &&
facets.contains(ResourceTypeFacet.CONFIGURATION);
@@ -263,13 +277,12 @@ public class ResourceGroupDetailView extends
AbstractTwoLevelTabSetView<Resource
updateSubTab(this.configurationTab, this.configHistory, new FullHTMLPane(
"/rhq/group/configuration/history-plain.xhtml?groupId=" +
groupId), true, true);
}
-
- visible = groupCategory == GroupCategory.MIXED || // allow mixed groups to show
events from supporting resources
- (groupCategory == GroupCategory.COMPATIBLE &&
facets.contains(ResourceTypeFacet.EVENT));
+ // allow mixed groups to show events from supporting resources
+ visible = groupCategory == GroupCategory.MIXED
+ || (groupCategory == GroupCategory.COMPATIBLE &&
facets.contains(ResourceTypeFacet.EVENT));
if (updateTab(this.eventsTab, visible, true)) {
- updateSubTab(this.eventsTab, this.eventHistory,
-
EventCompositeHistoryView.get(this.eventsTab.extendLocatorId("CompositeHistView"),
groupComposite),
- true, true);
+ updateSubTab(this.eventsTab, this.eventHistory,
EventCompositeHistoryView.get(this.eventsTab
+ .extendLocatorId("CompositeHistView"), groupComposite), true,
true);
}
this.show();
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
index dee71d2..d913229 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
@@ -46,6 +46,7 @@ import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.tree.EnhancedTreeNode;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupListView;
import
org.rhq.enterprise.gui.coregui.client.inventory.groups.definitions.GroupDefinitionListView;
import
org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.ResourceAutodiscoveryView;
@@ -265,11 +266,13 @@ public class InventoryView extends LocatableHLayout implements
BookmarkableView
}
} else if (GROUPS_SECTION_VIEW_ID.equals(sectionName)) {
if (PAGE_COMPATIBLE_GROUPS.equals(pageName)) {
- content = new
ResourceGroupListView(extendLocatorId("Compatible"), new
Criteria("category",
- GroupCategory.COMPATIBLE.name()), "Compatible Groups",
"types/Cluster_up_24.png");
+ content = new
ResourceGroupListView(extendLocatorId("Compatible"), new Criteria(
+ ResourceGroupDataSourceField.CATEGORY.propertyName(),
GroupCategory.COMPATIBLE.name()),
+ "Compatible Groups", "types/Cluster_up_24.png");
} else if (PAGE_MIXED_GROUPS.equals(pageName)) {
- content = new ResourceGroupListView(extendLocatorId("Mixed"),
new Criteria("category",
- GroupCategory.MIXED.name()), "Mixed Groups",
"types/Group_up_24.png");
+ content = new ResourceGroupListView(extendLocatorId("Mixed"),
new Criteria(
+ ResourceGroupDataSourceField.CATEGORY.propertyName(),
GroupCategory.MIXED.name()), "Mixed Groups",
+ "types/Group_up_24.png");
} else if (PAGE_GROUP_DEFINITIONS.equals(pageName)) {
content = new
GroupDefinitionListView(extendLocatorId("Definitions"),
"types/GroupDefinition_16.png");
} else if (PAGE_PROBLEM_GROUPS.equals(pageName)) {
commit 2a6f63978e077abb1bba6f81a7aee7e7b6e85b28
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 21 14:25:27 2010 -0400
- Fix issue with resource group list view using bad field name
-- Make better use of the datasource field enums
- add "id" to the resourcegroupcompositedatasource for display in debug
mode
- cosmetic, remove obsolete straggler defs of useDatasourceDefinedFields()
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java
index f783b4c..6e7e81e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/NotificationsAlertDefinitionForm.java
@@ -190,10 +190,6 @@ public class NotificationsAlertDefinitionForm extends
LocatableVLayout implement
}
@Override
- public void useDatasourceDefinedFields() {
- }
-
- @Override
public AlertNotification copyValues(ListGridRecord from) {
return (AlertNotification) from.getAttributeAsObject(FIELD_OBJECT);
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
index b2fea0a..cb338a7 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
@@ -19,7 +19,10 @@
package org.rhq.enterprise.gui.coregui.client.inventory.groups;
import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.CATEGORY;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.DESCRIPTION;
import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.NAME;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.PLUGIN;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.TYPE;
import java.util.List;
@@ -27,6 +30,7 @@ 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.DataSourceField;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.rpc.RPCResponse;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -68,21 +72,27 @@ public class ResourceGroupCompositeDataSource extends
RPCDataSource<ResourceGrou
protected List<DataSourceField> addDataSourceFields() {
List<DataSourceField> fields = super.addDataSourceFields();
- DataSourceTextField nameDataField = new DataSourceTextField("name",
"Name", 200);
+ DataSourceField idDataField = new DataSourceIntegerField("id",
"ID", 50);
+ idDataField.setPrimaryKey(true);
+ idDataField.setCanEdit(false);
+ fields.add(idDataField);
+
+ DataSourceTextField nameDataField = new DataSourceTextField(NAME.propertyName(),
NAME.title(), 200);
nameDataField.setCanEdit(false);
fields.add(nameDataField);
- DataSourceTextField descriptionDataField = new
DataSourceTextField("description", "Description");
+ DataSourceTextField descriptionDataField = new
DataSourceTextField(DESCRIPTION.propertyName(), DESCRIPTION
+ .title());
descriptionDataField.setCanEdit(false);
fields.add(descriptionDataField);
- DataSourceTextField typeNameDataField = new
DataSourceTextField("typeName", "Type");
+ DataSourceTextField typeNameDataField = new
DataSourceTextField(TYPE.propertyName(), TYPE.title());
fields.add(typeNameDataField);
- DataSourceTextField pluginNameDataField = new
DataSourceTextField("pluginName", "Plugin");
+ DataSourceTextField pluginNameDataField = new
DataSourceTextField(PLUGIN.propertyName(), PLUGIN.title());
fields.add(pluginNameDataField);
- DataSourceTextField categoryDataField = new
DataSourceTextField("category", "Category");
+ DataSourceTextField categoryDataField = new
DataSourceTextField(CATEGORY.propertyName(), CATEGORY.title());
fields.add(categoryDataField);
return fields;
@@ -123,10 +133,10 @@ public class ResourceGroupCompositeDataSource extends
RPCDataSource<ResourceGrou
@Override
public ResourceGroupComposite copyValues(ListGridRecord from) {
Integer idAttrib = from.getAttributeAsInt("id");
- String nameAttrib = from.getAttribute("name");
- String descriptionAttrib = from.getAttribute("description");
- String typeNameAttrib = from.getAttribute("typeName");
- String pluginNameAttrib = from.getAttribute("pluginName");
+ String nameAttrib = from.getAttribute(NAME.propertyName());
+ String descriptionAttrib = from.getAttribute(DESCRIPTION.propertyName());
+ String typeNameAttrib = from.getAttribute(TYPE.propertyName());
+ String pluginNameAttrib = from.getAttribute(PLUGIN.propertyName());
ResourceType rt = null;
ResourceGroup rg = new ResourceGroup(nameAttrib);
@@ -155,9 +165,9 @@ public class ResourceGroupCompositeDataSource extends
RPCDataSource<ResourceGrou
ListGridRecord record = new ListGridRecord();
record.setAttribute("group", from);
record.setAttribute("id", from.getResourceGroup().getId());
- record.setAttribute("name", from.getResourceGroup().getName());
- record.setAttribute("description",
from.getResourceGroup().getDescription());
- record.setAttribute("category",
from.getResourceGroup().getGroupCategory().name());
+ record.setAttribute(NAME.propertyName(), from.getResourceGroup().getName());
+ record.setAttribute(DESCRIPTION.propertyName(),
from.getResourceGroup().getDescription());
+ record.setAttribute(CATEGORY.propertyName(),
from.getResourceGroup().getGroupCategory().name());
record.setAttribute("explicitUp",
String.valueOf(from.getExplicitUp()));
record.setAttribute("explicitDown",
String.valueOf(from.getExplicitDown()));
@@ -169,8 +179,8 @@ public class ResourceGroupCompositeDataSource extends
RPCDataSource<ResourceGrou
if (from.getResourceGroup().getResourceType() != null) {
record.setAttribute("resourceType",
from.getResourceGroup().getResourceType());
- record.setAttribute("typeName",
from.getResourceGroup().getResourceType().getName());
- record.setAttribute("pluginName",
from.getResourceGroup().getResourceType().getPlugin());
+ record.setAttribute(TYPE.propertyName(),
from.getResourceGroup().getResourceType().getName());
+ record.setAttribute(PLUGIN.propertyName(),
from.getResourceGroup().getResourceType().getPlugin());
}
return record;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupDataSourceField.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupDataSourceField.java
index d7deadd..88ecdf6 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupDataSourceField.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupDataSourceField.java
@@ -35,7 +35,7 @@ public enum ResourceGroupDataSourceField {
PLUGIN("pluginName", "Plugin"),
- CATEGORY("category", "Category");
+ CATEGORY("groupCategory", "Category");
/**
* Corresponds to a property name of Resource
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
index 32aabb0..5aced32 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
@@ -18,6 +18,12 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.CATEGORY;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.DESCRIPTION;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.NAME;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.PLUGIN;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.TYPE;
+
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Alignment;
@@ -64,7 +70,7 @@ public class ResourceGroupListView extends Table {
@Override
protected void configureTable() {
- ListGridField nameField = new ListGridField("name", "Name",
300);
+ ListGridField nameField = new ListGridField(NAME.propertyName(), NAME.title(),
300);
nameField.setCellFormatter(new CellFormatter() {
public String format(Object value, ListGridRecord record, int i, int i1) {
String groupId = record.getAttribute("id");
@@ -73,10 +79,10 @@ public class ResourceGroupListView extends Table {
}
});
- ListGridField descriptionField = new ListGridField("description",
"Description");
- ListGridField typeNameField = new ListGridField("typeName",
"Type", 130);
- ListGridField pluginNameField = new ListGridField("pluginName",
"Plugin", 100);
- ListGridField categoryField = new ListGridField("category",
"Category", 100);
+ ListGridField descriptionField = new ListGridField(DESCRIPTION.propertyName(),
DESCRIPTION.title());
+ ListGridField typeNameField = new ListGridField(TYPE.propertyName(),
TYPE.title(), 130);
+ ListGridField pluginNameField = new ListGridField(PLUGIN.propertyName(),
PLUGIN.title(), 100);
+ ListGridField categoryField = new ListGridField(CATEGORY.propertyName(),
CATEGORY.title(), 100);
ListGridField availabilityChildrenField = new
ListGridField("availabilityChildren", "Children", 100);
availabilityChildrenField.setWrap(false);
@@ -86,7 +92,7 @@ public class ResourceGroupListView extends Table {
availabilityDescendantsField.setWrap(false);
availabilityDescendantsField.setAlign(Alignment.CENTER);
- getListGrid().setFields(nameField, descriptionField, typeNameField,
pluginNameField, categoryField,
+ setListGridFields(nameField, descriptionField, typeNameField, pluginNameField,
categoryField,
availabilityChildrenField, availabilityDescendantsField);
addTableAction(extendLocatorId("Delete"), "Delete",
Table.SelectionEnablement.ANY,
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
index 3f6e197..a862db6 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
@@ -19,7 +19,10 @@
package org.rhq.enterprise.gui.coregui.client.inventory.groups;
import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.CATEGORY;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.DESCRIPTION;
import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.NAME;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.PLUGIN;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.TYPE;
import java.util.List;
@@ -72,21 +75,22 @@ public class ResourceGroupsDataSource extends
RPCDataSource<ResourceGroup> {
idDataField.setPrimaryKey(true);
fields.add(idDataField);
- DataSourceTextField nameDataField = new DataSourceTextField("name",
"Name", 200);
+ DataSourceTextField nameDataField = new DataSourceTextField(NAME.propertyName(),
NAME.title(), 200);
nameDataField.setCanEdit(false);
fields.add(nameDataField);
- DataSourceTextField descriptionDataField = new
DataSourceTextField("description", "Description");
+ DataSourceTextField descriptionDataField = new
DataSourceTextField(DESCRIPTION.propertyName(), DESCRIPTION
+ .title());
descriptionDataField.setCanEdit(false);
fields.add(descriptionDataField);
- DataSourceTextField typeNameDataField = new
DataSourceTextField("typeName", "Type");
+ DataSourceTextField typeNameDataField = new
DataSourceTextField(TYPE.propertyName(), TYPE.title());
fields.add(typeNameDataField);
- DataSourceTextField pluginNameDataField = new
DataSourceTextField("pluginName", "Plugin");
+ DataSourceTextField pluginNameDataField = new
DataSourceTextField(PLUGIN.propertyName(), PLUGIN.title());
fields.add(pluginNameDataField);
- DataSourceTextField categoryDataField = new
DataSourceTextField("category", "Category");
+ DataSourceTextField categoryDataField = new
DataSourceTextField(CATEGORY.propertyName(), CATEGORY.title());
fields.add(categoryDataField);
return fields;
@@ -126,10 +130,10 @@ public class ResourceGroupsDataSource extends
RPCDataSource<ResourceGroup> {
@Override
public ResourceGroup copyValues(ListGridRecord from) {
Integer idAttrib = from.getAttributeAsInt("id");
- String nameAttrib = from.getAttribute("name");
- String descriptionAttrib = from.getAttribute("description");
- String typeNameAttrib = from.getAttribute("typeName");
- String pluginNameAttrib = from.getAttribute("pluginName");
+ String nameAttrib = from.getAttribute(NAME.propertyName());
+ String descriptionAttrib = from.getAttribute(DESCRIPTION.propertyName());
+ String typeNameAttrib = from.getAttribute(TYPE.propertyName());
+ String pluginNameAttrib = from.getAttribute(PLUGIN.propertyName());
ResourceType rt = null;
ResourceGroup rg = new ResourceGroup(nameAttrib);
@@ -150,14 +154,14 @@ public class ResourceGroupsDataSource extends
RPCDataSource<ResourceGroup> {
ListGridRecord record = new ListGridRecord();
record.setAttribute("group", from);
record.setAttribute("id", from.getId());
- record.setAttribute("name", from.getName());
- record.setAttribute("description", from.getDescription());
- record.setAttribute("category", from.getGroupCategory().name());
+ record.setAttribute(NAME.propertyName(), from.getName());
+ record.setAttribute(DESCRIPTION.propertyName(), from.getDescription());
+ record.setAttribute(CATEGORY.propertyName(), from.getGroupCategory().name());
if (from.getResourceType() != null) {
record.setAttribute("resourceType", from.getResourceType());
- record.setAttribute("typeName", from.getResourceType().getName());
- record.setAttribute("pluginName",
from.getResourceType().getPlugin());
+ record.setAttribute(TYPE.propertyName(), from.getResourceType().getName());
+ record.setAttribute(PLUGIN.propertyName(),
from.getResourceType().getPlugin());
}
return record;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
index 7759f53..c2c2e0e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
@@ -99,12 +99,6 @@ public class ResourceDatasource extends RPCDataSource<Resource>
{
return fields;
}
- @Override
- public void useDatasourceDefinedFields() {
- // TODO Auto-generated method stub
-
- }
-
public void executeFetch(final DSRequest request, final DSResponse response) {
ResourceCriteria criteria = getFetchCriteria(request);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java
index 9546d66..9d8c94d 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java
@@ -18,6 +18,12 @@
*/
package org.rhq.enterprise.gui.coregui.client.menu;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.CATEGORY;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.DESCRIPTION;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.NAME;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.PLUGIN;
+import static
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.TYPE;
+
import com.google.gwt.user.client.History;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.TextMatchStyle;
@@ -34,7 +40,6 @@ import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import com.smartgwt.client.widgets.grid.ListGridField;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
-import
org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
@@ -137,16 +142,16 @@ public class SearchBarPane extends LocatableHLayout {
private ComboBoxItem getGroupComboBox() {
final ComboBoxItem comboBox = getBaseComboBox(SearchType.GROUP);
- ListGridField nameField =
ResourceGroupDataSourceField.NAME.getListGridField(250);
- ListGridField descriptionField =
ResourceGroupDataSourceField.DESCRIPTION.getListGridField();
- ListGridField typeNameField =
ResourceGroupDataSourceField.TYPE.getListGridField(130);
- ListGridField pluginNameField =
ResourceGroupDataSourceField.PLUGIN.getListGridField(100);
- ListGridField categoryField =
ResourceGroupDataSourceField.CATEGORY.getListGridField(105);
+ ListGridField nameField = NAME.getListGridField(250);
+ ListGridField descriptionField = DESCRIPTION.getListGridField();
+ ListGridField typeNameField = TYPE.getListGridField(130);
+ ListGridField pluginNameField = PLUGIN.getListGridField(100);
+ ListGridField categoryField = CATEGORY.getListGridField(105);
comboBox.setPickListFields(nameField, descriptionField, typeNameField,
pluginNameField, categoryField);
comboBox.setValueField("id");
- comboBox.setDisplayField(ResourceGroupDataSourceField.NAME.propertyName());
+ comboBox.setDisplayField(NAME.propertyName());
comboBox.setOptionDataSource(new ResourceGroupsDataSource());
return comboBox;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index ce0ce25..d61a308 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -73,14 +73,6 @@ public abstract class RPCDataSource<T> extends DataSource {
}
/**
- * Override in each subclass to set the default ds fields for the ds. The datasource
should not
- * define and set ds fields in the constructor in case a user of the ds wants to set
their own. For example,
- * those that want to use list grid fields (like our list views).
- */
- public void useDatasourceDefinedFields() {
- }
-
- /**
* A pattern that can be used for Datasource subclassing. Each subclass can add
it's own fields prior to
* all of the fields being added to the datasource.
*/
@@ -130,8 +122,8 @@ public abstract class RPCDataSource<T> extends DataSource {
if (request.getStartRow() == null || request.getEndRow() == null) {
pageControl = new PageControl();
} else {
- pageControl = PageControl.getExplicitPageControl(request.getStartRow(),
- request.getEndRow() - request.getStartRow());
+ pageControl = PageControl.getExplicitPageControl(request.getStartRow(),
request.getEndRow()
+ - request.getStartRow());
}
// Initialize sorting.
commit d8d3923378207946060daf0a7158554a2e94696b
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Oct 20 19:48:29 2010 -0400
group config: add set-all-values-to controls at top of edit-member-values modal; fix a
few other bugs in the group config editor
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index 28d5960..163ff47 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -1283,11 +1283,13 @@ public class ConfigurationEditor extends LocatableVLayout {
valueItem = new PasswordItem();
break;
case BOOLEAN:
- valueItem = new RadioGroupItem();
- LinkedHashMap<String, String> valMap = new
LinkedHashMap<String, String>();
- valMap.put("true", "Yes");
- valMap.put("false", "No");
- valueItem.setValueMap(valMap);
+ RadioGroupItem radioGroupItem = new RadioGroupItem();
+ radioGroupItem.setVertical(false);
+ valueItem = radioGroupItem;
+ LinkedHashMap<String, String> valueMap = new
LinkedHashMap<String, String>();
+ valueMap.put("true", "Yes");
+ valueMap.put("false", "No");
+ valueItem.setValueMap(valueMap);
break;
case INTEGER:
case LONG:
@@ -1300,8 +1302,7 @@ public class ConfigurationEditor extends LocatableVLayout {
}
}
- valueItem.setDefaultValue((String)null);
- valueItem.setValue(propertySimple.getStringValue());
+ valueItem.setDefaultValue(propertySimple.getStringValue());
valueItem.setRequired(propertyDefinitionSimple.isRequired());
List<Validator> validators = buildValidators(propertyDefinitionSimple,
propertySimple);
@@ -1606,6 +1607,7 @@ public class ConfigurationEditor extends LocatableVLayout {
String stringValue = (value != null) ? value.toString() : null;
item.setValue(stringValue);
}
+ item.setDefaultValue((String)null);
}
private static class PropertyDefinitionComparator implements
Comparator<PropertyDefinition> {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
index 4583a4a..c2e2eb7 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
@@ -32,14 +32,19 @@ import com.smartgwt.client.widgets.events.ClickEvent;
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.form.fields.ButtonItem;
+import com.smartgwt.client.widgets.form.fields.CheckboxItem;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.FormItemIcon;
+import com.smartgwt.client.widgets.form.fields.SpacerItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.form.fields.events.FormItemClickHandler;
import com.smartgwt.client.widgets.form.fields.events.FormItemIconClickEvent;
import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.Property;
@@ -180,16 +185,81 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
private void displayMemberValuesEditor(String locatorId, final
PropertyDefinitionSimple propertyDefinitionSimple,
final PropertySimple aggregatePropertySimple,
Integer index, final FormItem
aggregateValueItem) {
+ final Window popup = new Window();
+ popup.setTitle("Member Values for Property '" +
propertyDefinitionSimple.getName() + "'");
+ popup.setWidth(800);
+ popup.setHeight(600);
+ popup.setIsModal(true);
+ popup.setShowModalMask(true);
+ popup.setShowCloseButton(false);
+ popup.centerInPage();
+
LocatableVLayout layout = new LocatableVLayout(locatorId);
layout.setHeight100();
+ layout.setMargin(11);
+
+ final DynamicForm setAllForm = new DynamicForm();
+ setAllForm.setNumCols(4);
+ setAllForm.setColWidths(175, 25, 250, 100);
+ setAllForm.setCellPadding(5);
+
+ List<FormItem> setAllItems = new ArrayList<FormItem>();
+
+ // Header Row
+ SpacerItem spacerItem = new SpacerItem();
+ setAllItems.add(spacerItem);
+
+ StaticTextItem unsetAllHeader = new StaticTextItem();
+ unsetAllHeader.setShowTitle(false);
+ unsetAllHeader.setDefaultValue("<h4>Unset</h4>");
+ setAllItems.add(unsetAllHeader);
+
+ StaticTextItem valueAllHeader = new StaticTextItem();
+ valueAllHeader.setShowTitle(false);
+ valueAllHeader.setDefaultValue("<h4>Value</h4>");
+
+ setAllItems.add(valueAllHeader);
+
+ spacerItem = new SpacerItem();
+ //spacerItem.setEndRow(true);
+ setAllItems.add(spacerItem);
+
+ // Input Row
+ StaticTextItem setAllValuesToItem = new StaticTextItem();
+ setAllValuesToItem.setShowTitle(false);
+ setAllValuesToItem.setDefaultValue("<b>Set all values to:
</b>");
+ setAllValuesToItem.setAlign(Alignment.RIGHT);
+ setAllItems.add(setAllValuesToItem);
+
+ PropertySimple masterPropertySimple = new
PropertySimple(aggregatePropertySimple.getName(), null);
+ final FormItem masterValueItem = super.buildSimpleField(propertyDefinitionSimple,
masterPropertySimple);
+ masterValueItem.setDisabled(false);
+
+ FormItem masterUnsetItem = buildUnsetItem(propertyDefinitionSimple,
masterPropertySimple, masterValueItem);
+ if (masterUnsetItem instanceof CheckboxItem) {
+ masterUnsetItem.setValue(false);
+ }
- // TODO: Add 'Set All Values To' and 'Unset All' controls in a
separate DynamicForm.
+ setAllItems.add(masterUnsetItem);
+ setAllItems.add(masterValueItem);
- final DynamicForm form = new DynamicForm();
- form.setHeight100();
- form.setNumCols(3);
- form.setColWidths("60%", "8%", "32%");
- layout.addMember(form);
+ ButtonItem applyButtonItem = new ButtonItem();
+ applyButtonItem.setTitle("Apply");
+ //applyButtonItem.setEndRow(true);
+ setAllItems.add(applyButtonItem);
+
+ setAllForm.setFields(setAllItems.toArray(new FormItem[setAllItems.size()]));
+ layout.addMember(setAllForm);
+
+ VLayout spacerLayout = new VLayout();
+ spacerLayout.setHeight(20);
+ layout.addMember(spacerLayout);
+
+ final DynamicForm membersForm = new DynamicForm();
+ membersForm.setHeight100();
+ membersForm.setNumCols(3);
+ membersForm.setColWidths("52%", "8%", "40%");
+ layout.addMember(membersForm);
// Add header row.
List<FormItem> items = new ArrayList<FormItem>();
@@ -208,9 +278,8 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
items.add(valueHeader);
// Add data rows.
- final Map<String, PropertySimple> memberProperties = new HashMap<String,
PropertySimple>(this.memberConfigurations.size());
final List<FormItem> valueItems = new
ArrayList<FormItem>(this.memberConfigurations.size());
- final List<FormItem> unsetItems = new
ArrayList<FormItem>(this.memberConfigurations.size());
+ final Map<String, PropertySimple> valueItemNameToPropertySimpleMap = new
HashMap<String, PropertySimple>();
for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
String memberName = memberConfiguration.getLabel();
StaticTextItem memberItem = new StaticTextItem();
@@ -219,26 +288,15 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
items.add(memberItem);
Configuration configuration = memberConfiguration.getConfiguration();
PropertySimple memberPropertySimple = getPropertySimple(configuration,
propertyDefinitionSimple, index);
- memberProperties.put(memberName, memberPropertySimple);
FormItem valueItem = buildSimpleField(propertyDefinitionSimple,
memberPropertySimple);
- valueItem.setAttribute("rhq:property", memberPropertySimple);
valueItems.add(valueItem);
+ valueItemNameToPropertySimpleMap.put(valueItem.getName(),
memberPropertySimple);
FormItem unsetItem = buildUnsetItem(propertyDefinitionSimple,
memberPropertySimple, valueItem);
items.add(unsetItem);
- unsetItems.add(unsetItem);
items.add(valueItem);
valueItem.setEndRow(true);
}
- form.setItems(items.toArray(new FormItem[items.size()]));
-
- final Window popup = new Window();
- popup.setTitle("Member Values for Property '" +
propertyDefinitionSimple.getName());
- popup.setWidth(800);
- popup.setHeight(600);
- popup.setIsModal(true);
- popup.setShowModalMask(true);
- popup.setShowCloseButton(false);
- popup.centerInPage();
+ membersForm.setItems(items.toArray(new FormItem[items.size()]));
final IButton okButton = new IButton("OK");
okButton.disable();
@@ -251,8 +309,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
if ((value != null && !value.equals(firstValue)) || (value ==
null && firstValue != null)) {
valuesHomogeneous = false;
}
- PropertySimple memberPropertySimple =
-
(PropertySimple)valueItem.getAttributeAsObject("rhq:property");
+ PropertySimple memberPropertySimple =
valueItemNameToPropertySimpleMap.get(valueItem.getName());
memberPropertySimple.setValue(value);
memberPropertySimple.setErrorMessage(null);
}
@@ -269,8 +326,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
aggregateUnsetItem.setValue(firstValue == null);
- // Set the aggregate value item's value to the homogeneous value,
enable it, and make sure it has
- // validators set.
+ // Set the aggregate value item's value to the homogeneous value,
unhide it, and enable it.
setValue(aggregateValueItem, firstValue);
aggregateValueItem.show();
aggregateValueItem.setDisabled(false);
@@ -286,18 +342,36 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
aggregateStaticItem.show();
}
- form.markForRedraw();
+ membersForm.markForRedraw();
popup.destroy();
}
});
// Only enable the OK button if all properties are valid.
- form.addItemChangedHandler(new ItemChangedHandler() {
+ membersForm.addItemChangedHandler(new ItemChangedHandler() {
public void onItemChanged(ItemChangedEvent itemChangedEvent) {
- okButton.setDisabled(!form.validate());
+ okButton.setDisabled(!membersForm.validate());
}
});
+ applyButtonItem.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent
clickEvent) {
+ Object value = masterValueItem.getValue();
+ for (FormItem valueItem : valueItems) {
+ setValue(valueItem, value);
+
+ FormItem unsetItem =
valueItemNameToUnsetItemMap.get(valueItem.getName());
+ if (unsetItem instanceof CheckboxItem) {
+ unsetItem.setValue((value == null));
+ valueItem.setDisabled((value == null));
+ }
+
+ okButton.setDisabled(!membersForm.validate());
+ }
+ }
+ });
+
final IButton cancelButton = new IButton("Cancel");
cancelButton.addClickHandler(new
com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -308,12 +382,11 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
// TODO: Anchor the button bar at the bottom of the modal window, so it's
always visible.
HLayout buttons = new HLayout();
buttons.setAlign(Alignment.CENTER);
- buttons.setMembersMargin(10);
+ buttons.setMembersMargin(7);
buttons.setMembers(okButton, cancelButton);
layout.addMember(buttons);
popup.addItem(layout);
-
popup.show();
}
commit 16ff182bc813383485b77bc96312505c74ea37ec
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Oct 20 17:43:44 2010 -0400
no need to store the full resource type in the record
don't allow selections in the grids
refactor out common methods that trigger when edit buttons are pushed
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeNodeBuilder.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeNodeBuilder.java
index ec26699..c038076 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeNodeBuilder.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeNodeBuilder.java
@@ -141,50 +141,46 @@ public class ResourceTypeTreeNodeBuilder {
public static class ResourceTypeListGridRecord extends ListGridRecord {
- private ResourceType resourceType;
+ private int id;
private ResourceTypeListGridRecord(ResourceTypeTemplateCountComposite composite)
{
- this.resourceType = composite.getType();
+ ResourceType resourceType = composite.getType();
+ this.id = resourceType.getId();
- setAttribute(ATTRIB_ID, String.valueOf(resourceType.getId()));
+ setAttribute(ATTRIB_ID, String.valueOf(id));
setAttribute(ATTRIB_NAME, resourceType.getName());
setAttribute(ATTRIB_PLUGIN, resourceType.getPlugin());
- setAttribute(ATTRIB_CATEGORY, resourceType.getCategory().getDisplayName());
+ setAttribute(ATTRIB_CATEGORY, resourceType.getCategory().name());
setAttribute(ATTRIB_ENABLED_ALERT_TEMPLATES,
composite.getEnabledAlertCount());
setAttribute(ATTRIB_DISABLED_ALERT_TEMPLATES,
composite.getDisabledAlertCount());
setAttribute(ATTRIB_ENABLED_METRIC_TEMPLATES,
composite.getEnabledMetricCount());
setAttribute(ATTRIB_DISABLED_METRIC_TEMPLATES,
composite.getDisabledMetricCount());
}
- public ResourceType getResourceType() {
- return resourceType;
- }
-
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
- if (!(o instanceof ResourceTypeTreeNode)) {
+ if (!(o instanceof ResourceTypeListGridRecord)) {
return false;
}
- return (this.resourceType.getId() == ((ResourceTypeTreeNode)
o).resourceType.getId());
+ return (this.id == ((ResourceTypeListGridRecord) o).id);
}
@Override
public int hashCode() {
- return 31 * resourceType.getId();
+ return 31 * id;
}
}
public static class ResourceTypeTreeNode extends TreeNode {
- private ResourceType resourceType;
private String id;
private String parentId;
private ResourceTypeTreeNode(ResourceTypeTemplateCountComposite composite, String
parentId) {
- this.resourceType = composite.getType();
+ ResourceType resourceType = composite.getType();
String id = String.valueOf(resourceType.getId());
setID(id);
@@ -197,7 +193,7 @@ public class ResourceTypeTreeNodeBuilder {
setAttribute(ATTRIB_PARENT_ID, parentId);
setAttribute(ATTRIB_NAME, resourceType.getName());
setAttribute(ATTRIB_PLUGIN, resourceType.getPlugin());
- setAttribute(ATTRIB_CATEGORY, resourceType.getCategory().getDisplayName());
+ setAttribute(ATTRIB_CATEGORY, resourceType.getCategory().name());
setAttribute(ATTRIB_ENABLED_ALERT_TEMPLATES,
composite.getEnabledAlertCount());
setAttribute(ATTRIB_DISABLED_ALERT_TEMPLATES,
composite.getDisabledAlertCount());
setAttribute(ATTRIB_DISABLED_METRIC_TEMPLATES,
composite.getEnabledMetricCount());
@@ -206,10 +202,6 @@ public class ResourceTypeTreeNodeBuilder {
setIsFolder(true);
}
- public ResourceType getResourceType() {
- return resourceType;
- }
-
@Override
public boolean equals(Object o) {
if (this == o) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
index 6e2047d..ff50be7 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.gui.coregui.client.admin.templates;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Canvas;
@@ -36,7 +37,7 @@ import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeGridField;
import com.smartgwt.client.widgets.tree.TreeNode;
-import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -80,6 +81,25 @@ public class ResourceTypeTreeView extends LocatableVLayout {
new ResourceTypeTreeNodeBuilder(platformsList, platformServicesList,
serversTreeGrid);
}
+ private static void editAlertTemplate(Record record) {
+ SC.say("Alert Template : " //
+ + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_NAME)
+ + "==>"
+ + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN)
+ + "==>"
+ + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ }
+
+ private static void editMetricTemplate(Record record) {
+ //
http://localhost:7080/admin/platform/monitor/Config.do?nomenu=true&mo...
+ SC.say("Metric Template: " //
+ + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_NAME)
+ + "==>"
+ + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN)
+ + "==>"
+ + record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ }
+
public static class CustomResourceTypeListGrid extends LocatableListGrid {
private HLayout rollOverCanvas;
private ListGridRecord rollOverRecord;
@@ -91,6 +111,7 @@ public class ResourceTypeTreeView extends LocatableVLayout {
setFixedRecordHeights(false);
setShowRollOverCanvas(true);
setEmptyMessage("Loading...");
+ setSelectionType(SelectionStyle.NONE);
final ListGridField name = new
ListGridField(ResourceTypeTreeNodeBuilder.ATTRIB_NAME, "Name");
final ListGridField plugin = new
ListGridField(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN, "Plugin");
@@ -147,11 +168,7 @@ public class ResourceTypeTreeView extends LocatableVLayout {
metricTemplateImg.setWidth(16);
metricTemplateImg.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
- //
http://localhost:7080/admin/platform/monitor/Config.do?nomenu=true&mo...
- SC.say("Metric Template: "
- +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_NAME) + "==>"
- +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN) +
"==>"
- +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ editMetricTemplate(rollOverRecord);
}
});
@@ -166,10 +183,7 @@ public class ResourceTypeTreeView extends LocatableVLayout {
alertTemplateImg.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- SC.say("Alert Template : "
- +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_NAME) + "==>"
- +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN) +
"==>"
- +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ editAlertTemplate(rollOverRecord);
}
});
@@ -191,6 +205,7 @@ public class ResourceTypeTreeView extends LocatableVLayout {
setFixedRecordHeights(false);
setShowRollOverCanvas(true);
setEmptyMessage("Loading...");
+ setSelectionType(SelectionStyle.NONE);
setAnimateFolders(false);
final TreeGridField name = new
TreeGridField(ResourceTypeTreeNodeBuilder.ATTRIB_NAME, "Name");
@@ -245,11 +260,7 @@ public class ResourceTypeTreeView extends LocatableVLayout {
metricTemplateImg.setWidth(16);
metricTemplateImg.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
- //
http://localhost:7080/admin/platform/monitor/Config.do?nomenu=true&mo...
- SC.say("Metric Template: "
- +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_NAME) + "==>"
- +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN) +
"==>"
- +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ editMetricTemplate(rollOverRecord);
}
});
@@ -264,10 +275,7 @@ public class ResourceTypeTreeView extends LocatableVLayout {
alertTemplateImg.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- SC.say("Alert Template : "
- +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_NAME) + "==>"
- +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN) +
"==>"
- +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ editAlertTemplate(rollOverRecord);
}
});
@@ -282,10 +290,8 @@ public class ResourceTypeTreeView extends LocatableVLayout {
if (record instanceof TreeNode) {
if (record instanceof ResourceTypeTreeNodeBuilder.ResourceTypeTreeNode)
{
- ResourceType resourceType =
((ResourceTypeTreeNodeBuilder.ResourceTypeTreeNode) record)
- .getResourceType();
-
- switch (resourceType.getCategory()) {
+ String c =
record.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_CATEGORY);
+ switch (ResourceCategory.valueOf(c)) {
case PLATFORM:
return "types/Platform_up_16.png";
case SERVER:
commit a0388ba94ee654ee2dbe79a4c47a12ae9941577f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Oct 20 16:50:20 2010 -0400
the new gwt "templates" admin page. the "edit alert template" and
"edit metric template" rollover buttons don't do anything real yet - just
pops up a debug window for now
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
index add1a53..e20572f 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
@@ -92,16 +92,18 @@ import org.rhq.core.domain.util.Summary;
@NamedQuery(name = ResourceType.FIND_CHILDREN_BY_PARENT, query = "SELECT
DISTINCT rt FROM ResourceType AS rt "
+ "JOIN FETCH rt.parentResourceTypes AS pa " + // also fetch parents,
as we need them later
"WHERE pa IN (:resourceType)"),
+ // template count composites need the parent types fetched; however, because of a
quirk in hibernate,
+ // we can't use the template component constructor in the select, we'll build
the composites in our code
@NamedQuery(name = ResourceType.FIND_ALL_TEMPLATE_COUNT_COMPOSITES, query =
"" //
- + "SELECT new
org.rhq.core.domain.resource.composite.ResourceTypeTemplateCountComposite" //
- + "(" //
+ // + "SELECT new
org.rhq.core.domain.resource.composite.ResourceTypeTemplateCountComposite (" //
+ + "SELECT " //
+ " rt," //
+ " (SELECT COUNT(md) FROM MeasurementDefinition AS md WHERE
md.resourceType = rt AND md.defaultOn = TRUE), "//
+ " (SELECT COUNT(md) FROM MeasurementDefinition AS md WHERE
md.resourceType = rt AND md.defaultOn = FALSE), "//
+ " (SELECT COUNT(ad) FROM AlertDefinition AS ad WHERE ad.resourceType = rt
AND ad.deleted = FALSE AND ad.enabled = TRUE), "//
+ " (SELECT COUNT(ad) FROM AlertDefinition AS ad WHERE ad.resourceType = rt
AND ad.deleted = FALSE AND ad.enabled = FALSE) "//
- + ")" //
- + "FROM ResourceType AS rt"),
+ // + ")" //
+ + "FROM ResourceType AS rt LEFT JOIN FETCH rt.parentResourceTypes p"),
@NamedQuery(name = ResourceType.QUERY_FIND_BY_CATEGORY, query = "SELECT rt FROM
ResourceType AS rt "
+ "WHERE rt.category = :category"),
@NamedQuery(name = ResourceType.QUERY_FIND_UTILIZED_BY_CATEGORY, query = "SELECT
DISTINCT res.resourceType "
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceTypeTemplateCountComposite.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceTypeTemplateCountComposite.java
index b2a906f..990acde 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceTypeTemplateCountComposite.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/ResourceTypeTemplateCountComposite.java
@@ -31,13 +31,17 @@ public class ResourceTypeTemplateCountComposite implements
Serializable, Compara
private static final long serialVersionUID = 1L;
- private final ResourceType type;
- private final long enabledMetricCount;
- private final long disabledMetricCount;
- private final long enabledAlertCount;
- private final long disabledAlertCount;
+ private ResourceType type;
+ private long enabledMetricCount;
+ private long disabledMetricCount;
+ private long enabledAlertCount;
+ private long disabledAlertCount;
private String pluginInfo;
+ // no arg constructor required by gwt
+ protected ResourceTypeTemplateCountComposite() {
+ }
+
public ResourceTypeTemplateCountComposite(ResourceType type, long enabledMetricCount,
long disabledMetricCount,
long enabledAlertCount, long disabledAlertCount) {
super();
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 8c82506..614ac1e 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
@@ -39,6 +39,7 @@ 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.templates.ResourceTypeTreeView;
import org.rhq.enterprise.gui.coregui.client.admin.users.UsersView;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.components.tree.EnhancedTreeNode;
@@ -246,7 +247,7 @@ public class AdministrationView extends LocatableHLayout implements
Bookmarkable
if (PAGE_SYSTEM_SETTINGS_VIEW_ID.equals(pageName)) {
url = "/admin/config/Config.do?mode=edit";
} else if (PAGE_TEMPLATES_VIEW_ID.equals(pageName)) {
- url =
"/admin/config/EditDefaults.do?mode=monitor&viewMode=all";
+ content = new
ResourceTypeTreeView(this.extendLocatorId("Templates"));
} else if (PAGE_DOWNLOADS_VIEW_ID.equals(pageName)) {
url = "/rhq/admin/downloads-body.xhtml";
} else if (PAGE_LICENSE_VIEW_ID.equals(pageName)) {
@@ -254,8 +255,10 @@ public class AdministrationView extends LocatableHLayout implements
Bookmarkable
} else if (PAGE_PLUGINS_VIEW_ID.equals(pageName)) {
url = "/rhq/admin/plugin/plugin-list-plain.xhtml";
}
- url = addQueryStringParam(url, "nomenu=true");
- content = new FullHTMLPane(url);
+ if (url != null) {
+ url = addQueryStringParam(url, "nomenu=true");
+ content = new FullHTMLPane(url);
+ }
} else if (SECTION_TOPOLOGY_VIEW_ID.equals(sectionName)) {
String url = null;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeNodeBuilder.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeNodeBuilder.java
new file mode 100644
index 0000000..ec26699
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeNodeBuilder.java
@@ -0,0 +1,241 @@
+/*
+ * 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.admin.templates;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.tree.TreeGrid;
+import com.smartgwt.client.widgets.tree.TreeNode;
+
+import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.ResourceTypeTemplateCountComposite;
+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.ResourceTypeGWTServiceAsync;
+
+/**
+ * @author Greg Hinkle
+ * @author John Mazzitelli
+ */
+public class ResourceTypeTreeNodeBuilder {
+
+ public static final String ATTRIB_ID = "id";
+ public static final String ATTRIB_PARENT_ID = "parentId";
+ public static final String ATTRIB_NAME = "name";
+ public static final String ATTRIB_PLUGIN = "plugin";
+ public static final String ATTRIB_CATEGORY = "category";
+ public static final String ATTRIB_ENABLED_METRIC_TEMPLATES =
"enabledMetricTemplates";
+ public static final String ATTRIB_DISABLED_METRIC_TEMPLATES =
"disabledMetricTemplates";
+ public static final String ATTRIB_ENABLED_ALERT_TEMPLATES =
"enabledAlertTemplates";
+ public static final String ATTRIB_DISABLED_ALERT_TEMPLATES =
"disabledAlertTemplates";
+
+ public ResourceTypeTreeNodeBuilder(final ListGrid platformsGrid, final ListGrid
platformServicesGrid,
+ final TreeGrid serversGrid) {
+ ResourceTypeGWTServiceAsync resourceTypeService =
GWTServiceLookup.getResourceTypeGWTService();
+
+ resourceTypeService
+ .getTemplateCountCompositeMap(new AsyncCallback<Map<Integer,
ResourceTypeTemplateCountComposite>>() {
+
+ @Override
+ public void onSuccess(Map<Integer,
ResourceTypeTemplateCountComposite> result) {
+ HashSet<ResourceTypeListGridRecord> platformsRecords;
+ HashSet<ResourceTypeListGridRecord> platformServicesRecords;
+ HashSet<ResourceTypeTreeNode> treeNodes;
+
+ platformsRecords = new HashSet<ResourceTypeListGridRecord>();
+ platformServicesRecords = new
HashSet<ResourceTypeListGridRecord>();
+ treeNodes = new HashSet<ResourceTypeTreeNode>();
+
+ for (ResourceTypeTemplateCountComposite composite : result.values())
{
+ ResourceType type = composite.getType();
+ Set<ResourceType> parentTypes =
type.getParentResourceTypes();
+ if (isEmpty(parentTypes)) {
+ if (type.getCategory() == ResourceCategory.PLATFORM) {
+ // no parents but is a platform - these are our main,
top-level platforms
+ platformsRecords.add(new
ResourceTypeListGridRecord(composite));
+ } else {
+ // no parents but not a platform - these are our
top-level servers
+ treeNodes.add(new ResourceTypeTreeNode(composite,
type.getPlugin()));
+ }
+ } else {
+ // has parents; if all the direct parents are top level
platforms
+ // and the category is service, consider it a
"special" platform service
+ boolean isPlatformService = true; // assume its one, unless
one of its parents is not a top level platform
+ if (type.getCategory() == ResourceCategory.SERVICE) {
+ for (ResourceType parentType : parentTypes) {
+ // if one of its parents is not a platform or one of
its parent has parents itself,
+ // then this is not a platform service
+ if ((parentType.getCategory() !=
ResourceCategory.PLATFORM)
+ || !isEmpty(parentType.getParentResourceTypes()))
{
+ isPlatformService = false;
+ break;
+ }
+ }
+ } else {
+ isPlatformService = false; // can't be a platform
service, its not in the SERVICE category
+ }
+
+ if (isPlatformService) {
+ platformServicesRecords.add(new
ResourceTypeListGridRecord(composite));
+ } else {
+ // in some cases, a top level server is limited to which
platforms it can run on.
+ // therefore, the parents will not be null/empty (as
would be the case if the top level
+ // server can run on ALL platforms), but instead it will
have the subset of platforms
+ // the type is valid on. But its the same type - so we
only want to show it once. Therefore,
+ // once we see a parent that is a top level platform, we
don't add the type again for other
+ // top level platforms. That's what gotPlatform
boolean tracks.
+ boolean gotPlatform = false;
+ for (ResourceType parentType :
type.getParentResourceTypes()) {
+ boolean isPlatform = (parentType.getCategory() ==
ResourceCategory.PLATFORM && isEmpty(parentType
+ .getParentResourceTypes()));
+ if (!isPlatform || !gotPlatform) {
+ treeNodes.add(new ResourceTypeTreeNode(composite,
String.valueOf(parentType
+ .getId())));
+ }
+ if (isPlatform) {
+ gotPlatform = true;
+ }
+ }
+ }
+ }
+ }
+
+ platformsGrid.setData(platformsRecords.toArray(new
ListGridRecord[platformsRecords.size()]));
+ platformServicesGrid.setData(platformServicesRecords
+ .toArray(new ListGridRecord[platformServicesRecords.size()]));
+ serversGrid.getTree().linkNodes(treeNodes.toArray(new
TreeNode[treeNodes.size()]));
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load resource
types", caught);
+ }
+ });
+ }
+
+ private boolean isEmpty(Set<ResourceType> set) {
+ return set == null || set.isEmpty();
+ }
+
+ public static class ResourceTypeListGridRecord extends ListGridRecord {
+
+ private ResourceType resourceType;
+
+ private ResourceTypeListGridRecord(ResourceTypeTemplateCountComposite composite)
{
+ this.resourceType = composite.getType();
+
+ setAttribute(ATTRIB_ID, String.valueOf(resourceType.getId()));
+ setAttribute(ATTRIB_NAME, resourceType.getName());
+ setAttribute(ATTRIB_PLUGIN, resourceType.getPlugin());
+ setAttribute(ATTRIB_CATEGORY, resourceType.getCategory().getDisplayName());
+ setAttribute(ATTRIB_ENABLED_ALERT_TEMPLATES,
composite.getEnabledAlertCount());
+ setAttribute(ATTRIB_DISABLED_ALERT_TEMPLATES,
composite.getDisabledAlertCount());
+ setAttribute(ATTRIB_ENABLED_METRIC_TEMPLATES,
composite.getEnabledMetricCount());
+ setAttribute(ATTRIB_DISABLED_METRIC_TEMPLATES,
composite.getDisabledMetricCount());
+ }
+
+ public ResourceType getResourceType() {
+ return resourceType;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof ResourceTypeTreeNode)) {
+ return false;
+ }
+ return (this.resourceType.getId() == ((ResourceTypeTreeNode)
o).resourceType.getId());
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 * resourceType.getId();
+ }
+ }
+
+ public static class ResourceTypeTreeNode extends TreeNode {
+
+ private ResourceType resourceType;
+ private String id;
+ private String parentId;
+
+ private ResourceTypeTreeNode(ResourceTypeTemplateCountComposite composite, String
parentId) {
+ this.resourceType = composite.getType();
+
+ String id = String.valueOf(resourceType.getId());
+ setID(id);
+ this.id = id;
+
+ setParentID(parentId);
+ this.parentId = parentId;
+
+ setAttribute(ATTRIB_ID, id);
+ setAttribute(ATTRIB_PARENT_ID, parentId);
+ setAttribute(ATTRIB_NAME, resourceType.getName());
+ setAttribute(ATTRIB_PLUGIN, resourceType.getPlugin());
+ setAttribute(ATTRIB_CATEGORY, resourceType.getCategory().getDisplayName());
+ setAttribute(ATTRIB_ENABLED_ALERT_TEMPLATES,
composite.getEnabledAlertCount());
+ setAttribute(ATTRIB_DISABLED_ALERT_TEMPLATES,
composite.getDisabledAlertCount());
+ setAttribute(ATTRIB_DISABLED_METRIC_TEMPLATES,
composite.getEnabledMetricCount());
+ setAttribute(ATTRIB_ENABLED_METRIC_TEMPLATES,
composite.getDisabledMetricCount());
+
+ setIsFolder(true);
+ }
+
+ public ResourceType getResourceType() {
+ return resourceType;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof ResourceTypeTreeNode)) {
+ return false;
+ }
+
+ ResourceTypeTreeNode that = (ResourceTypeTreeNode) o;
+
+ if (!this.id.equals(that.id)) {
+ return false;
+ }
+ if (this.parentId == null) {
+ return that.parentId == null;
+ }
+ return this.parentId.equals(that.parentId);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 31;
+ result = result * id.hashCode();
+ result = result + (parentId != null ? parentId.hashCode() : 0);
+ return result;
+ }
+ }
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
new file mode 100644
index 0000000..6e2047d
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
@@ -0,0 +1,301 @@
+/*
+ * 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.admin.templates;
+
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.VisibilityMode;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.ImgButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+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.layout.HLayout;
+import com.smartgwt.client.widgets.layout.SectionStack;
+import com.smartgwt.client.widgets.layout.SectionStackSection;
+import com.smartgwt.client.widgets.tree.TreeGrid;
+import com.smartgwt.client.widgets.tree.TreeGridField;
+import com.smartgwt.client.widgets.tree.TreeNode;
+
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * @author Greg Hinkle
+ * @author John Mazzitelli
+ */
+public class ResourceTypeTreeView extends LocatableVLayout {
+
+ public ResourceTypeTreeView(String locatorId) {
+ super(locatorId);
+
+ setWidth100();
+ setHeight100();
+
+ SectionStack sectionStack = new SectionStack();
+ sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
+
+ ListGrid platformsList = new
CustomResourceTypeListGrid(extendLocatorId("platformsList"));
+ SectionStackSection platforms = new SectionStackSection("Platforms");
+ platforms.setExpanded(true);
+ platforms.addItem(platformsList);
+
+ ListGrid platformServicesList = new
CustomResourceTypeListGrid(extendLocatorId("platformServicesList"));
+ SectionStackSection platformServices = new SectionStackSection("Platform
Services");
+ platformServices.setExpanded(true);
+ platformServices.addItem(platformServicesList);
+
+ TreeGrid serversTreeGrid = new
CustomResourceTypeTreeGrid(extendLocatorId("serversTree"));
+ SectionStackSection servers = new SectionStackSection("Servers");
+ servers.setExpanded(true);
+ servers.addItem(serversTreeGrid);
+
+ sectionStack.addSection(platforms);
+ sectionStack.addSection(platformServices);
+ sectionStack.addSection(servers);
+
+ addMember(sectionStack);
+
+ new ResourceTypeTreeNodeBuilder(platformsList, platformServicesList,
serversTreeGrid);
+ }
+
+ public static class CustomResourceTypeListGrid extends LocatableListGrid {
+ private HLayout rollOverCanvas;
+ private ListGridRecord rollOverRecord;
+
+ public CustomResourceTypeListGrid(String locatorId) {
+ super(locatorId);
+
+ setWrapCells(true);
+ setFixedRecordHeights(false);
+ setShowRollOverCanvas(true);
+ setEmptyMessage("Loading...");
+
+ final ListGridField name = new
ListGridField(ResourceTypeTreeNodeBuilder.ATTRIB_NAME, "Name");
+ final ListGridField plugin = new
ListGridField(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN, "Plugin");
+ final ListGridField category = new
ListGridField(ResourceTypeTreeNodeBuilder.ATTRIB_CATEGORY, "Category");
+ final ListGridField enabledAlertTemplates = new ListGridField(
+ ResourceTypeTreeNodeBuilder.ATTRIB_ENABLED_ALERT_TEMPLATES, "Enabled
Alert Templates");
+ final ListGridField disabledAlertTemplates = new ListGridField(
+ ResourceTypeTreeNodeBuilder.ATTRIB_DISABLED_ALERT_TEMPLATES,
"Disabled Alert Templates");
+ final ListGridField enabledMetricTemplates = new ListGridField(
+ ResourceTypeTreeNodeBuilder.ATTRIB_ENABLED_METRIC_TEMPLATES,
"Enabled Metric Templates");
+ final ListGridField disabledMetricTemplates = new ListGridField(
+ ResourceTypeTreeNodeBuilder.ATTRIB_DISABLED_METRIC_TEMPLATES,
"Disabled Metric Templates");
+
+ plugin.setHidden(true);
+ category.setHidden(true);
+
+ name.setWidth("40%");
+ plugin.setWidth("10%");
+ category.setWidth("10%");
+ enabledAlertTemplates.setWidth("10%");
+ disabledAlertTemplates.setWidth("10%");
+ enabledMetricTemplates.setWidth("10%");
+ disabledMetricTemplates.setWidth("10%");
+
+ enabledAlertTemplates.setPrompt("Number of alert templates that are
enabled on this resource type");
+ disabledAlertTemplates
+ .setPrompt("Number of alert templates that are created but disabled
on this resource type");
+ enabledMetricTemplates
+ .setPrompt("Number of metric schedules that are enabled by default
on this resource type");
+ disabledMetricTemplates
+ .setPrompt("Number of metric schedules that are disabled by default
on this resource type");
+
+ setFields(name, plugin, category, enabledAlertTemplates,
disabledAlertTemplates, enabledMetricTemplates,
+ disabledMetricTemplates);
+ }
+
+ @Override
+ protected Canvas getRollOverCanvas(Integer rowNum, Integer colNum) {
+ rollOverRecord = this.getRecord(rowNum);
+
+ if (rollOverCanvas == null) {
+ rollOverCanvas = new HLayout(3);
+ rollOverCanvas.setSnapTo("TR");
+ rollOverCanvas.setWidth(50);
+ rollOverCanvas.setHeight(22);
+
+ ImgButton metricTemplateImg = new ImgButton();
+ metricTemplateImg.setShowDown(false);
+ metricTemplateImg.setShowRollOver(false);
+ metricTemplateImg.setLayoutAlign(Alignment.CENTER);
+
metricTemplateImg.setSrc("subsystems/monitor/Edit_Metric.png");
+ metricTemplateImg.setPrompt("Edit Metric Template");
+ metricTemplateImg.setHeight(16);
+ metricTemplateImg.setWidth(16);
+ metricTemplateImg.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ //
http://localhost:7080/admin/platform/monitor/Config.do?nomenu=true&mo...
+ SC.say("Metric Template: "
+ +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_NAME) + "==>"
+ +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN) +
"==>"
+ +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ }
+ });
+
+ ImgButton alertTemplateImg = new ImgButton();
+ alertTemplateImg.setShowDown(false);
+ alertTemplateImg.setShowRollOver(false);
+ alertTemplateImg.setLayoutAlign(Alignment.CENTER);
+ alertTemplateImg.setSrc("subsystems/alert/Edit_Alert.png");
+ alertTemplateImg.setPrompt("Edit Alert Template");
+ alertTemplateImg.setHeight(16);
+ alertTemplateImg.setWidth(16);
+ alertTemplateImg.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ SC.say("Alert Template : "
+ +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_NAME) + "==>"
+ +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN) +
"==>"
+ +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ }
+ });
+
+ rollOverCanvas.addMember(metricTemplateImg);
+ rollOverCanvas.addMember(alertTemplateImg);
+ }
+ return rollOverCanvas;
+ }
+ }
+
+ public static class CustomResourceTypeTreeGrid extends LocatableTreeGrid {
+ private HLayout rollOverCanvas;
+ private ListGridRecord rollOverRecord;
+
+ public CustomResourceTypeTreeGrid(String locatorId) {
+ super(locatorId);
+
+ setWrapCells(true);
+ setFixedRecordHeights(false);
+ setShowRollOverCanvas(true);
+ setEmptyMessage("Loading...");
+ setAnimateFolders(false);
+
+ final TreeGridField name = new
TreeGridField(ResourceTypeTreeNodeBuilder.ATTRIB_NAME, "Name");
+ final TreeGridField plugin = new
TreeGridField(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN, "Plugin");
+ final TreeGridField category = new
TreeGridField(ResourceTypeTreeNodeBuilder.ATTRIB_CATEGORY, "Category");
+ final TreeGridField enabledAlertTemplates = new TreeGridField(
+ ResourceTypeTreeNodeBuilder.ATTRIB_ENABLED_ALERT_TEMPLATES, "Enabled
Alert Templates");
+ final TreeGridField disabledAlertTemplates = new TreeGridField(
+ ResourceTypeTreeNodeBuilder.ATTRIB_DISABLED_ALERT_TEMPLATES,
"Disabled Alert Templates");
+ final TreeGridField enabledMetricTemplates = new TreeGridField(
+ ResourceTypeTreeNodeBuilder.ATTRIB_ENABLED_METRIC_TEMPLATES,
"Enabled Metric Templates");
+ final TreeGridField disabledMetricTemplates = new TreeGridField(
+ ResourceTypeTreeNodeBuilder.ATTRIB_DISABLED_METRIC_TEMPLATES,
"Disabled Metric Templates");
+
+ name.setWidth("40%");
+ plugin.setWidth("10%");
+ category.setWidth("10%");
+ enabledAlertTemplates.setWidth("10%");
+ disabledAlertTemplates.setWidth("10%");
+ enabledMetricTemplates.setWidth("10%");
+ disabledMetricTemplates.setWidth("10%");
+
+ enabledAlertTemplates.setPrompt("Number of alert templates that are
enabled on this resource type");
+ disabledAlertTemplates
+ .setPrompt("Number of alert templates that are created but disabled
on this resource type");
+ enabledMetricTemplates
+ .setPrompt("Number of metric schedules that are enabled by default
on this resource type");
+ disabledMetricTemplates
+ .setPrompt("Number of metric schedules that are disabled by default
on this resource type");
+
+ setFields(name, plugin, category, enabledAlertTemplates,
disabledAlertTemplates, enabledMetricTemplates,
+ disabledMetricTemplates);
+ }
+
+ @Override
+ protected Canvas getRollOverCanvas(Integer rowNum, Integer colNum) {
+ rollOverRecord = this.getRecord(rowNum);
+
+ if (rollOverCanvas == null) {
+ rollOverCanvas = new HLayout(3);
+ rollOverCanvas.setSnapTo("TR");
+ rollOverCanvas.setWidth(50);
+ rollOverCanvas.setHeight(22);
+
+ ImgButton metricTemplateImg = new ImgButton();
+ metricTemplateImg.setShowDown(false);
+ metricTemplateImg.setShowRollOver(false);
+ metricTemplateImg.setLayoutAlign(Alignment.CENTER);
+
metricTemplateImg.setSrc("subsystems/monitor/Edit_Metric.png");
+ metricTemplateImg.setPrompt("Edit Metric Template");
+ metricTemplateImg.setHeight(16);
+ metricTemplateImg.setWidth(16);
+ metricTemplateImg.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ //
http://localhost:7080/admin/platform/monitor/Config.do?nomenu=true&mo...
+ SC.say("Metric Template: "
+ +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_NAME) + "==>"
+ +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN) +
"==>"
+ +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ }
+ });
+
+ ImgButton alertTemplateImg = new ImgButton();
+ alertTemplateImg.setShowDown(false);
+ alertTemplateImg.setShowRollOver(false);
+ alertTemplateImg.setLayoutAlign(Alignment.CENTER);
+ alertTemplateImg.setSrc("subsystems/alert/Edit_Alert.png");
+ alertTemplateImg.setPrompt("Edit Alert Template");
+ alertTemplateImg.setHeight(16);
+ alertTemplateImg.setWidth(16);
+ alertTemplateImg.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ SC.say("Alert Template : "
+ +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_NAME) + "==>"
+ +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_PLUGIN) +
"==>"
+ +
rollOverRecord.getAttribute(ResourceTypeTreeNodeBuilder.ATTRIB_ID));
+ }
+ });
+
+ rollOverCanvas.addMember(metricTemplateImg);
+ rollOverCanvas.addMember(alertTemplateImg);
+ }
+ return rollOverCanvas;
+ }
+
+ @Override
+ protected String getIcon(Record record, boolean defaultState) {
+
+ if (record instanceof TreeNode) {
+ if (record instanceof ResourceTypeTreeNodeBuilder.ResourceTypeTreeNode)
{
+ ResourceType resourceType =
((ResourceTypeTreeNodeBuilder.ResourceTypeTreeNode) record)
+ .getResourceType();
+
+ switch (resourceType.getCategory()) {
+ case PLATFORM:
+ return "types/Platform_up_16.png";
+ case SERVER:
+ return "types/Server_up_16.png";
+ case SERVICE:
+ return "types/Service_up_16.png";
+ }
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceTypeGWTService.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceTypeGWTService.java
index e2eeb96..9d4e471 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceTypeGWTService.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/ResourceTypeGWTService.java
@@ -2,12 +2,14 @@ package org.rhq.enterprise.gui.coregui.client.gwt;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Map;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import org.rhq.core.domain.criteria.ResourceTypeCriteria;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.ResourceTypeTemplateCountComposite;
import org.rhq.core.domain.util.PageList;
@RemoteServiceRelativePath("ResourceTypeGWTService")
@@ -20,4 +22,6 @@ public interface ResourceTypeGWTService extends RemoteService {
ArrayList<ResourceType> getAllResourceTypeAncestors(int resourceTypeId);
HashMap<Integer, String> getResourceTypeDescendantsWithOperations(int
resourceTypeId);
+
+ Map<Integer, ResourceTypeTemplateCountComposite>
getTemplateCountCompositeMap();
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceTypeGWTServiceImpl.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceTypeGWTServiceImpl.java
index be25a0b..5cffd24 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceTypeGWTServiceImpl.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceTypeGWTServiceImpl.java
@@ -3,10 +3,12 @@ package org.rhq.enterprise.gui.coregui.server.gwt;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.rhq.core.domain.criteria.ResourceTypeCriteria;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceLineageComposite;
+import org.rhq.core.domain.resource.composite.ResourceTypeTemplateCountComposite;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceTypeGWTService;
@@ -72,4 +74,15 @@ public class ResourceTypeGWTServiceImpl extends AbstractGWTServiceImpl
implement
throw new RuntimeException(ThrowableUtil.getAllMessages(e));
}
}
+
+ @Override
+ public Map<Integer, ResourceTypeTemplateCountComposite>
getTemplateCountCompositeMap() {
+ try {
+ ResourceTypeManagerLocal typeManager = LookupUtil.getResourceTypeManager();
+ Map<Integer, ResourceTypeTemplateCountComposite> map =
typeManager.getTemplateCountCompositeMap();
+ return SerialUtility.prepare(map,
"ResourceTypes.getTemplateCountCompositeMap");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
}
\ No newline at end of file
diff --git
a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/alert/Edit_Alert.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/alert/Edit_Alert.png
new file mode 100644
index 0000000..cecb563
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/alert/Edit_Alert.png
differ
diff --git
a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/monitor/Edit_Metric.png
b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/monitor/Edit_Metric.png
new file mode 100644
index 0000000..6e3de53
Binary files /dev/null and
b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/monitor/Edit_Metric.png
differ
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java
index 1837023..034cd6e 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java
@@ -394,12 +394,45 @@ public class ResourceTypeManagerBean implements
ResourceTypeManagerLocal, Resour
@SuppressWarnings("unchecked")
public Map<Integer, ResourceTypeTemplateCountComposite>
getTemplateCountCompositeMap() {
Query templateCountQuery =
entityManager.createNamedQuery(ResourceType.FIND_ALL_TEMPLATE_COUNT_COMPOSITES);
- List<ResourceTypeTemplateCountComposite> composites =
templateCountQuery.getResultList();
+ // the weirdness here is because we needed to JOIN FETCH the parent types, but
hibernate bombs when you do that
+ // and try to use a composite constructor in the query itself. We need to build
the composites here.
+ // Our results will be a list of arrays that we'll build into the composite
below
+ List<?> results = templateCountQuery.getResultList();
+
+ // we don't need to send all the data in resource types over the wire, so
we'll be scrubbing the types
+ // to avoid the scrubbed types getting persisted back to the db, let's clear
the persistence context
+ entityManager.clear();
Map<Integer, ResourceTypeTemplateCountComposite> compositeMap = new
HashMap<Integer, ResourceTypeTemplateCountComposite>();
- for (ResourceTypeTemplateCountComposite next : composites) {
- compositeMap.put(next.getType().getId(), next);
+ for (Object result : results) {
+ Object[] array = (Object[]) result;
+
+ ResourceType type = (ResourceType) array[0];
+
+ // scrub it to avoid sending data over the wire we don't need
+ // some of these are eagerly loaded, but my paranoia says assume everything
is eagerly loaded to purge it all
+ type.setBundleType(null);
+ type.setChildResourceTypes(null);
+ type.setChildSubCategories(null);
+ type.setClassLoaderType(null);
+ type.setEventDefinitions(null);
+ type.setMetricDefinitions(null);
+ type.setOperationDefinitions(null);
+ type.setPackageTypes(null);
+ type.setPluginConfigurationDefinition(null);
+ type.setProcessScans(null);
+ type.setProductVersions(null);
+ type.setResourceConfigurationDefinition(null);
+ type.setResourceGroups(null);
+ type.setResources(null);
+ type.setSubCategory(null);
+
+ ResourceTypeTemplateCountComposite composite = new
ResourceTypeTemplateCountComposite(type,
+ ((Number) array[1]).longValue(), ((Number) array[2]).longValue(),
((Number) array[3]).longValue(),
+ ((Number) array[4]).longValue());
+ compositeMap.put(composite.getType().getId(), composite);
}
+
return compositeMap;
}
commit ae8dfb3eaa8512174d536795aa3f17f5ba2e444b
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Oct 20 15:05:40 2010 -0400
fix a bug i introduced earlier today that was causing the group list views to fail to
display; make titles of group list views prettier (separate words rather than camel case)
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
index e198fc0..4583a4a 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
@@ -89,7 +89,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
if (isAggregateProperty(propertySimple)) {
// Create the "MEMBER VALUES DIFFER" label that is displayed when
member values are heterogeneous.
final StaticTextItem staticItem = new StaticTextItem();
- staticItem.setValue("MEMBER VALUES DIFFER");
+ staticItem.setValue("member values differ");
staticItem.setTextBoxStyle("InlineNote");
staticItem.setShowTitle(false);
staticItem.setTooltip("Member values differ - click icon to edit
them.");
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 bdb1160..92fc25d 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
@@ -166,7 +166,7 @@ public class GWTServiceLookup {
String sessionId = UserSessionManager.getSessionId();
if (sessionId != null) {
- Log.info("SessionRpcRequestBuilder is adding sessionId to request:
" + sessionId);
+ Log.debug("SessionRpcRequestBuilder is adding sessionId to request:
" + sessionId);
rb.setHeader(UserSessionManager.SESSION_NAME, sessionId);
} else {
Log.error("SessionRpcRequestBuilder constructed without a value for
" + UserSessionManager.SESSION_NAME);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
index 2b5097f..b2fea0a 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
@@ -157,7 +157,7 @@ public class ResourceGroupCompositeDataSource extends
RPCDataSource<ResourceGrou
record.setAttribute("id", from.getResourceGroup().getId());
record.setAttribute("name", from.getResourceGroup().getName());
record.setAttribute("description",
from.getResourceGroup().getDescription());
- record.setAttribute("category",
from.getResourceGroup().getGroupCategory());
+ record.setAttribute("category",
from.getResourceGroup().getGroupCategory().name());
record.setAttribute("explicitUp",
String.valueOf(from.getExplicitUp()));
record.setAttribute("explicitDown",
String.valueOf(from.getExplicitDown()));
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
index 6aa4e65..32aabb0 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
@@ -26,6 +26,7 @@ import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -65,8 +66,10 @@ public class ResourceGroupListView extends Table {
protected void configureTable() {
ListGridField nameField = new ListGridField("name", "Name",
300);
nameField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1)
{
- return "<a href=\"#ResourceGroup/" +
listGridRecord.getAttribute("id") + "\">" + o +
"</a>";
+ public String format(Object value, ListGridRecord record, int i, int i1) {
+ String groupId = record.getAttribute("id");
+ String groupUrl =
LinkManager.getResourceGroupLink(Integer.valueOf(groupId));
+ return "<a href=\"" + groupUrl +
"\">" + value + "</a>";
}
});
@@ -79,12 +82,12 @@ public class ResourceGroupListView extends Table {
availabilityChildrenField.setWrap(false);
availabilityChildrenField.setAlign(Alignment.CENTER);
- ListGridField availabilityDescendentsField = new
ListGridField("availabilityDescendents", "Descendents", 100);
- availabilityDescendentsField.setWrap(false);
- availabilityDescendentsField.setAlign(Alignment.CENTER);
+ ListGridField availabilityDescendantsField = new
ListGridField("availabilityDescendents", "Descendants", 100);
+ availabilityDescendantsField.setWrap(false);
+ availabilityDescendantsField.setAlign(Alignment.CENTER);
getListGrid().setFields(nameField, descriptionField, typeNameField,
pluginNameField, categoryField,
- availabilityChildrenField, availabilityDescendentsField);
+ availabilityChildrenField, availabilityDescendantsField);
addTableAction(extendLocatorId("Delete"), "Delete",
Table.SelectionEnablement.ANY,
"Delete the selected resource groups?", new TableAction() {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
index e0778bb..3f6e197 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
@@ -152,7 +152,7 @@ public class ResourceGroupsDataSource extends
RPCDataSource<ResourceGroup> {
record.setAttribute("id", from.getId());
record.setAttribute("name", from.getName());
record.setAttribute("description", from.getDescription());
- record.setAttribute("category", from.getGroupCategory());
+ record.setAttribute("category", from.getGroupCategory().name());
if (from.getResourceType() != null) {
record.setAttribute("resourceType", from.getResourceType());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
index fcef030..dee71d2 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
@@ -266,19 +266,19 @@ public class InventoryView extends LocatableHLayout implements
BookmarkableView
} else if (GROUPS_SECTION_VIEW_ID.equals(sectionName)) {
if (PAGE_COMPATIBLE_GROUPS.equals(pageName)) {
content = new
ResourceGroupListView(extendLocatorId("Compatible"), new
Criteria("category",
- GroupCategory.COMPATIBLE.name()), PAGE_COMPATIBLE_GROUPS,
"types/Cluster_up_24.png");
+ GroupCategory.COMPATIBLE.name()), "Compatible Groups",
"types/Cluster_up_24.png");
} else if (PAGE_MIXED_GROUPS.equals(pageName)) {
content = new ResourceGroupListView(extendLocatorId("Mixed"),
new Criteria("category",
- GroupCategory.MIXED.name()), PAGE_MIXED_GROUPS,
"types/Group_up_24.png");
+ GroupCategory.MIXED.name()), "Mixed Groups",
"types/Group_up_24.png");
} else if (PAGE_GROUP_DEFINITIONS.equals(pageName)) {
content = new
GroupDefinitionListView(extendLocatorId("Definitions"),
"types/GroupDefinition_16.png");
} else if (PAGE_PROBLEM_GROUPS.equals(pageName)) {
//TODO - there is no underlying support for this criteria. Also, there
should not be an active
// new button on this page.
content = new
ResourceGroupListView(extendLocatorId("DownGroups"),
- new Criteria("availability", "down"),
PAGE_PROBLEM_GROUPS, "types/Cluster_down_16.png");
+ new Criteria("availability", "down"),
"Problem Groups", "types/Cluster_down_16.png");
} else { // selected the Inventory node itself
- content = new
ResourceGroupListView(extendLocatorId("AllGroups"), null, PAGE_GROUPS,
+ content = new
ResourceGroupListView(extendLocatorId("AllGroups"), null, "All
Groups",
"types/Cluster_up_24.png",
"types/Group_up_24.png");
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
index d60a616..0c5c221 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
@@ -387,7 +387,7 @@ a:hover {
}
.InlineNote {
- color: #511;
+ color: #C22;
}
.log-panel {
commit 96e0b10bc8c6f02608c744a8741165d10f881af4
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Oct 20 11:20:39 2010 -0400
Replacing call to finder method that has been removed in favor of criteria query
diff --git
a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventAlertJSON.jsp
b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventAlertJSON.jsp
index 2cc3da3..173fe16 100644
---
a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventAlertJSON.jsp
+++
b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/events/EventAlertJSON.jsp
@@ -7,6 +7,7 @@
<%@ page import="org.rhq.core.domain.util.PageControl" %>
<%@ page import="org.rhq.core.domain.util.PageList" %>
<%@ page import="org.rhq.core.domain.util.PageOrdering" %>
+<%@ page import="org.rhq.core.domain.criteria.AlertCriteria" %>
<%@ page import="org.rhq.enterprise.gui.common.tag.FunctionTagLibrary"
%>
<%@ page import="org.rhq.enterprise.gui.legacy.ParamConstants" %>
<%@ page import="org.rhq.enterprise.gui.legacy.WebUser" %>
@@ -29,8 +30,14 @@
PageControl pc = new PageControl(0, 100);
pc.setPrimarySortOrder(PageOrdering.DESC);
- PageList<Alert> alerts = alertManager.findAlerts(resourceId, null, null, begin,
end, pc);
+ AlertCriteria criteria = new AlertCriteria();
+ criteria.addFilterResourceIds(resourceId);
+ criteria.addFilterStartTime(begin);
+ criteria.addFilterEndTime(end);
+ criteria.setPageControl(pc);
+
+ PageList<Alert> alerts = alertManager.findAlertsByCriteria(user.getSubject(),
criteria);
%>
{ "events":
commit 1863896db8bd017e29a385cbb06fcbeb9402262a
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Oct 20 11:06:08 2010 -0400
core group config code for top-level simples and static maps of simples is done; still
to do: set-all-values-to controls and support for dynamic/open maps of simples
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index df61aaa..28d5960 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -1326,17 +1326,11 @@ public class ConfigurationEditor extends LocatableVLayout {
// Only update the underlying property when the input is changed if it's a
top-level simple or a simple within a
// top-level map.
- PropertyDefinitionMap parentPropertyMapDefinition =
- propertyDefinitionSimple.getParentPropertyMapDefinition();
- if (propertyDefinitionSimple.getConfigurationDefinition() != null ||
- (parentPropertyMapDefinition != null &&
parentPropertyMapDefinition.getConfigurationDefinition() != null)) {
+ if (updatePropertyValueOnChange(propertyDefinitionSimple, propertySimple)) {
valueItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent changedEvent) {
- propertySimple.setErrorMessage(null);
+ public void onChanged(ChangedEvent changedEvent) {
+ updatePropertySimpleValue(changedEvent.getValue(),
propertySimple, propertyDefinitionSimple);
boolean isValid = changedEvent.getItem().validate();
- if (isValid) {
- propertySimple.setValue(changedEvent.getValue());
- }
firePropertyChangedEvent(propertySimple,
propertyDefinitionSimple, isValid);
}
});
@@ -1345,6 +1339,20 @@ public class ConfigurationEditor extends LocatableVLayout {
return valueItem;
}
+ protected boolean updatePropertyValueOnChange(PropertyDefinitionSimple
propertyDefinitionSimple,
+ PropertySimple propertySimple) {
+ PropertyDefinitionMap parentPropertyMapDefinition =
+ propertyDefinitionSimple.getParentPropertyMapDefinition();
+ return propertyDefinitionSimple.getConfigurationDefinition() != null ||
+ (parentPropertyMapDefinition != null &&
parentPropertyMapDefinition.getConfigurationDefinition() != null);
+ }
+
+ protected void updatePropertySimpleValue(Object value, PropertySimple
propertySimple,
+ PropertyDefinitionSimple
propertyDefinitionSimple) {
+ propertySimple.setErrorMessage(null);
+ propertySimple.setValue(value);
+ }
+
protected static Property getTopLevelProperty(Property property) {
Property currentProperty = property;
while (currentProperty.getConfiguration() == null) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
index c3ba6cb..e198fc0 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
@@ -159,7 +159,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
for (GroupMemberConfiguration memberConfiguration : memberConfigurations) {
Configuration configuration = memberConfiguration.getConfiguration();
PropertySimple memberPropertySimple =
- getPropertySimple(configuration, propertyDefinitionSimple,
propertySimple, null);
+ getPropertySimple(configuration, propertyDefinitionSimple, null);
memberPropertySimple.setValue(value);
}
}
@@ -218,7 +218,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
memberItem.setDefaultValue(memberName);
items.add(memberItem);
Configuration configuration = memberConfiguration.getConfiguration();
- PropertySimple memberPropertySimple = getPropertySimple(configuration,
propertyDefinitionSimple, aggregatePropertySimple, index);
+ PropertySimple memberPropertySimple = getPropertySimple(configuration,
propertyDefinitionSimple, index);
memberProperties.put(memberName, memberPropertySimple);
FormItem valueItem = buildSimpleField(propertyDefinitionSimple,
memberPropertySimple);
valueItem.setAttribute("rhq:property", memberPropertySimple);
@@ -317,13 +317,36 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
popup.show();
}
+ @Override
+ protected boolean updatePropertyValueOnChange(PropertyDefinitionSimple
propertyDefinitionSimple,
+ PropertySimple propertySimple) {
+ return isAggregateProperty(propertySimple) &&
super.updatePropertyValueOnChange(propertyDefinitionSimple, propertySimple); // TODO:
Implement this method.
+ }
+
+ @Override
+ protected void updatePropertySimpleValue(Object value, PropertySimple
propertySimple,
+ PropertyDefinitionSimple
propertyDefinitionSimple) {
+ // Update the aggregate property
+ super.updatePropertySimpleValue(value, propertySimple,
propertyDefinitionSimple);
+ propertySimple.setOverride(true);
+
+ // Update all the member properties.
+ for (GroupMemberConfiguration memberConfiguration : this.memberConfigurations) {
+ Configuration configuration = memberConfiguration.getConfiguration();
+ PropertySimple memberPropertySimple =
+ getPropertySimple(configuration, propertyDefinitionSimple, null);
+ memberPropertySimple.setErrorMessage(null);
+ memberPropertySimple.setValue(value);
+ }
+ }
+
private PropertySimple getPropertySimple(Configuration configuration,
PropertyDefinitionSimple
propertyDefinitionSimple,
- PropertySimple aggregatePropertySimple,
Integer index) {
+ Integer index) {
LinkedList<PropertyDefinition> propertyDefinitionHierarchy = new
LinkedList<PropertyDefinition>();
PropertyDefinition currentPropertyDefinition = propertyDefinitionSimple;
- do {
- propertyDefinitionHierarchy.addFirst(currentPropertyDefinition);
+ propertyDefinitionHierarchy.add(currentPropertyDefinition);
+ do {
if (currentPropertyDefinition.getParentPropertyMapDefinition() != null) {
currentPropertyDefinition =
currentPropertyDefinition.getParentPropertyMapDefinition();
} else if (currentPropertyDefinition.getParentPropertyListDefinition() !=
null) {
@@ -331,6 +354,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
} else if (currentPropertyDefinition.getConfigurationDefinition() == null) {
throw new IllegalStateException(currentPropertyDefinition + " has no
parent.");
}
+ propertyDefinitionHierarchy.addFirst(currentPropertyDefinition);
}
while (currentPropertyDefinition.getConfigurationDefinition() == null);
@@ -348,10 +372,6 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
}
PropertySimple propertySimple = (PropertySimple)property;
- if (isHomogeneous(aggregatePropertySimple)) {
- // If the aggregate property has its override bit set, make sure the member
property has the same value.
- propertySimple.setStringValue(aggregatePropertySimple.getStringValue());
- }
return propertySimple;
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestConfigurationView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestConfigurationView.java
index 2fd5dfa..9d94650 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestConfigurationView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestConfigurationView.java
@@ -20,6 +20,7 @@
package org.rhq.enterprise.gui.coregui.client.test;
import java.util.EnumSet;
+import java.util.Set;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.events.ClickEvent;
@@ -91,15 +92,17 @@ public class TestConfigurationView
MessageCenter messageCenter = CoreGUI.getMessageCenter();
Message message;
if (event.isValidationStateChanged()) {
- if (event.getInvalidPropertyNames().isEmpty()) {
+ Set<String> invalidPropertyNames = event.getInvalidPropertyNames();
+ if (invalidPropertyNames.isEmpty()) {
this.saveButton.enable();
message = new Message("All properties now have valid values, so the
configuration can now be saved.",
- Message.Severity.Info, EnumSet.of(Message.Option.Transient));
+ Message.Severity.Info, EnumSet.of(Message.Option.Transient,
Message.Option.Sticky));
}
else {
this.saveButton.disable();
message = new Message(
- "One or more properties have invalid values. The values must be
corrected before the configuration can be saved.",
+ "The following properties have invalid values: " +
invalidPropertyNames
+ + " - the values must be corrected before the configuration
can be saved.",
Message.Severity.Error, EnumSet.of(Message.Option.Transient,
Message.Option.Sticky));
}
messageCenter.notify(message);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestGroupConfigurationView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestGroupConfigurationView.java
index 7d71c02..f54bb01 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestGroupConfigurationView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestGroupConfigurationView.java
@@ -22,6 +22,7 @@ package org.rhq.enterprise.gui.coregui.client.test;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
+import java.util.Set;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.events.ClickEvent;
@@ -100,15 +101,17 @@ public class TestGroupConfigurationView
MessageCenter messageCenter = CoreGUI.getMessageCenter();
Message message;
if (event.isValidationStateChanged()) {
- if (event.getInvalidPropertyNames().isEmpty()) {
+ Set<String> invalidPropertyNames = event.getInvalidPropertyNames();
+ if (invalidPropertyNames.isEmpty()) {
this.saveButton.enable();
message = new Message("All properties now have valid values, so the
configuration can now be saved.",
- Message.Severity.Info, EnumSet.of(Message.Option.Transient));
+ Message.Severity.Info, EnumSet.of(Message.Option.Transient,
Message.Option.Sticky));
}
else {
this.saveButton.disable();
message = new Message(
- "One or more properties have invalid values. The values must be
corrected before the configuration can be saved.",
+ "The following properties have invalid values: " +
invalidPropertyNames
+ + " - the values must be corrected before the configuration
can be saved.",
Message.Severity.Error, EnumSet.of(Message.Option.Transient,
Message.Option.Sticky));
}
messageCenter.notify(message);
commit 927bc83226129c29feab114910c9d226bd2e5ddf
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Oct 19 18:55:33 2010 -0400
more work on group config component; add test view for group config
(#TestGroupConfig); misc datasource fixes
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 6db7fc8..3888cdc 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
@@ -48,6 +48,7 @@ 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.test.TestConfigurationView;
+import org.rhq.enterprise.gui.coregui.client.test.TestGroupConfigurationView;
import org.rhq.enterprise.gui.coregui.client.util.ErrorHandler;
import org.rhq.enterprise.gui.coregui.client.util.WidgetUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.MessageBar;
@@ -217,6 +218,8 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
canvas = new ReportTopView("Report");
} else if (breadcrumbName.equals(TestConfigurationView.VIEW_ID)) {
canvas = new TestConfigurationView("TestConfig");
+ } else if (breadcrumbName.equals(TestGroupConfigurationView.VIEW_ID)) {
+ canvas = new TestGroupConfigurationView("TestGroupConfig");
} else {
canvas = null;
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index 2cbebe4..df61aaa 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -128,7 +128,6 @@ import
org.rhq.core.domain.configuration.definition.constraint.IntegerRangeConst
import org.rhq.core.domain.configuration.definition.constraint.RegexConstraint;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.components.table.PropertyGrid;
import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -558,20 +557,8 @@ public class ConfigurationEditor extends LocatableVLayout {
Property property,
boolean oddRow,
List<FormItem> fields, final boolean
firePropertyChangedEvents) {
- List<FormItem> fieldsForThisProperty = new ArrayList<FormItem>();
+ List<FormItem> fieldsForThisProperty;
- StaticTextItem nameItem = new StaticTextItem();
- nameItem.setStartRow(true);
- String title = "<b>"
- + (propertyDefinition.getDisplayName() != null ?
propertyDefinition.getDisplayName() : propertyDefinition
- .getName()) + "</b>";
- nameItem.setValue(title);
- nameItem.setShowTitle(false);
-
- fieldsForThisProperty.add(nameItem);
- fields.add(nameItem);
-
- final FormItem valueItem;
if (propertyDefinition instanceof PropertyDefinitionSimple) {
final PropertyDefinitionSimple propertyDefinitionSimple =
(PropertyDefinitionSimple)propertyDefinition;
PropertySimple propertySimple = (PropertySimple)property;
@@ -580,34 +567,8 @@ public class ConfigurationEditor extends LocatableVLayout {
propertySimple = new PropertySimple(propertyDefinitionSimple.getName(),
null);
}
- final PropertySimple finalPropertySimple = propertySimple;
- valueItem = buildSimpleField(propertyDefinitionSimple, propertySimple);
- valueItem.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent changedEvent) {
- finalPropertySimple.setErrorMessage(null);
- boolean isValid = changedEvent.getItem().validate();
- if (isValid) {
- finalPropertySimple.setValue(changedEvent.getValue());
- }
- if (firePropertyChangedEvents) {
- firePropertyChangedEvent(finalPropertySimple,
propertyDefinitionSimple, isValid);
- }
- }
- });
-
- FormItem unsetItem = buildUnsetItem(propertyDefinitionSimple, propertySimple,
valueItem);
- fieldsForThisProperty.add(unsetItem);
- fields.add(unsetItem);
-
- fieldsForThisProperty.add(valueItem);
- fields.add(valueItem);
-
- StaticTextItem descriptionItem = new StaticTextItem();
- descriptionItem.setValue(propertyDefinition.getDescription());
- descriptionItem.setShowTitle(false);
- descriptionItem.setEndRow(true);
- fieldsForThisProperty.add(descriptionItem);
- fields.add(descriptionItem);
+ fieldsForThisProperty = buildFieldsForPropertySimple(propertyDefinition,
propertyDefinitionSimple,
+ propertySimple);
} else if (propertyDefinition instanceof PropertyDefinitionList) {
PropertyDefinitionList propertyDefinitionList =
(PropertyDefinitionList)propertyDefinition;
PropertyDefinition memberDefinition =
propertyDefinitionList.getMemberDefinition();
@@ -615,41 +576,9 @@ public class ConfigurationEditor extends LocatableVLayout {
if (propertyList == null) {
propertyList = new PropertyList(propertyDefinitionList.getName());
}
- if (memberDefinition instanceof PropertyDefinitionMap) {
- // List of Maps is a specially supported case with summary fields as
columns in a table
- // Note: This field spans 3 columns.
- PropertyDefinitionMap memberDefinitionMap =
(PropertyDefinitionMap)memberDefinition;
- CanvasItem listOfMapsItem = buildListOfMapsField(locatorId,
- memberDefinitionMap,
- propertyList, oddRow);
- fieldsForThisProperty.add(listOfMapsItem);
- fields.add(listOfMapsItem);
- } else if (memberDefinition instanceof PropertyDefinitionSimple) {
- SpacerItem unsetItem = new SpacerItem();
- fieldsForThisProperty.add(unsetItem);
- fields.add(unsetItem);
-
- CanvasItem listOfSimplesItem = buildListOfSimplesField(locatorId,
propertyDefinitionList, propertyList,
- oddRow);
- fieldsForThisProperty.add(listOfSimplesItem);
- fields.add(listOfSimplesItem);
-
- StaticTextItem descriptionItem = new StaticTextItem();
- descriptionItem.setValue(propertyDefinition.getDescription());
- descriptionItem.setShowTitle(false);
- descriptionItem.setEndRow(true);
- fieldsForThisProperty.add(descriptionItem);
- fields.add(descriptionItem);
- } else {
- Log.error("List " + propertyList + " has unsupported
member type: " + memberDefinition);
- Canvas canvas = new Canvas();
- // TODO: Add label with error message to canvas.
- CanvasItem canvasItem = buildComplexPropertyField(canvas);
- canvasItem.setColSpan(3);
- canvasItem.setEndRow(true);
- fieldsForThisProperty.add(canvasItem);
- fields.add(canvasItem);
- }
+ fieldsForThisProperty = buildFieldsForPropertyList(locatorId,
propertyDefinition, oddRow,
+ propertyDefinitionList,
+ memberDefinition, propertyList);
} else if (propertyDefinition instanceof PropertyDefinitionMap) {
PropertyDefinitionMap propertyDefinitionMap =
(PropertyDefinitionMap)propertyDefinition;
PropertyMap propertyMap = (PropertyMap)property;
@@ -657,18 +586,113 @@ public class ConfigurationEditor extends LocatableVLayout {
propertyMap = new PropertyMap(propertyDefinitionMap.getName());
}
- // Note: This field spans 3 columns.
- FormItem mapField =
- buildMapField(locatorId, propertyDefinitionMap, propertyMap);
- fields.add(mapField);
+ fieldsForThisProperty = buildFieldsForPropertyMap(locatorId,
propertyDefinitionMap, propertyMap);
+ } else {
+ throw new IllegalStateException("Property definition null or of unknown
type: " + propertyDefinition);
}
- // Set row background color.
+ // Add the fields for this property to the master fields list and set the row
background color.
for (FormItem field : fieldsForThisProperty) {
+ fields.add(field);
field.setCellStyle(oddRow ? "OddRow" : "EvenRow");
}
}
+ protected List<FormItem> buildFieldsForPropertySimple(PropertyDefinition
propertyDefinition,
+ PropertyDefinitionSimple
propertyDefinitionSimple,
+ PropertySimple propertySimple) {
+ List<FormItem> fields = new ArrayList<FormItem>();
+
+ StaticTextItem nameItem = buildNameItem(propertyDefinition);
+ fields.add(nameItem);
+
+ FormItem valueItem;
+ valueItem = buildSimpleField(propertyDefinitionSimple, propertySimple);
+
+ FormItem unsetItem = buildUnsetItem(propertyDefinitionSimple, propertySimple,
valueItem);
+ fields.add(unsetItem);
+
+ fields.add(valueItem);
+
+ StaticTextItem descriptionItem = buildDescriptionField(propertyDefinition);
+ fields.add(descriptionItem);
+
+ return fields;
+ }
+
+ protected List<FormItem> buildFieldsForPropertyList(String locatorId,
PropertyDefinition propertyDefinition, boolean oddRow,
+ PropertyDefinitionList
propertyDefinitionList,
+ PropertyDefinition memberDefinition,
PropertyList propertyList) {
+ List<FormItem> fields = new ArrayList<FormItem>();
+
+ StaticTextItem nameItem = buildNameItem(propertyDefinition);
+ fields.add(nameItem);
+
+ if (memberDefinition instanceof PropertyDefinitionMap) {
+ // List of Maps is a specially supported case with summary fields as columns
in a table
+ // Note: This field spans 3 columns.
+ PropertyDefinitionMap memberDefinitionMap =
(PropertyDefinitionMap)memberDefinition;
+ CanvasItem listOfMapsItem = buildListOfMapsField(locatorId,
+ memberDefinitionMap,
+ propertyList, oddRow);
+ fields.add(listOfMapsItem);
+ } else if (memberDefinition instanceof PropertyDefinitionSimple) {
+ SpacerItem unsetItem = new SpacerItem();
+ fields.add(unsetItem);
+
+ CanvasItem listOfSimplesItem = buildListOfSimplesField(locatorId,
propertyDefinitionList, propertyList,
+ oddRow);
+ fields.add(listOfSimplesItem);
+
+ StaticTextItem descriptionItem = buildDescriptionField(propertyDefinition);
+ fields.add(descriptionItem);
+ } else {
+ Log.error("List " + propertyList + " has unsupported member
type: " + memberDefinition);
+ Canvas canvas = new Canvas();
+ // TODO: Add label with error message to canvas.
+ CanvasItem canvasItem = buildComplexPropertyField(canvas);
+ canvasItem.setColSpan(3);
+ canvasItem.setEndRow(true);
+ fields.add(canvasItem);
+ }
+
+ return fields;
+ }
+
+ protected List<FormItem> buildFieldsForPropertyMap(String locatorId,
+ PropertyDefinitionMap propertyDefinitionMap,
PropertyMap propertyMap) {
+ List<FormItem> fields = new ArrayList<FormItem>();
+
+ StaticTextItem nameItem = buildNameItem(propertyDefinitionMap);
+ fields.add(nameItem);
+
+ // Note: This field spans 3 columns.
+ FormItem mapField =
+ buildMapField(locatorId, propertyDefinitionMap, propertyMap);
+ fields.add(mapField);
+
+ return fields;
+ }
+
+ private StaticTextItem buildNameItem(PropertyDefinition propertyDefinition) {
+ StaticTextItem nameItem = new StaticTextItem();
+ nameItem.setStartRow(true);
+ String title = "<b>"
+ + (propertyDefinition.getDisplayName() != null ?
propertyDefinition.getDisplayName() : propertyDefinition
+ .getName()) + "</b>";
+ nameItem.setValue(title);
+ nameItem.setShowTitle(false);
+ return nameItem;
+ }
+
+ private StaticTextItem buildDescriptionField(PropertyDefinition propertyDefinition)
{
+ StaticTextItem descriptionItem = new StaticTextItem();
+ descriptionItem.setValue(propertyDefinition.getDescription());
+ descriptionItem.setShowTitle(false);
+ descriptionItem.setEndRow(true);
+ return descriptionItem;
+ }
+
private void firePropertyChangedEvent(Property property,
PropertyDefinition propertyDefinition,
boolean isValid) {
@@ -1300,6 +1324,24 @@ public class ConfigurationEditor extends LocatableVLayout {
valueItem.setShowTitle(false);
valueItem.setWidth(220);
+ // Only update the underlying property when the input is changed if it's a
top-level simple or a simple within a
+ // top-level map.
+ PropertyDefinitionMap parentPropertyMapDefinition =
+ propertyDefinitionSimple.getParentPropertyMapDefinition();
+ if (propertyDefinitionSimple.getConfigurationDefinition() != null ||
+ (parentPropertyMapDefinition != null &&
parentPropertyMapDefinition.getConfigurationDefinition() != null)) {
+ valueItem.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent changedEvent) {
+ propertySimple.setErrorMessage(null);
+ boolean isValid = changedEvent.getItem().validate();
+ if (isValid) {
+ propertySimple.setValue(changedEvent.getValue());
+ }
+ firePropertyChangedEvent(propertySimple,
propertyDefinitionSimple, isValid);
+ }
+ });
+ }
+
return valueItem;
}
@@ -1334,11 +1376,10 @@ public class ConfigurationEditor extends LocatableVLayout {
unsetItem.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent changeEvent) {
Boolean isUnset = (Boolean) changeEvent.getValue();
+ valueItem.setDisabled(isUnset);
if (isUnset) {
setValue(valueItem, null);
- valueItem.setDisabled(true);
} else {
- valueItem.setDisabled(false);
valueItem.focusInItem();
}
valueItem.redraw();
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
index de29950..c3ba6cb 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
@@ -49,7 +49,6 @@ import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
-import org.rhq.enterprise.gui.coregui.client.RefreshableView;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
@@ -60,6 +59,7 @@ import
org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
*/
public class GroupConfigurationEditor extends ConfigurationEditor {
private List<GroupMemberConfiguration> memberConfigurations;
+ private Map<String, FormItem> valueItemNameToStaticItemMap = new
HashMap<String, FormItem>();
private Map<String, FormItem> valueItemNameToUnsetItemMap = new
HashMap<String, FormItem>();
public GroupConfigurationEditor(String locatorId, ConfigurationDefinition
configurationDefinition,
@@ -80,6 +80,34 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
}
@Override
+ protected List<FormItem> buildFieldsForPropertySimple(PropertyDefinition
propertyDefinition,
+ PropertyDefinitionSimple
propertyDefinitionSimple,
+ PropertySimple propertySimple)
{
+ List<FormItem> fields =
super.buildFieldsForPropertySimple(propertyDefinition, propertyDefinitionSimple,
+ propertySimple);
+
+ if (isAggregateProperty(propertySimple)) {
+ // Create the "MEMBER VALUES DIFFER" label that is displayed when
member values are heterogeneous.
+ final StaticTextItem staticItem = new StaticTextItem();
+ staticItem.setValue("MEMBER VALUES DIFFER");
+ staticItem.setTextBoxStyle("InlineNote");
+ staticItem.setShowTitle(false);
+ staticItem.setTooltip("Member values differ - click icon to edit
them.");
+ Boolean isHomogeneous = isHomogeneous(propertySimple);
+ staticItem.setVisible(!isHomogeneous);
+
+ FormItem valueItem = fields.get(2);
+ FormItemIcon icon = buildEditMemberValuesIcon(propertyDefinitionSimple,
propertySimple, valueItem);
+ staticItem.setIcons(icon);
+
+ this.valueItemNameToStaticItemMap.put(valueItem.getName(), staticItem);
+ fields.add(3, staticItem);
+ }
+
+ return fields;
+ }
+
+ @Override
protected FormItem buildSimpleField(final PropertyDefinitionSimple
propertyDefinitionSimple,
final PropertySimple propertySimple) {
final FormItem item = super.buildSimpleField(propertyDefinitionSimple,
propertySimple);
@@ -87,40 +115,55 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
boolean isAggregate = isAggregateProperty(propertySimple);
if (isAggregate) {
// Add the icon that user can click to edit the member values.
- FormItemIcon icon = new FormItemIcon();
- icon.setSrc("[SKIN]/actions/edit.png");
- icon.setName("Edit Member Values");
- icon.setNeverDisable(true);
- icon.addFormItemClickHandler(new FormItemClickHandler() {
- public void onFormItemClick(FormItemIconClickEvent event) {
- // TODO: Pass the actual index, rather than null, if the prop is
inside a list.
-
displayMemberValuesEditor(extendLocatorId("MemberValuesEditor"),
propertyDefinitionSimple,
- propertySimple, null, item);
- }
- });
- // TODO: Figure out a way to add a tooltip to the icon.
- item.setIcons(icon);
+ FormItemIcon icon = buildEditMemberValuesIcon(propertyDefinitionSimple,
propertySimple, item);
- if (!isHomogeneous(propertySimple)) {
- updateHeterogeneousValueItem(item);
- }
+ item.setIcons(icon);
item.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent changedEvent) {
Object value = changedEvent.getValue();
- for (GroupMemberConfiguration memberConfiguration :
memberConfigurations) {
- Configuration configuration =
memberConfiguration.getConfiguration();
- PropertySimple memberPropertySimple =
- getPropertySimple(configuration, propertyDefinitionSimple,
propertySimple, null);
- memberPropertySimple.setValue(value);
- }
+ updateMemberProperties(propertyDefinitionSimple, propertySimple,
value);
}
});
+
+ Boolean isHomogeneous = isHomogeneous(propertySimple);
+ item.setVisible(isHomogeneous);
}
return item;
}
+ private FormItemIcon buildEditMemberValuesIcon(final PropertyDefinitionSimple
propertyDefinitionSimple,
+ final PropertySimple propertySimple,
final FormItem dynamicItem) {
+ FormItemIcon icon = new FormItemIcon();
+
+ icon.setSrc("[SKIN]/actions/edit.png");
+ icon.setName("Edit Member Values");
+ icon.setNeverDisable(true);
+ icon.addFormItemClickHandler(new FormItemClickHandler() {
+ public void onFormItemClick(FormItemIconClickEvent event) {
+ // TODO: Pass the actual index, rather than null, if the prop is
inside a list.
+
displayMemberValuesEditor(extendLocatorId("MemberValuesEditor"),
propertyDefinitionSimple,
+ propertySimple, null, dynamicItem);
+ }
+ });
+
+ // TODO: Figure out a way to add a tooltip to the icon.
+
+ return icon;
+ }
+
+ private void updateMemberProperties(PropertyDefinitionSimple
propertyDefinitionSimple,
+ PropertySimple propertySimple, Object value
+ ) {
+ for (GroupMemberConfiguration memberConfiguration : memberConfigurations) {
+ Configuration configuration = memberConfiguration.getConfiguration();
+ PropertySimple memberPropertySimple =
+ getPropertySimple(configuration, propertyDefinitionSimple,
propertySimple, null);
+ memberPropertySimple.setValue(value);
+ }
+ }
+
@Override
protected FormItem buildUnsetItem(final PropertyDefinitionSimple
propertyDefinitionSimple, final PropertySimple propertySimple,
final FormItem valueItem) {
@@ -136,8 +179,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
private void displayMemberValuesEditor(String locatorId, final
PropertyDefinitionSimple propertyDefinitionSimple,
final PropertySimple aggregatePropertySimple,
- Integer index, final FormItem
aggregateValueItem
- ) {
+ Integer index, final FormItem
aggregateValueItem) {
LocatableVLayout layout = new LocatableVLayout(locatorId);
layout.setHeight100();
@@ -215,31 +257,36 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
memberPropertySimple.setErrorMessage(null);
}
+ FormItem aggregateStaticItem =
valueItemNameToStaticItemMap.get(aggregateValueItem.getName());
+
FormItem aggregateUnsetItem =
valueItemNameToUnsetItemMap.get(aggregateValueItem.getName());
aggregateUnsetItem.setDisabled(!valuesHomogeneous);
+
if (valuesHomogeneous) {
// Update the value of the aggregate property and set its override
flag to true.
aggregatePropertySimple.setValue(firstValue);
aggregatePropertySimple.setOverride(true);
+ aggregateUnsetItem.setValue(firstValue == null);
+
// Set the aggregate value item's value to the homogeneous value,
enable it, and make sure it has
// validators set.
- aggregateValueItem.setDisabled(false);
setValue(aggregateValueItem, firstValue);
- aggregateValueItem.setTooltip(null);
- aggregateValueItem.setValidateOnChange(true);
- aggregateValueItem.setValidateOnExit(true);
+ aggregateValueItem.show();
+ aggregateValueItem.setDisabled(false);
+
+ aggregateStaticItem.hide();
- aggregateUnsetItem.setValue(firstValue == null);
} else {
aggregatePropertySimple.setValue(null);
aggregatePropertySimple.setOverride(false);
- updateHeterogeneousValueItem(aggregateValueItem);
+ aggregateValueItem.hide();
- aggregateUnsetItem.setValue((String)null);
+ aggregateStaticItem.show();
}
+ form.markForRedraw();
popup.destroy();
}
});
@@ -270,14 +317,6 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
popup.show();
}
- private void updateHeterogeneousValueItem(FormItem item) {
- item.setDisabled(true);
- item.setValidateOnChange(false);
- item.setValidateOnExit(false);
- item.setValue("MEMBER VALUES DIFFER");
- item.setTooltip("Member values differ - click icon to edit them.");
- }
-
private PropertySimple getPropertySimple(Configuration configuration,
PropertyDefinitionSimple
propertyDefinitionSimple,
PropertySimple aggregatePropertySimple,
Integer index) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
index 6fd1d01..2b5097f 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
@@ -157,7 +157,7 @@ public class ResourceGroupCompositeDataSource extends
RPCDataSource<ResourceGrou
record.setAttribute("id", from.getResourceGroup().getId());
record.setAttribute("name", from.getResourceGroup().getName());
record.setAttribute("description",
from.getResourceGroup().getDescription());
- record.setAttribute("category",
from.getResourceGroup().getGroupCategory().toString());
+ record.setAttribute("category",
from.getResourceGroup().getGroupCategory());
record.setAttribute("explicitUp",
String.valueOf(from.getExplicitUp()));
record.setAttribute("explicitDown",
String.valueOf(from.getExplicitDown()));
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
index 190baf7..e0778bb 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
@@ -152,7 +152,7 @@ public class ResourceGroupsDataSource extends
RPCDataSource<ResourceGroup> {
record.setAttribute("id", from.getId());
record.setAttribute("name", from.getName());
record.setAttribute("description", from.getDescription());
- record.setAttribute("category", from.getGroupCategory().toString());
+ record.setAttribute("category", from.getGroupCategory());
if (from.getResourceType() != null) {
record.setAttribute("resourceType", from.getResourceType());
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDataSourceField.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDataSourceField.java
index 59b55e9..be80e8e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDataSourceField.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDataSourceField.java
@@ -40,12 +40,12 @@ public enum ResourceDataSourceField {
AVAILABILITY("currentAvailability", "Availability");
/**
- * Corresponds to a property name of Resource
+ * Corresponds to a property name of Resource (e.g. resourceType.name).
*/
private String propertyName;
/**
- * The display name for the field or property
+ * The table header for the field or property (e.g. Type).
*/
private String title;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
index 2b3a4c2..7759f53 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
@@ -163,7 +163,7 @@ public class ResourceDatasource extends RPCDataSource<Resource>
{
record.setAttribute(DESCRIPTION.propertyName(), from.getDescription());
record.setAttribute(TYPE.propertyName(), from.getResourceType().getId());
record.setAttribute(PLUGIN.propertyName(), from.getResourceType().getPlugin());
- record.setAttribute(CATEGORY.propertyName(),
from.getResourceType().getCategory().getDisplayName());
+ record.setAttribute(CATEGORY.propertyName(),
from.getResourceType().getCategory());
record.setAttribute("icon",
from.getResourceType().getCategory().getDisplayName() + "_"
+ (from.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP
? "up" : "down") + "_16.png");
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestConfigurationFactory.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestConfigurationFactory.java
index 396f07a..89d7d53 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestConfigurationFactory.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestConfigurationFactory.java
@@ -45,48 +45,48 @@ import
org.rhq.core.domain.configuration.definition.PropertySimpleType;
*/
public abstract class TestConfigurationFactory {
public static ConfigurationDefinition createConfigurationDefinition() {
- ConfigurationDefinition configurationDefinition = new
ConfigurationDefinition("TestConfig", "a test config");
+ ConfigurationDefinition configDef = new
ConfigurationDefinition("TestConfig", "a test config");
ConfigurationTemplate defaultTemplate = new
ConfigurationTemplate(ConfigurationTemplate.DEFAULT_TEMPLATE_NAME, "default
template");
- configurationDefinition.putTemplate(defaultTemplate);
+ configDef.putTemplate(defaultTemplate);
Configuration defaultConfiguration = new Configuration();
defaultTemplate.setConfiguration(defaultConfiguration);
Map<String, PropertyDefinition> propertyDefinitions = new
HashMap<String, PropertyDefinition>();
- configurationDefinition.setPropertyDefinitions(propertyDefinitions);
+ configDef.setPropertyDefinitions(propertyDefinitions);
int orderIndex = 0;
PropertyDefinitionSimple simplePropDef;
simplePropDef = createStringPropDef1();
- addPropertyDefinition(propertyDefinitions, simplePropDef, orderIndex++);
+ addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef = createStringPropDef2();
- addPropertyDefinition(propertyDefinitions, simplePropDef, orderIndex++);
+ addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef = new PropertyDefinitionSimple("LongString", "a Long
String simple prop", false,
PropertySimpleType.LONG_STRING);
simplePropDef.setDisplayName(simplePropDef.getName());
- addPropertyDefinition(propertyDefinitions, simplePropDef, orderIndex++);
+ addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef = new PropertyDefinitionSimple("Password", "a
Password simple prop", false,
PropertySimpleType.PASSWORD);
simplePropDef.setDisplayName(simplePropDef.getName());
- addPropertyDefinition(propertyDefinitions, simplePropDef, orderIndex++);
+ addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef = new PropertyDefinitionSimple("Boolean", "a
required Boolean simple prop", true,
PropertySimpleType.BOOLEAN);
simplePropDef.setDisplayName(simplePropDef.getName());
- addPropertyDefinition(propertyDefinitions, simplePropDef, orderIndex++);
+ addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef.setRequired(true);
simplePropDef = createIntegerPropDef();
- addPropertyDefinition(propertyDefinitions, simplePropDef, orderIndex++);
+ addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef = new PropertyDefinitionSimple("Float", "a Float
simple prop", false, PropertySimpleType.FLOAT);
simplePropDef.setDisplayName(simplePropDef.getName());
- addPropertyDefinition(propertyDefinitions, simplePropDef, orderIndex++);
+ addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef = new PropertyDefinitionSimple("StringEnum1",
"a String enum prop with <=5 items - should be rendered as radio
buttons", false,
@@ -98,7 +98,7 @@ public abstract class TestConfigurationFactory {
propDefEnums.add(new PropertyDefinitionEnumeration("NJ",
"NJ"));
propDefEnums.add(new PropertyDefinitionEnumeration("PA",
"PA"));
simplePropDef.setEnumeratedValues(propDefEnums, false);
- addPropertyDefinition(propertyDefinitions, simplePropDef, orderIndex++);
+ addPropertyDefinition(configDef, simplePropDef, orderIndex++);
simplePropDef = new PropertyDefinitionSimple("StringEnum2",
"a String enum prop with >5 items - should be rendered as a popup
menu", false, PropertySimpleType.STRING);
@@ -112,31 +112,31 @@ public abstract class TestConfigurationFactory {
propDefEnums.add(new PropertyDefinitionEnumeration("blue",
"blue"));
propDefEnums.add(new PropertyDefinitionEnumeration("purple",
"purple"));
simplePropDef.setEnumeratedValues(propDefEnums, false);
- addPropertyDefinition(propertyDefinitions, simplePropDef, orderIndex++);
+ addPropertyDefinition(configDef, simplePropDef, orderIndex++);
PropertyDefinitionMap mapPropDef = new
PropertyDefinitionMap("MapOfSimples", "a map of simples", false);
mapPropDef.put(createStringPropDef1());
mapPropDef.put(createStringPropDef2());
mapPropDef.put(createIntegerPropDef());
mapPropDef.setDisplayName(mapPropDef.getName());
- addPropertyDefinition(propertyDefinitions, mapPropDef, orderIndex++);
+ addPropertyDefinition(configDef, mapPropDef, orderIndex++);
PropertyDefinitionMap openMapPropDef = new
PropertyDefinitionMap("OpenMapOfSimples", "an open map of simples",
false);
openMapPropDef.setDisplayName(openMapPropDef.getName());
- addPropertyDefinition(propertyDefinitions, openMapPropDef, orderIndex++);
+ addPropertyDefinition(configDef, openMapPropDef, orderIndex++);
PropertyDefinitionMap readOnlyOpenMapPropDef = new
PropertyDefinitionMap("ReadOnlyOpenMapOfSimples",
"a read-only open map of simples", false);
readOnlyOpenMapPropDef.setDisplayName(readOnlyOpenMapPropDef.getName());
readOnlyOpenMapPropDef.setReadOnly(true);
- addPropertyDefinition(propertyDefinitions, readOnlyOpenMapPropDef,
orderIndex++);
+ addPropertyDefinition(configDef, readOnlyOpenMapPropDef, orderIndex++);
PropertyDefinitionList listOfSimplesPropDef = new
PropertyDefinitionList("ListOfSimples",
"a list of Integer simples", true, new
PropertyDefinitionSimple("integer", "an integer", false,
PropertySimpleType.INTEGER));
listOfSimplesPropDef.setDisplayName(listOfSimplesPropDef.getName());
- addPropertyDefinition(propertyDefinitions, listOfSimplesPropDef, orderIndex++);
+ addPropertyDefinition(configDef, listOfSimplesPropDef, orderIndex++);
PropertyDefinitionMap mapInListPropDef =
new PropertyDefinitionMap("MapOfSimplesInList", "a map of
simples in a list", false);
@@ -148,7 +148,7 @@ public abstract class TestConfigurationFactory {
PropertyDefinitionList listPropDef = new
PropertyDefinitionList("ListOfMaps", "a list of maps", true,
mapInListPropDef);
listPropDef.setDisplayName(listPropDef.getName());
- addPropertyDefinition(propertyDefinitions, listPropDef, orderIndex++);
+ addPropertyDefinition(configDef, listPropDef, orderIndex++);
PropertyDefinitionMap mapInReadOnlyListPropDef =
new PropertyDefinitionMap("MapOfSimplesInReadOnlyList", "a map
of simples in a list", false);
@@ -161,7 +161,7 @@ public abstract class TestConfigurationFactory {
"a read-only list of maps", true, mapInReadOnlyListPropDef);
readOnlyListPropDef.setDisplayName(readOnlyListPropDef.getName());
readOnlyListPropDef.setReadOnly(true);
- addPropertyDefinition(propertyDefinitions, readOnlyListPropDef, orderIndex++);
+ addPropertyDefinition(configDef, readOnlyListPropDef, orderIndex++);
PropertyGroupDefinition propertyGroupDefinition = new
PropertyGroupDefinition("myGroup");
propertyGroupDefinition.setDisplayName(propertyGroupDefinition.getName());
@@ -171,14 +171,14 @@ public abstract class TestConfigurationFactory {
PropertySimpleType.STRING);
myString.setDisplayName(myString.getName());
myString.setSummary(true);
- addPropertyDefinition(propertyDefinitions, myString, orderIndex++);
+ addPropertyDefinition(configDef, myString, orderIndex++);
myString.setPropertyGroupDefinition(propertyGroupDefinition);
PropertyDefinitionSimple myString2 = new
PropertyDefinitionSimple("myString2", "my other little string", true,
PropertySimpleType.STRING);
myString2.setDisplayName(myString2.getName());
myString2.setSummary(true);
- addPropertyDefinition(propertyDefinitions, myString2, orderIndex++);
+ addPropertyDefinition(configDef, myString2, orderIndex++);
myString2.setPropertyGroupDefinition(propertyGroupDefinition);
PropertyGroupDefinition propertyGroupDefinition2 = new
PropertyGroupDefinition("myGroup2");
@@ -189,7 +189,7 @@ public abstract class TestConfigurationFactory {
PropertySimpleType.STRING);
myString3.setDisplayName((myString3.getName()));
myString3.setSummary(true);
- addPropertyDefinition(propertyDefinitions, myString3, orderIndex++);
+ addPropertyDefinition(configDef, myString3, orderIndex++);
myString3.setPropertyGroupDefinition(propertyGroupDefinition2);
PropertyDefinitionSimple enumExample = new
PropertyDefinitionSimple("myEnum",
@@ -201,16 +201,16 @@ public abstract class TestConfigurationFactory {
myEnums.add(new PropertyDefinitionEnumeration("Camden",
"Camden"));
myEnums.add(new PropertyDefinitionEnumeration("Gloucester",
"Gloucester"));
enumExample.setEnumeratedValues(myEnums, false);
- addPropertyDefinition(propertyDefinitions, enumExample, orderIndex++);
+ addPropertyDefinition(configDef, enumExample, orderIndex++);
enumExample.setPropertyGroupDefinition(propertyGroupDefinition2);
- return configurationDefinition;
+ return configDef;
}
- private static void addPropertyDefinition(Map<String, PropertyDefinition>
propertyDefinitions,
- PropertyDefinition propDef, int orderIndex)
{
+ private static void addPropertyDefinition(ConfigurationDefinition configDef,
+ PropertyDefinition propDef, int orderIndex)
{
propDef.setOrder(orderIndex);
- propertyDefinitions.put(propDef.getName(), propDef);
+ configDef.put(propDef);
}
public static Configuration createConfiguration() {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestGroupConfigurationView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestGroupConfigurationView.java
new file mode 100644
index 0000000..7d71c02
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestGroupConfigurationView.java
@@ -0,0 +1,139 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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.test;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.LayoutSpacer;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import
org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import
org.rhq.enterprise.gui.coregui.client.components.configuration.GroupConfigurationEditor;
+import
org.rhq.enterprise.gui.coregui.client.components.configuration.GroupMemberConfiguration;
+import
org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeEvent;
+import
org.rhq.enterprise.gui.coregui.client.components.configuration.PropertyValueChangeListener;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenter;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * @author Ian Springer
+ */
+public class TestGroupConfigurationView
+ extends LocatableVLayout implements PropertyValueChangeListener {
+ public static final String VIEW_ID = "TestGroupConfig";
+
+ private static final int GROUP_SIZE = 2;
+
+ private ConfigurationEditor editor;
+ private LocatableIButton saveButton;
+ private ConfigurationDefinition configurationDefinition;
+ private List<GroupMemberConfiguration> memberConfigurations;
+
+ public TestGroupConfigurationView(String locatorId) {
+ super(locatorId);
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ setWidth100();
+ setHeight100();
+
+ ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setWidth100();
+
+ toolStrip.addMember(new LayoutSpacer());
+
+ this.saveButton = new LocatableIButton(this.extendLocatorId("Save"),
"Save");
+ this.saveButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ save();
+ }
+ });
+ this.saveButton.disable();
+ toolStrip.addMember(this.saveButton);
+
+ addMember(toolStrip);
+
+ this.configurationDefinition =
TestConfigurationFactory.createConfigurationDefinition();
+ this.memberConfigurations = new
ArrayList<GroupMemberConfiguration>(GROUP_SIZE);
+ for (int i = 0; i < GROUP_SIZE; i++) {
+ Configuration configuration =
TestConfigurationFactory.createConfiguration();
+ GroupMemberConfiguration memberConfiguration = new
GroupMemberConfiguration(i, "Member #" + i,
+ configuration);
+ this.memberConfigurations.add(memberConfiguration);
+ }
+
+ reloadConfiguration();
+ }
+
+ @Override
+ public void propertyValueChanged(PropertyValueChangeEvent event) {
+ MessageCenter messageCenter = CoreGUI.getMessageCenter();
+ Message message;
+ if (event.isValidationStateChanged()) {
+ if (event.getInvalidPropertyNames().isEmpty()) {
+ this.saveButton.enable();
+ message = new Message("All properties now have valid values, so the
configuration can now be saved.",
+ Message.Severity.Info, EnumSet.of(Message.Option.Transient));
+ }
+ else {
+ this.saveButton.disable();
+ message = new Message(
+ "One or more properties have invalid values. The values must be
corrected before the configuration can be saved.",
+ Message.Severity.Error, EnumSet.of(Message.Option.Transient,
Message.Option.Sticky));
+ }
+ messageCenter.notify(message);
+ } else {
+ this.saveButton.enable();
+ }
+ }
+
+ private void reloadConfiguration() {
+ this.saveButton.disable();
+ if (editor != null) {
+ editor.destroy();
+ removeMember(editor);
+ }
+
+ editor = new GroupConfigurationEditor(extendLocatorId("Editor"),
this.configurationDefinition,
+ this.memberConfigurations);
+ editor.setOverflow(Overflow.AUTO);
+ editor.addPropertyValueChangeListener(this);
+ addMember(editor);
+ }
+
+ private void save() {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Member configurations updated.", "Member
configurations updated."));
+ reloadConfiguration();
+ }
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index 3314eeb..ce0ce25 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -24,6 +24,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.JavaScriptObject;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.DSRequest;
@@ -328,7 +329,7 @@ public abstract class RPCDataSource<T> extends DataSource {
@SuppressWarnings("unchecked")
public static <S> S getFilter(DSRequest request, String paramName,
Class<S> type) {
- com.allen_sauer.gwt.log.client.Log.debug("Fetching " + paramName +
" (" + type + ")");
+ Log.debug("Fetching " + paramName + " (" + type +
")");
Criteria criteria = request.getCriteria();
Map<String, Object> criteriaMap = criteria.getValues();
@@ -350,7 +351,7 @@ public abstract class RPCDataSource<T> extends DataSource {
}
}
- com.allen_sauer.gwt.log.client.Log.debug("Result = " + result);
+ Log.debug("Result = " + result);
return result;
}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
index 54cc3a9..d60a616 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
@@ -386,6 +386,10 @@ a:hover {
border-color: #EE1111; /* slightly darker medium red */
}
+.InlineNote {
+ color: #511;
+}
+
.log-panel {
z-index: 9999999 !important;
}
commit 3cdfaed39fe6197cc4a825ba1c9adcb9c3f1892d
Author: Joseph Marques <joseph(a)redhat.com>
Date: Tue Oct 19 16:47:59 2010 -0400
use the correct cased name of the GroupCategory for filtering groups in the inventory
borwser
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
index a1683dc..fcef030 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
@@ -39,6 +39,7 @@ import com.smartgwt.client.widgets.tree.TreeNode;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewId;
@@ -138,7 +139,7 @@ public class InventoryView extends LocatableHLayout implements
BookmarkableView
treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
- TreeNode node = (TreeNode)selectionEvent.getRecord();
+ TreeNode node = (TreeNode) selectionEvent.getRecord();
String pageName = node.getName();
String viewPath = InventoryView.VIEW_ID + "/" + sectionName
+ "/" + pageName;
String currentViewPath = History.getToken();
@@ -170,7 +171,8 @@ public class InventoryView extends LocatableHLayout implements
BookmarkableView
final TreeNode onlyServices = new EnhancedTreeNode(PAGE_SERVICES);
onlyServices.setIcon("types/Service_up_16.png");
- final TreeNode inventory = new EnhancedTreeNode(SUBSECTION_RESOURCE_INVENTORY,
onlyPlatforms, onlyServers, onlyServices);
+ final TreeNode inventory = new EnhancedTreeNode(SUBSECTION_RESOURCE_INVENTORY,
onlyPlatforms, onlyServers,
+ onlyServices);
final TreeNode downServers = new EnhancedTreeNode(PAGE_DOWN);
downServers.setIcon("types/Server_down_16.png");
@@ -209,7 +211,8 @@ public class InventoryView extends LocatableHLayout implements
BookmarkableView
TreeGrid treeGrid = new LocatableTreeGrid(GROUPS_SECTION_VIEW_ID);
treeGrid.setShowHeader(false);
Tree tree = new Tree();
- TreeNode rootNode = new EnhancedTreeNode(GROUPS_SECTION_VIEW_ID,
groupGroupDefinitions, inventory, savedSearches);
+ TreeNode rootNode = new EnhancedTreeNode(GROUPS_SECTION_VIEW_ID,
groupGroupDefinitions, inventory,
+ savedSearches);
tree.setRoot(rootNode);
treeGrid.setData(tree);
@@ -263,10 +266,10 @@ public class InventoryView extends LocatableHLayout implements
BookmarkableView
} else if (GROUPS_SECTION_VIEW_ID.equals(sectionName)) {
if (PAGE_COMPATIBLE_GROUPS.equals(pageName)) {
content = new
ResourceGroupListView(extendLocatorId("Compatible"), new
Criteria("category",
- "compatible"), PAGE_COMPATIBLE_GROUPS,
"types/Cluster_up_24.png");
+ GroupCategory.COMPATIBLE.name()), PAGE_COMPATIBLE_GROUPS,
"types/Cluster_up_24.png");
} else if (PAGE_MIXED_GROUPS.equals(pageName)) {
- content = new ResourceGroupListView(extendLocatorId("Mixed"),
new Criteria("category", "mixed"),
- PAGE_MIXED_GROUPS, "types/Group_up_24.png");
+ content = new ResourceGroupListView(extendLocatorId("Mixed"),
new Criteria("category",
+ GroupCategory.MIXED.name()), PAGE_MIXED_GROUPS,
"types/Group_up_24.png");
} else if (PAGE_GROUP_DEFINITIONS.equals(pageName)) {
content = new
GroupDefinitionListView(extendLocatorId("Definitions"),
"types/GroupDefinition_16.png");
} else if (PAGE_PROBLEM_GROUPS.equals(pageName)) {
commit fec18e5250c61671c12ac0ec80bf617c06c489f1
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Oct 19 15:46:56 2010 -0400
use locatable
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
index 5cf3937..47a97c9 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDetailsView.java
@@ -34,7 +34,6 @@ import com.smartgwt.client.widgets.form.fields.StaticTextItem;
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.layout.VLayout;
import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;
@@ -47,23 +46,26 @@ import org.rhq.enterprise.gui.coregui.client.ViewId;
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.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Joseph Marques
+ * @author Ian Springer
*/
-public class AlertDetailsView extends VLayout implements BookmarkableView {
+public class AlertDetailsView extends LocatableVLayout implements BookmarkableView {
private int alertId;
private ViewId viewId;
- private static AlertDetailsView INSTANCE = new AlertDetailsView();
+ private static AlertDetailsView INSTANCE = new
AlertDetailsView("alertDetailsView");
public static AlertDetailsView getInstance() {
return INSTANCE;
}
- private AlertDetailsView() {
+ private AlertDetailsView(String locatorId) {
// access through the static singleton only
+ super(locatorId);
}
private void show(int alertId) {
commit 29d5db075f19213dc2536e1ba19ba7769a23de44
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Oct 19 15:25:44 2010 -0400
adding new dependencies to eclipse classpath so we can build again in eclipse
diff --git a/.classpath b/.classpath
index 7d1cd22..ecbd0c8 100644
--- a/.classpath
+++ b/.classpath
@@ -143,6 +143,7 @@
<classpathentry kind="src"
path="modules/helpers/rtfilter/src/main/java"/>
<classpathentry kind="src"
path="modules/helpers/pluginAnnotations/src/main/java"/>
<classpathentry kind="src"
path="modules/helpers/pluginGen/src/main/java"/>
+ <classpathentry kind="src"
path="modules/helpers/perftest-support/src/main/java"/>
<classpathentry kind="src"
path="etc/samples/skeleton-plugin/src/main/java"/>
<classpathentry kind="src"
path="etc/samples/custom-serverplugin/src/main/java"/>
<classpathentry kind="src"
path="etc/samples/simplereport-serverplugin/src/main/java"/>
@@ -171,7 +172,7 @@
<classpathentry exported="true" kind="var"
path="M2_REPO/struts/struts/1.2.9/struts-1.2.9.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/commons-validator/commons-validator/1.1.4/commons-validator-1.1.4.jar"/>
- <classpathentry exported="true" kind="var"
path="M2_REPO/org/testng/testng/5.9/testng-5.9-jdk15.jar"/>
+ <classpathentry exported="true" kind="var"
path="M2_REPO/org/testng/testng/5.13.1/testng-5.13.1.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/org/snmp4j/snmp4j/1.8.2/snmp4j-1.8.2.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/tomcat/tomcat-jk/4.1.31/tomcat-jk-4.1.31.jar"/>
@@ -256,5 +257,8 @@
<classpathentry exported="true" kind="var"
path="M2_REPO/ca/nanometrics/gflot/1.0.0/gflot-1.0.0.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/com/jcraft/jsch/0.1.29/jsch-0.1.29.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar"/>
+ <classpathentry exported="true" kind="var"
path="M2_REPO/org/dbunit/dbunit/2.4.8/dbunit-2.4.8.jar"/>
+ <classpathentry exported="true" kind="var"
path="M2_REPO/org/apache/poi/poi/3.6/poi-3.6.jar"/>
+ <classpathentry exported="true" kind="var"
path="M2_REPO/bsh/bsh/1.3.0/bsh-1.3.0.jar"/>
<classpathentry kind="output" path="eclipse-classes"/>
</classpath>
commit f167d3614e58cc62e02de088b1d3dcaae7a3a19a
Merge: 0f62ed4... 501e5d1...
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Oct 19 14:07:04 2010 -0400
Merge branch 'delete-agent-plugin'
commit 501e5d1c1bc27399c5c46a9778829bd927925ed5
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Oct 19 14:05:56 2010 -0400
making deleted column not nullable
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
b/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
index 1644849..a181d83 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
@@ -17,7 +17,7 @@
<column name="PLUGIN" type="VARCHAR2"
size="100"/>
<column name="CTIME" type="LONG"/>
<column name="MTIME" type="LONG"/>
- <column name="DELETED" type="BOOLEAN"
default="FALSE"/>
+ <column name="DELETED" type="BOOLEAN"
default="FALSE" required="TRUE"/>
<column name="SUBCATEGORY_ID" type="INTEGER"/>
<!--
TODO add support to DB setup for tables with circular dependencies and then add
back this RI
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 4b4c6a0..69d7e3c 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3263,6 +3263,7 @@
SET DELETED = false
</statement>
</schema-directSQL>
+ <schema-alterColumn table="RHQ_RESOURCE_TYPE"
column="DELETED" nullable="FALSE" />
</schemaSpec>
</dbupgrade>
</target>
commit 0f62ed4950ae6f39a9905ba614ad2bba8ea3c44b
Merge: e60ff62... 81d68da...
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Oct 19 13:16:52 2010 -0400
Merge branch 'master' of
ssh://git.fedorahosted.org/git/rhq/rhq
commit e60ff628d63a550a7ef0362cd4859c7b6d78b4c4
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Oct 19 13:04:46 2010 -0400
Adding deleted flag to ResourceType
This commit also included the dbsetup/dbupgrade changes. The deleted
flag will be set to indicate that a ResourceType will be deleted.
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index 379c31f..8f393cc 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.100</db.schema.version>
+ <db.schema.version>2.101</db.schema.version>
</properties>
<dependencies>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
b/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
index 48f9f2a..1644849 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/inventory-schema.xml
@@ -17,6 +17,7 @@
<column name="PLUGIN" type="VARCHAR2"
size="100"/>
<column name="CTIME" type="LONG"/>
<column name="MTIME" type="LONG"/>
+ <column name="DELETED" type="BOOLEAN"
default="FALSE"/>
<column name="SUBCATEGORY_ID" type="INTEGER"/>
<!--
TODO add support to DB setup for tables with circular dependencies and then add
back this RI
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index b462cfa..4b4c6a0 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3254,6 +3254,16 @@
<!-- location was only exposed in the struts-based UI, so it
hasn't been seen in years anyway -->
<schema-deleteColumn table="RHQ_RESOURCE_GROUP"
column="LOCATION" />
</schemaSpec>
+
+ <schemaSpec version="2.101">
+ <schema-addColumn table="RHQ_RESOURCE_TYPE"
column="DELETED" columnType="BOOLEAN"/>
+ <schema-directSQL>
+ <statement desc="Set deleted flag for existing resources
types to false">
+ UPDATE RHQ_RESOURCE_TYPE
+ SET DELETED = false
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
</dbupgrade>
</target>
</project>
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
index 19cdd11..add1a53 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
@@ -307,6 +307,9 @@ public class ResourceType implements Serializable,
Comparable<ResourceType> {
@Column(name = "MTIME")
private Long mtime;
+ @Column(name = "DELETED")
+ private boolean deleted;
+
@ManyToMany(mappedBy = "parentResourceTypes", cascade = {
CascadeType.REFRESH })
@OrderBy
//@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@@ -534,6 +537,14 @@ public class ResourceType implements Serializable,
Comparable<ResourceType> {
return this.mtime;
}
+ public boolean isDeleted() {
+ return deleted;
+ }
+
+ public void setDeleted(boolean deleted) {
+ this.deleted = deleted;
+ }
+
@PreUpdate
void onUpdate() {
this.mtime = System.currentTimeMillis();
commit 1b5f9f9975a41f056db0c77639bd5563148b56d7
Merge: fba8b55... 06382be...
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Oct 19 11:09:16 2010 -0400
Merge branch 'master' of
ssh://git.fedorahosted.org/git/rhq/rhq
commit fba8b55540b9624ef53d3d6f14ffe2cd333deeba
Merge: 9690d71... a6d0d0b...
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Oct 18 10:26:51 2010 -0400
Merge branch 'master' of
ssh://git.fedorahosted.org/git/rhq/rhq
commit 9690d71a55f959b95ab6859b39d641ec0d3f4a4b
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Oct 12 17:48:48 2010 -0400
Updating javadocs
diff --git
a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/measurement/MeasurementAgentService.java
b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/measurement/MeasurementAgentService.java
index 786e60f..dba93fc 100644
---
a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/measurement/MeasurementAgentService.java
+++
b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/measurement/MeasurementAgentService.java
@@ -70,10 +70,8 @@ public interface MeasurementAgentService {
* <p>Measurement data collected via this call will have its non-persistent
"name" field set the name of the
* measurement, but will not have scheduleIds set.</p>
*
- * @param resourceId id of resource to collect from
- * @param dataType the data type of the of the metrics to be collected -
either
- * {@link DataType#MEASUREMENT} or {@link DataType#TRAIT}
- * @param measurementNames the names of the numeric metrics or traits to be
collected
+ * @param resourceId id of resource to collect from
+ * @param requests Each request specifies a metric to be collected along with its
corresponding data type
* @return the set of collected measurements with their data values collected
*/
Set<MeasurementData> getRealTimeMeasurementValue(int resourceId,
List<MeasurementDataRequest> requests);