[rhq] modules/enterprise
by Joseph Marques
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
New commits:
commit fe3c4a473cfeaf90f417b9f0af73cc8e7aadb022
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Aug 18 21:55:13 2010 -0400
fix summary>dashboard sub-tab linkage for resources
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java
index c29deec..b857b35 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java
@@ -46,7 +46,6 @@ public class DashboardView extends FullHTMLPane implements ResourceSelectListene
@Override
public void onResourceSelected(ResourceComposite resourceComposite) {
this.resourceComposite = resourceComposite;
- setContentsURL("/rhq/resource/summary/summary-plain.xhtml?id="
- + resourceComposite.getResource().getId());
+ setContentsURL("/rhq/resource/summary/overview-plain.xhtml?id=" + resourceComposite.getResource().getId());
}
}
13 years, 9 months
[rhq] modules/enterprise
by ips
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java | 12 ++--------
1 file changed, 3 insertions(+), 9 deletions(-)
New commits:
commit 132910516670d8972fbf50d94586e86a667fd638
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Aug 18 20:04:37 2010 -0400
remove superfluous call to ResourceManager.updateResource()
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java
index dfab090..aac1143 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java
@@ -29,7 +29,6 @@ import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
-import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
public class ConfigurationServerServiceImpl implements ConfigurationServerService {
@@ -66,7 +65,6 @@ public class ConfigurationServerServiceImpl implements ConfigurationServerServic
public void persistUpdatedResourceConfiguration(int resourceId, Configuration resourceConfiguration) {
ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
- ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
Subject overlord = subjectManager.getOverlord();
ResourceConfigurationUpdate update = configurationManager.persistNewResourceConfigurationUpdateHistory(
@@ -80,11 +78,7 @@ public class ConfigurationServerServiceImpl implements ConfigurationServerServic
}
}
- Resource resource = update.getResource();
- Configuration configuration = update.getConfiguration().deepCopy(false); // clone the config, zeroing out ids
-
- resourceManager.updateResource(overlord, resource); // update simple properties, still need to merge config
- configurationManager.setResourceConfiguration(resource.getId(), configuration); // now merge latest config
-
+ Configuration configuration = update.getConfiguration().deepCopy(false); // clone the config, zeroing out ids
+ configurationManager.setResourceConfiguration(resourceId, configuration); // now set it as the current config on the Resource
}
-}
\ No newline at end of file
+}
13 years, 9 months
[rhq] modules/enterprise
by Joseph Marques
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AuthorizationGWTServiceImpl.java | 25 ++++------
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/security/UntrustedSSLProtocolSocketFactory.java | 5 +-
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/DistributionManagerBeanTest.java | 9 ++-
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/definition/framework/test/ExpressionEvaluatorTest.java | 3 -
6 files changed, 24 insertions(+), 22 deletions(-)
New commits:
commit 23419f815c97149f8028a525a27b55e5a3d32b61
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Aug 18 15:49:20 2010 -0400
get rid of some compiler errors / warnings
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AuthorizationGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AuthorizationGWTServiceImpl.java
index ffbd94b..7218061 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AuthorizationGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AuthorizationGWTServiceImpl.java
@@ -35,32 +35,27 @@ public class AuthorizationGWTServiceImpl extends AbstractGWTServiceImpl implemen
private AuthorizationManagerLocal authorizationManager = LookupUtil.getAuthorizationManager();
public Set<Permission> getExplicitResourcePermissions(int resourceId) {
- return SerialUtility.prepare(
- new HashSet(authorizationManager.getExplicitResourcePermissions(getSessionSubject(), resourceId)),
- "AuthorizationManager.getExplicitResourcePermissions");
+ return SerialUtility.prepare(new HashSet<Permission>(authorizationManager.getExplicitResourcePermissions(
+ getSessionSubject(), resourceId)), "AuthorizationManager.getExplicitResourcePermissions");
}
public Set<Permission> getImplicitResourcePermissions(int resourceId) {
- return SerialUtility.prepare(
- new HashSet(authorizationManager.getImplicitResourcePermissions(getSessionSubject(), resourceId)),
- "AuthorizationManager.getImplicitResourcePermissions");
+ return SerialUtility.prepare(new HashSet<Permission>(authorizationManager.getImplicitResourcePermissions(
+ getSessionSubject(), resourceId)), "AuthorizationManager.getImplicitResourcePermissions");
}
public Set<Permission> getExplicitGroupPermissions(int groupId) {
- return SerialUtility.prepare(
- new HashSet(authorizationManager.getExplicitGroupPermissions(getSessionSubject(), groupId)),
- "AuthorizationManager.getExplicitGroupPermissions");
+ return SerialUtility.prepare(new HashSet<Permission>(authorizationManager.getExplicitGroupPermissions(
+ getSessionSubject(), groupId)), "AuthorizationManager.getExplicitGroupPermissions");
}
public Set<Permission> getImplicitGroupPermissions(int groupId) {
- return SerialUtility.prepare(
- new HashSet(authorizationManager.getImplicitGroupPermissions(getSessionSubject(), groupId)),
- "AuthorizationManager.getImplicitGroupPermissions");
+ return SerialUtility.prepare(new HashSet<Permission>(authorizationManager.getImplicitGroupPermissions(
+ getSessionSubject(), groupId)), "AuthorizationManager.getImplicitGroupPermissions");
}
public Set<Permission> getExplicitGlobalPermissions() {
- return SerialUtility.prepare(
- new HashSet(authorizationManager.getExplicitGlobalPermissions(getSessionSubject())),
- "AuthorizationManager.getExplicitGlobalPermissions");
+ return SerialUtility.prepare(new HashSet<Permission>(authorizationManager
+ .getExplicitGlobalPermissions(getSessionSubject())), "AuthorizationManager.getExplicitGlobalPermissions");
}
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
index 82ffd48..cac0892 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
@@ -244,7 +244,7 @@ public final class CriteriaQueryGenerator {
String returnValue = null;
if (value instanceof String) {
returnValue = "'" + prepareStringBindValue((String) value) + "'";
- } else if (value instanceof Enum) {
+ } else if (value instanceof Enum<?>) {
// note: this strategy won't work for entities with multiple enums that are persisted differently
EnumType type = getPersistenceEnumType(value.getClass());
if (type == EnumType.STRING) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
index 9d61cfd..61f613e 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
@@ -637,7 +637,7 @@ public final class LookupUtil {
}
}
- @SuppressWarnings( { "unchecked", "unused" })
+ @SuppressWarnings("unchecked")
private static <T> T lookupRemote(Class<? super T> type) {
try {
return (T) lookup(getRemoteJNDIName(type));
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/security/UntrustedSSLProtocolSocketFactory.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/security/UntrustedSSLProtocolSocketFactory.java
index 1218e64..dca9282 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/security/UntrustedSSLProtocolSocketFactory.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/security/UntrustedSSLProtocolSocketFactory.java
@@ -24,10 +24,13 @@ import java.net.Socket;
import java.net.UnknownHostException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
+
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;
+
import org.apache.commons.httpclient.protocol.Protocol;
+import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
import org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory;
/**
@@ -55,7 +58,7 @@ public class UntrustedSSLProtocolSocketFactory extends SSLProtocolSocketFactory
if (!isRegistered()) {
if (untrustSSL == null) {
- untrustSSL = new Protocol("https", new UntrustedSSLProtocolSocketFactory(), 443);
+ untrustSSL = new Protocol("https", (ProtocolSocketFactory) new UntrustedSSLProtocolSocketFactory(), 443);
}
Protocol.registerProtocol("https", untrustSSL);
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/DistributionManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/DistributionManagerBeanTest.java
index e24f39c..037c071 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/DistributionManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/DistributionManagerBeanTest.java
@@ -63,21 +63,24 @@ public class DistributionManagerBeanTest extends AbstractEJB3Test {
assert distro == null;
}
+ @SuppressWarnings("unchecked")
public void testDistributionFiles() throws Exception {
String kslabel = "testCreateDeleteRepo";
String kspath = "/tmp";
- int id = distManager.createDistribution(overlord, kslabel, kspath, distType).getId();
+ // don't get id, if not needed downstream
+ //int id = distManager.createDistribution(overlord, kslabel, kspath, distType).getId();
+ distManager.createDistribution(overlord, kslabel, kspath, distType);
Distribution distro = distManager.getDistributionByLabel(kslabel);
DistributionFile distfile = new DistributionFile(distro, "vmlinux", "d41d8cd98f00b204e9800998ecf8427e");
EntityManager em = getEntityManager();
em.persist(distfile);
- Query query = em.createNamedQuery(distfile.SELECT_BY_DIST_ID);
+ Query query = em.createNamedQuery(DistributionFile.SELECT_BY_DIST_ID);
query.setParameter("distId", distro.getId());
List<DistributionFile> results = query.getResultList();
assert results.size() != 0;
- Query querydel = em.createNamedQuery(distfile.DELETE_BY_DIST_ID);
+ Query querydel = em.createNamedQuery(DistributionFile.DELETE_BY_DIST_ID);
querydel.setParameter("distId", distro.getId());
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/definition/framework/test/ExpressionEvaluatorTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/definition/framework/test/ExpressionEvaluatorTest.java
index 7b958ef..fd3db2e 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/definition/framework/test/ExpressionEvaluatorTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/definition/framework/test/ExpressionEvaluatorTest.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.server.resource.group.definition.framework.test;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import org.testng.annotations.Test;
@@ -158,7 +159,7 @@ public class ExpressionEvaluatorTest extends AbstractEJB3Test {
public void testWellFormedExpressions() throws Exception {
String[][] successTestCases = getSuccessTestCases();
- List<Integer> suppressedCases = Arrays.asList();
+ List<Integer> suppressedCases = Collections.emptyList();
getTransactionManager().begin();
try {
13 years, 9 months
[rhq] 2 commits - modules/enterprise
by Joseph Marques
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java | 10 +++++-----
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
New commits:
commit 75c3c13a68f88836da805eac2acea1deb722d422
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Aug 18 13:47:30 2010 -0400
modify ConfigurationServerServiceImpl to take into account new semantics for ResourceManagerBean.updateResource
* remove call to 'resource.setResourceConfiguration(configuration)', it was redundant with 'configurationManager.setResourceConfiguration(resource.getId(), configuration)'
* update comments to accurately reflect what work is being done at which steps
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java
index 6ae1e16..dfab090 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java
@@ -81,10 +81,10 @@ public class ConfigurationServerServiceImpl implements ConfigurationServerServic
}
Resource resource = update.getResource();
- // First clone the config, zeroing out all id's.
- Configuration configuration = update.getConfiguration().deepCopy(false);
- configurationManager.setResourceConfiguration(resource.getId(), configuration);
- resource.setResourceConfiguration(configuration);
- resourceManager.updateResource(overlord, resource);
+ Configuration configuration = update.getConfiguration().deepCopy(false); // clone the config, zeroing out ids
+
+ resourceManager.updateResource(overlord, resource); // update simple properties, still need to merge config
+ configurationManager.setResourceConfiguration(resource.getId(), configuration); // now merge latest config
+
}
}
\ No newline at end of file
commit 563c5f32e5212488904e0c52b28b879af0b36f08
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Aug 18 10:48:16 2010 -0400
fix ResourceManagerRemote to use naming conventions established for remote API
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java
index 01ed5a1..8f8604d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java
@@ -109,8 +109,8 @@ public interface ResourceManagerRemote {
*/
@WebMethod
Resource updateResource( //
- @WebParam(name = "subject") Subject user, //
- @WebParam(name = "resource") Resource resource);
+ @WebParam(name = "subject") Subject subject, //
+ @WebParam(name = "resource") Resource resource);
/**
* Removes these resources from inventory. The resources may subsequently be rediscovered. Note that for
13 years, 9 months
[rhq] 19 commits - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java | 45 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java | 94 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleResourceGroupSelector.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleSubjectSelector.java | 35 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRoleSelector.java | 15
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java | 101 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleSelector.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentOptionsStep.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDestinationStep.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleStep.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/selection/PlatformResourceGroupSelector.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/ConfirmationStep.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/RevertStep.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 343 ++++------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java | 12
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java | 65 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 20
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackForm.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/AbstractWizardStep.java | 21
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java | 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java | 18
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java | 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java | 45 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java | 65 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesView.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupMembersStep.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java | 125 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java | 90 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSelectListener.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java | 32
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java | 67 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesView.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java | 37 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java | 116 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableDynamicForm.java | 24
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java | 24
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableListGrid.java | 23
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTransferImgButton.java | 47 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTreeGrid.java | 22
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableVLayout.java | 24
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/SeleniumUtility.java | 109 +++
56 files changed, 1040 insertions(+), 706 deletions(-)
New commits:
commit 36b0828833f339b27fbb8512fa4fdc362e3c5dd8
Merge: aaaac7d... d40f338...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Aug 18 10:39:40 2010 -0400
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit aaaac7d771794bc60510b105380bcc0d8482cbec
Merge: de55f13... b53c54e...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Aug 18 10:20:20 2010 -0400
Merge branch 'master' into master-jay
commit de55f13450544b831725d912b97e50f110d1d698
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Aug 18 10:11:54 2010 -0400
Prevent duplicate setting of the current resource [group]. This is a bit
of a leak and also causes ID conflict.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
index c75f6e8..53d259b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
@@ -52,12 +52,10 @@ public class ResourceGroupTopView extends HLayout implements BookmarkableView {
private ResourceGroupGWTServiceAsync groupService = GWTServiceLookup.getResourceGroupService();
-
public ResourceGroupTopView() {
}
-
@Override
protected void onInit() {
super.onInit();
@@ -73,37 +71,49 @@ public class ResourceGroupTopView extends HLayout implements BookmarkableView {
detailView = new ResourceGroupDetailView();
-// treeView.addResourceSelectListener(detailView);
+ // treeView.addResourceSelectListener(detailView);
setContent(detailView);
}
-
public void setSelectedGroup(final int groupId, final ViewPath view) {
+ // check if requested group is already the current group
+ if (null != currentGroup && currentGroup.getResourceGroup().getId() == groupId) {
+ return;
+ }
+
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
criteria.addFilterId(groupId);
//criteria.fetchTags(true);
- groupService.findResourceGroupCompositesByCriteria(criteria, new AsyncCallback<PageList<ResourceGroupComposite>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getMessageCenter().notify(new Message("Group with id [" + groupId +
- "] does not exist or is not accessible.", Message.Severity.Warning));
- caught.printStackTrace();
- CoreGUI.goTo(InventoryView.VIEW_PATH);
- }
-
- public void onSuccess(PageList<ResourceGroupComposite> result) {
- if (result.isEmpty()) {
- //noinspection ThrowableInstanceNeverThrown
- onFailure(new Exception("Group with id [" + groupId + "] does not exist."));
- } else {
- currentGroup = result.get(0);
- treeView.setSelectedGroup(currentGroup.getResourceGroup().getId());
- detailView.onGroupSelected(currentGroup);
+ groupService.findResourceGroupCompositesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceGroupComposite>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Group with id [" + groupId + "] does not exist or is not accessible.",
+ Message.Severity.Warning));
+ caught.printStackTrace();
+ CoreGUI.goTo(InventoryView.VIEW_PATH);
}
- }
- });
- }
+ public void onSuccess(PageList<ResourceGroupComposite> result) {
+ if (result.isEmpty()) {
+ //noinspection ThrowableInstanceNeverThrown
+ onFailure(new Exception("Group with id [" + groupId + "] does not exist."));
+ } else {
+ // check if requested group is already the current group. This can happen if
+ // renderView (or any callers) execute in quick succession on the same resource group,
+ // because of the (async) delay in this call path
+ if (null != currentGroup && currentGroup.getResourceGroup().getId() == groupId) {
+ return;
+ }
+
+ currentGroup = result.get(0);
+ treeView.setSelectedGroup(currentGroup.getResourceGroup().getId());
+ detailView.onGroupSelected(currentGroup);
+ }
+ }
+ });
+ }
public void setContent(Canvas newContent) {
if (contentCanvas.getChildren().length > 0)
@@ -112,7 +122,6 @@ public class ResourceGroupTopView extends HLayout implements BookmarkableView {
contentCanvas.markForRedraw();
}
-
public void renderView(ViewPath viewPath) {
if (viewPath.isEnd()) {
// default detail view
@@ -121,14 +130,10 @@ public class ResourceGroupTopView extends HLayout implements BookmarkableView {
}
Integer groupId = Integer.parseInt(viewPath.getCurrent().getPath());
-
- if (currentGroup == null || currentGroup.getResourceGroup().getId() != groupId) {
- // The previous history item did not already point to this group.
- setSelectedGroup(groupId, viewPath);
- }
+ setSelectedGroup(groupId, viewPath);
viewPath.next();
- this.detailView.renderView(viewPath);
+ this.detailView.renderView(viewPath);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSelectListener.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSelectListener.java
index 21806ab..cf285ea 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSelectListener.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSelectListener.java
@@ -26,7 +26,7 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
public interface ResourceSelectListener {
/**
- * An event handler that is called then the user selects a Resource.
+ * An event handler that is called when the user selects a Resource.
*
* @param resourceComposite a Resource composite for the Resource that was just selected by the user; the Resource
* wrapped by the composite's ResourceType will be mostly fetched.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
index 535cdca..b4f140b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
@@ -54,7 +54,6 @@ public class ResourceTopView extends HLayout implements BookmarkableView {
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
-
public ResourceTopView() {
}
@@ -73,23 +72,28 @@ public class ResourceTopView extends HLayout implements BookmarkableView {
addMember(contentCanvas);
// created above
-// detailView = new ResourceDetailView();
+ // detailView = new ResourceDetailView();
treeView.addResourceSelectListener(detailView);
setContent(detailView);
}
-
public void setSelectedResource(final int resourceId, final ViewPath view) {
+ // Prevent multiple calls in a row for the same resource.
+ if (null != this.currentResource && currentResource.getResource().getId() == resourceId) {
+ return;
+ }
+
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterId(resourceId);
criteria.fetchTags(true);
//criteria.fetchParentResource(true);
resourceService.findResourceCompositesByCriteria(criteria, new AsyncCallback<PageList<ResourceComposite>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getMessageCenter().notify(new Message("Resource with id [" + resourceId +
- "] does not exist or is not accessible.", Message.Severity.Warning));
+ CoreGUI.getMessageCenter().notify(
+ new Message("Resource with id [" + resourceId + "] does not exist or is not accessible.",
+ Message.Severity.Warning));
CoreGUI.goTo(InventoryView.VIEW_PATH);
}
@@ -106,7 +110,6 @@ public class ResourceTopView extends HLayout implements BookmarkableView {
});
}
-
private void loadResourceType(final ResourceComposite resourceComposite, final ViewPath view) {
final Resource resource = resourceComposite.getResource();
ResourceTypeRepository.Cache.getInstance().getResourceTypes(
@@ -122,13 +125,19 @@ public class ResourceTopView extends HLayout implements BookmarkableView {
});
}
-
private void completeSetSelectedResource(ResourceComposite resourceComposite, ViewPath viewPath) {
+ // Prevent multiple calls in a row for the same resource. This can happen if renderView executes
+ // in quick succession on the same resource viewpath, because of the (async) delay between
+ // setSelectedResource and this call
+ if (null != this.currentResource
+ && currentResource.getResource().getId() == resourceComposite.getResource().getId()) {
+ return;
+ }
+
this.currentResource = resourceComposite;
this.detailView.onResourceSelected(resourceComposite);
}
-
public void setContent(Canvas newContent) {
if (contentCanvas.getChildren().length > 0)
contentCanvas.getChildren()[0].destroy();
@@ -136,7 +145,6 @@ public class ResourceTopView extends HLayout implements BookmarkableView {
contentCanvas.markForRedraw();
}
-
public void renderView(ViewPath viewPath) {
if (viewPath.isEnd()) {
// default detail view
@@ -145,11 +153,7 @@ public class ResourceTopView extends HLayout implements BookmarkableView {
}
Integer resourceId = Integer.parseInt(viewPath.getCurrent().getPath());
-
- if (currentResource == null || currentResource.getResource().getId() != resourceId) {
- // The previous history item did not already point to this Resource.
- setSelectedResource(resourceId, viewPath);
- }
+ setSelectedResource(resourceId, viewPath);
this.treeView.renderView(viewPath);
commit 1e91147abf3db61eeb181efcb542a94967ee9e5b
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Aug 18 10:10:33 2010 -0400
Avoid NPE if currentAvail has yet to be set
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
index 1adee12..ecb4806 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeDatasource.java
@@ -37,6 +37,7 @@ import com.smartgwt.client.widgets.tree.TreeNode;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.ResourceAvailability;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceSubCategory;
@@ -105,27 +106,26 @@ public class ResourceTreeDatasource extends DataSource {
// Asume success
response.setStatus(0);
switch (request.getOperationType()) {
- case ADD:
- //executeAdd(request, response);
- break;
- case FETCH:
- executeFetch(requestId, request, response);
- break;
- case REMOVE:
- //executeRemove(lstRec);
- break;
- case UPDATE:
- //executeAdd(lstRec, false);
- break;
-
- default:
- break;
+ case ADD:
+ //executeAdd(request, response);
+ break;
+ case FETCH:
+ executeFetch(requestId, request, response);
+ break;
+ case REMOVE:
+ //executeRemove(lstRec);
+ break;
+ case UPDATE:
+ //executeAdd(lstRec, false);
+ break;
+
+ default:
+ break;
}
return request.getData();
}
-
public void executeFetch(final String requestId, final DSRequest request, final DSResponse response) {
final long start = System.currentTimeMillis();
@@ -167,15 +167,17 @@ public class ResourceTreeDatasource extends DataSource {
private void processIncomingData(List<Resource> result, final DSResponse response, final String requestId) {
- ResourceTypeRepository.Cache.getInstance().loadResourceTypes(result,
- EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children, ResourceTypeRepository.MetadataType.subCategory),
- new ResourceTypeRepository.ResourceTypeLoadedCallback() {
- public void onResourceTypeLoaded(List<Resource> result) {
- response.setData(build(result));
- processResponse(requestId, response);
- response.setStatus(DSResponse.STATUS_SUCCESS);
- }
- });
+ ResourceTypeRepository.Cache.getInstance().loadResourceTypes(
+ result,
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children,
+ ResourceTypeRepository.MetadataType.subCategory),
+ new ResourceTypeRepository.ResourceTypeLoadedCallback() {
+ public void onResourceTypeLoaded(List<Resource> result) {
+ response.setData(build(result));
+ processResponse(requestId, response);
+ response.setStatus(DSResponse.STATUS_SUCCESS);
+ }
+ });
}
/**
@@ -200,12 +202,11 @@ public class ResourceTreeDatasource extends DataSource {
HashMap<ResourceSubCategory, CategoryTreeNode> categories = new HashMap<ResourceSubCategory, CategoryTreeNode>();
HashMap<ResourceType, TypeTreeNode> types = new HashMap<ResourceType, TypeTreeNode>();
-
for (ResourceTreeNode node : nodes) {
built.add(node);
if (!types.containsKey(node.getResourceType())
- && node.getResourceType().getCategory() != ResourceCategory.PLATFORM) {
+ && node.getResourceType().getCategory() != ResourceCategory.PLATFORM) {
String parentResourceId = String.valueOf(node.getResource().getParentResource().getId());
@@ -264,7 +265,6 @@ public class ResourceTreeDatasource extends DataSource {
}
}
-
public static class TypeTreeNode extends TreeNode {
private TypeTreeNode(String parentId, String parentResourceId, String type) {
@@ -288,7 +288,7 @@ public class ResourceTreeDatasource extends DataSource {
String id = String.valueOf(resource.getId());
String parentId = resource.getParentResource() == null ? null
- : (resource.getParentResource().getId() + "_" + resource.getResourceType().getName());
+ : (resource.getParentResource().getId() + "_" + resource.getResourceType().getName());
// System.out.println(id + " / " + parentId);
@@ -302,13 +302,14 @@ public class ResourceTreeDatasource extends DataSource {
setAttribute("name", resource.getName());
setAttribute("description", resource.getDescription());
+ ResourceAvailability currentAvail = resource.getCurrentAvailability();
setAttribute(
- "currentAvailability",
- resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "/images/icons/availability_green_16.png"
- : "/images/icons/availability_red_16.png");
+ "currentAvailability",
+ (null != currentAvail && currentAvail.getAvailabilityType() == AvailabilityType.UP) ? "/images/icons/availability_green_16.png"
+ : "/images/icons/availability_red_16.png");
setIsFolder((resource.getResourceType().getChildResourceTypes() != null && !resource.getResourceType()
- .getChildResourceTypes().isEmpty()));
+ .getChildResourceTypes().isEmpty()));
}
public Resource getResource() {
commit 98b4e155771fe69e5aa325d938f554c10aa8bd16
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Aug 18 10:08:35 2010 -0400
Selenium Work - Avoid having an Abstract class re-use the same name/title
for all of its subclasses. This causes ID conflicts. Let the subclasses
define unique names/titles.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java
index 333b500..55379d1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java
@@ -25,6 +25,7 @@ import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+
import org.rhq.core.domain.criteria.MeasurementScheduleCriteria;
import org.rhq.enterprise.gui.coregui.client.components.table.BooleanCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
@@ -37,15 +38,12 @@ import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
* @author Ian Springer
*/
public abstract class AbstractMeasurementScheduleListView extends Table {
- private static final String TITLE = "Metric Collection Schedules";
-
- private static final SortSpecifier[] SORT_SPECIFIERS = new SortSpecifier[]{
- new SortSpecifier(MeasurementScheduleCriteria.SORT_FIELD_DISPLAY_NAME, SortDirection.ASCENDING)
- };
+ private static final SortSpecifier[] SORT_SPECIFIERS = new SortSpecifier[] { new SortSpecifier(
+ MeasurementScheduleCriteria.SORT_FIELD_DISPLAY_NAME, SortDirection.ASCENDING) };
- public AbstractMeasurementScheduleListView(AbstractMeasurementScheduleDataSource dataSource, Criteria criteria,
- String[] excludedFieldNames) {
- super(TITLE, criteria, SORT_SPECIFIERS, excludedFieldNames);
+ public AbstractMeasurementScheduleListView(String title, AbstractMeasurementScheduleDataSource dataSource,
+ Criteria criteria, String[] excludedFieldNames) {
+ super(title, criteria, SORT_SPECIFIERS, excludedFieldNames);
setDataSource(dataSource);
}
@@ -58,7 +56,7 @@ public abstract class AbstractMeasurementScheduleListView extends Table {
protected void onInit() {
super.onInit();
- ListGrid listGrid = getListGrid();
+ ListGrid listGrid = getListGrid();
listGrid.getField(MeasurementScheduleCriteria.SORT_FIELD_DISPLAY_NAME).setWidth("20%");
listGrid.getField(MeasurementScheduleCriteria.SORT_FIELD_DESCRIPTION).setWidth("40%");
listGrid.getField(MeasurementScheduleCriteria.SORT_FIELD_DATA_TYPE).setWidth("10%");
@@ -79,7 +77,7 @@ public abstract class AbstractMeasurementScheduleListView extends Table {
getDataSource().disableSchedules(AbstractMeasurementScheduleListView.this);
}
});
- addExtraWidget(new UpdateCollectionIntervalWidget(this));
+ addExtraWidget(new UpdateCollectionIntervalWidget(this));
}
class MillisecondsCellFormatter implements CellFormatter {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesView.java
index a9b10f2..89273ff 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesView.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.schedules;
import com.smartgwt.client.data.Criteria;
+
import org.rhq.core.domain.criteria.MeasurementScheduleCriteria;
import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractMeasurementScheduleListView;
@@ -28,10 +29,12 @@ import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractMeasuremen
* @author Ian Springer
*/
public class SchedulesView extends AbstractMeasurementScheduleListView {
+ private static final String TITLE = "Group Metric Collection Schedules";
+
private static final String[] EXCLUDED_FIELD_NAMES = new String[] { MeasurementScheduleCriteria.FILTER_FIELD_RESOURCE_GROUP_ID };
public SchedulesView(int resourceGroupId) {
- super(new SchedulesDataSource(resourceGroupId), createCriteria(resourceGroupId), EXCLUDED_FIELD_NAMES);
+ super(TITLE, new SchedulesDataSource(resourceGroupId), createCriteria(resourceGroupId), EXCLUDED_FIELD_NAMES);
}
private static Criteria createCriteria(int resourceGroupId) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesView.java
index 9b60119..ca4f159 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesView.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.schedules;
import com.smartgwt.client.data.Criteria;
+
import org.rhq.core.domain.criteria.MeasurementScheduleCriteria;
import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractMeasurementScheduleListView;
@@ -28,10 +29,13 @@ import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractMeasuremen
* @author Ian Springer
*/
public class SchedulesView extends AbstractMeasurementScheduleListView {
+
+ private static final String TITLE = "Metric Collection Schedules";
+
private static final String[] EXCLUDED_FIELD_NAMES = new String[] { MeasurementScheduleCriteria.FILTER_FIELD_RESOURCE_ID };
public SchedulesView(int resourceId) {
- super(new SchedulesDataSource(resourceId), createCriteria(resourceId), EXCLUDED_FIELD_NAMES);
+ super(TITLE, new SchedulesDataSource(resourceId), createCriteria(resourceId), EXCLUDED_FIELD_NAMES);
}
private static Criteria createCriteria(int resourceId) {
commit 1c44909cf24b45241bc42baa231fba3ccff7cccc
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Aug 18 10:06:15 2010 -0400
Selenium Work - Table now extends LocatableVLayout as opposed to VLayout
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 94b4199..43e45aa 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
@@ -41,18 +41,18 @@ import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
-import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
* @author Ian Springer
*/
-public class Table extends VLayout {
+public class Table extends LocatableVLayout {
private static final SelectionEnablement DEFAULT_SELECTION_ENABLEMENT = SelectionEnablement.ALWAYS;
@@ -127,7 +127,7 @@ public class Table extends VLayout {
public Table(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers, String[] excludedFieldNames,
boolean autoFetchData) {
- super();
+ super(tableTitle);
setWidth100();
setHeight100();
commit 42a36978ba0640df8ce8b0835ac2d067801806be
Merge: 3217ce7... 7677e9f...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Aug 17 22:48:52 2010 -0400
Merge branch 'master' into master-jay
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupMembersStep.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index aa4c428,d35ec53..94b4199
--- 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
@@@ -389,6 -398,11 +402,11 @@@ public class Table extends VLayout
}
tableAction.actionButton.setDisabled(!enabled);
}
+ for (Canvas extraWidget : extraWidgets) {
+ if (extraWidget instanceof TableWidget) {
- ((TableWidget)extraWidget).refresh(this.listGrid);
++ ((TableWidget) extraWidget).refresh(this.listGrid);
+ }
+ }
this.tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + count + " selected)");
}
}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java
index 993e92b,d579c8c..a55b334
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java
@@@ -98,9 -103,7 +103,8 @@@ public class GroupCreateWizard extends
public void onSuccess(ResourceGroup result) {
CoreGUI.getMessageCenter().notify(
new Message("Saved new group " + result.getName(), Message.Severity.Info));
+
- // try and get the new group reflected in the UI.
- CoreGUI.refresh();
+ resourceGroupListView.refresh();
}
});
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
index c519956,70c5445..4026e47
--- 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
@@@ -33,8 -33,9 +33,8 @@@ import com.smartgwt.client.widgets.tree
import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeNode;
- import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.ResourceCategory;
+ import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewId;
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
index a5dde2e,b56df20..280cb89
--- 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
@@@ -18,17 -18,6 +18,15 @@@
*/
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.List;
+import java.util.Map;
+
- import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
@@@ -49,15 -38,20 +47,12 @@@ import org.rhq.enterprise.gui.coregui.c
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
- import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-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;
-
/**
* @author Greg Hinkle
*/
public class ResourceDatasource extends RPCDataSource<Resource> {
- private String query;
--
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
public ResourceDatasource() {
@@@ -70,7 -60,7 +65,7 @@@
DataSourceField idDataField = new DataSourceIntegerField("id", "ID", 20);
idDataField.setPrimaryKey(true);
- DataSourceImageField iconField = new DataSourceImageField("icon");
- DataSourceImageField iconField = new DataSourceImageField("icon","");
++ DataSourceImageField iconField = new DataSourceImageField("icon", "");
iconField.setImageURLPrefix("types/");
DataSourceTextField nameDataField = new DataSourceTextField(NAME.propertyName(), NAME.title(), 200);
@@@ -93,14 -83,7 +88,6 @@@
categoryDataField, availabilityDataField);
}
- public String getQuery() {
- return query;
- }
--
- public void setQuery(String query) {
- this.query = query;
- }
-
public void executeFetch(final DSRequest request, final DSResponse response) {
ResourceCriteria criteria = getFetchCriteria(request);
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
index 9a5993b,97a55db..98e5ab9
--- 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
@@@ -115,10 -122,31 +122,30 @@@ public class ResourceSearchView extend
getListGrid().setFields(idField, iconField, nameField, descriptionField, typeNameField, pluginNameField,
categoryField, availabilityField);
- addTableAction("Uninventory", Table.SelectionEnablement.ANY, "Are you sure you want to delete # resources?",
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- getListGrid().removeSelectedData();
+ addTableAction("Uninventory", Table.SelectionEnablement.ANY,
+ "Are you sure you want to uninventory # resources?", new TableAction() {
+ public void executeAction(ListGridRecord[] selections) {
+ int[] resourceIds = new int[selections.length];
+ int index = 0;
+ for (ListGridRecord selection : selections) {
+ resourceIds[index++] = selection.getAttributeAsInt("id");
+ }
+ ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();
+
+ resourceManager.uninventoryResources(resourceIds, new AsyncCallback<List<Integer>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to uninventory selected resources", caught);
+ }
+
+ public void onSuccess(List<Integer> result) {
+ CoreGUI.getMessageCenter()
+ .notify(
+ new Message("Successfully uninventoried " + result.size() + " resources",
+ Severity.Info));
+
+ ResourceSearchView.this.refresh();
+ }
+ });
-
}
});
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index 53909d1,d761dbd..8e51dd9
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@@ -88,10 -87,9 +88,9 @@@ public class MenuBarView extends VLayou
// loggedInAs.setWrap(false);
// loggedInAs.setValign(VerticalAlignment.CENTER);
// helpLayout.addMember(loggedInAs);
-
- topStrip.addMember(new Hyperlink("Help", "Help"));
- topStrip.addMember(new Hyperlink("Preferences", "Preferences"));
- topStrip.addMember(new Hyperlink("Log Out", "LogOut"));
+ topStrip.addMember(SeleniumUtility.setHtmlId(new Hyperlink("Help", "Help")));
+ topStrip.addMember(SeleniumUtility.setHtmlId(new Hyperlink("Preferences", "Preferences")));
+ topStrip.addMember(SeleniumUtility.setHtmlId(new Hyperlink("Log Out", "LogOut")));
// helpLayout.setLayoutAlign(VerticalAlignment.CENTER);
// topStrip.addMember(helpLayout);
commit 3217ce7871f55fd792b3c123ded5ab9d133b2350
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Aug 17 16:43:05 2010 -0400
Selenium Integration Work
- Add "Locatable" widget class wrappers
- Add SeleniumUtility class
- Add explicit ID hooks to
- all Selectors
- several other places (but no where near all)
- Fixed issues with selector filters
- Worked around GWT bug http://code.google.com/p/smartgwt/issues/detail?id=490
which breaks use of AdvancedCriteria.
- Fixed issues in the InventoryView stacks
- Added html hooks to MenuBar
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java
index bf912cd..3fc37f4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java
@@ -18,12 +18,6 @@
*/
package org.rhq.enterprise.gui.coregui.client;
-import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceSelector;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeTreeView;
-import org.rhq.enterprise.gui.coregui.client.report.tag.TagCloudView;
-
import com.smartgwt.client.types.Side;
import com.smartgwt.client.types.TabBarControls;
import com.smartgwt.client.widgets.Canvas;
@@ -35,6 +29,11 @@ import com.smartgwt.client.widgets.menu.events.ItemClickHandler;
import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;
+import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceSelector;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeTreeView;
+import org.rhq.enterprise.gui.coregui.client.report.tag.TagCloudView;
+
/**
* @author Greg Hinkle
*/
@@ -45,7 +44,7 @@ public class DemoCanvas extends Canvas {
setWidth100();
setHeight100();
-
+
final TabSet topTabSet = new TabSet();
topTabSet.setTabBarPosition(Side.TOP);
topTabSet.setWidth100();//(1200);
@@ -60,10 +59,9 @@ public class DemoCanvas extends Canvas {
final Tab configTab = new Tab("Configuration Editor");
//Tab alertHistoryTab = new Tab("Alert History");
-
tagTab.setPane(new TagCloudView());
-
- selectorTab.setPane(new ResourceSelector());
+
+ selectorTab.setPane(new ResourceSelector("Demo Resource Selector"));
// Agent: resource (10005) type (10060)
// Raw: 10003 / 10023
@@ -93,18 +91,18 @@ public class DemoCanvas extends Canvas {
System.out.println("Loading: " + x);
topTabSet.removeTab(configTab);
switch (x) {
- case 0:
- configTab.setPane(new ConfigurationEditor(10005, 10060));
- break;
- case 1:
- configTab.setPane(new ConfigurationEditor(10003, 10023));
- break;
- case 2:
- configTab.setPane(new ConfigurationEditor(10002, 10022));
- break;
- case 3:
- configTab.setPane(new ConfigurationEditor(10149, 10134));
- break;
+ case 0:
+ configTab.setPane(new ConfigurationEditor(10005, 10060));
+ break;
+ case 1:
+ configTab.setPane(new ConfigurationEditor(10003, 10023));
+ break;
+ case 2:
+ configTab.setPane(new ConfigurationEditor(10002, 10022));
+ break;
+ case 3:
+ configTab.setPane(new ConfigurationEditor(10149, 10134));
+ break;
}
topTabSet.addTab(configTab, 0);
topTabSet.selectTab(0);
@@ -113,7 +111,8 @@ public class DemoCanvas extends Canvas {
}
});
- topTabSet.setTabBarControls(TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER, new MenuButton("Config Resource", configSelectMenu));
+ topTabSet.setTabBarControls(TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER, new MenuButton(
+ "Config Resource", configSelectMenu));
addChild(topTabSet);
}
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 cca86be..5b76f3a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
@@ -18,15 +18,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.roles;
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.authz.Permission;
-import org.rhq.core.domain.authz.Role;
-import org.rhq.core.domain.resource.group.ResourceGroup;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceGroupSelector;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSCallback;
@@ -51,9 +45,15 @@ import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.authz.Role;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceGroupSelector;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/**
* @author Greg Hinkle
@@ -62,10 +62,8 @@ public class RoleEditView extends VLayout {
private Role roleBeingEdited;
-
private Label message = new Label("Select a role to edit...");
-
private VLayout editCanvas;
private HeaderLabel editLabel;
private DynamicForm form;
@@ -79,7 +77,6 @@ public class RoleEditView extends VLayout {
private Window editorWindow;
-
public RoleEditView() {
super();
setPadding(10);
@@ -121,13 +118,11 @@ public class RoleEditView extends VLayout {
groupSelectorItem.setTitleOrientation(TitleOrientation.TOP);
groupSelectorItem.setColSpan(2);
-
subjectSelectorItem = new CanvasItem("subjectSelectionCanvas", "Assigned Subjects");
subjectSelectorItem.setCanvas(new Label("loading...")); //new RoleSubjectSelector(null));
subjectSelectorItem.setTitleOrientation(TitleOrientation.TOP);
subjectSelectorItem.setColSpan(2);
-
SubmitItem saveButton = new SubmitItem("save", "Save");
saveButton.addClickHandler(new ClickHandler() {
@@ -144,14 +139,8 @@ public class RoleEditView extends VLayout {
}
});
-
- form.setItems(
- idItem,
- nameItem,
- permissionEditorItem,
- groupSelectorItem,
- subjectSelectorItem,
- saveButton, new ResetItem("reset", "Reset"));
+ form.setItems(idItem, nameItem, permissionEditorItem, groupSelectorItem, subjectSelectorItem, saveButton,
+ new ResetItem("reset", "Reset"));
editCanvas.addMember(form);
@@ -168,24 +157,25 @@ public class RoleEditView extends VLayout {
permissionEditorItem.setParentForm(form);
permissionEditorItem.setPermissions((Set<Permission>) record.getAttributeAsObject("permissions"));
- groupSelector = new RoleResourceGroupSelector((Collection<ResourceGroup>) record.getAttributeAsObject("resourceGroups"));
+ groupSelector = new RoleResourceGroupSelector("RoleEditor-Groups", (Collection<ResourceGroup>) record
+ .getAttributeAsObject("resourceGroups"));
groupSelectorItem.setCanvas(groupSelector);
-
- subjectSelector = new RoleSubjectSelector((Collection<Subject>) record.getAttributeAsObject("subjects"));
+ subjectSelector = new RoleSubjectSelector("RoleEditor-Subjects", (Collection<Subject>) record
+ .getAttributeAsObject("subjects"));
subjectSelectorItem.setCanvas(subjectSelector);
} catch (Throwable t) {
t.printStackTrace();
}
-// markForRedraw();
+ // markForRedraw();
}
public void editNone() {
message.show();
editCanvas.hide();
-// markForRedraw();
+ // markForRedraw();
}
public void editNew() {
@@ -195,7 +185,6 @@ public class RoleEditView extends VLayout {
editLabel.setContents("Create Role");
-
editorWindow = new Window();
editorWindow.setTitle("Create Role");
editorWindow.setWidth(800);
@@ -209,7 +198,6 @@ public class RoleEditView extends VLayout {
}
-
public void save() {
System.out.println("Saving role");
@@ -230,18 +218,17 @@ public class RoleEditView extends VLayout {
roleId = Integer.parseInt(new ListGridRecord(dsRequest.getData()).getAttribute("id"));
}
+ GWTServiceLookup.getRoleService().setAssignedResourceGroups(roleId, groupIds,
+ new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update role's assigned groups", caught);
+ }
- GWTServiceLookup.getRoleService().setAssignedResourceGroups(
- roleId, groupIds,
- new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to update role's assigned groups", caught);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Updated assigned groups", Message.Severity.Info));
- }
- });
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Updated assigned groups", Message.Severity.Info));
+ }
+ });
HashSet<Integer> selectedSubjects = subjectSelector.getSelection();
int[] subjectIds = new int[selectedSubjects.size()];
@@ -250,18 +237,16 @@ public class RoleEditView extends VLayout {
subjectIds[i++] = id;
}
+ GWTServiceLookup.getRoleService().setAssignedSubjects(roleId, subjectIds, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update role's assigned subjects", caught);
+ }
- GWTServiceLookup.getRoleService().setAssignedSubjects(
- roleId, subjectIds,
- new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to update role's assigned subjects", caught);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Updated role assigned subjects", Message.Severity.Info));
- }
- });
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Updated role assigned subjects", Message.Severity.Info));
+ }
+ });
if (editorWindow != null) {
editorWindow.destroy();
@@ -270,7 +255,6 @@ public class RoleEditView extends VLayout {
});
}
-
public DynamicForm getForm() {
return form;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleResourceGroupSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleResourceGroupSelector.java
index 8b7288f..12f5fde 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleResourceGroupSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleResourceGroupSelector.java
@@ -35,8 +35,8 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.Resour
*/
public class RoleResourceGroupSelector extends ResourceGroupSelector {
- public RoleResourceGroupSelector(Collection<ResourceGroup> groups) {
- super();
+ public RoleResourceGroupSelector(String id, Collection<ResourceGroup> groups) {
+ super(id);
if (groups != null) {
ListGridRecord[] data = (new ResourceGroupsDataSource()).buildRecords(groups);
setAssigned(data);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleSubjectSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleSubjectSelector.java
index 4b8e940..42e4b2f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleSubjectSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleSubjectSelector.java
@@ -38,21 +38,17 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
*/
public class RoleSubjectSelector extends AbstractSelector<Subject> {
-
-
- public RoleSubjectSelector(Collection<Subject> subjects) {
- super();
+ public RoleSubjectSelector(String id, Collection<Subject> subjects) {
+ super(id);
if (subjects != null) {
ListGridRecord[] data = (new UsersDataSource()).buildRecords(subjects);
setAssigned(data);
}
}
-
-
@Override
protected DynamicForm getAvailableFilterForm() {
- return null; // TODO: Implement this method.
+ return null; // TODO: Implement this method.
}
@Override
@@ -62,22 +58,21 @@ public class RoleSubjectSelector extends AbstractSelector<Subject> {
@Override
protected Criteria getLatestCriteria(DynamicForm availableFilterForm) {
- return null; // TODO: Implement this method.
+ return null; // TODO: Implement this method.
}
-
public class SelectedSubjectsDataSource extends UsersDataSource {
- @Override
- public ListGridRecord[] buildRecords(Collection<Subject> subjects) {
- ListGridRecord[] records = super.buildRecords(subjects);
- for (ListGridRecord record : records) {
- if (selection.contains(record.getAttributeAsInt("id"))) {
- record.setEnabled(false);
- }
- }
- return records;
- }
- }
+ @Override
+ public ListGridRecord[] buildRecords(Collection<Subject> subjects) {
+ ListGridRecord[] records = super.buildRecords(subjects);
+ for (ListGridRecord record : records) {
+ if (selection.contains(record.getAttributeAsInt("id"))) {
+ record.setEnabled(false);
+ }
+ }
+ return records;
+ }
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRoleSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRoleSelector.java
index e554fef..146303a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRoleSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/SubjectRoleSelector.java
@@ -29,11 +29,8 @@ import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.authz.Role;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesDataSource;
import org.rhq.enterprise.gui.coregui.client.components.selector.AbstractSelector;
-import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
/**
@@ -41,20 +38,17 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
*/
public class SubjectRoleSelector extends AbstractSelector<Role> {
-
- public SubjectRoleSelector(Collection<Role> roles) {
- super();
+ public SubjectRoleSelector(String id, Collection<Role> roles) {
+ super(id);
if (roles != null) {
ListGridRecord[] data = (new RolesDataSource()).buildRecords(roles);
setAssigned(data);
}
}
-
-
@Override
protected DynamicForm getAvailableFilterForm() {
- return null; // TODO: Implement this method.
+ return null; // TODO: Implement this method.
}
@Override
@@ -65,10 +59,9 @@ public class SubjectRoleSelector extends AbstractSelector<Role> {
@Override
protected Criteria getLatestCriteria(DynamicForm availableFilterForm) {
- return null; // TODO: Implement this method.
+ return null; // TODO: Implement this method.
}
-
public class SelectedRolesDataSource extends RolesDataSource {
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
index 334315b..6042b4f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
@@ -18,12 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.users;
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.authz.Role;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import java.util.HashSet;
+import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSCallback;
@@ -39,28 +35,27 @@ import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.CanvasItem;
-import com.smartgwt.client.widgets.form.fields.ResetItem;
import com.smartgwt.client.widgets.form.fields.SectionItem;
-import com.smartgwt.client.widgets.form.fields.SubmitItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
-import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
-import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
-import java.util.HashSet;
-import java.util.Set;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Role;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/**
* @author Greg Hinkle
*/
public class UserEditView extends VLayout {
-
private Label message = new Label("Select a user to edit...");
-// private SubjectRolesEditorItem subjectRolesEditorItem ;
+ // private SubjectRolesEditorItem subjectRolesEditorItem ;
private VLayout editCanvas;
private HeaderLabel editLabel;
@@ -75,10 +70,9 @@ public class UserEditView extends VLayout {
private Window editorWindow;
private SubjectRoleSelector roleSelector;
-
public UserEditView() {
- dataSource = UsersDataSource.getInstance();
-
+ dataSource = UsersDataSource.getInstance();
+
setWidth100();
setHeight100();
@@ -99,42 +93,34 @@ public class UserEditView extends VLayout {
SectionItem userEditSection = new SectionItem("userEditSection", "Edit User");
-
-// TextItem firstName = new TextItem("firstName", "First Name");
-//
-// TextItem lastName = new TextItem("lastName", "Last Name");
-//
-// TextItem email = new TextItem("email", "Email Address");
-//
-//
-// BooleanItem enabled = new BooleanItem();
-// enabled.setName("enabled");
-// enabled.setTitle("Enabled");
-//
-// TextItem username = new TextItem("username", "Username");
-//
-// TextItem phone = new TextItem("phone", "Phone");
-
-
-// form.setField//s(userEditSection);
-
-
+ // TextItem firstName = new TextItem("firstName", "First Name");
+ //
+ // TextItem lastName = new TextItem("lastName", "Last Name");
+ //
+ // TextItem email = new TextItem("email", "Email Address");
+ //
+ //
+ // BooleanItem enabled = new BooleanItem();
+ // enabled.setName("enabled");
+ // enabled.setTitle("Enabled");
+ //
+ // TextItem username = new TextItem("username", "Username");
+ //
+ // TextItem phone = new TextItem("phone", "Phone");
+
+ // form.setField//s(userEditSection);
form.setUseAllDataSourceFields(true);
form.setDataSource(dataSource);
-
-
-
this.roleSelectionItem = new CanvasItem("selectRoles", "Select Roles");
this.roleSelectionItem.setTitleOrientation(TitleOrientation.TOP);
this.roleSelectionItem.setColSpan(2);
-// roleSelectionItem.setCanvas(new SubjectRoleSelector(null));
+ // roleSelectionItem.setCanvas(new SubjectRoleSelector(null));
TextItem departmentItem = new TextItem("department");
departmentItem.setRequired(false);
-
IButton saveButton = new IButton("Save");
saveButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(com.smartgwt.client.widgets.events.ClickEvent clickEvent) {
@@ -172,11 +158,8 @@ public class UserEditView extends VLayout {
buttonLayout.addMember(resetButton);
buttonLayout.addMember(cancelButton);
-
-
form.setItems(departmentItem, roleSelectionItem);
-
editCanvas = new VLayout();
editCanvas.addMember(form);
@@ -200,27 +183,26 @@ public class UserEditView extends VLayout {
}
GWTServiceLookup.getRoleService().setAssignedSubjectRoles(subjectId, roleIds,
- new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to set subject role assignments.",caught);
- }
+ new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to set subject role assignments.", caught);
+ }
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Succesfully saved new user roles.", Message.Severity.Info));
- }
- });
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Succesfully saved new user roles.", Message.Severity.Info));
+ }
+ });
}
});
}
-
public void editRecord(Record record) {
-// form.getDataSource().getField("username").setCanEdit(true );
+ // form.getDataSource().getField("username").setCanEdit(true );
-
- roleSelector = new SubjectRoleSelector((Set<Role>) record.getAttributeAsObject("roles"));
+ roleSelector = new SubjectRoleSelector("UserEditor-Roles", (Set<Role>) record.getAttributeAsObject("roles"));
roleSelectionItem.setCanvas(roleSelector);
try {
@@ -245,7 +227,7 @@ public class UserEditView extends VLayout {
subject = new Subject();
ListGridRecord r = dataSource.copyValues(subject);
editRecord(r);
-// form.getDataSource().getField("username").setCanEdit(false);
+ // form.getDataSource().getField("username").setCanEdit(false);
form.setSaveOperationType(DSOperationType.ADD);
editorWindow = new Window();
@@ -265,9 +247,6 @@ public class UserEditView extends VLayout {
UserEditView editView = new UserEditView();
editView.editNewInternal();
-
-
}
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleSelector.java
index aaca7be..1756582 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleSelector.java
@@ -47,8 +47,8 @@ public class BundleSelector extends AbstractSelector<Bundle> {
private BundleGWTServiceAsync bundleService = GWTServiceLookup.getBundleService();
- public BundleSelector() {
- super();
+ public BundleSelector(String id) {
+ super(id);
}
protected DynamicForm getAvailableFilterForm() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
index 219d58f..e4281f6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java
@@ -40,7 +40,7 @@ public class BundleSummaryStep extends AbstractWizardStep {
public Canvas getCanvas() {
- DynamicForm form = new DynamicForm();
+ DynamicForm form = getDynamicForm();
form.setNumCols(2);
form.setMargin(20);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
index 794a2c1..98490d6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java
@@ -55,7 +55,7 @@ public class BundleUploadDataStep extends AbstractWizardStep {
}
public Canvas getCanvas() {
- final VLayout mainLayout = new VLayout();
+ final VLayout mainLayout = getVLayout();
mainLayout.setMargin(Integer.valueOf(20));
mainLayout.setWidth100();
mainLayout.setHeight(10);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
index 27f5a99..00f7b5b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java
@@ -47,6 +47,7 @@ import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
public class BundleUploadDistroFileStep extends AbstractWizardStep {
@@ -128,7 +129,7 @@ public class BundleUploadDistroFileStep extends AbstractWizardStep {
urlTextItem.setRequired(false);
urlTextItem.setShowTitle(false);
urlTextItem.setWidth(400);
- DynamicForm urlForm = new DynamicForm();
+ DynamicForm urlForm = new LocatableDynamicForm("URL");
urlForm.setPadding(20);
urlForm.setWidth100();
urlForm.setItems(urlTextItem);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
index c96debc..b69f2ed 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java
@@ -55,7 +55,7 @@ public class DeployStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (canvas == null) {
- canvas = new VLayout();
+ canvas = getVLayout();
canvas.setWidth100();
canvas.setHeight100();
canvas.setAlign(Alignment.CENTER);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java
index 558d396..a2b2b97 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java
@@ -52,7 +52,7 @@ public class GetDeploymentInfoStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (form == null) {
- form = new DynamicForm();
+ form = getDynamicForm();
form.setWidth100();
form.setNumCols(2);
form.setColWidths("50%", "*");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentOptionsStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentOptionsStep.java
index 24ca6c7..c29ff74 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentOptionsStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentOptionsStep.java
@@ -47,7 +47,7 @@ public class GetDeploymentOptionsStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (form == null) {
- form = new DynamicForm();
+ form = getDynamicForm();
form.setWidth100();
form.setNumCols(2);
form.setColWidths("50%", "*");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDestinationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDestinationStep.java
index 407e3d9..1ca7062 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDestinationStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDestinationStep.java
@@ -59,7 +59,7 @@ public class GetDestinationStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (this.form == null) {
- this.form = new VLayout();
+ this.form = getVLayout();
this.valForm.setWidth100();
this.valForm.setNumCols(2);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleStep.java
index 771e51d..2671e04 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleStep.java
@@ -43,7 +43,7 @@ public class SelectBundleStep extends AbstractWizardStep {
}
public Canvas getCanvas() {
- this.selector = new BundleSelector();
+ this.selector = new BundleSelector(getName());
return this.selector;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
index a9529af..ef41a78 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/SelectBundleVersionStep.java
@@ -66,7 +66,7 @@ public class SelectBundleVersionStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (form == null) {
- form = new DynamicForm();
+ form = getDynamicForm();
form.setWidth100();
form.setNumCols(2);
form.setColWidths("50%", "*");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/selection/PlatformResourceGroupSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/selection/PlatformResourceGroupSelector.java
index 75620bb..f8ec6dc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/selection/PlatformResourceGroupSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/selection/PlatformResourceGroupSelector.java
@@ -10,8 +10,8 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
public class PlatformResourceGroupSelector extends ResourceGroupSelector {
- public PlatformResourceGroupSelector() {
- super();
+ public PlatformResourceGroupSelector(String id) {
+ super(id);
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/ConfirmationStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/ConfirmationStep.java
index fd7264d..87002c3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/ConfirmationStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/ConfirmationStep.java
@@ -56,7 +56,8 @@ public class ConfirmationStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (layout == null) {
- layout = new VLayout(10);
+ layout = getVLayout();
+ layout.setMembersMargin(10);
BundleDeploymentCriteria c = new BundleDeploymentCriteria();
c.addFilterDestinationId(this.wizard.getDestination().getId());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java
index 0164035..f008b99 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/GetRevertInfoStep.java
@@ -52,7 +52,7 @@ public class GetRevertInfoStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (form == null) {
- form = new DynamicForm();
+ form = getDynamicForm();
form.setWidth100();
form.setNumCols(2);
form.setColWidths("50%", "*");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/RevertStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/RevertStep.java
index 41566e3..bf1413c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/RevertStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/RevertStep.java
@@ -55,7 +55,7 @@ public class RevertStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (canvas == null) {
- canvas = new VLayout();
+ canvas = getVLayout();
canvas.setWidth100();
canvas.setHeight100();
canvas.setAlign(Alignment.CENTER);
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 8f143ae..6029ada 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
@@ -18,31 +18,14 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.configuration;
-import org.rhq.core.domain.configuration.AbstractPropertyMap;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.Property;
-import org.rhq.core.domain.configuration.PropertyList;
-import org.rhq.core.domain.configuration.PropertyMap;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.configuration.RawConfiguration;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.configuration.definition.ConfigurationFormat;
-import org.rhq.core.domain.configuration.definition.PropertyDefinition;
-import org.rhq.core.domain.configuration.definition.PropertyDefinitionEnumeration;
-import org.rhq.core.domain.configuration.definition.PropertyDefinitionList;
-import org.rhq.core.domain.configuration.definition.PropertyDefinitionMap;
-import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
-import org.rhq.core.domain.configuration.definition.PropertyGroupDefinition;
-import org.rhq.core.domain.configuration.definition.PropertySimpleType;
-import org.rhq.core.domain.configuration.definition.constraint.Constraint;
-import org.rhq.core.domain.configuration.definition.constraint.IntegerRangeConstraint;
-import org.rhq.core.domain.configuration.definition.constraint.RegexConstraint;
-import org.rhq.core.domain.resource.ResourceType;
-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;
-import org.rhq.enterprise.gui.coregui.client.util.CanvasUtility;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Record;
@@ -85,7 +68,6 @@ import com.smartgwt.client.widgets.form.validator.RegExpValidator;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.SortNormalizer;
import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
@@ -97,7 +79,6 @@ import com.smartgwt.client.widgets.layout.SectionStackSection;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.menu.IMenuButton;
import com.smartgwt.client.widgets.menu.Menu;
-import com.smartgwt.client.widgets.menu.MenuButton;
import com.smartgwt.client.widgets.menu.MenuItem;
import com.smartgwt.client.widgets.menu.MenuItemSeparator;
import com.smartgwt.client.widgets.menu.events.ClickHandler;
@@ -109,21 +90,37 @@ import com.smartgwt.client.widgets.tree.Tree;
import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeNode;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import org.rhq.core.domain.configuration.AbstractPropertyMap;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.RawConfiguration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.ConfigurationFormat;
+import org.rhq.core.domain.configuration.definition.PropertyDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionEnumeration;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionList;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionMap;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
+import org.rhq.core.domain.configuration.definition.PropertyGroupDefinition;
+import org.rhq.core.domain.configuration.definition.PropertySimpleType;
+import org.rhq.core.domain.configuration.definition.constraint.Constraint;
+import org.rhq.core.domain.configuration.definition.constraint.IntegerRangeConstraint;
+import org.rhq.core.domain.configuration.definition.constraint.RegexConstraint;
+import org.rhq.core.domain.resource.ResourceType;
+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;
+import org.rhq.enterprise.gui.coregui.client.util.CanvasUtility;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class ConfigurationEditor extends VLayout {
-
+public class ConfigurationEditor extends LocatableVLayout {
private ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
@@ -154,7 +151,7 @@ public class ConfigurationEditor extends VLayout {
; // Need this extra semicolon for the qdox parser
public ConfigurationEditor() {
-
+ super("ConfigurationEditor");
}
public ConfigurationEditor(int resourceId, int resourceTypeId) {
@@ -162,6 +159,7 @@ public class ConfigurationEditor extends VLayout {
}
public ConfigurationEditor(int resourceId, int resourceTypeId, ConfigType configType) {
+ super("ConfigurationEditor");
this.resourceId = resourceId;
this.resourceTypeId = resourceTypeId;
this.configType = configType;
@@ -169,11 +167,11 @@ public class ConfigurationEditor extends VLayout {
}
public ConfigurationEditor(ConfigurationDefinition definition, Configuration configuration) {
+ super("ConfigurationEditor");
this.configuration = configuration;
this.definition = definition;
}
-
public Configuration getConfiguration() {
return configuration;
}
@@ -222,19 +220,19 @@ public class ConfigurationEditor extends VLayout {
}
});
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[]{resourceTypeId},
- EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypesLoadedCallback() {
- public void onTypesLoaded(HashMap<Integer, ResourceType> types) {
- System.out.println("ConfigDef retreived in: " + (System.currentTimeMillis() - start));
- definition = types.get(resourceTypeId).getResourceConfigurationDefinition();
- if (definition == null) {
- loadingLabel.hide();
- showError("No configuration supported for this resource");
- }
- reload();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[] { resourceTypeId },
+ EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypesLoadedCallback() {
+ public void onTypesLoaded(HashMap<Integer, ResourceType> types) {
+ System.out.println("ConfigDef retreived in: " + (System.currentTimeMillis() - start));
+ definition = types.get(resourceTypeId).getResourceConfigurationDefinition();
+ if (definition == null) {
+ loadingLabel.hide();
+ showError("No configuration supported for this resource");
}
- });
+ reload();
+ }
+ });
} else if (configType == ConfigType.plugin) {
configurationService.getPluginConfiguration(resourceId, new AsyncCallback<Configuration>() {
@@ -248,50 +246,50 @@ public class ConfigurationEditor extends VLayout {
}
});
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[]{resourceTypeId}, EnumSet.of(ResourceTypeRepository.MetadataType.pluginConfigurationDefinition), new ResourceTypeRepository.TypesLoadedCallback() {
- public void onTypesLoaded(HashMap<Integer, ResourceType> types) {
- System.out.println("ConfigDef retreived in: " + (System.currentTimeMillis() - start));
- definition = types.get(resourceTypeId).getPluginConfigurationDefinition();
- if (definition == null) {
- showError("No configuration supported for this resource");
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(new Integer[] { resourceTypeId },
+ EnumSet.of(ResourceTypeRepository.MetadataType.pluginConfigurationDefinition),
+ new ResourceTypeRepository.TypesLoadedCallback() {
+ public void onTypesLoaded(HashMap<Integer, ResourceType> types) {
+ System.out.println("ConfigDef retreived in: " + (System.currentTimeMillis() - start));
+ definition = types.get(resourceTypeId).getPluginConfigurationDefinition();
+ if (definition == null) {
+ showError("No configuration supported for this resource");
+ }
+ reload();
}
- reload();
- }
- });
+ });
}
} else {
reload();
}
}
-
public void reload() {
if (definition == null || configuration == null) {
// Wait for both to load
return;
}
-
originalConfiguration = configuration.deepCopy();
-
tabSet = new TabSet();
- if (definition.getConfigurationFormat() == ConfigurationFormat.RAW || definition.getConfigurationFormat() == ConfigurationFormat.STRUCTURED_AND_RAW) {
+ if (definition.getConfigurationFormat() == ConfigurationFormat.RAW
+ || definition.getConfigurationFormat() == ConfigurationFormat.STRUCTURED_AND_RAW) {
System.out.println("Loading files view");
Tab tab = new Tab("Files");
tab.setPane(buildRawPane());
tabSet.addTab(tab);
}
- if (definition.getConfigurationFormat() == ConfigurationFormat.STRUCTURED || definition.getConfigurationFormat() == ConfigurationFormat.STRUCTURED_AND_RAW) {
+ if (definition.getConfigurationFormat() == ConfigurationFormat.STRUCTURED
+ || definition.getConfigurationFormat() == ConfigurationFormat.STRUCTURED_AND_RAW) {
System.out.println("loading properties view");
Tab tab = new Tab("Properties");
tab.setPane(buildStructuredPane());
tabSet.addTab(tab);
}
-
for (Canvas c : getChildren()) {
c.destroy();
}
@@ -323,10 +321,9 @@ public class ConfigurationEditor extends VLayout {
fileTree.setData(files);
fileTree.setWidth(250);
-
DynamicForm form = new DynamicForm();
final TextAreaItem rawEditor = new TextAreaItem();
-// rawEditor.setValue("This is a test");
+ // rawEditor.setValue("This is a test");
rawEditor.setShowTitle(false);
form.setItems(rawEditor);
form.setHeight100();
@@ -351,13 +348,11 @@ public class ConfigurationEditor extends VLayout {
return layout;
}
-
protected VLayout buildStructuredPane() {
VLayout layout = new VLayout();
List<PropertyGroupDefinition> definitions = definition.getGroupDefinitions();
-
final SectionStack sectionStack = new SectionStack();
sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
sectionStack.setWidth100();
@@ -365,17 +360,15 @@ public class ConfigurationEditor extends VLayout {
sectionStack.setScrollSectionIntoView(true);
sectionStack.setOverflow(Overflow.AUTO);
-
if (definition.getNonGroupedProperties().size() > 0) {
sectionStack.addSection(buildGroupSection(null));
}
for (PropertyGroupDefinition definition : definitions) {
-// System.out.println("building: " + definition.getDisplayName());
+ // System.out.println("building: " + definition.getDisplayName());
sectionStack.addSection(buildGroupSection(definition));
}
-
Menu menu = new Menu();
for (SectionStackSection section : sectionStack.getSections()) {
MenuItem item = new MenuItem(section.getTitle());
@@ -404,7 +397,6 @@ public class ConfigurationEditor extends VLayout {
// TODO GH: Save button as saveListener() or remove the buttons from this form and have
// the container provide them?
-
toolStrip = new ToolStrip();
toolStrip.setBackgroundImage(null);
@@ -414,8 +406,7 @@ public class ConfigurationEditor extends VLayout {
saveButton = new IButton("Save");
saveButton.setAlign(Alignment.CENTER);
saveButton.setDisabled(true);
-// toolStrip.addMember(saveButton);
-
+ // toolStrip.addMember(saveButton);
IButton resetButton = new IButton("Reset");
resetButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
@@ -424,8 +415,7 @@ public class ConfigurationEditor extends VLayout {
}
});
-
-// toolStrip.addMember(resetButton);
+ // toolStrip.addMember(resetButton);
toolStrip.addMember(new LayoutSpacer());
toolStrip.addMember(new IMenuButton("Jump to Section", menu));
@@ -436,7 +426,6 @@ public class ConfigurationEditor extends VLayout {
return layout;
}
-
public SectionStackSection buildGroupSection(PropertyGroupDefinition group) {
SectionStackSection section;
@@ -444,16 +433,18 @@ public class ConfigurationEditor extends VLayout {
section = new SectionStackSection("General Properties");
} else {
- section = new SectionStackSection("<div style=\"float:left; font-weight: bold;\">" + group.getDisplayName() + "</div>" +
- (group.getDescription() != null
- ? ("<div style='padding-left: 50px; font-weight: normal; font-size: smaller; float: right;'>" + group.getDescription() + "</div>")
- : ""));
+ section = new SectionStackSection(
+ "<div style=\"float:left; font-weight: bold;\">"
+ + group.getDisplayName()
+ + "</div>"
+ + (group.getDescription() != null ? ("<div style='padding-left: 50px; font-weight: normal; font-size: smaller; float: right;'>"
+ + group.getDescription() + "</div>")
+ : ""));
section.setExpanded(!group.isDefaultHidden());
}
- ArrayList<PropertyDefinition> definitions = new ArrayList<PropertyDefinition>(
- ((group == null) ? definition.getNonGroupedProperties() : definition.getPropertiesInGroup(group.getName()))
- );
+ ArrayList<PropertyDefinition> definitions = new ArrayList<PropertyDefinition>(((group == null) ? definition
+ .getNonGroupedProperties() : definition.getPropertiesInGroup(group.getName())));
Collections.sort(definitions, new PropertyDefinitionComparator());
DynamicForm form = buildPropertiesForm(definitions, configuration);
@@ -462,7 +453,6 @@ public class ConfigurationEditor extends VLayout {
return section;
}
-
private DynamicForm buildPropertiesForm(ArrayList<PropertyDefinition> definitions, AbstractPropertyMap propertyMap) {
DynamicForm form = new DynamicForm();
form.setValuesManager(valuesManager);
@@ -482,13 +472,10 @@ public class ConfigurationEditor extends VLayout {
form.setCellPadding(5);
form.setColWidths(190, 28, 210);
-
ArrayList<FormItem> fields = new ArrayList<FormItem>();
-
boolean odd = true;
-
for (PropertyDefinition propertyDefinition : definitions) {
Property property = propertyMap.get(propertyDefinition.getName());
if (property == null) {
@@ -505,17 +492,18 @@ public class ConfigurationEditor extends VLayout {
return form;
}
-
- public void addItems(ArrayList<FormItem> fields, PropertyDefinition propertyDefinition, Property property, boolean oddRow) {
+ public void addItems(ArrayList<FormItem> fields, PropertyDefinition propertyDefinition, Property property,
+ boolean oddRow) {
StaticTextItem nameItem = new StaticTextItem();
nameItem.setStartRow(true);
- String title = "<b>" + (propertyDefinition.getDisplayName() != null ? propertyDefinition.getDisplayName() : propertyDefinition.getName()) + "</b>";
+ String title = "<b>"
+ + (propertyDefinition.getDisplayName() != null ? propertyDefinition.getDisplayName() : propertyDefinition
+ .getName()) + "</b>";
nameItem.setValue(title);
nameItem.setShowTitle(false);
nameItem.setCellStyle(oddRow ? "OddRow" : "EvenRow");
-
fields.add(nameItem);
FormItem valueItem = null;
@@ -523,7 +511,6 @@ public class ConfigurationEditor extends VLayout {
valueItem = buildSimpleField(fields, (PropertyDefinitionSimple) propertyDefinition, oddRow, property);
fields.add(valueItem);
-
StaticTextItem descriptionItem = new StaticTextItem();
descriptionItem.setValue(propertyDefinition.getDescription());
descriptionItem.setShowTitle(false);
@@ -533,14 +520,16 @@ public class ConfigurationEditor extends VLayout {
} else if (propertyDefinition instanceof PropertyDefinitionList) {
if (((PropertyDefinitionList) propertyDefinition).getMemberDefinition() instanceof PropertyDefinitionMap) {
// List of Maps is a specially supported case with summary fields as columns in a table
- buildListOfMapsField(fields, (PropertyDefinitionMap) ((PropertyDefinitionList) propertyDefinition).getMemberDefinition(), oddRow, (PropertyList) property);
+ buildListOfMapsField(fields, (PropertyDefinitionMap) ((PropertyDefinitionList) propertyDefinition)
+ .getMemberDefinition(), oddRow, (PropertyList) property);
}
} else if (propertyDefinition instanceof PropertyDefinitionMap) {
buildMapsField(fields, (PropertyDefinitionMap) propertyDefinition, (PropertyMap) property);
}
}
- private void buildMapsField(ArrayList<FormItem> fields, PropertyDefinitionMap propertyDefinitionMap, PropertyMap propertyMap) {
+ private void buildMapsField(ArrayList<FormItem> fields, PropertyDefinitionMap propertyDefinitionMap,
+ PropertyMap propertyMap) {
// create the property grid
PropertyGrid propertyGrid = new PropertyGrid();
propertyGrid.getNameField().setName("Name");
@@ -554,7 +543,6 @@ public class ConfigurationEditor extends VLayout {
// set the editors and attribute name where to find the record type
propertyGrid.setEditorsMap("fieldType", editorsMap);
-
if (propertyMap != null) {
ListGridRecord[] records = new ListGridRecord[propertyMap.getMap().size()];
int i = 0;
@@ -572,19 +560,19 @@ public class ConfigurationEditor extends VLayout {
CanvasItem item = new CanvasItem();
item.setCanvas(propertyGrid);
-// item.setHeight(500);
+ // item.setHeight(500);
item.setColSpan(3);
item.setEndRow(true);
item.setShowTitle(false);
fields.add(item);
-
}
- private void buildListOfMapsField(ArrayList<FormItem> fields, final PropertyDefinitionMap propertyDefinition, boolean oddRow, final PropertyList propertyList) {
+ private void buildListOfMapsField(ArrayList<FormItem> fields, final PropertyDefinitionMap propertyDefinition,
+ boolean oddRow, final PropertyList propertyList) {
final ListGrid summaryTable = new ListGrid();
-// summaryTable.setID("config_summaryTable_" + propertyDefinition.getName());
+ // summaryTable.setID("config_summaryTable_" + propertyDefinition.getName());
summaryTable.setAlternateRecordStyles(true);
summaryTable.setShowAllRecords(true);
summaryTable.setBodyOverflow(Overflow.VISIBLE);
@@ -592,7 +580,8 @@ public class ConfigurationEditor extends VLayout {
summaryTable.setAutoFitData(Autofit.HORIZONTAL);
ArrayList<ListGridField> fieldsList = new ArrayList<ListGridField>();
- ArrayList<PropertyDefinition> definitions = new ArrayList<PropertyDefinition>(propertyDefinition.getPropertyDefinitions().values());
+ ArrayList<PropertyDefinition> definitions = new ArrayList<PropertyDefinition>(propertyDefinition
+ .getPropertyDefinitions().values());
Collections.sort(definitions, new PropertyDefinitionComparator());
for (PropertyDefinition subDef : definitions) {
@@ -606,12 +595,10 @@ public class ConfigurationEditor extends VLayout {
field.setType(ListGridFieldType.FLOAT);
}
-
fieldsList.add(field);
}
}
-
if (fieldsList.size() == 0) {
// An extra "feature of the config system". If no fields are labeled summary, all are considered summary.
for (PropertyDefinition subDef : definitions) {
@@ -629,7 +616,7 @@ public class ConfigurationEditor extends VLayout {
ListGridField editField = new ListGridField("edit", 20);
editField.setType(ListGridFieldType.ICON);
-// editField.setIcon(Window.getImgURL("[SKIN]/actions/edit.png"));
+ // editField.setIcon(Window.getImgURL("[SKIN]/actions/edit.png"));
editField.setCellIcon(Window.getImgURL("[SKIN]/actions/edit.png"));
editField.setCanEdit(false);
editField.setCanGroupBy(false);
@@ -638,16 +625,16 @@ public class ConfigurationEditor extends VLayout {
editField.addRecordClickHandler(new RecordClickHandler() {
public void onRecordClick(RecordClickEvent recordClickEvent) {
System.out.println("You want to edit: " + recordClickEvent.getRecord());
- displayMapEditor(summaryTable, recordClickEvent.getRecord(), propertyDefinition, propertyList, (PropertyMap) recordClickEvent.getRecord().getAttributeAsObject("_RHQ_PROPERTY"));
+ displayMapEditor(summaryTable, recordClickEvent.getRecord(), propertyDefinition, propertyList,
+ (PropertyMap) recordClickEvent.getRecord().getAttributeAsObject("_RHQ_PROPERTY"));
}
});
fieldsList.add(editField);
-
if (!readOnly) {
ListGridField removeField = new ListGridField("remove", 20);
removeField.setType(ListGridFieldType.ICON);
-// removeField.setIcon(Window.getImgURL("[SKIN]/actions/remove.png")); //"/images/tbb_delete.gif");
+ // removeField.setIcon(Window.getImgURL("[SKIN]/actions/remove.png")); //"/images/tbb_delete.gif");
removeField.setCellIcon(Window.getImgURL("[SKIN]/actions/remove.png")); //"/images/tbb_delete.gif");
removeField.setCanEdit(false);
removeField.setCanFilter(true);
@@ -673,14 +660,11 @@ public class ConfigurationEditor extends VLayout {
fieldsList.add(removeField);
}
-
summaryTable.setFields(fieldsList.toArray(new ListGridField[fieldsList.size()]));
-
ListGridRecord[] rows = buildSummaryRecords(propertyList, definitions);
summaryTable.setData(rows);
-
VLayout summaryTableHolder = new VLayout();
ToolStrip toolStrip = new ToolStrip();
@@ -695,13 +679,11 @@ public class ConfigurationEditor extends VLayout {
toolStrip.addMember(addRowButton);
-
summaryTableHolder.setMembers(summaryTable, toolStrip);
-
CanvasItem item = new CanvasItem();
item.setCanvas(summaryTableHolder);
-// item.setHeight(500);
+ // item.setHeight(500);
item.setColSpan(3);
item.setEndRow(true);
item.setShowTitle(false);
@@ -758,14 +740,14 @@ public class ConfigurationEditor extends VLayout {
return record;
}
-
- private FormItem buildSimpleField(ArrayList<FormItem> fields, PropertyDefinitionSimple propertyDefinition, boolean oddRow, Property property) {
+ private FormItem buildSimpleField(ArrayList<FormItem> fields, PropertyDefinitionSimple propertyDefinition,
+ boolean oddRow, Property property) {
final PropertySimple propertySimple = (PropertySimple) property;
FormItem valueItem = null;
-
- boolean isUnset = (property == null || propertySimple.getStringValue() == null) && propertyDefinition.isRequired() == false;
+ boolean isUnset = (property == null || propertySimple.getStringValue() == null)
+ && propertyDefinition.isRequired() == false;
CheckboxItem unsetItem = null;
if (!propertyDefinition.isRequired()) {
@@ -784,7 +766,6 @@ public class ConfigurationEditor extends VLayout {
fields.add(spacer);
}
-
List<PropertyDefinitionEnumeration> enumeratedValues = propertyDefinition.getEnumeratedValues();
if (enumeratedValues != null && enumeratedValues.size() > 0) {
@@ -805,43 +786,44 @@ public class ConfigurationEditor extends VLayout {
} else {
switch (propertyDefinition.getType()) {
- case STRING:
- case FILE:
- case DIRECTORY:
- valueItem = new TextItem();
- valueItem.setValue(property == null ? "" : propertySimple.getStringValue());
- break;
- case LONG_STRING:
- valueItem = new TextAreaItem();
- valueItem.setValue(property == null ? "" : propertySimple.getStringValue());
- break;
- case PASSWORD:
- valueItem = new PasswordItem();
- valueItem.setValue(property == null ? "" : propertySimple.getStringValue());
- 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);
- valueItem.setValue(property == null || propertySimple.getStringValue() == null ? false : propertySimple.getBooleanValue());
- break;
- case INTEGER:
- case LONG:
- valueItem = new IntegerItem();
- if (property != null && propertySimple.getStringValue() != null)
- valueItem.setValue(propertySimple.getLongValue());
- break;
- case FLOAT:
- case DOUBLE:
- valueItem = new FloatItem();
- valueItem.setValue(property == null || propertySimple.getStringValue() == null ? 0 : propertySimple.getDoubleValue());
- break;
+ case STRING:
+ case FILE:
+ case DIRECTORY:
+ valueItem = new TextItem();
+ valueItem.setValue(property == null ? "" : propertySimple.getStringValue());
+ break;
+ case LONG_STRING:
+ valueItem = new TextAreaItem();
+ valueItem.setValue(property == null ? "" : propertySimple.getStringValue());
+ break;
+ case PASSWORD:
+ valueItem = new PasswordItem();
+ valueItem.setValue(property == null ? "" : propertySimple.getStringValue());
+ 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);
+ valueItem.setValue(property == null || propertySimple.getStringValue() == null ? false : propertySimple
+ .getBooleanValue());
+ break;
+ case INTEGER:
+ case LONG:
+ valueItem = new IntegerItem();
+ if (property != null && propertySimple.getStringValue() != null)
+ valueItem.setValue(propertySimple.getLongValue());
+ break;
+ case FLOAT:
+ case DOUBLE:
+ valueItem = new FloatItem();
+ valueItem.setValue(property == null || propertySimple.getStringValue() == null ? 0 : propertySimple
+ .getDoubleValue());
+ break;
}
}
-
valueItem.setRequired(propertyDefinition.isRequired());
if (propertyDefinition.getConstraints() != null) {
@@ -863,28 +845,25 @@ public class ConfigurationEditor extends VLayout {
}
}
-/*
- Click handlers seem to be turned off for disabled fields... need an alternative
- valueItem.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- System.out.println("Click in value field");
- clickEvent.getItem().setDisabled(false);
- unsetItem.setValue(false);
-
- }
- });
-*/
+ /*
+ Click handlers seem to be turned off for disabled fields... need an alternative
+ valueItem.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ System.out.println("Click in value field");
+ clickEvent.getItem().setDisabled(false);
+ unsetItem.setValue(false);
+ }
+ });
+ */
valueItem.setShowTitle(false);
valueItem.setDisabled(isUnset || readOnly);
valueItem.setWidth(220);
valueItem.setCellStyle(oddRow ? "OddRow" : "EvenRow");
-
final FormItem finalValueItem = valueItem;
-
finalValueItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent changedEvent) {
propertySimple.setValue(changedEvent.getValue());
@@ -910,12 +889,11 @@ public class ConfigurationEditor extends VLayout {
return valueItem;
}
+ private void displayMapEditor(final ListGrid summaryTable, final Record existingRecord,
+ PropertyDefinitionMap definition, final PropertyList list, PropertyMap map) {
- private void displayMapEditor(final ListGrid summaryTable, final Record existingRecord, PropertyDefinitionMap definition, final PropertyList list, PropertyMap map) {
-
-
- final ArrayList<PropertyDefinition> definitions = new ArrayList<PropertyDefinition>(
- definition.getPropertyDefinitions().values());
+ final ArrayList<PropertyDefinition> definitions = new ArrayList<PropertyDefinition>(definition
+ .getPropertyDefinitions().values());
Collections.sort(definitions, new PropertyDefinitionComparator());
@@ -923,7 +901,6 @@ public class ConfigurationEditor extends VLayout {
if (newRow)
map = new PropertyMap(definition.getName());
-
final PropertyMap finalMap = map;
final PropertyMap copy = finalMap.deepCopy(true);
@@ -944,7 +921,7 @@ public class ConfigurationEditor extends VLayout {
popup.centerInPage();
final IButton saveButton = new IButton("Save");
-// saveButton.setID("config_structured_button_save");
+ // saveButton.setID("config_structured_button_save");
saveButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -963,22 +940,22 @@ public class ConfigurationEditor extends VLayout {
for (PropertyDefinition subDef : definitions) {
PropertyDefinitionSimple subDefSimple = (PropertyDefinitionSimple) subDef;
PropertySimple propertySimple = ((PropertySimple) finalMap.get(subDefSimple.getName()));
- existingRecord.setAttribute(subDefSimple.getName(), propertySimple != null ? propertySimple.getStringValue() : null);
+ existingRecord.setAttribute(subDefSimple.getName(), propertySimple != null ? propertySimple
+ .getStringValue() : null);
}
summaryTable.updateData(existingRecord);
}
summaryTable.redraw();
-// ListGridRecord[] rows = buildSummaryRecords(list, definitions);
-// summaryTable.setData(rows);
-// summaryTable.redraw();
-// summaryTable.addData();
+ // ListGridRecord[] rows = buildSummaryRecords(list, definitions);
+ // summaryTable.setData(rows);
+ // summaryTable.redraw();
+ // summaryTable.addData();
popup.destroy();
}
});
-
final IButton cancelButton = new IButton("Cancel");
cancelButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -999,16 +976,12 @@ public class ConfigurationEditor extends VLayout {
popup.show();
-
}
-
private static class PropertyDefinitionComparator implements Comparator<PropertyDefinition> {
public int compare(PropertyDefinition o1, PropertyDefinition o2) {
return new Integer(o1.getOrder()).compareTo(o2.getOrder());
}
}
-
}
-
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java
index f2c02f5..1b49027 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java
@@ -20,7 +20,7 @@
* if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
+
package org.rhq.enterprise.gui.coregui.client.components.form;
import java.util.ArrayList;
@@ -34,6 +34,8 @@ import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+
/**
* @author Greg Hinkle
*/
@@ -50,7 +52,7 @@ public class RadioGroupWithComponentsItem extends CanvasItem {
super(name, title);
this.valueMap = valueMap;
this.form = form;
- this.canvas = new RGWCCanvas();
+ this.canvas = new RGWCCanvas(title);
this.selected = null;
setCanvas(this.canvas);
}
@@ -67,8 +69,10 @@ public class RadioGroupWithComponentsItem extends CanvasItem {
return valueMap.get(this.selected);
}
- public class RGWCCanvas extends DynamicForm {
- public RGWCCanvas() {
+ public class RGWCCanvas extends LocatableDynamicForm {
+
+ public RGWCCanvas(String id) {
+ super(id);
setNumCols(3);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
index 8fc14b0..ecdf5eb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
@@ -38,7 +38,6 @@ import com.smartgwt.client.widgets.events.KeyPressHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.events.ItemChangedEvent;
import com.smartgwt.client.widgets.form.events.ItemChangedHandler;
-import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.RecordDropEvent;
@@ -46,22 +45,26 @@ import com.smartgwt.client.widgets.grid.events.RecordDropHandler;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.layout.VStack;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTransferImgButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public abstract class AbstractSelector<T> extends VLayout {
+public abstract class AbstractSelector<T> extends LocatableVLayout {
protected HashSet<Integer> selection = new HashSet<Integer>();
protected ListGridRecord[] initialSelection;
-
- protected ListGrid availableGrid;
- protected ListGrid assignedGrid;
+ protected DynamicForm availableFilterForm;
+ protected HLayout hlayout;
+ protected LocatableListGrid availableGrid;
+ protected LocatableListGrid assignedGrid;
+ protected RPCDataSource<T> datasource;
protected TransferImgButton addButton;
protected TransferImgButton removeButton;
@@ -70,7 +73,12 @@ public abstract class AbstractSelector<T> extends VLayout {
protected Criteria latestCriteria;
- public AbstractSelector() {
+ public AbstractSelector(String id) {
+ super(id);
+ String safeId = getID();
+ hlayout = new HLayout();
+ availableGrid = new LocatableListGrid(safeId + "-availableGrid");
+ assignedGrid = new LocatableListGrid(safeId + "-assignedGrid");
}
public void setAssigned(ListGridRecord[] assignedRecords) {
@@ -91,25 +99,23 @@ public abstract class AbstractSelector<T> extends VLayout {
protected void onInit() {
super.onInit();
- final DynamicForm availableFilterForm = getAvailableFilterForm();
-
+ availableFilterForm = getAvailableFilterForm();
if (availableFilterForm != null) {
addMember(availableFilterForm);
}
- HLayout hlayout = new HLayout();
hlayout.setAlign(VerticalAlignment.BOTTOM);
- // LEFT SIDE
- availableGrid = new ListGrid();
+ // LEFT SIDE
availableGrid.setHeight(300);
availableGrid.setCanDragRecordsOut(true);
+ availableGrid.setCanAcceptDroppedRecords(true);
availableGrid.setDragTrackerMode(DragTrackerMode.ICON);
availableGrid.setTrackerImage(new ImgProperties("types/Service_up_16.png", 16, 16));
availableGrid.setDragDataAction(DragDataAction.COPY);
- availableGrid.setDataSource(getDataSource());
+ datasource = getDataSource();
+ availableGrid.setDataSource(datasource);
availableGrid.setFetchDelay(700);
-
availableGrid.setAutoFetchData(true);
availableGrid.setFields(new ListGridField("icon", 50), new ListGridField("name"));
@@ -139,12 +145,12 @@ public abstract class AbstractSelector<T> extends VLayout {
moveButtonStack.setAlign(VerticalAlignment.CENTER);
moveButtonStack.setWidth(40);
- addButton = new TransferImgButton(TransferImgButton.RIGHT);
+ addButton = new LocatableTransferImgButton(TransferImgButton.RIGHT);
addButton.setDisabled(true);
- removeButton = new TransferImgButton(TransferImgButton.LEFT);
+ removeButton = new LocatableTransferImgButton(TransferImgButton.LEFT);
removeButton.setDisabled(true);
- addAllButton = new TransferImgButton(TransferImgButton.RIGHT_ALL);
- removeAllButton = new TransferImgButton(TransferImgButton.LEFT_ALL);
+ addAllButton = new LocatableTransferImgButton(TransferImgButton.RIGHT_ALL);
+ removeAllButton = new LocatableTransferImgButton(TransferImgButton.LEFT_ALL);
removeAllButton.setDisabled(true);
moveButtonStack.addMember(addButton);
@@ -155,12 +161,11 @@ public abstract class AbstractSelector<T> extends VLayout {
hlayout.addMember(moveButtonStack);
// RIGHT SIDE
-
- assignedGrid = new ListGrid();
assignedGrid.setHeight(300);
assignedGrid.setCanReorderRecords(true);
assignedGrid.setCanDragRecordsOut(true);
-
+ assignedGrid.setDragTrackerMode(DragTrackerMode.ICON);
+ assignedGrid.setTrackerImage(new ImgProperties("types/Service_up_16.png", 16, 16));
assignedGrid.setCanAcceptDroppedRecords(true);
ListGridField iconField = new ListGridField("icon", 50);
iconField.setType(ListGridFieldType.ICON);
@@ -236,6 +241,12 @@ public abstract class AbstractSelector<T> extends VLayout {
}
});
+ availableGrid.addRecordDropHandler(new RecordDropHandler() {
+ public void onRecordDrop(RecordDropEvent recordDropEvent) {
+ deselect(recordDropEvent.getDropRecords());
+ }
+ });
+
assignedGrid.addRecordDropHandler(new RecordDropHandler() {
public void onRecordDrop(RecordDropEvent recordDropEvent) {
select(recordDropEvent.getDropRecords());
@@ -250,7 +261,18 @@ public abstract class AbstractSelector<T> extends VLayout {
}
addMember(hlayout);
+ }
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ availableGrid.destroy();
+ assignedGrid.destroy();
+ addButton.destroy();
+ removeButton.destroy();
+ addAllButton.destroy();
+ removeAllButton.destroy();
+ availableFilterForm.destroy();
}
protected void updateButtons() {
@@ -266,6 +288,7 @@ public abstract class AbstractSelector<T> extends VLayout {
record.setEnabled(false);
selection.add(record.getAttributeAsInt("id"));
}
+ assignedGrid.markForRedraw();
}
protected void deselect(ListGridRecord[] records) {
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 2418783..aa4c428 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
@@ -34,11 +34,8 @@ import com.smartgwt.client.widgets.Label;
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.events.DataArrivedEvent;
import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
-import com.smartgwt.client.widgets.grid.events.FieldStateChangedEvent;
-import com.smartgwt.client.widgets.grid.events.FieldStateChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.HLayout;
@@ -47,6 +44,8 @@ import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
/**
* @author Greg Hinkle
@@ -68,7 +67,6 @@ public class Table extends VLayout {
private String headerIcon;
-
private boolean showHeader = true;
private boolean showFooter = true;
@@ -124,7 +122,7 @@ public class Table extends VLayout {
}
public Table(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers, String[] excludedFieldNames,
- boolean autoFetchData) {
+ boolean autoFetchData) {
super();
setWidth100();
@@ -135,7 +133,7 @@ public class Table extends VLayout {
setTableTitle(tableTitle);
// Grid
- listGrid = new ListGrid();
+ listGrid = new LocatableListGrid(tableTitle);
if (criteria != null) {
listGrid.setInitialCriteria(criteria);
}
@@ -164,7 +162,6 @@ public class Table extends VLayout {
protected void onInit() {
super.onInit();
-
// NOTE: It is essential that we wait to hide any excluded fields until after super.onDraw() is called, since
// super.onDraw() is what actually adds the fields to the ListGrid (based on what fields are defined in
// the underlying datasource).
@@ -174,13 +171,10 @@ public class Table extends VLayout {
}
}
-
tableInfo.setWrap(false);
-
}
-
@Override
protected void onDraw() {
super.onDraw();
@@ -215,14 +209,14 @@ public class Table extends VLayout {
footer.removeMembers(footer.getMembers());
for (final TableActionInfo tableAction : tableActions) {
- IButton button = new IButton(tableAction.title);
+ IButton button = new LocatableIButton(tableAction.title);
button.setDisabled(true);
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
if (tableAction.confirmMessage != null) {
String message = tableAction.confirmMessage.replaceAll("\\#", String.valueOf(listGrid
- .getSelection().length));
+ .getSelection().length));
SC.ask(message, new BooleanCallback() {
public void execute(Boolean confirmed) {
@@ -244,10 +238,9 @@ public class Table extends VLayout {
footer.addMember(extraWidgetCanvas);
}
-
footer.addMember(new LayoutSpacer());
- IButton refreshButton = new IButton("Refresh");
+ IButton refreshButton = new LocatableIButton("Refresh");
refreshButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
listGrid.invalidateCache();
@@ -268,11 +261,9 @@ public class Table extends VLayout {
public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
refreshTableInfo();
fieldSizes.clear();
- totalWidth = 0;
}
});
-
addMember(footer);
}
}
@@ -297,9 +288,7 @@ public class Table extends VLayout {
this.showFooter = showFooter;
}
- private int totalWidth;
private ArrayList<Integer> fieldSizes = new ArrayList<Integer>();
- private boolean autoSizing = false;
public void refresh(Criteria criteria) {
this.listGrid.invalidateCache();
@@ -311,7 +300,6 @@ public class Table extends VLayout {
this.listGrid.invalidateCache();
this.listGrid.markForRedraw();
}
-
public void setTableTitle(String titleString) {
if (titleString == null) {
@@ -334,10 +322,12 @@ public class Table extends VLayout {
title.markForRedraw();
}
+ @SuppressWarnings("unchecked")
public void setDataSource(RPCDataSource dataSource) {
listGrid.setDataSource(dataSource);
}
+ @SuppressWarnings("unchecked")
public RPCDataSource getDataSource() {
return (RPCDataSource) listGrid.getDataSource();
}
@@ -346,7 +336,6 @@ public class Table extends VLayout {
return listGrid;
}
-
public void setTitleComponent(Canvas canvas) {
this.titleComponent = canvas;
}
@@ -356,7 +345,7 @@ public class Table extends VLayout {
}
public void addTableAction(String title, SelectionEnablement enablement, String confirmation,
- TableAction tableAction) {
+ TableAction tableAction) {
if (enablement == null) {
enablement = DEFAULT_SELECTION_ENABLEMENT;
}
@@ -383,20 +372,20 @@ public class Table extends VLayout {
for (TableActionInfo tableAction : tableActions) {
boolean enabled;
switch (tableAction.enablement) {
- case ALWAYS:
- enabled = true;
- break;
- case ANY:
- enabled = (count >= 1);
- break;
- case SINGLE:
- enabled = (count == 1);
- break;
- case MULTIPLE:
- enabled = (count > 1);
- break;
- default:
- throw new IllegalStateException("Unhandled SelectionEnablement: " + tableAction.enablement.name());
+ case ALWAYS:
+ enabled = true;
+ break;
+ case ANY:
+ enabled = (count >= 1);
+ break;
+ case SINGLE:
+ enabled = (count == 1);
+ break;
+ case MULTIPLE:
+ enabled = (count > 1);
+ break;
+ default:
+ throw new IllegalStateException("Unhandled SelectionEnablement: " + tableAction.enablement.name());
}
tableAction.actionButton.setDisabled(!enabled);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackForm.java
index 93b8428..691bb32 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackForm.java
@@ -24,9 +24,10 @@ import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
-import com.smartgwt.client.widgets.form.DynamicForm;
-public class DynamicCallbackForm extends DynamicForm implements DynamicCallbackFormImplHost {
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+
+public class DynamicCallbackForm extends LocatableDynamicForm implements DynamicCallbackFormImplHost {
private static int frameIndex = 0;
@@ -36,7 +37,7 @@ public class DynamicCallbackForm extends DynamicForm implements DynamicCallbackF
private static DynamicCallbackFormImpl impl = GWT.create(DynamicCallbackFormImpl.class);
public DynamicCallbackForm(String frameName) {
- super();
+ super(frameName);
this.frameName = frameName + (frameIndex++);
setTarget(this.frameName);
init();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/AbstractWizardStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/AbstractWizardStep.java
index 1fd87f8..d899ace 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/AbstractWizardStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/AbstractWizardStep.java
@@ -19,6 +19,11 @@
package org.rhq.enterprise.gui.coregui.client.components.wizard;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
public abstract class AbstractWizardStep implements WizardStep {
@@ -33,4 +38,20 @@ public abstract class AbstractWizardStep implements WizardStep {
public boolean previousPage() {
return true;
}
+
+ /**
+ * Convenience routine returns a DynamicForm tagged for Selenium
+ * @return the form
+ */
+ protected DynamicForm getDynamicForm() {
+ return new LocatableDynamicForm(getName());
+ }
+
+ /**
+ * Convenience routine returns a VLayout tagged for Selenium
+ * @return the VLayout
+ */
+ protected VLayout getVLayout() {
+ return new LocatableVLayout(getName());
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
index a8ff10b..611ff82 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/wizard/WizardView.java
@@ -36,11 +36,17 @@ import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+
/**
* @author Greg Hinkle
*/
public class WizardView extends VLayout {
+ static private final String CANCEL = "Cancel";
+ static private final String NEXT = "Next";
+ static private final String PREVIOUS = "Previous";
+
private Window wizardWindow;
private Wizard wizard;
private int currentStep;
@@ -152,7 +158,7 @@ public class WizardView extends VLayout {
}
private void setupButtons() {
- cancelButton = new IButton("Cancel");
+ cancelButton = new LocatableIButton(CANCEL);
cancelButton.setDisabled(false);
cancelButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -160,7 +166,7 @@ public class WizardView extends VLayout {
closeDialog();
}
});
- previousButton = new IButton("Previous");
+ previousButton = new LocatableIButton(PREVIOUS);
previousButton.setDisabled(true);
previousButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -171,7 +177,7 @@ public class WizardView extends VLayout {
}
}
});
- nextButton = new IButton("Next");
+ nextButton = new LocatableIButton(NEXT);
nextButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -271,7 +277,7 @@ public class WizardView extends VLayout {
// Attempt to clean up canvases created in the steps
for (Canvas canvas : createdCanvases) {
- canvas.markForDestroy();
+ canvas.destroy();
}
wizardWindow.destroy();
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 8171d96..3b5df8b 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
@@ -42,14 +42,22 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
*/
public class ResourceGroupListView extends Table {
+ private static final String DEFAULT_TITLE = "Resource Groups";
+
public ResourceGroupListView() {
- super("Resource Groups");
+ this(DEFAULT_TITLE);
+ }
+
+ public ResourceGroupListView(String title) {
+ super(title);
setWidth100();
setHeight100();
}
- public ResourceGroupListView(Criteria criteria) {
- super("Resource Groups", criteria);
+ public ResourceGroupListView(Criteria criteria, String title) {
+ super(title, criteria);
+ setWidth100();
+ setHeight100();
}
@Override
@@ -102,7 +110,7 @@ public class ResourceGroupListView extends Table {
CoreGUI.getMessageCenter().notify(
new Message("Deleted resource group [" + object.getName() + "]", Severity.Info));
- CoreGUI.refresh();
+ refresh();
}
});
}
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 aaaaeaa..9de2407 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
@@ -56,6 +56,11 @@ public class ResourceGroupsDataSource extends RPCDataSource<ResourceGroup> {
}
public ResourceGroupsDataSource() {
+
+ // TODO until http://code.google.com/p/smartgwt/issues/detail?id=490 is fixed always go to the server for data
+ this.setAutoCacheAllData(false);
+ this.setCacheAllData(false);
+
DataSourceField idDataField = new DataSourceIntegerField("id", "ID", 20);
idDataField.setPrimaryKey(true);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
index 7c0156a..8656997 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
@@ -18,37 +18,21 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.definitions;
-import org.rhq.enterprise.gui.coregui.client.components.table.Table;
-import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource;
-
-import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.types.SelectionAppearance;
import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.util.BooleanCallback;
-import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.grid.CellFormatter;
-import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
-import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
/**
* @author Greg Hinkle
*/
public class GroupDefinitionListView extends VLayout {
-
public GroupDefinitionListView() {
setWidth100();
@@ -62,29 +46,24 @@ public class GroupDefinitionListView extends VLayout {
table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
-
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
ListGridField nameField = new ListGridField("name", "Name", 250);
nameField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- return "<a href=\"#ResourceGroupDefinition/" + listGridRecord.getAttribute("id") +"\">" + o + "</a>";
+ return "<a href=\"#ResourceGroupDefinition/" + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
}
});
-
- 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", 60);
-////
-//// ListGridField availabilityField = new ListGridField("currentAvailability", "Availability", 55);
-//
-// availabilityField.setAlign(Alignment.CENTER);
-// listGrid.setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField, availabilityField);
-
-
-
+ //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", 60);
+ ////
+ //// ListGridField availabilityField = new ListGridField("currentAvailability", "Availability", 55);
+ //
+ // availabilityField.setAlign(Alignment.CENTER);
+ // listGrid.setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField, availabilityField);
addMember(table);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
index 032cc75..8a2a8cc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
@@ -50,7 +50,7 @@ public class GroupCreateStep extends AbstractWizardStep {
if (form == null) {
- form = new DynamicForm();
+ form = getDynamicForm();
form.setValuesManager(new ValuesManager());
form.setWidth100();
form.setNumCols(2);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java
index 55d1588..993e92b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java
@@ -82,7 +82,7 @@ public class GroupCreateWizard extends AbstractWizard {
}
public void cancel() {
- // TODO: Implement this method.
+ // Nothing to do. Group is persisted after the "Finish" button.
}
public boolean createGroup() {
@@ -98,7 +98,9 @@ public class GroupCreateWizard extends AbstractWizard {
public void onSuccess(ResourceGroup result) {
CoreGUI.getMessageCenter().notify(
new Message("Saved new group " + result.getName(), Message.Severity.Info));
- // TODO: Implement this method.
+
+ // try and get the new group reflected in the UI.
+ CoreGUI.refresh();
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupMembersStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupMembersStep.java
index cc79abc..3a3048d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupMembersStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupMembersStep.java
@@ -46,7 +46,7 @@ public class GroupMembersStep extends AbstractWizardStep {
public Canvas getCanvas() {
ResourceType rt = wizard.getCompatibleGroupResourceType();
if ((selector == null) || (rt != requireType)) {
- selector = new ResourceSelector();
+ selector = new ResourceSelector(getName());
requireType = rt;
selector.setRequireType(rt);
}
@@ -54,7 +54,8 @@ public class GroupMembersStep extends AbstractWizardStep {
}
public boolean nextPage() {
- return wizard.createGroup();
+ wizard.createGroup();
+ return true; // last step
}
public String getName() {
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 2e2617e..c519956 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
@@ -33,7 +33,6 @@ import com.smartgwt.client.widgets.tree.Tree;
import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeNode;
-import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
@@ -42,6 +41,7 @@ import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
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.util.selenium.LocatableTreeGrid;
/**
* @author Greg Hinkle
@@ -50,6 +50,22 @@ public class InventoryView extends HLayout implements BookmarkableView {
public static final String VIEW_PATH = "Inventory";
+ private static final String SECTION_GROUPS = "Groups";
+ private static final String SECTION_RESOURCES = "Resources";
+
+ private static final String SUBSECTION_INVENTORY = "Inventory";
+ private static final String SUBSECTION_SAVED_SEARCHES = "Saved Searches";
+
+ private static final String PAGE_COMPATIBLE_GROUPS = "Compatible Groups";
+ private static final String PAGE_DOWN = "Down Servers";
+ private static final String PAGE_GROUPS = "All Groups";
+ private static final String PAGE_GROUP_DEFINITIONS = "Group Definitions";
+ private static final String PAGE_MIXED_GROUPS = "Mixed Groups";
+ private static final String PAGE_PLATFORMS = "Platforms";
+ private static final String PAGE_PROBLEM_GROUPS = "Problem Groups";
+ private static final String PAGE_RESOURCES = "All Resources";
+ private static final String PAGE_SERVERS = "Servers";
+ private static final String PAGE_SERVICES = "Services";
private ViewId currentSectionViewId;
private ViewId currentPageViewId;
@@ -58,7 +74,6 @@ public class InventoryView extends HLayout implements BookmarkableView {
private Canvas currentContent;
private LinkedHashMap<String, TreeGrid> treeGrids = new LinkedHashMap<String, TreeGrid>();
-
private SectionStack sectionStack;
@Override
@@ -92,7 +107,6 @@ public class InventoryView extends HLayout implements BookmarkableView {
}
});
-
SectionStackSection section = new SectionStackSection(name);
section.setExpanded(true);
section.addItem(grid);
@@ -100,7 +114,6 @@ public class InventoryView extends HLayout implements BookmarkableView {
sectionStack.addSection(section);
}
-
addMember(sectionStack);
addMember(contentCanvas);
@@ -119,34 +132,35 @@ public class InventoryView extends HLayout implements BookmarkableView {
}
private SectionStackSection buildResourcesSection() {
- final SectionStackSection section = new SectionStackSection("Resources");
+ final SectionStackSection section = new SectionStackSection(SECTION_RESOURCES);
section.setExpanded(true);
- final TreeNode allResources = new TreeNode("All Resources");
- final TreeNode onlyPlatforms = new TreeNode("Platforms");
+ final TreeNode allResources = new TreeNode(PAGE_RESOURCES);
+ final TreeNode onlyPlatforms = new TreeNode(PAGE_PLATFORMS);
onlyPlatforms.setIcon("types/Platform_up_16.png");
- final TreeNode onlyServers = new TreeNode("Servers");
+ final TreeNode onlyServers = new TreeNode(PAGE_SERVERS);
onlyServers.setIcon("types/Server_up_16.png");
- final TreeNode onlyServices = new TreeNode("Services");
+ final TreeNode onlyServices = new TreeNode(PAGE_SERVICES);
onlyServices.setIcon("types/Service_up_16.png");
- final TreeNode inventory = new TreeNode("Inventory", allResources, onlyPlatforms, onlyServers, onlyServices);
+ final TreeNode inventory = new TreeNode(SUBSECTION_INVENTORY, allResources, onlyPlatforms, onlyServers,
+ onlyServices);
- final TreeNode downServers = new TreeNode("Down Servers");
+ final TreeNode downServers = new TreeNode(PAGE_DOWN);
downServers.setIcon("types/Server_down_16.png");
- final TreeNode savedSearches = new TreeNode("Saved Searches", downServers);
+ final TreeNode savedSearches = new TreeNode(SUBSECTION_SAVED_SEARCHES, downServers);
- TreeGrid treeGrid = new TreeGrid();
+ TreeGrid treeGrid = new LocatableTreeGrid(SECTION_RESOURCES);
treeGrid.setShowHeader(false);
Tree tree = new Tree();
- tree.setRoot(new TreeNode("security", inventory, savedSearches));
+ tree.setRoot(new TreeNode(SECTION_RESOURCES, inventory, savedSearches));
treeGrid.setData(tree);
treeGrid.getTree().openAll();
- treeGrids.put("Resources", treeGrid);
+ treeGrids.put(SECTION_RESOURCES, treeGrid);
section.addItem(treeGrid);
@@ -154,28 +168,27 @@ public class InventoryView extends HLayout implements BookmarkableView {
}
private SectionStackSection buildGroupsSection() {
- final SectionStackSection section = new SectionStackSection("Groups");
+ final SectionStackSection section = new SectionStackSection(SECTION_GROUPS);
section.setExpanded(true);
- final TreeNode allGroups = new TreeNode("All Groups");
- final TreeNode onlyCompatible = new TreeNode("Compatible Groups");
- final TreeNode onlyMixed = new TreeNode("Mixed Groups");
- final TreeNode groupGroupDefinitions = new TreeNode("Group Definitions");
- final TreeNode inventory = new TreeNode("Inventory", allGroups, onlyCompatible, onlyMixed,
- groupGroupDefinitions);
+ final TreeNode allGroups = new TreeNode(PAGE_GROUPS);
+ final TreeNode onlyCompatible = new TreeNode(PAGE_COMPATIBLE_GROUPS);
+ final TreeNode onlyMixed = new TreeNode(PAGE_MIXED_GROUPS);
+ final TreeNode groupGroupDefinitions = new TreeNode(PAGE_GROUP_DEFINITIONS);
+ final TreeNode inventory = new TreeNode(SECTION_GROUPS, allGroups, onlyCompatible, onlyMixed,
+ groupGroupDefinitions);
- final TreeNode problemGroups = new TreeNode("Problem Groups");
- final TreeNode savedSearches = new TreeNode("Saved Searches", problemGroups);
+ final TreeNode problemGroups = new TreeNode(PAGE_PROBLEM_GROUPS);
+ final TreeNode savedSearches = new TreeNode(SUBSECTION_SAVED_SEARCHES, problemGroups);
- TreeGrid treeGrid = new TreeGrid();
+ TreeGrid treeGrid = new LocatableTreeGrid(SECTION_GROUPS);
treeGrid.setShowHeader(false);
Tree tree = new Tree();
- tree.setRoot(new TreeNode("clustering", inventory, savedSearches));
+ tree.setRoot(new TreeNode(SECTION_GROUPS, inventory, savedSearches));
treeGrid.setData(tree);
-
treeGrid.getTree().openAll();
- treeGrids.put("Groups", treeGrid);
+ treeGrids.put(SECTION_GROUPS, treeGrid);
section.addItem(treeGrid);
return section;
@@ -194,7 +207,6 @@ public class InventoryView extends HLayout implements BookmarkableView {
this.currentContent = newContent;
}
-
private void renderContentView(ViewPath viewPath) {
currentSectionViewId = viewPath.getCurrent();
@@ -204,39 +216,41 @@ public class InventoryView extends HLayout implements BookmarkableView {
String page = currentPageViewId.getPath();
Canvas content = null;
- if ("Resources".equals(section)) {
-
- if ("All Resources".equals(page)) {
- content = new ResourceSearchView();
- } else if ("Platforms".equals(page)) {
- content = new ResourceSearchView(new Criteria(ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.PLATFORM.name()));
- } else if ("Servers".equals(page)) {
- content = new ResourceSearchView(new Criteria(ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.SERVER.name()));
- } else if ("Services".equals(page)) {
- content = new ResourceSearchView(new Criteria(ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.SERVICE.name()));
- } else if ("Down Servers".equals(page)) {
-
- Criteria criteria = new Criteria(ResourceDataSourceField.AVAILABILITY.propertyName(), AvailabilityType.DOWN.name());
+ if (SECTION_RESOURCES.equals(section)) {
+
+ if (PAGE_RESOURCES.equals(page)) {
+ content = new ResourceSearchView(null, PAGE_RESOURCES);
+ } else if (PAGE_PLATFORMS.equals(page)) {
+ content = new ResourceSearchView(new Criteria(ResourceDataSourceField.CATEGORY.propertyName(),
+ ResourceCategory.PLATFORM.name()), PAGE_PLATFORMS);
+ } else if (PAGE_SERVERS.equals(page)) {
+ content = new ResourceSearchView(new Criteria(ResourceDataSourceField.CATEGORY.propertyName(),
+ ResourceCategory.SERVER.name()), PAGE_SERVERS);
+ } else if (PAGE_SERVICES.equals(page)) {
+ content = new ResourceSearchView(new Criteria(ResourceDataSourceField.CATEGORY.propertyName(),
+ ResourceCategory.SERVICE.name()), PAGE_SERVICES);
+ } else if (PAGE_DOWN.equals(page)) {
+ Criteria criteria = new Criteria(ResourceDataSourceField.AVAILABILITY.propertyName(),
+ ResourceCategory.PLATFORM.name());
criteria.addCriteria(ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.SERVER.name());
- content = new ResourceSearchView(criteria);
+ content = new ResourceSearchView(criteria, PAGE_DOWN);
}
- } else if ("Groups".equals(section)) {
+ } else if (SECTION_GROUPS.equals(section)) {
- if ("All Groups".equals(page)) {
+ if (PAGE_GROUPS.equals(page)) {
content = new ResourceGroupListView();
- } else if ("Compatible Groups".equals(page)) {
- content = new ResourceGroupListView(new Criteria("category", "compatible"));
- } else if ("Mixed Groups".equals(page)) {
- content = new ResourceGroupListView(new Criteria("category", "mixed"));
- } else if ("Group Definitions".equals(page)) {
+ } else if (PAGE_COMPATIBLE_GROUPS.equals(page)) {
+ content = new ResourceGroupListView(new Criteria("category", "compatible"), PAGE_COMPATIBLE_GROUPS);
+ } else if (PAGE_MIXED_GROUPS.equals(page)) {
+ content = new ResourceGroupListView(new Criteria("category", "mixed"), PAGE_MIXED_GROUPS);
+ } else if (PAGE_GROUP_DEFINITIONS.equals(page)) {
content = new GroupDefinitionListView();
- } else if ("Problem Groups".equals(page)) {
- content = new ResourceGroupListView(new Criteria("availability", "down"));
+ } else if (PAGE_PROBLEM_GROUPS.equals(page)) {
+ content = new ResourceGroupListView(new Criteria("availability", "down"), PAGE_PROBLEM_GROUPS);
}
}
-
for (String name : treeGrids.keySet()) {
TreeGrid treeGrid = treeGrids.get(name);
@@ -251,15 +265,12 @@ public class InventoryView extends HLayout implements BookmarkableView {
}
}
-
setContent(content);
-
if (content instanceof BookmarkableView) {
((BookmarkableView) content).renderView(viewPath.next().next());
}
-
}
public void renderView(ViewPath viewPath) {
@@ -280,6 +291,5 @@ public class InventoryView extends HLayout implements BookmarkableView {
}
-
}
}
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 c0731b8..a5dde2e 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
@@ -26,6 +26,7 @@ import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceD
import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.TYPE;
import java.util.List;
+import java.util.Map;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -62,6 +63,10 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
public ResourceDatasource() {
super();
+ // TODO until http://code.google.com/p/smartgwt/issues/detail?id=490 is fixed always go to the server for data
+ this.setAutoCacheAllData(false);
+ this.setCacheAllData(false);
+
DataSourceField idDataField = new DataSourceIntegerField("id", "ID", 20);
idDataField.setPrimaryKey(true);
@@ -114,21 +119,24 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
});
}
+ @SuppressWarnings("unchecked")
protected ResourceCriteria getFetchCriteria(final DSRequest request) {
ResourceCriteria criteria = new ResourceCriteria();
criteria.setPageControl(getPageControl(request));
+ // TODO: This call is broken in 2.2, http://code.google.com/p/smartgwt/issues/detail?id=490
+ // when using AdvancedCriteria
+ Map<String, Object> criteriaMap = request.getCriteria().getValues();
- if (request.getCriteria().getValues().get("parentId") != null) {
- criteria.addFilterParentResourceId(Integer.parseInt((String) request.getCriteria().getValues().get(
- "parentId")));
+ if (criteriaMap.get("parentId") != null) {
+ criteria.addFilterParentResourceId(Integer.parseInt((String) criteriaMap.get("parentId")));
}
- if (request.getCriteria().getValues().get("id") != null) {
+ if (criteriaMap.get("id") != null) {
criteria.addFilterId(Integer.parseInt(request.getCriteria().getAttribute("id")));
}
- if (request.getCriteria().getValues().get("resourceIds") != null) {
+ if (criteriaMap.get("resourceIds") != null) {
int[] ids = request.getCriteria().getAttributeAsIntArray("resourceIds");
Integer[] oids = new Integer[ids.length];
for (int i = 0; i < ids.length; i++) {
@@ -138,48 +146,47 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
}
// Fetch member Resources of the group with the specified id.
- if (request.getCriteria().getValues().get("groupId") != null) {
- int groupId = Integer.parseInt((String) request.getCriteria().getValues().get("groupId"));
+ if (criteriaMap.get("groupId") != null) {
+ int groupId = Integer.parseInt((String) criteriaMap.get("groupId"));
criteria.addFilterImplicitGroupIds(groupId);
}
- if (request.getCriteria().getValues().get(NAME.propertyName()) != null) {
- criteria.addFilterName((String) request.getCriteria().getValues().get(NAME.propertyName()));
+ if (criteriaMap.get(NAME.propertyName()) != null) {
+ criteria.addFilterName((String) criteriaMap.get(NAME.propertyName()));
}
- if (request.getCriteria().getValues().get(CATEGORY.propertyName()) != null) {
- criteria.addFilterResourceCategory(ResourceCategory.valueOf(((String) request.getCriteria().getValues()
- .get(CATEGORY.propertyName())).toUpperCase()));
+ if (criteriaMap.get(CATEGORY.propertyName()) != null) {
+ criteria.addFilterResourceCategory(ResourceCategory.valueOf(((String) criteriaMap.get(CATEGORY
+ .propertyName())).toUpperCase()));
}
- if (request.getCriteria().getValues().get(AVAILABILITY.propertyName()) != null) {
- criteria.addFilterCurrentAvailability(AvailabilityType.valueOf(((String) request.getCriteria().getValues()
- .get(AVAILABILITY.propertyName())).toUpperCase()));
+ if (criteriaMap.get(AVAILABILITY.propertyName()) != null) {
+ criteria.addFilterCurrentAvailability(AvailabilityType.valueOf(((String) criteriaMap.get(AVAILABILITY
+ .propertyName())).toUpperCase()));
}
- if (request.getCriteria().getValues().get(TYPE.propertyName()) != null) {
- criteria.addFilterResourceTypeId(Integer.parseInt(((String) request.getCriteria().getValues().get(
- TYPE.propertyName()))));
+ if (criteriaMap.get(TYPE.propertyName()) != null) {
+ criteria.addFilterResourceTypeId(Integer.parseInt(((String) criteriaMap.get(TYPE.propertyName()))));
}
- if (request.getCriteria().getValues().get(PLUGIN.propertyName()) != null) {
- criteria.addFilterPluginName((String) request.getCriteria().getValues().get(PLUGIN.propertyName()));
+ if (criteriaMap.get(PLUGIN.propertyName()) != null) {
+ criteria.addFilterPluginName((String) criteriaMap.get(PLUGIN.propertyName()));
}
- if (request.getCriteria().getValues().get("tag") != null) {
- criteria.addFilterTag((Tag) request.getCriteria().getValues().get("tag"));
+ if (criteriaMap.get("tag") != null) {
+ criteria.addFilterTag((Tag) criteriaMap.get("tag"));
}
- if (request.getCriteria().getValues().get("tagNamespace") != null) {
- criteria.addFilterTagNamespace((String) request.getCriteria().getValues().get("tagNamespace"));
+ if (criteriaMap.get("tagNamespace") != null) {
+ criteria.addFilterTagNamespace((String) criteriaMap.get("tagNamespace"));
}
- if (request.getCriteria().getValues().get("tagSemantic") != null) {
- criteria.addFilterTagSemantic((String) request.getCriteria().getValues().get("tagSemantic"));
+ if (criteriaMap.get("tagSemantic") != null) {
+ criteria.addFilterTagSemantic((String) criteriaMap.get("tagSemantic"));
}
- if (request.getCriteria().getValues().get("tagName") != null) {
- criteria.addFilterTagName((String) request.getCriteria().getValues().get("tagName"));
+ if (criteriaMap.get("tagName") != null) {
+ criteria.addFilterTagName((String) criteriaMap.get("tagName"));
}
return criteria;
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 1642c64..9a5993b 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,36 +18,27 @@
*/
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 com.google.gwt.event.dom.client.KeyCodes;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.SelectionAppearance;
import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.TextItem;
-import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
-import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
-import javax.persistence.Id;
-
-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;
-
/**
* @author Greg Hinkle
*/
@@ -90,24 +81,23 @@ public class ResourceSearchView extends Table {
setWidth100();
setHeight100();
-// DynamicForm searchPanel = new DynamicForm();
-// final TextItem searchBox = new TextItem("query", "Search Resources");
-// searchBox.setValue("");
-// searchPanel.setWrapItemTitles(false);
-// searchPanel.setFields(searchBox);
-
+ // DynamicForm searchPanel = new DynamicForm();
+ // final TextItem searchBox = new TextItem("query", "Search Resources");
+ // searchBox.setValue("");
+ // searchPanel.setWrapItemTitles(false);
+ // searchPanel.setFields(searchBox);
final ResourceDatasource datasource = new ResourceDatasource();
-// setTitleComponent(searchPanel);
+ // setTitleComponent(searchPanel);
setDataSource(datasource);
getListGrid().setSelectionType(SelectionStyle.SIMPLE);
-// getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
+ // getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
getListGrid().setResizeFieldsInRealTime(true);
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
- ListGridField iconField = new ListGridField("icon","", 40);
+ ListGridField iconField = new ListGridField("icon", "", 40);
ListGridField nameField = new ListGridField(NAME.propertyName(), NAME.title(), 250);
nameField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
@@ -123,15 +113,14 @@ public class ResourceSearchView extends Table {
ListGridField availabilityField = new ListGridField(AVAILABILITY.propertyName(), AVAILABILITY.title(), 55);
availabilityField.setAlign(Alignment.CENTER);
getListGrid().setFields(idField, iconField, nameField, descriptionField, typeNameField, pluginNameField,
- categoryField, availabilityField);
-
- addTableAction("Uninventory", Table.SelectionEnablement.ANY,
- "Are you sure you want to delete # resources?", new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- getListGrid().removeSelectedData();
- }
- });
+ categoryField, availabilityField);
+ addTableAction("Uninventory", Table.SelectionEnablement.ANY, "Are you sure you want to delete # resources?",
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ getListGrid().removeSelectedData();
+ }
+ });
/*searchBox.addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
@@ -153,13 +142,10 @@ public class ResourceSearchView extends Table {
});*/
}
-
-
public int getMatches() {
return this.getListGrid().getTotalRows();
}
-
public void addResourceSelectedListener(ResourceSelectListener listener) {
selectListeners.add(listener);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
index 0623308..7713a23 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java
@@ -59,7 +59,7 @@ public class OperationSchedulingStep extends AbstractWizardStep implements ItemC
if (form == null) {
valuesManager = new ValuesManager();
- form = new DynamicForm();
+ form = getDynamicForm();
form.setValuesManager(valuesManager);
form.setWrapItemTitles(false);
form.setErrorOrientation(FormErrorOrientation.RIGHT);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java
index 14ec617..1be6813 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java
@@ -46,7 +46,7 @@ public class ConfigurationTemplateStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (form == null) {
- form = new DynamicForm();
+ form = getDynamicForm();
TextItem nameItem = new TextItem("resourceName", "Resource Name");
nameItem.setRequired(true);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java
index 7731067..f2f15dc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceGroupSelector.java
@@ -18,13 +18,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.selection;
-import java.util.ArrayList;
import java.util.Collection;
-import com.smartgwt.client.data.AdvancedCriteria;
import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.data.Criterion;
-import com.smartgwt.client.types.OperatorId;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.SpacerItem;
@@ -41,8 +37,8 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
*/
public class ResourceGroupSelector extends AbstractSelector<ResourceGroup> {
- public ResourceGroupSelector() {
- super();
+ public ResourceGroupSelector(String id) {
+ super(id);
}
protected DynamicForm getAvailableFilterForm() {
@@ -63,22 +59,39 @@ public class ResourceGroupSelector extends AbstractSelector<ResourceGroup> {
return new SelectedResourceGroupsDataSource();
}
+ // TODO: Until http://code.google.com/p/smartgwt/issues/detail?id=490 is fixed, avoid AdvancedCriteria and always
+ // use server-side fetch and simple criteria. When fixed, use the commented version below. Also see
+ // ResourceGroupDataSource.
protected Criteria getLatestCriteria(DynamicForm availableFilterForm) {
String search = (String) availableFilterForm.getValue("search");
String category = (String) availableFilterForm.getValue("groupCategory");
- ArrayList<Criterion> criteria = new ArrayList<Criterion>(2);
+ Criteria criteria = new Criteria();
if (null != search) {
- criteria.add(new Criterion("name", OperatorId.CONTAINS, search));
+ criteria.addCriteria("name", search);
}
if (null != category) {
- criteria.add(new Criterion("category", OperatorId.EQUALS, category));
+ criteria.addCriteria("category", category);
}
- AdvancedCriteria latestCriteria = new AdvancedCriteria(OperatorId.AND, criteria.toArray(new Criterion[criteria
- .size()]));
- return latestCriteria;
+ return criteria;
}
+ // protected Criteria getLatestCriteria(DynamicForm availableFilterForm) {
+ // String search = (String) availableFilterForm.getValue("search");
+ // String category = (String) availableFilterForm.getValue("groupCategory");
+ // ArrayList<Criterion> criteria = new ArrayList<Criterion>(2);
+ // if (null != search) {
+ // criteria.add(new Criterion("name", OperatorId.CONTAINS, search));
+ // }
+ // if (null != category) {
+ // criteria.add(new Criterion("category", OperatorId.EQUALS, category));
+ // }
+ // AdvancedCriteria latestCriteria = new AdvancedCriteria(OperatorId.AND, criteria.toArray(new Criterion[criteria
+ // .size()]));
+ //
+ // return latestCriteria;
+ // }
+
public class SelectedResourceGroupsDataSource extends ResourceGroupsDataSource {
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
index 0d25f38..2115988 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
@@ -23,14 +23,10 @@ import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceD
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.Collection;
-import com.smartgwt.client.data.AdvancedCriteria;
import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.data.Criterion;
import com.smartgwt.client.data.DSRequest;
-import com.smartgwt.client.types.OperatorId;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.IPickTreeItem;
import com.smartgwt.client.widgets.form.fields.SelectItem;
@@ -44,6 +40,7 @@ import org.rhq.enterprise.gui.coregui.client.components.selector.AbstractSelecto
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypePluginTreeDataSource;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
/**
* @author Greg Hinkle
@@ -52,8 +49,8 @@ public class ResourceSelector extends AbstractSelector<Resource> {
private ResourceType requireType;
- public ResourceSelector() {
- super();
+ public ResourceSelector(String id) {
+ super(id);
}
public ResourceType getRequireType() {
@@ -66,75 +63,108 @@ public class ResourceSelector extends AbstractSelector<Resource> {
}
protected DynamicForm getAvailableFilterForm() {
- DynamicForm availableFilterForm = new DynamicForm();
- availableFilterForm.setNumCols(6);
- final TextItem search = new TextItem("search", "Search");
-
- IPickTreeItem typeSelectItem = new IPickTreeItem("type", "Type");
- typeSelectItem.setDataSource(new ResourceTypePluginTreeDataSource());
- typeSelectItem.setValueField("id");
- typeSelectItem.setCanSelectParentItems(true);
- typeSelectItem.setLoadDataOnDemand(false);
- typeSelectItem.setEmptyMenuMessage("Loading...");
- typeSelectItem.setShowIcons(true);
-
- if (requireType != null) {
- // TODO: Currently ignore the typeSelectItem widget because we already know the type.
- // Alternatively, we could display it disabled but we'd want the type name to be displayed as the
- // value. To get this to display the type name I think we need to pre-fetch the type tree here. We could
- // potentially optimize typeSelectItem.setValue(requireType.getId()) to build a tree that includes only
- // this single type.
- //typeSelectItem.setValue(requireType.getId());
- //typeSelectItem.setDisabled(true);
- availableFilterForm.setItems(search);
- } else {
- SelectItem categorySelect = new SelectItem("category", "Category");
- categorySelect.setValueMap("Platform", "Server", "Service");
- categorySelect.setAllowEmptyValue(true);
-
- availableFilterForm.setItems(search, typeSelectItem, categorySelect);
+ if (null == availableFilterForm) {
+ availableFilterForm = new LocatableDynamicForm("AvailableFilterForm");
+ availableFilterForm.setNumCols(6);
+ final TextItem search = new TextItem("search", "Search");
+
+ IPickTreeItem typeSelectItem = new IPickTreeItem("type", "Type");
+ typeSelectItem.setDataSource(new ResourceTypePluginTreeDataSource());
+ typeSelectItem.setValueField("id");
+ typeSelectItem.setCanSelectParentItems(true);
+ typeSelectItem.setLoadDataOnDemand(false);
+ typeSelectItem.setEmptyMenuMessage("Loading...");
+ typeSelectItem.setShowIcons(true);
+
+ if (requireType != null) {
+ // TODO: Currently ignore the typeSelectItem widget because we already know the type.
+ // Alternatively, we could display it disabled but we'd want the type name to be displayed as the
+ // value. To get this to display the type name I think we need to pre-fetch the type tree here. We could
+ // potentially optimize typeSelectItem.setValue(requireType.getId()) to build a tree that includes only
+ // this single type.
+ //typeSelectItem.setValue(requireType.getId());
+ //typeSelectItem.setDisabled(true);
+ availableFilterForm.setItems(search);
+ } else {
+ SelectItem categorySelect = new SelectItem("category", "Category");
+ categorySelect.setValueMap("Platform", "Server", "Service");
+ categorySelect.setAllowEmptyValue(true);
+
+ availableFilterForm.setItems(search, typeSelectItem, categorySelect);
+ }
}
return availableFilterForm;
}
protected RPCDataSource<Resource> getDataSource() {
- return new SelectedResourceDataSource();
+ if (null == datasource) {
+ datasource = new SelectedResourceDataSource();
+ }
+
+ return datasource;
}
+ // TODO: Until http://code.google.com/p/smartgwt/issues/detail?id=490 is fixed, avoid AdvancedCriteria and always
+ // use server-side fetch and simple criteria. When fixed, use the commented version below. Also see
+ // ResourceDataSource.
protected Criteria getLatestCriteria(DynamicForm availableFilterForm) {
String search = (String) availableFilterForm.getValue("search");
String type = availableFilterForm.getValueAsString("type");
String category = (String) availableFilterForm.getValue("category");
- ArrayList<Criterion> criteria = new ArrayList<Criterion>(3);
+ Criteria criteria = new Criteria();
if (null != search) {
- criteria.add(new Criterion(NAME.propertyName(), OperatorId.CONTAINS, search));
+ criteria.addCriteria(NAME.propertyName(), search);
}
if (null != type) {
// If type is a number its a typeId, otherwise a plugin name
try {
Integer.parseInt(type);
- criteria.add(new Criterion(TYPE.propertyName(), OperatorId.EQUALS, type));
+ criteria.addCriteria(TYPE.propertyName(), type);
} catch (NumberFormatException nfe) {
- criteria.add(new Criterion(PLUGIN.propertyName(), OperatorId.EQUALS, type));
+ criteria.addCriteria(PLUGIN.propertyName(), type);
}
}
if (null != category) {
- criteria.add(new Criterion(CATEGORY.propertyName(), OperatorId.EQUALS, category));
+ criteria.addCriteria(CATEGORY.propertyName(), category);
}
- AdvancedCriteria latestCriteria = new AdvancedCriteria(OperatorId.AND, criteria.toArray(new Criterion[criteria
- .size()]));
- return latestCriteria;
+ return criteria;
}
+ // protected Criteria getLatestCriteria(DynamicForm availableFilterForm) {
+ // String search = (String) availableFilterForm.getValue("search");
+ // String type = availableFilterForm.getValueAsString("type");
+ // String category = (String) availableFilterForm.getValue("category");
+ // ArrayList<Criterion> criteria = new ArrayList<Criterion>(3);
+ // if (null != search) {
+ // criteria.add(new Criterion(NAME.propertyName(), OperatorId.CONTAINS, search));
+ // }
+ // if (null != type) {
+ // // If type is a number its a typeId, otherwise a plugin name
+ // try {
+ // Integer.parseInt(type);
+ // criteria.add(new Criterion(TYPE.propertyName(), OperatorId.EQUALS, type));
+ // } catch (NumberFormatException nfe) {
+ // criteria.add(new Criterion(PLUGIN.propertyName(), OperatorId.EQUALS, type));
+ // }
+ // }
+ // if (null != category) {
+ // criteria.add(new Criterion(CATEGORY.propertyName(), OperatorId.EQUALS, category));
+ // }
+ // AdvancedCriteria latestCriteria = new AdvancedCriteria(OperatorId.AND, criteria.toArray(new Criterion[criteria
+ // .size()]));
+ //
+ // return latestCriteria;
+ //}
+
private class SelectedResourceDataSource extends ResourceDatasource {
@Override
public ListGridRecord[] buildRecords(Collection<Resource> resources) {
ListGridRecord[] records = super.buildRecords(resources);
for (ListGridRecord record : records) {
- if (selection.contains(record.getAttributeAsInt("id"))) {
+ if (getSelection().contains(record.getAttributeAsInt("id"))) {
record.setEnabled(false);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index d761dbd..53909d1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@ -29,6 +29,7 @@ import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.enterprise.gui.coregui.client.components.AboutModalWindow;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
* @author Greg Hinkle
@@ -87,9 +88,10 @@ public class MenuBarView extends VLayout {
// loggedInAs.setWrap(false);
// loggedInAs.setValign(VerticalAlignment.CENTER);
// helpLayout.addMember(loggedInAs);
- topStrip.addMember(new Hyperlink("Help", "Help"));
- topStrip.addMember(new Hyperlink("Preferences", "Preferences"));
- topStrip.addMember(new Hyperlink("Log Out", "LogOut"));
+
+ topStrip.addMember(SeleniumUtility.setHtmlId(new Hyperlink("Help", "Help")));
+ topStrip.addMember(SeleniumUtility.setHtmlId(new Hyperlink("Preferences", "Preferences")));
+ topStrip.addMember(SeleniumUtility.setHtmlId(new Hyperlink("Log Out", "LogOut")));
// helpLayout.setLayoutAlign(VerticalAlignment.CENTER);
// topStrip.addMember(helpLayout);
@@ -140,6 +142,7 @@ public class MenuBarView extends VLayout {
styleClass += "Selected";
}
+ // Set explicit identifiers because the generated scLocator is not getting picked up by Selenium.
headerString.append("<td id=\"" + section + "\" class=\"" + styleClass
+ "\" onclick=\"document.location='#" + section + "'\" >");
headerString.append(section);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableDynamicForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableDynamicForm.java
new file mode 100644
index 0000000..6daedc2
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableDynamicForm.java
@@ -0,0 +1,24 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.form.DynamicForm;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.form.DynamicForm that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableDynamicForm extends DynamicForm {
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-id"
+ * </pre>
+ * @param id not null or empty.
+ */
+ public LocatableDynamicForm(String id) {
+ super();
+ String locatorId = this.getScClassName() + "-" + id;
+ setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java
new file mode 100644
index 0000000..74d01ae
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java
@@ -0,0 +1,24 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.IButton;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.IButton that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableIButton extends IButton {
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-title"
+ * </pre>
+ * @param id not null or empty.
+ */
+ public LocatableIButton(String title) {
+ super(title);
+ String locatorId = this.getScClassName() + "-" + title;
+ setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableListGrid.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableListGrid.java
new file mode 100644
index 0000000..739aee5
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableListGrid.java
@@ -0,0 +1,23 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.grid.ListGrid;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.grid.ListGrid that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableListGrid extends ListGrid {
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-id"
+ * </pre>
+ * @param id not null or empty.
+ */
+ public LocatableListGrid(String id) {
+ super();
+ String locatorId = this.getScClassName() + "-" + id;
+ setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTransferImgButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTransferImgButton.java
new file mode 100644
index 0000000..e254411
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTransferImgButton.java
@@ -0,0 +1,47 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.TransferImgButton;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.TransferImgButton that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableTransferImgButton extends TransferImgButton {
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-img.toString()"
+ * </pre>
+ * @param id not null or empty.
+ */
+ public LocatableTransferImgButton(TransferImg img) {
+ super(img);
+ String locatorId = this.getScClassName() + "-" + getSuffix(img);
+ setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+ }
+
+ private String getSuffix(TransferImg img) {
+ if (TransferImgButton.LEFT == img)
+ return "LEFT";
+ if (TransferImgButton.LEFT_ALL == img)
+ return "LEFT_ALL";
+ if (TransferImgButton.RIGHT == img)
+ return "RIGHT";
+ if (TransferImgButton.RIGHT_ALL == img)
+ return "RIGHT_ALL";
+ if (TransferImgButton.UP == img)
+ return "UP";
+ if (TransferImgButton.UP_FIRST == img)
+ return "UP_FIRST";
+ if (TransferImgButton.DOWN == img)
+ return "DOWN";
+ if (TransferImgButton.DOWN_LAST == img)
+ return "DOWN_LAST";
+ if (TransferImgButton.DELETE == img)
+ return "DELETE";
+
+ return img.toString();
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTreeGrid.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTreeGrid.java
new file mode 100644
index 0000000..317d795
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTreeGrid.java
@@ -0,0 +1,22 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.tree.TreeGrid;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.tree.TreeGrid that sets the ID for use with selenium scLocators.
+ *
+ * @author jay shaughnessy
+ */
+public class LocatableTreeGrid extends TreeGrid {
+
+ /**
+ * ID set explicitly
+ * @param id not null or empty
+ */
+ public LocatableTreeGrid(String id) {
+ super();
+ String locatorId = this.getScClassName() + "-" + id;
+ setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableVLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableVLayout.java
new file mode 100644
index 0000000..aa2c7dd
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableVLayout.java
@@ -0,0 +1,24 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.layout.VLayout;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.layout.VLayout that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableVLayout extends VLayout {
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-id"
+ * </pre>
+ * @param id not null or empty.
+ */
+ public LocatableVLayout(String id) {
+ super();
+ String locatorId = this.getScClassName() + "-" + id;
+ setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/SeleniumUtility.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/SeleniumUtility.java
new file mode 100644
index 0000000..a4d01ea
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/SeleniumUtility.java
@@ -0,0 +1,109 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.google.gwt.user.client.ui.Hyperlink;
+import com.google.gwt.user.client.ui.UIObject;
+import com.smartgwt.client.widgets.BaseWidget;
+
+/**
+ * Utilities for assisting with Selenium Automation
+ *
+ * @author Jay Shaughnessy
+ */
+public class SeleniumUtility {
+
+ /** A default id that is not ecommended as it will clash with any other element set to the default */
+ public static final String DEFAULT_ID = "DefaultID";
+
+ /**
+ * A utility for assigning an ID to a smartgwt widget. Any current ID will be overwritten. The algorithm is:
+ * <pre>
+ * If the widget has a non-empty title, the ID is set to the title, with spaces removed.
+ * Else the ID is set to the widget's hashcode
+ * </pre>
+ * @return the updated widget
+ * @return the ID.
+ */
+ static public <T extends BaseWidget> T setId(final T widget, String unsafeId) {
+ String id = getSafeId(unsafeId, String.valueOf(widget.hashCode()));
+ widget.setID(id);
+ return widget;
+ }
+
+ /**
+ * A utility for assigning an ID to a smartgwt widget. Any current ID will be overwritten. The algorithm is:
+ * <pre>
+ * Equivalent to setId(widget, widget.getTitle());
+ * </pre>
+ * @return the updated widget
+ * @return the ID.
+ */
+ static public <T extends BaseWidget> T setId(final T widget) {
+ return setId(widget, widget.getTitle());
+ }
+
+ /**
+ * A utility for assigning an ID to a gwt uiobject. For a smartgwt widget use {@link setId(BaseWidget)}.
+ * Any current ID will be overwritten. The algorithm is:
+ * <pre>
+ * If the unsafeId parameter is non-empty, the ID is set to the unsafeId, with spaces removed.
+ * Else the ID is set to the uiobject's hashcode
+ * </pre>
+ *
+ * @param uiObject
+ * @param unsafeId
+ * @return the updated uiObject
+ */
+ static public <T extends UIObject> T setHtmlId(final T uiObject, String unsafeId) {
+ String id = getSafeId(unsafeId, String.valueOf(uiObject.hashCode()));
+ uiObject.getElement().setAttribute("id", id);
+ return uiObject;
+ }
+
+ /**
+ * A utility for assigning an ID to a gwt Hyperlink. For a smartgwt widget
+ * use {@link setId(BaseWidget)}. Any current ID will be overwritten. The algorithm is:
+ * <pre>
+ * Equivalent to setHtmlId(hyperlink, hyperlink.getText());
+ * </pre>
+ *
+ * @param hyperlink
+ * @return the updated hyperlink
+ */
+ static public <T extends Hyperlink> T setHtmlId(final T hyperlink) {
+ return setHtmlId(hyperlink, hyperlink.getText());
+ }
+
+ /**
+ * Use only if you are sure the unsafeId is not null or empty, or if DEFAULT_ID is acceptable.
+ * <pre>
+ * Equivalent to:
+ *
+ * getSafeId( unsafeId, DEFAULT_ID );
+ * </pre>
+ * @param unsafeId The desired Id but with potential problems
+ * @return a safe version of unsafeId, or, if unsafeId is null or empty, DEFAULT_ID
+ */
+ static public String getSafeId(String unsafeId) {
+
+ return getSafeId(unsafeId, DEFAULT_ID);
+ }
+
+ /**
+ * Currently performs the following:
+ * <pre>
+ * - removes spaces
+ * - removes dots
+ * </pre>
+ * @param unsafeId The desired Id but with potential problems
+ * @param defaultId
+ * @return a safe version of unsafeId, or, if unsafeId is null or empty, defaultId
+ */
+ static public String getSafeId(String unsafeId, String defaultId) {
+ if ((null == unsafeId || unsafeId.trim().isEmpty())) {
+ return defaultId;
+ }
+
+ String safeId = unsafeId.replace(" ", "").replace(".", "");
+ return safeId;
+ }
+}
commit 645db4e980313895ff6b95fcbe9fdbc680b71acd
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Aug 17 14:30:03 2010 -0400
Fix a problem with LogOut
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 7cd621b..1e863fb 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
@@ -169,8 +169,7 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
Subject subject = result.get(0);
subject.setSessionId(sessionId);
setSessionSubject(subject);
- System.out.println("Portal-War logged in");
-
+ //System.out.println("Portal-War logged in");
}
});
} else {
@@ -311,6 +310,15 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
CoreGUI.sessionSubject = subject;
CoreGUI.userPreferences = new UserPreferences(subject);
loadProductInfo();
+ // After a user initiated logout start back at the default view
+ if ("LogOut".equals(CoreGUI.currentPath)) {
+ History.newItem(getDefaultView());
+ }
+ }
+
+ private static String getDefaultView() {
+ // TODO: should this be Dashboard or a User Preference?
+ return "";
}
public static void setContent(Canvas newContent) {
@@ -369,7 +377,6 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
// default view
History.newItem("Dashboard");
} else {
-
if (!viewPath.getCurrent().equals(currentViewId)) {
currentViewId = viewPath.getCurrent();
commit c955fb2c40e390155061148cfd3a29b1f3d86d30
Merge: 26a4756... 370ab8f...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Aug 10 12:30:02 2010 -0400
Merge branch 'master' into master-jay
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
commit 370ab8f832b9297e15f11bc025dd7463fecaa93e
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Aug 10 12:28:24 2010 -0400
Line terminator commit
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/index.html b/modules/enterprise/gui/portal-war/src/main/webapp/index.html
index c6499a3..156119e 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/index.html
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/index.html
@@ -1,9 +1,9 @@
-<html>
- <head>
- <meta http-equiv="Refresh" content="0; URL=/coregui/CoreGUI.html#Dashboard"/>
- </head>
- <body>
- <p>Redirecting to <a href="/coregui/CoreGUI.html#Dashboard">coregui.war</a>...</p>
- </body>
-</html>
-
+<html>
+ <head>
+ <meta http-equiv="Refresh" content="0; URL=/coregui/CoreGUI.html#Dashboard"/>
+ </head>
+ <body>
+ <p>Redirecting to <a href="/coregui/CoreGUI.html#Dashboard">coregui.war</a>...</p>
+ </body>
+</html>
+
commit 26a47567f821070bd960de598effdf0000976d33
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Aug 10 12:26:56 2010 -0400
Group List View and Create Wizard Work
- converted group list view to extend Table instead of VLayout with single table
- added group delete to list view
- changed button and confirm text for consistency (now like bundle buttons)
- removed checkboxes from list view
- added some core gui refresh to list view
- simplified wizard invoke style
- left justify create step and increase text box sizes
- improve Next/Previous handling
- respect selected compatible type on member selection page
- fetch only the required resources for compatible group member select
- fix issues with member filtering
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 d66a328..8171d96 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,50 +18,52 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.SelectionAppearance;
import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
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.components.wizard.WizardView;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.wizard.GroupCreateWizard;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
/**
* @author Greg Hinkle
*/
-public class ResourceGroupListView extends VLayout {
-
- private Table table;
+public class ResourceGroupListView extends Table {
public ResourceGroupListView() {
- this(null);
-
+ super("Resource Groups");
+ setWidth100();
+ setHeight100();
}
- /**
- * Resource Group list filtered by a given criteria
- * @param criteria
- */
public ResourceGroupListView(Criteria criteria) {
+ super("Resource Groups", criteria);
+ }
- setWidth100();
- setHeight100();
+ @Override
+ protected void onInit() {
+ super.onInit();
- final ResourceGroupsDataSource datasource = ResourceGroupsDataSource.getInstance();
+ // setHeaderIcon("?_24.png");
- table = new Table("Resource Groups", criteria);
- table.setDataSource(datasource);
+ final ResourceGroupsDataSource datasource = ResourceGroupsDataSource.getInstance();
+ setDataSource(datasource);
- table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
- table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
- table.getListGrid().setResizeFieldsInRealTime(true);
+ getListGrid().setSelectionType(SelectionStyle.SIMPLE);
+ //table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
+ getListGrid().setResizeFieldsInRealTime(true);
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
@@ -80,26 +82,38 @@ public class ResourceGroupListView extends VLayout {
ListGridField availabilityField = new ListGridField("currentAvailability", "Availability", 55);
availabilityField.setAlign(Alignment.CENTER);
- table.getListGrid().setFields(idField, nameField, descriptionField, typeNameField, pluginNameField,
- categoryField, availabilityField);
-
- table.addTableAction("Delete Groups", Table.SelectionEnablement.ANY,
- "Are you sure you want to delete # groups?", new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- // TODO: Implement this method.
+ getListGrid().setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField,
+ availabilityField);
+
+ addTableAction("Delete", Table.SelectionEnablement.ANY, "Delete the selected resource groups?",
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selections) {
+ ResourceGroupsDataSource ds = (ResourceGroupsDataSource) getDataSource();
+ for (ListGridRecord selection : selections) {
+ ResourceGroupGWTServiceAsync resourceGroupManager = GWTServiceLookup.getResourceGroupService();
+ final ResourceGroup object = ds.copyValues(selection);
+ resourceGroupManager.deleteResourceGroup(object.getId(), new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to delete resource group [" + object.getName() + "]", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Deleted resource group [" + object.getName() + "]", Severity.Info));
+
+ CoreGUI.refresh();
+ }
+ });
+ }
}
});
- table.addTableAction("New Group", new TableAction() {
+ addTableAction("New", new TableAction() {
public void executeAction(ListGridRecord[] selection) {
- WizardView view = new WizardView(new GroupCreateWizard());
- view.displayDialog();
+ new GroupCreateWizard().startBundleWizard();
}
});
-
-
- addMember(table);
-
}
}
\ No newline at end of file
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 debe24d..aaaaeaa 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
@@ -28,6 +28,7 @@ import com.smartgwt.client.rpc.RPCResponse;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
@@ -115,7 +116,24 @@ public class ResourceGroupsDataSource extends RPCDataSource<ResourceGroup> {
@Override
public ResourceGroup copyValues(ListGridRecord from) {
- return null; // TODO: Implement this method.
+ 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");
+ ResourceType rt = null;
+
+ ResourceGroup rg = new ResourceGroup(nameAttrib);
+ rg.setId(idAttrib);
+ rg.setDescription(descriptionAttrib);
+ if (null != typeNameAttrib) {
+ rt = new ResourceType();
+ rt.setName(typeNameAttrib);
+ rt.setPlugin(pluginNameAttrib);
+ rg.setResourceType(rt);
+ }
+
+ return rg;
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
index 96b6017..032cc75 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
@@ -52,19 +52,22 @@ public class GroupCreateStep extends AbstractWizardStep {
form = new DynamicForm();
form.setValuesManager(new ValuesManager());
- form.setNumCols(4);
+ form.setWidth100();
+ form.setNumCols(2);
TextItem name = new TextItem("name", "Name");
name.setRequired(true);
-
- TextItem location = new TextItem("location", "Location");
+ name.setWidth(300);
TextAreaItem description = new AutoFitTextAreaItem("description", "Description");
+ description.setWidth(300);
+
+ TextItem location = new TextItem("location", "Location");
+ location.setWidth(300);
CheckboxItem recursive = new CheckboxItem("recursive", "Recursive");
LinkedHashMap<String, Canvas> options = new LinkedHashMap<String, Canvas>();
-
options.put("Mixed", null);
IPickTreeItem typeSelectItem = new IPickTreeItem("type", "Type");
@@ -81,16 +84,25 @@ public class GroupCreateStep extends AbstractWizardStep {
options.put("Compatible", form2);
RadioGroupWithComponentsItem kind = new RadioGroupWithComponentsItem("kind", "Group Type", options, form);
- kind.setValue("Mixed Resources");
+ kind.setValue("Mixed");
- form.setFields(name, location, description, recursive, kind);
+ form.setFields(name, description, location, recursive, kind);
}
return form;
}
public boolean nextPage() {
- return form.validate();
+ boolean valid = form.validate();
+ if (valid) {
+ RadioGroupWithComponentsItem kind = (RadioGroupWithComponentsItem) form.getField("kind");
+ if ("Compatible".equals(kind.getSelected())) {
+ DynamicForm form2 = (DynamicForm) kind.getSelectedComponent();
+ valid = (null != form2.getValue("type"));
+ }
+ }
+
+ return valid;
}
public String getName() {
@@ -103,11 +115,16 @@ public class GroupCreateStep extends AbstractWizardStep {
group.setLocation(form.getValueAsString("location"));
group.setRecursive(form.getValue("recursive") != null ? true : false);
- if (form.getValue("type") != null) {
- ResourceType type = new ResourceType();
- type.setId(Integer.parseInt(form.getValueAsString("type")));
- group.setResourceType(type);
+ RadioGroupWithComponentsItem kind = (RadioGroupWithComponentsItem) form.getField("kind");
+ if ("Compatible".equals(kind.getSelected())) {
+ DynamicForm form2 = (DynamicForm) kind.getSelectedComponent();
+ if (null != form2.getValue("type")) {
+ ResourceType rt = new ResourceType();
+ rt.setId(Integer.parseInt(form2.getValueAsString("type")));
+ group.setResourceType(rt);
+ }
}
+
return group;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java
index 4c8b074..55d1588 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateWizard.java
@@ -28,6 +28,7 @@ import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.IButton;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizard;
@@ -68,6 +69,18 @@ public class GroupCreateWizard extends AbstractWizard {
return null; // TODO: Implement this method.
}
+ /**
+ * @return only the rt id is set
+ */
+ public ResourceType getCompatibleGroupResourceType() {
+ ResourceGroup rg = createStep.getGroup();
+ ResourceType rt = null;
+ if (null != rg) {
+ rt = rg.getResourceType();
+ }
+ return rt;
+ }
+
public void cancel() {
// TODO: Implement this method.
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupMembersStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupMembersStep.java
index 5f13657..cc79abc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupMembersStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupMembersStep.java
@@ -26,6 +26,7 @@ import java.util.HashSet;
import com.smartgwt.client.widgets.Canvas;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceSelector;
@@ -34,16 +35,20 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.Resour
*/
public class GroupMembersStep extends AbstractWizardStep {
- private GroupCreateWizard wizard;
- private ResourceSelector selector;
+ private GroupCreateWizard wizard = null;
+ private ResourceSelector selector = null;
+ private ResourceType requireType = null;
public GroupMembersStep(GroupCreateWizard wizard) {
this.wizard = wizard;
}
public Canvas getCanvas() {
- if (selector == null) {
+ ResourceType rt = wizard.getCompatibleGroupResourceType();
+ if ((selector == null) || (rt != requireType)) {
selector = new ResourceSelector();
+ requireType = rt;
+ selector.setRequireType(rt);
}
return selector;
}
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 49ec0e4..03deb9b 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
@@ -98,6 +98,24 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
public void executeFetch(final DSRequest request, final DSResponse response) {
+ ResourceCriteria criteria = getFetchCriteria(request);
+
+ resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to fetch resource data", caught);
+ response.setStatus(RPCResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<Resource> result) {
+
+ dataRetrieved(result, response, request);
+ }
+ });
+ }
+
+ protected ResourceCriteria getFetchCriteria(final DSRequest request) {
+
ResourceCriteria criteria = new ResourceCriteria();
criteria.setPageControl(getPageControl(request));
@@ -158,18 +176,7 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
criteria.addFilterTagName((String) request.getCriteria().getValues().get("tagName"));
}
- resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to fetch resource data", caught);
- response.setStatus(RPCResponse.STATUS_FAILURE);
- processResponse(request.getRequestId(), response);
- }
-
- public void onSuccess(PageList<Resource> result) {
-
- dataRetrieved(result, response, request);
- }
- });
+ return criteria;
}
@Override
@@ -215,7 +222,7 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
record.setAttribute("id", from.getId());
record.setAttribute(NAME.propertyName(), from.getName());
record.setAttribute(DESCRIPTION.propertyName(), from.getDescription());
- record.setAttribute(TYPE.propertyName(), from.getResourceType().getName());
+ record.setAttribute(TYPE.propertyName(), from.getResourceType().getId());
record.setAttribute(PLUGIN.propertyName(), from.getResourceType().getPlugin());
record.setAttribute(CATEGORY.propertyName(), from.getResourceType().getCategory().getDisplayName());
record.setAttribute("icon", from.getResourceType().getCategory().getDisplayName() + "_"
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
index 1274e14..0d25f38 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
@@ -18,12 +18,18 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.selection;
+import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.CATEGORY;
+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.Collection;
import com.smartgwt.client.data.AdvancedCriteria;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.Criterion;
+import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.types.OperatorId;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.IPickTreeItem;
@@ -31,7 +37,9 @@ import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.components.selector.AbstractSelector;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypePluginTreeDataSource;
@@ -42,18 +50,18 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
*/
public class ResourceSelector extends AbstractSelector<Resource> {
- private Integer requireTypeId;
+ private ResourceType requireType;
public ResourceSelector() {
super();
}
- public Integer getRequireTypeId() {
- return requireTypeId;
+ public ResourceType getRequireType() {
+ return requireType;
}
- public void setRequireTypeId(Integer requireTypeId) {
- this.requireTypeId = requireTypeId;
+ public void setRequireType(ResourceType requireType) {
+ this.requireType = requireType;
markForRedraw();
}
@@ -70,10 +78,15 @@ public class ResourceSelector extends AbstractSelector<Resource> {
typeSelectItem.setEmptyMenuMessage("Loading...");
typeSelectItem.setShowIcons(true);
- if (requireTypeId != null) {
- typeSelectItem.setValue(requireTypeId);
- typeSelectItem.setDisabled(true);
- availableFilterForm.setItems(search, typeSelectItem);
+ if (requireType != null) {
+ // TODO: Currently ignore the typeSelectItem widget because we already know the type.
+ // Alternatively, we could display it disabled but we'd want the type name to be displayed as the
+ // value. To get this to display the type name I think we need to pre-fetch the type tree here. We could
+ // potentially optimize typeSelectItem.setValue(requireType.getId()) to build a tree that includes only
+ // this single type.
+ //typeSelectItem.setValue(requireType.getId());
+ //typeSelectItem.setDisabled(true);
+ availableFilterForm.setItems(search);
} else {
SelectItem categorySelect = new SelectItem("category", "Category");
categorySelect.setValueMap("Platform", "Server", "Service");
@@ -91,23 +104,23 @@ public class ResourceSelector extends AbstractSelector<Resource> {
protected Criteria getLatestCriteria(DynamicForm availableFilterForm) {
String search = (String) availableFilterForm.getValue("search");
- String type = (String) availableFilterForm.getValue("type");
+ String type = availableFilterForm.getValueAsString("type");
String category = (String) availableFilterForm.getValue("category");
ArrayList<Criterion> criteria = new ArrayList<Criterion>(3);
if (null != search) {
- criteria.add(new Criterion("name", OperatorId.CONTAINS, search));
+ criteria.add(new Criterion(NAME.propertyName(), OperatorId.CONTAINS, search));
}
if (null != type) {
// If type is a number its a typeId, otherwise a plugin name
try {
Integer.parseInt(type);
- criteria.add(new Criterion("type", OperatorId.EQUALS, type));
+ criteria.add(new Criterion(TYPE.propertyName(), OperatorId.EQUALS, type));
} catch (NumberFormatException nfe) {
- criteria.add(new Criterion("plugin", OperatorId.EQUALS, type));
+ criteria.add(new Criterion(PLUGIN.propertyName(), OperatorId.EQUALS, type));
}
}
if (null != category) {
- criteria.add(new Criterion("category", OperatorId.EQUALS, category));
+ criteria.add(new Criterion(CATEGORY.propertyName(), OperatorId.EQUALS, category));
}
AdvancedCriteria latestCriteria = new AdvancedCriteria(OperatorId.AND, criteria.toArray(new Criterion[criteria
.size()]));
@@ -127,5 +140,21 @@ public class ResourceSelector extends AbstractSelector<Resource> {
}
return records;
}
+
+ @Override
+ protected ResourceCriteria getFetchCriteria(final DSRequest request) {
+ ResourceCriteria result = super.getFetchCriteria(request);
+
+ // additional filters
+ if (null != requireType) {
+ result.addFilterResourceTypeId(requireType.getId());
+ }
+
+ // additional return data
+ result.fetchResourceType(true);
+
+ return result;
+ }
+
}
}
commit d46570b01227074b6c53ccb45fadf6e05b1a3d6d
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Aug 10 12:18:03 2010 -0400
cosmetic changes only
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypePluginTreeDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypePluginTreeDataSource.java
index 227e783..03a2198 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypePluginTreeDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypePluginTreeDataSource.java
@@ -22,8 +22,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
-import java.util.HashSet;
-import java.util.ListIterator;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
@@ -48,7 +46,6 @@ import org.rhq.enterprise.gui.coregui.client.gwt.ResourceTypeGWTServiceAsync;
*/
public class ResourceTypePluginTreeDataSource extends DataSource {
-
private ResourceTypeGWTServiceAsync resourceTypeService = GWTServiceLookup.getResourceTypeGWTService();
public ResourceTypePluginTreeDataSource() {
@@ -57,7 +54,6 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
setDataProtocol(DSProtocol.CLIENTCUSTOM);
setDataFormat(DSDataFormat.CUSTOM);
-
DataSourceTextField idField = new DataSourceTextField("id", "ID");
idField.setPrimaryKey(true);
@@ -70,7 +66,6 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
DataSourceTextField resourceTypeField = new DataSourceTextField("category", "Category");
-
setFields(idField, parentIdField, resourceNameField, resourceKeyField, resourceTypeField);
}
@@ -80,17 +75,16 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
// Asume success
response.setStatus(0);
switch (request.getOperationType()) {
- case FETCH:
- executeFetch(request, response);
- break;
- default:
- break;
+ case FETCH:
+ executeFetch(request, response);
+ break;
+ default:
+ break;
}
return request.getData();
}
-
protected void executeFetch(final DSRequest request, final DSResponse response) {
String parentIdString = request.getCriteria().getAttributeAsString("parentId");
@@ -98,26 +92,23 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
processResponse(request.getRequestId(), response);
} else {
-
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
criteria.fetchParentResourceTypes(true);
criteria.setPageControl(PageControl.getUnlimitedInstance());
- resourceTypeService.findResourceTypesByCriteria(criteria,
- new AsyncCallback<PageList<ResourceType>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load resource type tree data", caught);
- }
-
- public void onSuccess(PageList<ResourceType> result) {
- response.setData(buildNodes(result));
- processResponse(request.getRequestId(), response);
- }
- });
+ resourceTypeService.findResourceTypesByCriteria(criteria, new AsyncCallback<PageList<ResourceType>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load resource type tree data", caught);
+ }
+
+ public void onSuccess(PageList<ResourceType> result) {
+ response.setData(buildNodes(result));
+ processResponse(request.getRequestId(), response);
+ }
+ });
}
}
-
public static TreeNode[] buildNodes(PageList<ResourceType> result) {
HashMap<String, PluginTreeNode> pluginNodes = new HashMap<String, PluginTreeNode>();
@@ -127,12 +118,11 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
if (type.getParentResourceTypes() == null || type.getParentResourceTypes().isEmpty()) {
PluginTreeNode pluginNode = pluginNodes.get(type.getPlugin());
- if (pluginNode == null) {
- pluginNode = new PluginTreeNode(type.getPlugin());
- pluginNodes.put(type.getPlugin(), pluginNode);
- nodes.add(pluginNode);
- }
-
+ if (pluginNode == null) {
+ pluginNode = new PluginTreeNode(type.getPlugin());
+ pluginNodes.put(type.getPlugin(), pluginNode);
+ nodes.add(pluginNode);
+ }
nodes.add(new ResourceTypeTreeNode(type, type.getPlugin()));
} else {
@@ -152,7 +142,6 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
return treeNodes;
}
-
/**
* Returns a prepopulated PageControl based on the provided DSRequest. This will set sort fields,
* pagination, but *not* filter fields.
@@ -166,7 +155,8 @@ public class ResourceTypePluginTreeDataSource 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.
@@ -183,7 +173,6 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
return pageControl;
}
-
public static class PluginTreeNode extends TreeNode {
String id;
@@ -195,19 +184,22 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
setParentID(null);
setAttribute("name", pluginName + " Plugin");
-// setAttribute("plugin",pluginName);
+ // setAttribute("plugin",pluginName);
setIcon("types/plugin_16.png"); // todo doesn't work
setEnabled(true);
}
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
PluginTreeNode that = (PluginTreeNode) o;
- if (!id.equals(that.id)) return false;
+ if (!id.equals(that.id))
+ return false;
return true;
}
@@ -245,20 +237,23 @@ public class ResourceTypePluginTreeDataSource extends DataSource {
setIsFolder(true);
}
-
public ResourceType getResourceType() {
return resourceType;
}
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
ResourceTypeTreeNode that = (ResourceTypeTreeNode) o;
- if (!id.equals(that.id)) return false;
- if (parentId != null ? !parentId.equals(that.parentId) : that.parentId != null) return false;
+ if (!id.equals(that.id))
+ return false;
+ if (parentId != null ? !parentId.equals(that.parentId) : that.parentId != null)
+ return false;
return true;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index 9d354f4..d761dbd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@ -18,36 +18,16 @@
*/
package org.rhq.enterprise.gui.coregui.client.menu;
-import com.google.gwt.dom.client.Document;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.History;
-import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Hyperlink;
-import com.smartgwt.client.types.ContentsType;
-import com.smartgwt.client.types.VerticalAlignment;
-import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Img;
-import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.events.DrawEvent;
-import com.smartgwt.client.widgets.events.DrawHandler;
-import com.smartgwt.client.widgets.events.ShowContextMenuEvent;
-import com.smartgwt.client.widgets.events.ShowContextMenuHandler;
-import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.menu.Menu;
-import com.smartgwt.client.widgets.menu.MenuBar;
-import com.smartgwt.client.widgets.menu.MenuItem;
-import com.smartgwt.client.widgets.menu.MenuItemSeparator;
-import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.AboutModalWindow;
/**
@@ -57,13 +37,12 @@ public class MenuBarView extends VLayout {
private AboutModalWindow aboutModalWindow;
- public static final String[] SECTIONS = {"Dashboard", "Inventory", "Reports", "Bundles", "Administration"};
+ public static final String[] SECTIONS = { "Dashboard", "Inventory", "Reports", "Bundles", "Administration" };
private String selected = "Dashboard";
private HTMLFlow linksPane;
-
protected void onDraw() {
super.onDraw();
@@ -81,7 +60,6 @@ public class MenuBarView extends VLayout {
}
});
-
ToolStrip topStrip = new ToolStrip();
topStrip.setHeight(34);
topStrip.setWidth100();
@@ -104,16 +82,16 @@ public class MenuBarView extends VLayout {
topStrip.addMember(new LayoutSpacer());
- HLayout helpLayout = new HLayout();
-// Label loggedInAs = new Label("Logged in as " + CoreGUI.getSessionSubject().getName());
-// loggedInAs.setWrap(false);
-// loggedInAs.setValign(VerticalAlignment.CENTER);
-// helpLayout.addMember(loggedInAs);
+ //HLayout helpLayout = new HLayout();
+ // Label loggedInAs = new Label("Logged in as " + CoreGUI.getSessionSubject().getName());
+ // loggedInAs.setWrap(false);
+ // loggedInAs.setValign(VerticalAlignment.CENTER);
+ // helpLayout.addMember(loggedInAs);
topStrip.addMember(new Hyperlink("Help", "Help"));
topStrip.addMember(new Hyperlink("Preferences", "Preferences"));
topStrip.addMember(new Hyperlink("Log Out", "LogOut"));
-// helpLayout.setLayoutAlign(VerticalAlignment.CENTER);
-// topStrip.addMember(helpLayout);
+ // helpLayout.setLayoutAlign(VerticalAlignment.CENTER);
+ // topStrip.addMember(helpLayout);
/* DynamicForm links = new DynamicForm();
links.setNumCols(SECTIONS.length * 2);
@@ -148,7 +126,7 @@ public class MenuBarView extends VLayout {
private String setupLinks() {
StringBuilder headerString = new StringBuilder(
- "<table style=\"height: 34px;\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
+ "<table style=\"height: 34px;\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
boolean first = true;
for (String section : SECTIONS) {
@@ -162,7 +140,8 @@ public class MenuBarView extends VLayout {
styleClass += "Selected";
}
- headerString.append("<td class=\"" + styleClass + "\" onclick=\"document.location='#" + section + "'\" >");
+ headerString.append("<td id=\"" + section + "\" class=\"" + styleClass
+ + "\" onclick=\"document.location='#" + section + "'\" >");
headerString.append(section);
headerString.append("</td>\n");
@@ -174,5 +153,4 @@ public class MenuBarView extends VLayout {
return headerString.toString();
}
-
}
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 a288517..95436d4 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
@@ -20,11 +20,6 @@ package org.rhq.enterprise.gui.coregui.client.util;
import java.util.Collection;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.core.domain.util.PageOrdering;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSource;
@@ -32,6 +27,10 @@ import com.smartgwt.client.types.DSDataFormat;
import com.smartgwt.client.types.DSProtocol;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageOrdering;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+
/**
* Base GWT-RPC oriented DataSource class.
*
@@ -59,21 +58,21 @@ public abstract class RPCDataSource<T> extends DataSource {
DSResponse response = createResponse(request);
switch (request.getOperationType()) {
- case FETCH:
- executeFetch(request, response);
- break;
- case ADD:
- executeAdd(request, response);
- break;
- case UPDATE:
- executeUpdate(request, response);
- break;
- case REMOVE:
- executeRemove(request, response);
- break;
- default:
- super.transformRequest(request);
- break;
+ case FETCH:
+ executeFetch(request, response);
+ break;
+ case ADD:
+ executeAdd(request, response);
+ break;
+ case UPDATE:
+ executeUpdate(request, response);
+ break;
+ case REMOVE:
+ executeRemove(request, response);
+ break;
+ default:
+ super.transformRequest(request);
+ break;
}
} catch (Throwable t) {
CoreGUI.getErrorHandler().handleError("Failure in datasource [" + request.getOperationType() + "]", t);
@@ -95,7 +94,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.
@@ -112,7 +112,6 @@ public abstract class RPCDataSource<T> extends DataSource {
return pageControl;
}
-
public ListGridRecord[] buildRecords(Collection<T> list) {
if (list == null) {
return null;
@@ -126,7 +125,6 @@ public abstract class RPCDataSource<T> extends DataSource {
return records;
}
-
/**
* Extensions should implement this method to retrieve data. Paging solutions should use
* {@link #getPageControl(com.smartgwt.client.data.DSRequest)}. All implementations should call processResponse()
@@ -138,12 +136,10 @@ public abstract class RPCDataSource<T> extends DataSource {
*/
protected abstract void executeFetch(final DSRequest request, final DSResponse response);
-
public abstract T copyValues(ListGridRecord from);
public abstract ListGridRecord copyValues(T from);
-
/**
* Executed on <code>REMOVE</code> operation. <code>processResponse (requestId, response)</code>
* should be called when operation completes (either successful or failure).
commit 82e6eafb41602e32be7645382b43fa53f252e707
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Aug 10 12:14:32 2010 -0400
cosmetic changes only
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index 3dc9f4c..8b2726c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
@@ -18,15 +18,11 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.list;
-import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.SelectionAppearance;
import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
@@ -63,7 +59,6 @@ public class BundlesListView extends Table {
setHeaderIcon("subsystems/bundle/Bundle_24.png");
-
setDataSource(new BundlesWithLatestVersionDataSource());
getListGrid().getField("id").setWidth("60");
@@ -71,27 +66,26 @@ public class BundlesListView extends Table {
getListGrid().getField("link").setType(ListGridFieldType.LINK);
getListGrid().getField("link").setTarget("_self");
-// getListGrid().getField("name").setCellFormatter(new CellFormatter() {
-// public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
-// return "";//<a href=\"#Bundles/Bundle/" + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
-// }
-// });
+ // getListGrid().getField("name").setCellFormatter(new CellFormatter() {
+ // public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ // return "";//<a href=\"#Bundles/Bundle/" + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
+ // }
+ // });
getListGrid().getField("description").setWidth("25%");
getListGrid().getField("latestVersion").setWidth("25%");
getListGrid().getField("versionsCount").setWidth("*");
getListGrid().setSelectionType(SelectionStyle.SIMPLE);
-// getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
+ // getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
addTableAction("New", Table.SelectionEnablement.ALWAYS, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
new BundleCreateWizard().startBundleWizard();
-
}
});
- addTableAction("Delete", Table.SelectionEnablement.ANY, "Delete the selected bundle?", new TableAction() {
+ addTableAction("Delete", Table.SelectionEnablement.ANY, "Delete the selected bundles?", new TableAction() {
public void executeAction(ListGridRecord[] selections) {
BundlesWithLatestVersionDataSource ds = (BundlesWithLatestVersionDataSource) getDataSource();
for (ListGridRecord selection : selections) {
@@ -148,7 +142,6 @@ public class BundlesListView extends Table {
});
}
-
public int getMatches() {
return this.getListGrid().getTotalRows();
}
commit 37d5573d9992b6158c9c47014fa42e874bee32ab
Merge: 163db5e... c08cbb0...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Sat Aug 7 00:14:07 2010 -0400
Merge branch 'master' into master-jay
commit 163db5e31289289df03123e0b8374646a487679a
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Sat Aug 7 00:12:21 2010 -0400
[BZ-610859] Fix issue in AS5 plugin discovery component that initializes
the log event source with the wrong name. When adding a second log
event source it introduces the name mismatch.
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerDiscoveryComponent.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerDiscoveryComponent.java
index 5068f2d..94cad13 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerDiscoveryComponent.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerDiscoveryComponent.java
@@ -32,18 +32,20 @@ import java.net.URL;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import java.util.Set;
-import java.util.HashMap;
-import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.maven.artifact.versioning.ComparableVersion;
-import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import org.jboss.on.common.jbossas.JBossASDiscoveryUtils;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertyList;
@@ -53,20 +55,18 @@ import org.rhq.core.pluginapi.event.log.LogFileEventResourceComponentHelper;
import org.rhq.core.pluginapi.inventory.ClassLoaderFacet;
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ManualAddFacet;
import org.rhq.core.pluginapi.inventory.ProcessScanResult;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-import org.rhq.core.pluginapi.inventory.ManualAddFacet;
import org.rhq.core.pluginapi.util.FileUtils;
import org.rhq.core.system.ProcessInfo;
import org.rhq.plugins.jbossas5.helper.JBossInstallationInfo;
import org.rhq.plugins.jbossas5.helper.JBossInstanceInfo;
-import org.rhq.plugins.jbossas5.helper.JBossProperties;
import org.rhq.plugins.jbossas5.helper.JBossProductType;
+import org.rhq.plugins.jbossas5.helper.JBossProperties;
import org.rhq.plugins.jbossas5.util.JnpConfig;
-import org.jboss.on.common.jbossas.JBossASDiscoveryUtils;
-
/**
* A Resource discovery component for JBoss AS Server Resources, which include the following:
*
@@ -79,7 +79,7 @@ import org.jboss.on.common.jbossas.JBossASDiscoveryUtils;
* @author Mark Spritzler
*/
public class ApplicationServerDiscoveryComponent implements ResourceDiscoveryComponent, ClassLoaderFacet,
- ManualAddFacet {
+ ManualAddFacet {
private static final String CHANGE_ME = "***CHANGE_ME***";
private static final String JBOSS_SERVICE_XML = "conf" + File.separator + "jboss-service.xml";
private static final String JBOSS_NAMING_SERVICE_XML = "deploy" + File.separator + "naming-service.xml";
@@ -98,14 +98,9 @@ public class ApplicationServerDiscoveryComponent implements ResourceDiscoveryCom
private static final List<String> CLIENT_JARS = Arrays.asList(
// NOTE: The jbossall-client.jar aggregates a whole bunch of other jars from the client dir via its
// MANIFEST.MF Class-Path.
- "client/jbossall-client.jar",
- "client/trove.jar",
- "client/javassist.jar",
- "common/lib/jboss-security-aspects.jar",
- "lib/jboss-managed.jar",
- "lib/jboss-metatype.jar",
- "lib/jboss-dependency.jar"
- );
+ "client/jbossall-client.jar", "client/trove.jar", "client/javassist.jar",
+ "common/lib/jboss-security-aspects.jar", "lib/jboss-managed.jar", "lib/jboss-metatype.jar",
+ "lib/jboss-dependency.jar");
private static final List<String> AS6_CLIENT_JARS = new ArrayList<String>(CLIENT_JARS);
static {
@@ -132,8 +127,7 @@ public class ApplicationServerDiscoveryComponent implements ResourceDiscoveryCom
}
public DiscoveredResourceDetails discoverResource(Configuration pluginConfig,
- ResourceDiscoveryContext discoveryContext)
- throws InvalidPluginConfigurationException {
+ ResourceDiscoveryContext discoveryContext) throws InvalidPluginConfigurationException {
// Set default values on any props that are not set.
//setPluginConfigurationDefaults(pluginConfiguration);
@@ -152,10 +146,11 @@ public class ApplicationServerDiscoveryComponent implements ResourceDiscoveryCom
}
@SuppressWarnings("unchecked")
- public List<URL> getAdditionalClasspathUrls(ResourceDiscoveryContext context, DiscoveredResourceDetails details)
- throws Exception {
+ public List<URL> getAdditionalClasspathUrls(ResourceDiscoveryContext context, DiscoveredResourceDetails details)
+ throws Exception {
Configuration pluginConfig = details.getPluginConfiguration();
- String homeDir = pluginConfig.getSimple(ApplicationServerPluginConfigurationProperties.HOME_DIR).getStringValue();
+ String homeDir = pluginConfig.getSimple(ApplicationServerPluginConfigurationProperties.HOME_DIR)
+ .getStringValue();
List<URL> clientJars = new ArrayList<URL>();
@@ -236,8 +231,8 @@ public class ApplicationServerDiscoveryComponent implements ResourceDiscoveryCom
jnpURL));
pluginConfiguration.put(new PropertySimple(ApplicationServerPluginConfigurationProperties.HOME_DIR,
installHome.getAbsolutePath()));
- pluginConfiguration.put(new PropertySimple(
- ApplicationServerPluginConfigurationProperties.SERVER_HOME_DIR, configDir));
+ pluginConfiguration.put(new PropertySimple(ApplicationServerPluginConfigurationProperties.SERVER_HOME_DIR,
+ configDir));
// Set the optional props...
pluginConfiguration.put(new PropertySimple(ApplicationServerPluginConfigurationProperties.SERVER_NAME,
@@ -247,19 +242,17 @@ public class ApplicationServerDiscoveryComponent implements ResourceDiscoveryCom
JBossASDiscoveryUtils.UserInfo userInfo = JBossASDiscoveryUtils.getJmxInvokerUserInfo(configDir);
if (userInfo != null) {
- pluginConfiguration.put(
- new PropertySimple(ApplicationServerPluginConfigurationProperties.PRINCIPAL,
- userInfo.getUsername()));
- pluginConfiguration.put(
- new PropertySimple(ApplicationServerPluginConfigurationProperties.CREDENTIALS,
- userInfo.getPassword()));
+ pluginConfiguration.put(new PropertySimple(ApplicationServerPluginConfigurationProperties.PRINCIPAL,
+ userInfo.getUsername()));
+ pluginConfiguration.put(new PropertySimple(ApplicationServerPluginConfigurationProperties.CREDENTIALS,
+ userInfo.getPassword()));
}
String javaHome = processInfo.getEnvironmentVariable(JAVA_HOME_ENV_VAR);
if (javaHome == null && log.isDebugEnabled()) {
log.warn("Unable to determine the JAVA_HOME environment variable for the JBoss AS process - "
+ " the Agent is probably running as a user that does not have access to the AS process's "
- + " environment.");
+ + " environment.");
}
pluginConfiguration.put(new PropertySimple(ApplicationServerPluginConfigurationProperties.JAVA_HOME,
javaHome));
@@ -281,15 +274,17 @@ public class ApplicationServerDiscoveryComponent implements ResourceDiscoveryCom
try {
return new InProcessJBossASDiscovery().discoverInProcessJBossAS(discoveryContext);
} catch (Throwable t) {
- log.debug("In-process JBoss AS discovery failed - we are probably not running embedded within JBoss AS.", t);
+ log
+ .debug("In-process JBoss AS discovery failed - we are probably not running embedded within JBoss AS.",
+ t);
return null;
}
}
private DiscoveredResourceDetails createResourceDetails(ResourceDiscoveryContext discoveryContext,
Configuration pluginConfig, @Nullable ProcessInfo processInfo, JBossInstallationInfo installInfo) {
- String serverHomeDir = pluginConfig.getSimple(
- ApplicationServerPluginConfigurationProperties.SERVER_HOME_DIR).getStringValue();
+ String serverHomeDir = pluginConfig.getSimple(ApplicationServerPluginConfigurationProperties.SERVER_HOME_DIR)
+ .getStringValue();
File absoluteConfigPath = resolvePathRelativeToHomeDir(pluginConfig, serverHomeDir);
// Canonicalize the config path, so it's consistent no matter how it's entered.
@@ -298,8 +293,8 @@ public class ApplicationServerDiscoveryComponent implements ResourceDiscoveryCom
// JON: fix for JBNADM-2634 - do not resolve symlinks (ips, 12/18/07)
String key = FileUtils.getCanonicalPath(absoluteConfigPath.getPath());
- String bindAddress = pluginConfig.getSimple(
- ApplicationServerPluginConfigurationProperties.BIND_ADDRESS).getStringValue();
+ String bindAddress = pluginConfig.getSimple(ApplicationServerPluginConfigurationProperties.BIND_ADDRESS)
+ .getStringValue();
String namingUrl = pluginConfig.getSimple(ApplicationServerPluginConfigurationProperties.NAMING_URL)
.getStringValue();
@@ -316,7 +311,7 @@ public class ApplicationServerDiscoveryComponent implements ResourceDiscoveryCom
String description = installInfo.getProductType().DESCRIPTION;
File deployDir = new File(absoluteConfigPath, "deploy");
-
+
File rhqInstallerWar = new File(deployDir, "rhq-installer.war");
File rhqInstallerWarUndeployed = new File(deployDir, "rhq-installer.war.rej");
boolean isRhqServer = rhqInstallerWar.exists() || rhqInstallerWarUndeployed.exists();
@@ -325,13 +320,15 @@ public class ApplicationServerDiscoveryComponent implements ResourceDiscoveryCom
// We know this is an RHQ Server. Let's add an event source for its server log file, but disable it by default.
configureEventSourceForServerLogFile(pluginConfig);
}
- String name = formatServerName(bindAddress, namingPort, discoveryContext.getSystemInformation().getHostname(), absoluteConfigPath.getName(), isRhqServer);
+ String name = formatServerName(bindAddress, namingPort, discoveryContext.getSystemInformation().getHostname(),
+ absoluteConfigPath.getName(), isRhqServer);
return new DiscoveredResourceDetails(discoveryContext.getResourceType(), key, name, installInfo.getVersion(),
description, pluginConfig, processInfo);
}
- public String formatServerName(String bindingAddress, String jnpPort, String hostname, String configurationName, boolean isRhq) {
+ public String formatServerName(String bindingAddress, String jnpPort, String hostname, String configurationName,
+ boolean isRhq) {
if (isRhq) {
return hostname + " RHQ Server";
@@ -359,12 +356,12 @@ public class ApplicationServerDiscoveryComponent implements ResourceDiscoveryCom
return hostnameToUse + " " + configurationName;
}
}
-
+
private void configureEventSourceForServerLogFile(Configuration pluginConfig) {
File rhqLogFile = resolvePathRelativeToHomeDir(pluginConfig, "../logs/rhq-server-log4j.log");
if (rhqLogFile.exists() && !rhqLogFile.isDirectory()) {
try {
- PropertyMap serverLogEventSource = new PropertyMap("serverLog");
+ PropertyMap serverLogEventSource = new PropertyMap("logEventSource");
serverLogEventSource.put(new PropertySimple(
LogFileEventResourceComponentHelper.LogEventSourcePropertyNames.LOG_FILE_PATH, rhqLogFile
.getCanonicalPath()));
@@ -426,7 +423,7 @@ public class ApplicationServerDiscoveryComponent implements ResourceDiscoveryCom
File logDir = new File(configDir, "log");
File serverLogFile = new File(logDir, "server.log");
if (serverLogFile.exists() && !serverLogFile.isDirectory()) {
- PropertyMap serverLogEventSource = new PropertyMap("serverLog");
+ PropertyMap serverLogEventSource = new PropertyMap("logEventSource");
serverLogEventSource.put(new PropertySimple(
LogFileEventResourceComponentHelper.LogEventSourcePropertyNames.LOG_FILE_PATH, serverLogFile));
serverLogEventSource.put(new PropertySimple(
@@ -445,7 +442,7 @@ public class ApplicationServerDiscoveryComponent implements ResourceDiscoveryCom
boolean supported = (version.compareTo(minimumVersion) >= 0);
if (!supported) {
log.debug(productType + " version " + version + " is not supported by this plugin (minimum " + productType
- + " version is " + minimumVersion + ") - skipping...");
+ + " version is " + minimumVersion + ") - skipping...");
}
return supported;
}
@@ -454,7 +451,8 @@ public class ApplicationServerDiscoveryComponent implements ResourceDiscoveryCom
private static File resolvePathRelativeToHomeDir(Configuration pluginConfig, @NotNull String path) {
File configDir = new File(path);
if (!configDir.isAbsolute()) {
- String homeDir = pluginConfig.getSimple(ApplicationServerPluginConfigurationProperties.HOME_DIR).getStringValue();
+ String homeDir = pluginConfig.getSimple(ApplicationServerPluginConfigurationProperties.HOME_DIR)
+ .getStringValue();
configDir = new File(homeDir, path);
}
return configDir;
commit 9c0a2cdf3c38a73b75d71f29aa49e41e6af8f639
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Sat Aug 7 00:10:24 2010 -0400
up the mc4j version
diff --git a/.classpath b/.classpath
index 35714ec..dc15df6 100644
--- a/.classpath
+++ b/.classpath
@@ -202,7 +202,7 @@
<classpathentry exported="true" kind="var" path="M2_REPO/javax/faces/jsf-impl/1.2_14/jsf-impl-1.2_14.jar" sourcepath="/M2_REPO/javax/faces/jsf-impl/1.2_14/jsf-impl-1.2_14-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/javax/el/el-api/1.0/el-api-1.0.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/sun/facelets/jsf-facelets/1.1.15.B1/jsf-facelets-1.1.15.B1.jar" sourcepath="/M2_REPO/com/sun/facelets/jsf-facelets/1.1.15.B1/jsf-facelets-1.1.15.B1-sources.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/mc4j/org-mc4j-ems/1.2.13/org-mc4j-ems-1.2.13.jar" sourcepath="/M2_REPO/mc4j/org-mc4j-ems/1.2.13/org-mc4j-ems-1.2.13-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/mc4j/org-mc4j-ems/1.2.14/org-mc4j-ems-1.2.14.jar" sourcepath="/M2_REPO/mc4j/org-mc4j-ems/1.2.13/org-mc4j-ems-1.2.13-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/opensymphony/quartz/quartz/1.6.5/quartz-1.6.5.jar" sourcepath="/M2_REPO/org/opensymphony/quartz/quartz/1.6.5/quartz-1.6.5-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/javax/mail/mail/1.4.2/mail-1.4.2.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-fileupload/commons-fileupload/1.2/commons-fileupload-1.2.jar"/>
commit 14e4a2fde58374e18db46335398bc3644ac2af95
Merge: 9b35996... cb5a73b...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Aug 5 22:32:33 2010 -0400
Merge branch 'master' into master-jay
diff --cc pom.xml
index e766f69,2a0db1c..ed621bf
--- a/pom.xml
+++ b/pom.xml
@@@ -85,11 -85,11 +85,11 @@@
<jsf-api.version>1.2_14</jsf-api.version>
<jsf-impl.version>1.2_14</jsf-impl.version>
<ojdbc5.version>11.2.0.1.0</ojdbc5.version>
- <ems.version>1.2.11</ems.version>
+ <ems.version>1.2.14</ems.version>
<postgresql.version>8.4-701.jdbc3</postgresql.version>
- <h2.version>1.1.117</h2.version>
+ <h2.version>1.2.139</h2.version>
<jtds.version>1.2.2</jtds.version>
- <richfaces.version>3.3.3.CR1</richfaces.version>
+ <richfaces.version>3.3.3.Final</richfaces.version>
<jline.version>0.9.94</jline.version>
<sigar.version>1.6.5.132</sigar.version>
<quartz.version>1.6.5</quartz.version>
commit 9b359963fa0af88b796d092ff5dca13f6333367f
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Aug 5 15:18:07 2010 -0400
[BZ-618659] [BZ-621662] Work around the fact that H2 does not yet support
blob update. This amounts to special casing H2 in the PackageVersion
handling. Also, update H2 version from 1.1.117 to 1.2.139 to get relevant
bug fixes, move to H2's latest db format, and set ourselves up for moving
forward again when/if H2 adds blob update support.
diff --git a/modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseTypeFactory.java b/modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseTypeFactory.java
index 896b396..ef66a51 100644
--- a/modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseTypeFactory.java
+++ b/modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseTypeFactory.java
@@ -172,6 +172,8 @@ public class DatabaseTypeFactory {
} else if (db_name.indexOf("h2") != -1) {
if (db_version.startsWith("1.1")) {
database_type_class = H2v11DatabaseType.class;
+ } else if (db_version.startsWith("1.2")) {
+ database_type_class = H2v12DatabaseType.class;
}
} else if (db_name.indexOf("sql server") != -1) {
if (db_version.startsWith("09.00") || db_version.startsWith("9.00")) { // SQL Server 2005
diff --git a/modules/core/dbutils/src/main/java/org/rhq/core/db/H2v12DatabaseType.java b/modules/core/dbutils/src/main/java/org/rhq/core/db/H2v12DatabaseType.java
new file mode 100644
index 0000000..42d164b
--- /dev/null
+++ b/modules/core/dbutils/src/main/java/org/rhq/core/db/H2v12DatabaseType.java
@@ -0,0 +1,42 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.core.db;
+
+/**
+ * H2 database version 1.2 which extends the abstract support for H2 database.
+ *
+ * @author Joseph Marques
+ */
+public class H2v12DatabaseType extends H2DatabaseType {
+ /**
+ * @see DatabaseType#getName()
+ */
+ @Override
+ public String getName() {
+ return H2DatabaseType.VENDOR_NAME + "v1.2";
+ }
+
+ /**
+ * @see DatabaseType#getVersion()
+ */
+ @Override
+ public String getVersion() {
+ return "1.2";
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
index 54ccd3f..40c2886 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
@@ -59,6 +59,7 @@ import org.rhq.core.clientapi.server.content.ContentServiceResponse;
import org.rhq.core.clientapi.server.content.DeletePackagesRequest;
import org.rhq.core.clientapi.server.content.DeployPackagesRequest;
import org.rhq.core.clientapi.server.content.RetrievePackageBitsRequest;
+import org.rhq.core.db.DatabaseTypeFactory;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.configuration.Configuration;
@@ -1585,10 +1586,15 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
* @param contentDetails
* @return PackageBits ref populated.
*/
- @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
private PackageBits loadPackageBits(InputStream packageBitStream, int packageVersionId, String packageName,
String packageVersion, PackageBits existingBits, Map<String, String> contentDetails) {
+ // If/When H2 handles blob update/streaming blobs we can get rid of this conditional code
+ if (DatabaseTypeFactory.isH2(DatabaseTypeFactory.getDefaultDatabaseType())) {
+ return loadPackageBitsH2(packageBitStream, packageVersionId, packageName, packageVersion, existingBits,
+ contentDetails);
+ }
+
// use existing or instantiate PackageBits instance.
PackageBits bits = (null == existingBits) ? initializePackageBits(null) : existingBits;
@@ -1596,7 +1602,7 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
PackageVersion pv = entityManager.find(PackageVersion.class, packageVersionId);
//associate the two if located.
- if (pv != null) {//np check.
+ if (null != pv) {
pv.setPackageBits(bits);
entityManager.flush();
}
@@ -1607,6 +1613,58 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
return bits;
}
+ private PackageBits loadPackageBitsH2(InputStream packageBitStream, int packageVersionId, String packageName,
+ String packageVersion, PackageBits existingBits, Map<String, String> contentDetails) {
+
+ PackageBits bits = null;
+ PackageBitsBlob blob = null;
+
+ // The blob cannot be updated, so we'll need to create a whole new row.
+ if (null != existingBits) {
+ blob = entityManager.find(PackageBitsBlob.class, existingBits.getId());
+ entityManager.remove(blob);
+ entityManager.flush();
+ }
+
+ // We have to work backwards to avoid constraint violations. PackageBits requires a PackageBitsBlob,
+ // so create and persist that first, getting the ID
+ blob = new PackageBitsBlob();
+ // just set the blob now, no streaming. The assumption is that H2 (demo) will not be using large blobs
+ byte[] bytes = StreamUtil.slurp(packageBitStream);
+ blob.setBits(bytes);
+ entityManager.persist(blob);
+ entityManager.flush();
+
+ // Now create the PackageBits entity and assign the Id and blob. Note, do not persist the
+ // entity, the row already exists (due to the blob persist above). Just perform and flush the update.
+ bits = new PackageBits();
+ bits.setId(blob.getId());
+ bits.setBlob(blob);
+ entityManager.flush();
+
+ //locate related packageVersion
+ PackageVersion pv = entityManager.find(PackageVersion.class, packageVersionId);
+
+ //associate the two if packageVersion exists.
+ if (null != pv) {
+ pv.setPackageBits(bits);
+ entityManager.flush();
+ }
+
+ // update contentDetails in needed
+ if (null != contentDetails) {
+ contentDetails.put(UPLOAD_FILE_SIZE, String.valueOf(bytes.length));
+ try {
+ contentDetails.put(UPLOAD_SHA256, new MessageDigestGenerator(MessageDigestGenerator.SHA_256)
+ .calcDigestString(bytes));
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to calculate SHA256 for package bits: ", e);
+ }
+ }
+
+ return bits;
+ }
+
/**
* This creates a new PackageBits entity initialized to EMPTY_BLOB for the associated PackageBitsBlob.
* Note that PackageBits and PackageBitsBlob are two entities that *share* the same db row. This is
diff --git a/pom.xml b/pom.xml
index 306bbff..e766f69 100644
--- a/pom.xml
+++ b/pom.xml
@@ -87,7 +87,7 @@
<ojdbc5.version>11.2.0.1.0</ojdbc5.version>
<ems.version>1.2.11</ems.version>
<postgresql.version>8.4-701.jdbc3</postgresql.version>
- <h2.version>1.1.117</h2.version>
+ <h2.version>1.2.139</h2.version>
<jtds.version>1.2.2</jtds.version>
<richfaces.version>3.3.3.CR1</richfaces.version>
<jline.version>0.9.94</jline.version>
13 years, 9 months
[rhq] 2 commits - etc/cli-scripts
by John Sanda
etc/cli-scripts/util.js | 95 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 95 insertions(+)
New commits:
commit d40f338fe64cc2a24b08e85a80d83fff458109c7
Merge: 5f825b8... b53c54e...
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Aug 18 10:28:47 2010 -0400
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 5f825b8c325fefc97c32af51c7fd19139e8229ca
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Aug 18 10:27:29 2010 -0400
Adding some generic utility functions for use in CLI scripts
diff --git a/etc/cli-scripts/util.js b/etc/cli-scripts/util.js
new file mode 100644
index 0000000..e0bb219
--- /dev/null
+++ b/etc/cli-scripts/util.js
@@ -0,0 +1,95 @@
+/**
+ * If obj is a JS array or a java.util.Collection, each element is passed to
+ * the callback function. If obj is a java.util.Map, each map entry is passed
+ * to the callback function as a key/value pair. If obj is none of the
+ * aforementioned types, it is treated as a generic object and each of its
+ * properties is passed to the callback function as a name/value pair.
+ */
+function foreach(obj, fn) {
+ if (obj instanceof Array) {
+ for (i in obj) {
+ fn(obj[i]);
+ }
+ }
+ else if (obj instanceof java.util.Collection) {
+ var iterator = obj.iterator();
+ while (iterator.hasNext()) {
+ fn(iterator.next());
+ }
+ }
+ else if (obj instanceof java.util.Map) {
+ var iterator = obj.entrySet().iterator()
+ while (iterator.hasNext()) {
+ var entry = iterator.next();
+ fn(entry.key, entry.value);
+ }
+ }
+ else { // assume we have a generic object
+ for (i in obj) {
+ fn(i, obj[i]);
+ }
+ }
+}
+
+/**
+ * Iterates over obj similar to foreach. fn should be a predicate that evaluates
+ * to true or false. The first match that is found is returned.
+ */
+function find(obj, fn) {
+ if (obj instanceof Array) {
+ for (i in obj) {
+ if (fn(obj[i])) {
+ return obj[i]
+ }
+ }
+ }
+ else if (obj instanceof java.util.Collection) {
+ var iterator = obj.iterator();
+ while (iterator.hasNext()) {
+ var next = iterator.next();
+ if (fn(next)) {
+ return next;
+ }
+ }
+ }
+ else if (obj instanceof java.util.Map) {
+ var iterator = obj.entrySet().iterator();
+ while (iterator.hasNext()) {
+ var entry = iterator.next();
+ if (fn(entry.key, entry.value)) {
+ return {key: entry.key, value: entry.value};
+ }
+ }
+ }
+ else {
+ for (i in obj) {
+ if (fn(i, obj[i])) {
+ return {key: i, value: obj[i]};
+ }
+ }
+ }
+ return null;
+}
+
+/**
+ * Iterates over obj similar to foreach. fn should be a predicate that evaluates
+ * to true or false. All of the matches are returned in a java.util.List.
+ */
+function findAll(obj, fn) {
+ var matches = java.util.ArrayList();
+ if ((obj instanceof Array) || (obj instanceof java.util.Collection)) {
+ foreach(obj, function(element) {
+ if (fn(element)) {
+ matches.add(element);
+ }
+ });
+ }
+ else {
+ foreach(obj, function(key, value) {
+ if (fn(theKey, theValue)) {
+ matches.add({key: theKey, value: theValue});
+ }
+ });
+ }
+ return matches;
+}
13 years, 9 months
[rhq] Branch 'release-3.0.0' - release.sh
by ips
release.sh | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
New commits:
commit 8e1c983c509790acc45a5db5ab314c552f3a5bd5
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Aug 17 19:01:46 2010 -0400
disable dry run for now
diff --git a/release.sh b/release.sh
index fd595a2..a9279a3 100644
--- a/release.sh
+++ b/release.sh
@@ -425,16 +425,16 @@ mvn clean $MAVEN_ARGS
# If this is a production build perform a dry run of tagging the release. Skip this for test builds to reduce the
# build time
-
-if [ "$MODE" = "production" ]; then
- echo "Doing a dry run of tagging the release..."
- mvn release:prepare $MAVEN_ARGS -DreleaseVersion=$RELEASE_VERSION -DdevelopmentVersion=$DEVELOPMENT_VERSION -Dresume=false -Dtag=$RELEASE_TAG "-DpreparationGoals=install $MAVEN_ARGS -Dmaven.test.skip=true -Ddbsetup-do-not-check-schema=true" -DdryRun=true
- [ "$?" -ne 0 ] && abort "Tagging dry run failed. Please see above Maven output for details, fix any issues, then try again."
- mvn release:clean $MAVEN_ARGS
- [ "$?" -ne 0 ] && abort "Failed to cleanup release plugin working files from tagging dry run. Please see above Maven output for details, fix any issues, then try again."
- echo
- echo "Tagging dry run succeeded!"
-fi
+# TODO: Re-enable this.
+#if [ "$MODE" = "production" ]; then
+# echo "Doing a dry run of tagging the release..."
+# mvn release:prepare $MAVEN_ARGS -DreleaseVersion=$RELEASE_VERSION -DdevelopmentVersion=$DEVELOPMENT_VERSION -Dresume=false -Dtag=$RELEASE_TAG "-DpreparationGoals=install $MAVEN_ARGS -Dmaven.test.skip=true -Ddbsetup-do-not-check-schema=true" -DdryRun=true
+# [ "$?" -ne 0 ] && abort "Tagging dry run failed. Please see above Maven output for details, fix any issues, then try again."
+# mvn release:clean $MAVEN_ARGS
+# [ "$?" -ne 0 ] && abort "Failed to cleanup release plugin working files from tagging dry run. Please see above Maven output for details, fix any issues, then try again."
+# echo
+# echo "Tagging dry run succeeded!"
+#fi
# If the dry run was skipped or succeeded, tag it for real.
13 years, 9 months
[rhq] Branch 'release-3.0.0' - pom.xml
by ips
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 985039301fb79b85affa16e97b49a2e78aee6c85
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Aug 17 18:50:19 2010 -0400
upgrade EMS from 1.2.11 to 1.2.15
diff --git a/pom.xml b/pom.xml
index 7ff85bb..0ffb5e7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -85,7 +85,7 @@
<jsf-api.version>1.2_14</jsf-api.version>
<jsf-impl.version>1.2_14</jsf-impl.version>
<ojdbc5.version>11.2.0.1.0</ojdbc5.version>
- <ems.version>1.2.11</ems.version>
+ <ems.version>1.2.15</ems.version>
<postgresql.version>8.4-701.jdbc3</postgresql.version>
<h2.version>1.1.117</h2.version>
<jtds.version>1.2.2</jtds.version>
13 years, 9 months
[rhq] pom.xml
by ips
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit b53c54eb2727ea1f98e103fee5f8d93e57a4c25d
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Aug 17 18:49:23 2010 -0400
upgrade EMS from 1.2.14 to 1.2.15
diff --git a/pom.xml b/pom.xml
index bc895da..13e4cc8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -85,7 +85,7 @@
<jsf-api.version>1.2_14</jsf-api.version>
<jsf-impl.version>1.2_14</jsf-impl.version>
<ojdbc5.version>11.2.0.1.0</ojdbc5.version>
- <ems.version>1.2.14</ems.version>
+ <ems.version>1.2.15</ems.version>
<postgresql.version>8.4-701.jdbc3</postgresql.version>
<h2.version>1.2.139</h2.version>
<jtds.version>1.2.2</jtds.version>
13 years, 9 months
[rhq] Branch 'release-3.0.0' - modules/plugins
by ips
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/helper/JmxConnectionHelper.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
New commits:
commit c450bad46b34128aa6c655d78e80544f9417dcc5
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Aug 17 16:40:12 2010 -0400
JmxConnectionHelper.loadConnection() should set JAR_TEMP_DIR EMS control prop to PC temp dir even when PC is running in embedded mode (i.e. in the admin-console) (https://bugzilla.redhat.com/show_bug.cgi?id=624817)
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/helper/JmxConnectionHelper.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/helper/JmxConnectionHelper.java
index 24e3b25..d6de3b5 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/helper/JmxConnectionHelper.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/helper/JmxConnectionHelper.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2009 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
@@ -189,12 +189,12 @@ public class JmxConnectionHelper {
// application files (making us unable to update them) Bug: JBNADM-670
connectionSettings.getControlProperties().setProperty(ConnectionFactory.COPY_JARS_TO_TEMP,
String.valueOf(Boolean.TRUE));
-
- // But tell it to put them in a place that we clean up when shutting down the agent
- connectionSettings.getControlProperties().setProperty(ConnectionFactory.JAR_TEMP_DIR,
- tmpDir.getAbsolutePath());
}
+ // Tell EMS to put its temp jars in a place that we clean up when shutting down the PC.
+ connectionSettings.getControlProperties().setProperty(ConnectionFactory.JAR_TEMP_DIR,
+ tmpDir.getAbsolutePath());
+
connectionSettings.getAdvancedProperties().setProperty(InternalVMTypeDescriptor.DEFAULT_DOMAIN_SEARCH,
"jboss");
13 years, 9 months