[rhq] modules/core modules/enterprise
by mazz
modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java | 3 ++-
modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
New commits:
commit f52524eb36fa6863d5500e35971b7e86d268f009
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Aug 25 10:50:12 2010 -0400
be defensive with entry.getSize() since it might return -1. this matches the same kind of fix we did in commit d7f47571f3e41951eb97fd07c5890c59a938d88a
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java b/modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java
index c8111fc..2a4e99d 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java
@@ -261,7 +261,8 @@ public class Deployer {
ZipUtil.walkZipFile(zipFile, new ZipEntryVisitor() {
public boolean visit(ZipEntry entry, ZipInputStream stream) throws Exception {
if (!entry.isDirectory()) {
- diskUsage.increaseDiskUsage(entry.getSize());
+ final long size = entry.getSize();
+ diskUsage.increaseDiskUsage(size > 0 ? size : 0);
diskUsage.incrementFileCount();
}
return true;
diff --git a/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java b/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java
index e9b82d2..4db9de9 100644
--- a/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java
+++ b/modules/enterprise/server/plugins/filetemplate-bundle/src/main/java/org/rhq/enterprise/server/plugins/filetemplate/BundleServerPluginComponent.java
@@ -211,7 +211,8 @@ public class BundleServerPluginComponent implements ServerPluginComponent, Bundl
public boolean visit(ZipEntry entry, ZipInputStream stream) throws Exception {
if (this.recipeName.equalsIgnoreCase(entry.getName())) {
// this should be safe downcast, recipes are not that big
- ByteArrayOutputStream out = new ByteArrayOutputStream((int) entry.getSize());
+ int contentSize = (int) entry.getSize();
+ ByteArrayOutputStream out = new ByteArrayOutputStream((contentSize > 0) ? contentSize : 32768);
StreamUtil.copy(stream, out, false);
this.recipe = new String(out.toByteArray());
out = null; // no need for this anymore, help out GC
13 years, 8 months
[rhq] 9 commits - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java | 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 20
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java | 47 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java | 40 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java | 44 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java | 40 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java | 49 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java | 29
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java | 20
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleSummaryStep.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDataStep.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadDistroFileStep.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java | 169 -----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/DeployStep.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentInfoStep.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDeploymentOptionsStep.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/GetDestinationStep.java | 3
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 | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java | 12
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java | 78 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java | 18
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java | 155 ++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java | 121 ++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java | 58 -
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 | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/revert/RevertStep.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java | 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java | 12
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java | 123 +---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java | 39 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/buttons/BackButton.java | 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/RadioGroupWithComponentsItem.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java | 56 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java | 123 ++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java | 22
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java | 25
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 148 ++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java | 35 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java | 86 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleDistributionFileUploadForm.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackForm.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java | 4
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 | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/content/repository/tree/ContentRepositoryTreeView.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java | 64 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java | 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletViewFactory.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java | 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java | 17
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java | 60 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java | 99 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java | 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedView.java | 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java | 47 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/TagCloudPortlet.java | 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MashupPortlet.java | 21
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MessagePortlet.java | 18
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java | 45 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java | 20
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 153 +++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java | 93 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java | 10
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/detail/monitoring/traits/TraitsView.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java | 42 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java | 29
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java | 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java | 158 ++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 296 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java | 86 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java | 17
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java | 255 +++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java | 144 ++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/event/EventHistoryView.java | 24
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java | 115 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java | 152 ++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java | 81 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/schedules/SchedulesView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsView.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java | 95 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/create/OperationSchedulingStep.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java | 107 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ConfigurationTemplateStep.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java | 80 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java | 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TagCloudView.java | 35 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java | 32 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java | 17
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/Locatable.java | 26
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableButton.java | 23
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableDialog.java | 33 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableDynamicForm.java | 22
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.java | 46 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHTMLPane.java | 34 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIMenuButton.java | 49 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableImg.java | 24
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableLabel.java | 49 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableLayout.java | 34 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableListGrid.java | 25
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableSectionStack.java | 34 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableStretchImgButton.java | 24
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTab.java | 70 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTabSet.java | 70 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTileLayout.java | 34 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableToolStrip.java | 34 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTransferImgButton.java | 20
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTreeGrid.java | 23
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableVLayout.java | 43 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/SeleniumUtility.java | 66 +-
127 files changed, 2814 insertions(+), 2322 deletions(-)
New commits:
commit ce8ddc2516d06d0f054d5cc761f19889294845c5
Merge: fa821d1... f129f33...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Aug 25 10:28:25 2010 -0400
Merge branch 'master' into master-jay
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTransferImgButton.java
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index b6308aa,053c330..2e0003f
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@@ -55,12 -55,9 +55,13 @@@ public class AdministrationView extend
private SectionStack sectionStack;
private Canvas contentCanvas;
+ private Canvas currentContent;
private LinkedHashMap<String, TreeGrid> treeGrids = new LinkedHashMap<String, TreeGrid>();
+ public AdministrationView(String locatorId) {
+ super(locatorId);
+ }
+
@Override
protected void onInit() {
super.onInit();
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
index 819ca9e,f5af5a9..5aefeec
--- 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
@@@ -52,7 -56,7 +57,7 @@@ import org.rhq.enterprise.gui.coregui.c
/**
* @author Greg Hinkle
*/
- public class UserEditView extends LocatableVLayout {
-public class UserEditView extends VLayout implements BookmarkableView {
++public class UserEditView extends LocatableVLayout implements BookmarkableView {
private Label message = new Label("Select a user to edit...");
@@@ -245,4 -247,44 +250,41 @@@
editorWindow.show();
}
+
- public static void editNew() {
- UserEditView editView = new UserEditView();
++ public static void editNew(String locatorId) {
++ UserEditView editView = new UserEditView(locatorId);
+ editView.editNewInternal();
+
+ }
+
+ private void editSubject(int subjectId, final ViewId current) {
+
+ SubjectCriteria criteria = new SubjectCriteria();
+ criteria.fetchRoles(true);
+ criteria.fetchConfiguration(true);
+
- GWTServiceLookup.getSubjectService().findSubjectsByCriteria(criteria,
- new AsyncCallback<PageList<Subject>>() {
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load subject for editing",caught);
- }
++ GWTServiceLookup.getSubjectService().findSubjectsByCriteria(criteria, new AsyncCallback<PageList<Subject>>() {
++ @Override
++ public void onFailure(Throwable caught) {
++ CoreGUI.getErrorHandler().handleError("Failed to load subject for editing", caught);
++ }
+
- @Override
- public void onSuccess(PageList<Subject> result) {
- Subject subject = result.get(0);
- Record record = new UsersDataSource().copyValues(subject);
- editRecord(record);
++ @Override
++ public void onSuccess(PageList<Subject> result) {
++ Subject subject = result.get(0);
++ Record record = new UsersDataSource().copyValues(subject);
++ editRecord(record);
+
- current.getBreadcrumbs().get(0).setDisplayName("Editing: " + subject.getName());
- CoreGUI.refreshBreadCrumbTrail();
- }
- });
++ current.getBreadcrumbs().get(0).setDisplayName("Editing: " + subject.getName());
++ CoreGUI.refreshBreadCrumbTrail();
++ }
++ });
+ }
+
+ @Override
+ public void renderView(ViewPath viewPath) {
+ int userId = viewPath.getCurrentAsInt();
+
-
-
+ editSubject(userId, viewPath.getCurrent());
+ }
}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index 70349b6,441fcd5..aa0cf64
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@@ -27,10 -28,10 +28,10 @@@ import org.rhq.enterprise.gui.coregui.c
/**
* @author Greg Hinkle
*/
- public class UsersView extends Table {
+ public class UsersView extends TableSection {
- public UsersView() {
- super("Users View");
+ public UsersView(String locatorId) {
+ super(locatorId, "Users View");
final UsersDataSource datasource = UsersDataSource.getInstance();
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index 565c5ce,a607496..0b2037d
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@@ -75,16 -73,14 +75,16 @@@ public class SubTabLayout extends Locat
int i = 0;
- for (final String title : subtabs.keySet()) {
+ for (final String locatorId : subtabs.keySet()) {
+
+ SubTab subTab = subtabs.get(locatorId);
if (currentlySelected == null) {
- currentlyDisplayed = subTab;
-// currentlyDisplayed = subtabs.get(title);
- currentlySelected = title;
++ // currentlyDisplayed = subTab;
+ currentlySelected = locatorId;
}
- Button button = new Button(title);
+ Button button = new LocatableButton(locatorId, subTab.getTitle());
button.setShowRollOver(false);
button.setActionType(SelectionType.RADIO);
button.setRadioGroup("subtabs");
@@@ -151,20 -149,20 +151,23 @@@
oldCanvas.destroy();
}
- subtabs.put(title, canvas);
- if (isDrawn() && title.equals(currentlySelected)) {
- draw(canvas);
+ String locatorId = subTab.getLocatorId();
+ subtabs.put(locatorId, subTab);
+ if (isDrawn() && locatorId.equals(currentlySelected)) {
+ draw(subTab);
}
-
}
- private void draw(Canvas canvas) {
- if (currentlyDisplayed != null && currentlyDisplayed != canvas) {
+ private void draw(SubTab subTab) {
- // if (currentlyDisplayed != null) {
- // currentlyDisplayed.getCanvas().hide();
- // // removeMember(currentlyDisplayed);
- // }
++ if (currentlyDisplayed != null && currentlyDisplayed.getCanvas() != subTab.getCanvas()) {
+ try {
- currentlyDisplayed.hide();
- } catch (Exception e) { } // ignore this
++ currentlyDisplayed.getCanvas().hide();
++ } catch (Exception e) {
++ // ignore this
++ }
+ }
+ Canvas canvas = subTab.getCanvas();
if (canvas != null) {
if (hasMember(canvas)) {
canvas.show();
commit fa821d19735be618b098b9c0eec9974fc2d42229
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Aug 25 10:10:14 2010 -0400
Selemium Work
- Disable ID Override
- Add more locators to Bundle Stack
- Fix issues with new SubTab object handling
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
index 6917f54..20188dd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
@@ -33,6 +33,7 @@ import org.rhq.enterprise.gui.coregui.client.bundle.list.BundlesListView;
import org.rhq.enterprise.gui.coregui.client.bundle.tree.BundleTreeView;
import org.rhq.enterprise.gui.coregui.client.content.repository.tree.ContentRepositoryTreeView;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableSectionStack;
/**
* @author Greg Hinkle
@@ -57,19 +58,19 @@ public class BundleTopView extends LocatableHLayout implements BookmarkableView
protected void onDraw() {
super.onDraw();
- SectionStack sectionStack = new SectionStack();
+ SectionStack sectionStack = new LocatableSectionStack(getLocatorId());
sectionStack.setShowResizeBar(true);
sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
sectionStack.setWidth(250);
sectionStack.setHeight100();
SectionStackSection bundlesSection = new SectionStackSection("Bundles");
- bundleTreeView = new BundleTreeView();
+ bundleTreeView = new BundleTreeView(extendLocatorId("BundleTree"));
bundlesSection.addItem(bundleTreeView);
sectionStack.addSection(bundlesSection);
SectionStackSection repositoriesSection = new SectionStackSection("Repositories");
- ContentRepositoryTreeView repoTree = new ContentRepositoryTreeView();
+ ContentRepositoryTreeView repoTree = new ContentRepositoryTreeView(extendLocatorId("RepoTree"));
repositoriesSection.addItem(repoTree);
sectionStack.addSection(repositoriesSection);
@@ -108,14 +109,14 @@ public class BundleTopView extends LocatableHLayout implements BookmarkableView
bundlesListView.refresh();
} else {
currentNextPath = null;
- this.bundlesListView = new BundlesListView(getLocatorId());
+ this.bundlesListView = new BundlesListView(extendLocatorId("BundleList"));
setContent(this.bundlesListView);
}
} else {
viewPath.getCurrent().getBreadcrumbs().clear();
if (!viewPath.getNext().equals(currentNextPath)) {
currentNextPath = viewPath.getNext();
- bundleView = new BundleView(getLocatorId());
+ bundleView = new BundleView(extendLocatorId("Bundle"));
setContent(bundleView);
bundleView.renderView(viewPath.next());
} else {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
index 000af5f..c795669 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/tree/BundleTreeView.java
@@ -26,28 +26,25 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.user.client.History;
import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeNode;
import com.smartgwt.client.widgets.tree.events.NodeClickEvent;
import com.smartgwt.client.widgets.tree.events.NodeClickHandler;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
/**
* @author Greg Hinkle
*/
-public class BundleTreeView extends TreeGrid {
-
- public BundleTreeView() {
+public class BundleTreeView extends LocatableTreeGrid {
+ public BundleTreeView(String locatorId) {
+ super(locatorId);
setWidth100();
setHeight100();
setLeaveScrollbarGap(false);
-// setShowRoot(true);
+ // setShowRoot(true);
setAutoFetchData(true);
setAnimateFolders(false);
setSelectionType(SelectionStyle.SINGLE);
@@ -67,7 +64,6 @@ public class BundleTreeView extends TreeGrid {
public void selectPath(ViewPath viewPath) {
-
if (viewPath.viewsLeft() > 0) {
String key = "";
for (ViewId view : viewPath.getViewPath().subList(2, viewPath.getViewPath().size())) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java
index a0f4ab9..e6be4f8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java
@@ -32,7 +32,7 @@ public class SubTab {
private Canvas canvas;
public SubTab(String locatorId, String title, Canvas canvas) {
- super();
+ this.locatorId = locatorId;
this.title = title;
this.canvas = canvas;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index 90a758f..565c5ce 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -196,6 +196,10 @@ public class SubTabLayout extends LocatableVLayout {
return currentIndex;
}
+ public String getCurrentTitle() {
+ return subtabs.get(currentlySelected).getTitle();
+ }
+
public boolean selectTabByLocatorId(String locatorId) {
boolean foundTab = false;
currentlySelected = locatorId;
@@ -249,7 +253,7 @@ public class SubTabLayout extends LocatableVLayout {
}
public void fireSubTabSelection() {
- TwoLevelTabSelectedEvent event = new TwoLevelTabSelectedEvent("?", currentlySelected, -1, currentIndex,
+ TwoLevelTabSelectedEvent event = new TwoLevelTabSelectedEvent("?", getCurrentTitle(), -1, currentIndex,
currentlyDisplayed.getCanvas());
hm.fireEvent(event);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
index 56c7e22..de4a27c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
@@ -60,9 +60,9 @@ public class TwoLevelTabSet extends LocatableTabSet implements TabSelectedHandle
TwoLevelTab tab = (TwoLevelTab) getSelectedTab();
- TwoLevelTabSelectedEvent event = new TwoLevelTabSelectedEvent(getSelectedTab().getTitle(),
- tab.getLayout().currentlySelected, tabSelectedEvent.getTabNum(), tab.getLayout().getCurrentIndex(), tab
- .getLayout().currentlyDisplayed.getCanvas());
+ TwoLevelTabSelectedEvent event = new TwoLevelTabSelectedEvent(tab.getTitle(),
+ tab.getLayout().getCurrentTitle(), tabSelectedEvent.getTabNum(), tab.getLayout().getCurrentIndex(), tab
+ .getLayout().getCurrentCanvas());
m.fireEvent(event);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/content/repository/tree/ContentRepositoryTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/content/repository/tree/ContentRepositoryTreeView.java
index 364fc67..79b1162 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/content/repository/tree/ContentRepositoryTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/content/repository/tree/ContentRepositoryTreeView.java
@@ -26,22 +26,21 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.user.client.History;
import com.smartgwt.client.types.SelectionStyle;
-import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeNode;
import com.smartgwt.client.widgets.tree.events.NodeClickEvent;
import com.smartgwt.client.widgets.tree.events.NodeClickHandler;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
-import org.rhq.enterprise.gui.coregui.client.bundle.tree.BundleTreeDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
/**
* @author Greg Hinkle
*/
-public class ContentRepositoryTreeView extends TreeGrid {
-
- public ContentRepositoryTreeView() {
+public class ContentRepositoryTreeView extends LocatableTreeGrid {
+ public ContentRepositoryTreeView(String locatorId) {
+ super(locatorId);
setWidth100();
setHeight100();
@@ -100,6 +99,5 @@ public class ContentRepositoryTreeView extends TreeGrid {
selectRecord(0);
}
-
}
}
\ No newline at end of file
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
index ac930e2..f6734c5 100644
--- 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
@@ -16,7 +16,7 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
*/
public class SeleniumUtility {
- private static final boolean USE_DEFAULT_IDS = false;
+ private static final boolean USE_DEFAULT_IDS = true;
/** 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";
@@ -29,22 +29,24 @@ public class SeleniumUtility {
* @return the updated widget
*/
static public <T extends BaseWidget> T setID(final T widget, String locatorId) {
- if (!USE_DEFAULT_IDS) {
- String unsafeId = widget.getScClassName() + "-" + locatorId;
- String safeId = SeleniumUtility.getSafeId(unsafeId, DEFAULT_ID);
- Canvas canvasWithId = Canvas.getById(safeId);
- if (null != canvasWithId) {
- try {
- canvasWithId.destroy();
- CoreGUI.getMessageCenter().notify(
- new Message("ID Conflict resolved: " + safeId, getSmallStackTrace(null), Severity.Info));
- } catch (Throwable t) {
- CoreGUI.getMessageCenter().notify(
- new Message("ID Conflict unresolved: " + getSmallStackTrace(t), Severity.Info));
- }
+ if (USE_DEFAULT_IDS) {
+ return widget;
+ }
+
+ String unsafeId = widget.getScClassName() + "-" + locatorId;
+ String safeId = SeleniumUtility.getSafeId(unsafeId, DEFAULT_ID);
+ Canvas canvasWithId = Canvas.getById(safeId);
+ if (null != canvasWithId) {
+ try {
+ canvasWithId.destroy();
+ CoreGUI.getMessageCenter().notify(
+ new Message("ID Conflict resolved: " + safeId, getSmallStackTrace(null), Severity.Warning));
+ } catch (Throwable t) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("ID Conflict unresolved: " + getSmallStackTrace(t), Severity.Info));
}
- widget.setID(SeleniumUtility.getSafeId(unsafeId, DEFAULT_ID));
}
+ widget.setID(safeId);
return widget;
}
@@ -76,11 +78,13 @@ public class SeleniumUtility {
* @return the updated uiObject
*/
static public <T extends UIObject> T setHtmlId(final T uiObject, String unsafeId) {
- if (!USE_DEFAULT_IDS) {
- String id = getSafeId(unsafeId, String.valueOf(uiObject.hashCode()));
- uiObject.getElement().setAttribute("id", id);
+ if (USE_DEFAULT_IDS) {
+ return uiObject;
}
+ String id = getSafeId(unsafeId, String.valueOf(uiObject.hashCode()));
+ uiObject.getElement().setAttribute("id", id);
+
return uiObject;
}
commit 2e3d461c5054a02a946a1d9e2f00de988812253c
Merge: 030243f... 6221a8a...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Aug 25 10:07:50 2010 -0400
Merge branch 'master' into master-jay
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
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/components/tagging/TagEditorView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.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/definitions/GroupDefinitionListView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableListGrid.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableVLayout.java
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RoleEditView.java
index 5b76f3a,5b76f3a..a30ec00
--- 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
@@@ -54,11 -54,11 +54,13 @@@ import org.rhq.enterprise.gui.coregui.c
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 org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
++import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
--public class RoleEditView extends VLayout {
++public class RoleEditView extends LocatableVLayout {
private Role roleBeingEdited;
@@@ -77,8 -77,8 +79,8 @@@
private Window editorWindow;
-- public RoleEditView() {
-- super();
++ public RoleEditView(String locatorId) {
++ super(locatorId);
setPadding(10);
setOverflow(Overflow.AUTO);
@@@ -100,7 -100,7 +102,7 @@@
editCanvas.addMember(editLabel);
-- form = new DynamicForm();
++ form = new LocatableDynamicForm(getLocatorId());
form.setWidth100();
form.setDataSource(RolesDataSource.getInstance());
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
index c00947d,f2d47bd..55d5bb7
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
@@@ -34,74 -30,56 +30,48 @@@ import org.rhq.enterprise.gui.coregui.c
/**
* @author Greg Hinkle
*/
- public class RolesView extends LocatableVLayout implements BookmarkableView {
+ public class RolesView extends TableSection implements BookmarkableView {
+ public RolesView(String locatorId) {
- super(locatorId);
- }
-
- @Override
- protected void onInit() {
- super.onInit();
-
- setWidth100();
- setHeight100();
++ super(locatorId, "Roles");
- public RolesView() {
- super("Roles");
final RolesDataSource datasource = RolesDataSource.getInstance();
+ setDataSource(datasource);
+ }
- final Table table = new Table(getLocatorId(), "Roles");
- table.setHeight("50%");
- table.setShowResizeBar(true);
- table.setResizeBarTarget("next");
- table.setDataSource(datasource);
-
- ListGridField idField = new ListGridField("id", "Id", 55);
- idField.setType(ListGridFieldType.INTEGER);
-
- ListGridField nameField = new ListGridField("name", "Name");
-
- table.getListGrid().setFields(idField, nameField);
+ @Override
+ protected void configureTable() {
+ super.configureTable();
- table.addTableAction("RemoveRole", "Remove", Table.SelectionEnablement.ANY,
-
- addTableAction("Remove",
- Table.SelectionEnablement.ANY,
- "Are you sure you want to delete # roles?",
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- getListGrid().removeSelectedData();
- }
- });
-
- addTableAction("Add Role",
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- createRole();
- }
- });
-
++ addTableAction(extendLocatorId("Delete"), "Delete", Table.SelectionEnablement.ANY,
+ "Are you sure you want to delete # roles?", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
- table.getListGrid().removeSelectedData();
++ getListGrid().removeSelectedData();
+ }
+ });
+
- table.addTableAction("AddRole", "Add Role", new TableAction() {
++ addTableAction(extendLocatorId("New"), "New", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ createRole();
+ }
+ });
-
- addMember(table);
-
- final RoleEditView roleEditor = new RoleEditView();
- roleEditor.setOverflow(Overflow.AUTO);
- addMember(roleEditor);
-
- table.getListGrid().addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (selectionEvent.getState()) {
- roleEditor.editRecord(selectionEvent.getRecord());
- } else {
- roleEditor.editNone();
- }
- }
- });
}
-
public void createRole() {
--
-- RoleEditView editView = new RoleEditView();
++ RoleEditView editView = new RoleEditView(extendLocatorId("Edit"));
editView.editNew();
}
+ @Override
+ public Canvas getDetailsView(int id) {
- RoleEditView editor = new RoleEditView();
++ RoleEditView editor = new RoleEditView(extendLocatorId("Detail"));
+
+ return editor;
+ }
+
public void renderView(ViewPath viewPath) {
System.out.println("Display role list");
--
}
}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
index 6042b4f,6042b4f..819ca9e
--- 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
@@@ -47,11 -47,11 +47,12 @@@ import org.rhq.enterprise.gui.coregui.c
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 org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
--public class UserEditView extends VLayout {
++public class UserEditView extends LocatableVLayout {
private Label message = new Label("Select a user to edit...");
@@@ -70,7 -70,7 +71,9 @@@
private Window editorWindow;
private SubjectRoleSelector roleSelector;
-- public UserEditView() {
++ public UserEditView(String locatorId) {
++ super(locatorId);
++
dataSource = UsersDataSource.getInstance();
setWidth100();
@@@ -223,7 -223,7 +226,7 @@@
markForRedraw();
}
-- private void editNewInternal() {
++ public void editNewInternal() {
subject = new Subject();
ListGridRecord r = dataSource.copyValues(subject);
editRecord(r);
@@@ -242,11 -242,11 +245,4 @@@
editorWindow.show();
}
--
-- public static void editNew() {
-- UserEditView editView = new UserEditView();
-- editView.editNewInternal();
--
-- }
--
}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index 6e49288,b194c1e..70349b6
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@@ -34,73 -27,50 +27,44 @@@ import org.rhq.enterprise.gui.coregui.c
/**
* @author Greg Hinkle
*/
- public class UsersView extends LocatableVLayout {
+ public class UsersView extends Table {
- public UsersView() {
- super("Users View");
+ public UsersView(String locatorId) {
- super(locatorId);
- setWidth100();
- setHeight100();
- }
-
- @Override
- protected void onInit() {
- super.onInit();
++ super(locatorId, "Users View");
final UsersDataSource datasource = UsersDataSource.getInstance();
- final Table table = new Table(getLocatorId(), "Users");
- table.setHeight("50%");
- table.setShowResizeBar(true);
- table.setDataSource(datasource);
-
- ListGridField idField = new ListGridField("id", "Id", 55);
- idField.setType(ListGridFieldType.INTEGER);
-
- ListGridField nameField = new ListGridField("name", "User Name", 100);
-
- ListGridField emailField = new ListGridField("emailAddress", "Email Address");
+ setDataSource(datasource);
+ }
- table.getListGrid().setFields(idField, nameField, emailField);
+ @Override
+ protected void configureTable() {
- ToolStrip toolStrip = new ToolStrip();
- toolStrip.setWidth100();
- toolStrip.setMembersMargin(15);
-
+ getListGrid().getField("id").setWidth(55);
+ getListGrid().getField("name").setWidth(100);
- table.addTableAction("RemoveUser", "Remove", Table.SelectionEnablement.ANY,
- addTableAction("Remove",
- Table.SelectionEnablement.ANY,
- "Are you sure you want to delete # users?",
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- getListGrid().removeSelectedData();
- }
- });
-
- addTableAction("Add User",
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- createUser();
- }
- });
++ addTableAction(extendLocatorId("Delete"), "Delete", Table.SelectionEnablement.ANY,
+ "Are you sure you want to delete # users?", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
- table.getListGrid().removeSelectedData();
++ getListGrid().removeSelectedData();
+ }
+ });
+
- table.addTableAction("AddUser", "Add User", new TableAction() {
++ addTableAction(extendLocatorId("New"), "New", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ createUser();
+ }
+ });
-
- final UserEditView userEditor = new UserEditView();
-
- final SectionStackSection detailsSection = new SectionStackSection("Details");
- detailsSection.setItems(new Label("Select a user to edit..."));
- detailsSection.setExpanded(false);
-
- table.getListGrid().addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (selectionEvent.getState()) {
- userEditor.editRecord(selectionEvent.getRecord());
- } else {
- userEditor.editNone();
- }
- }
- });
-
- addMember(table);
- addMember(userEditor);
}
-
public void createUser() {
- UserEditView.editNew();
++ UserEditView editView = new UserEditView(extendLocatorId("Edit"));
++ editView.editNewInternal();
+ }
+
-
+ public Canvas getDetailsView(int id) {
- final UserEditView userEditor = new UserEditView();
-
++ final UserEditView userEditor = new UserEditView(extendLocatorId("Detail"));
- UserEditView.editNew();
+ return userEditor;
}
}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
index ab863ad,cd9c95c..6e62db3
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@@ -87,9 -88,9 +87,8 @@@ public class AlertsView extends Table
showDetails = false;
}
-
@Override
- protected void onInit() {
- super.onInit();
+ protected void configureTable() {
// Add the list table as the top half of the view.
//Criteria criteria = new Criteria(AlertCriteria.);
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
index 7751ac1,0d2e070..e5dcc33
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
@@@ -37,16 -37,16 +37,14 @@@ import org.rhq.enterprise.gui.coregui.c
*/
public class BundleDeploymentListView extends Table {
- public BundleDeploymentListView(Criteria criteria) {
- super("Bundle Deployments", criteria);
+ public BundleDeploymentListView(String locatorId, Criteria criteria) {
+ super(locatorId, "Bundle Deployments", criteria);
+ setDataSource(new BundleDeploymentDataSource());
+ setHeaderIcon("subsystems/bundle/BundleDeployment_24.png");
}
-
-
@Override
- protected void onInit() {
- super.onInit();
- setHeaderIcon("subsystems/bundle/BundleDeployment_24.png");
-
- setDataSource(new BundleDeploymentDataSource());
+ protected void configureTable() {
getListGrid().getField("id").setWidth("60");
getListGrid().getField("name").setWidth("25%");
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
index cdf87b2,9883a72..e0580b0
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
@@@ -37,22 -37,24 +37,18 @@@ import org.rhq.enterprise.gui.coregui.c
*/
public class BundleDestinationListView extends Table {
-
-
- public BundleDestinationListView() {
- super("Bundle Destinations");
-
+ public BundleDestinationListView(String locatorId) {
- super(locatorId, "Bundle Destinations");
-
++ this(locatorId, null);
}
- public BundleDestinationListView(Criteria criteria) {
- super("Bundle Destinations", criteria);
+ public BundleDestinationListView(String locatorId, Criteria criteria) {
+ super(locatorId, "Bundle Destinations", criteria);
setHeaderIcon("subsystems/bundle/BundleDestination_24.png");
+ setDataSource(new BundleDestinationDataSource());
}
-
@Override
- protected void onInit() {
- super.onInit();
-
- setDataSource(new BundleDestinationDataSource());
-
+ protected void configureTable() {
-
-
getListGrid().getField("id").setWidth(45);
getListGrid().getField("name").setWidth("20%");
getListGrid().getField("name").setCellFormatter(new CellFormatter() {
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
index 6f26471,b102441..d97ccf9
--- 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
@@@ -43,14 -43,17 +43,14 @@@ import org.rhq.enterprise.gui.coregui.c
*/
public class BundlesListView extends Table {
- public BundlesListView() {
- this(null);
+ public BundlesListView(String locatorId) {
- super(locatorId, "Bundles");
- setWidth100();
- setHeight100();
++ this(locatorId, null);
}
- public BundlesListView(Criteria criteria) {
- super("Bundles", criteria);
-
+ public BundlesListView(String locatorId, Criteria criteria) {
+ super(locatorId, "Bundles", criteria);
+ setHeaderIcon("subsystems/bundle/Bundle_24.png");
-
+ setDataSource(new BundlesWithLatestVersionDataSource());
-
}
@Override
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java
index 438473d,04aa55d..69e182c
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java
@@@ -36,24 -36,19 +36,20 @@@ import org.rhq.enterprise.gui.coregui.c
*/
public class BundleVersionListView extends Table {
+ public BundleVersionListView(String locatorId) {
- super(locatorId);
++ this(locatorId, null);
+ }
- public BundleVersionListView(Criteria criteria) {
- super("Bundle Versions", criteria);
+ public BundleVersionListView(String locatorId, Criteria criteria) {
+ super(locatorId, "Bundle Versions", criteria);
setHeaderIcon("subsystems/bundle/BundleVersion_24.png");
+ BundleVersionDataSource bundleVersionsDataSource = new BundleVersionDataSource();
+ setDataSource(bundleVersionsDataSource);
}
-
@Override
- protected void onInit() {
- super.onInit();
-
- setHeight100();
-
- BundleVersionDataSource bundleVersionsDataSource = new BundleVersionDataSource();
- setDataSource(bundleVersionsDataSource);
+ protected void configureTable() {
-
getListGrid().getField("id").setWidth("60");
getListGrid().getField("name").setWidth("25%");
getListGrid().getField("name").setCellFormatter(new CellFormatter() {
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index bb7ece4,d9429f4..90a758f
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@@ -118,13 -114,21 +118,20 @@@ public class SubTabLayout extends Locat
-
}
// Initial settings
-- selectTab(currentlySelected);
++ selectTabByLocatorId(currentlySelected);
}
- public void enableSubTab(String locatorId) {
- disabledSubTabs.remove(locatorId);
- if (subTabButtons.containsKey(locatorId)) {
- subTabButtons.get(locatorId).enable();
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
- selectTab(currentlySelected);
++ selectTabByLocatorId(currentlySelected);
+ }
+
+ public void enableSubTab(String title) {
+ disabledSubTabs.remove(title);
+ if (subTabButtons.containsKey(title)) {
+ subTabButtons.get(title).enable();
markForRedraw();
}
}
@@@ -137,21 -141,27 +144,27 @@@
}
}
- public void updateSubTab(String title, Canvas canvas) {
-
+ public void updateSubTab(SubTab subTab) {
+ // Destroy old views so they don't leak
- Canvas oldCanvas = subtabs.get(title);
++ Canvas oldCanvas = subTab.getCanvas();
+ if (oldCanvas != null) {
+ oldCanvas.destroy();
+ }
+
- subtabs.put(title, canvas);
- if (isDrawn() && title.equals(currentlySelected)) {
- draw(canvas);
+ String locatorId = subTab.getLocatorId();
+ subtabs.put(locatorId, subTab);
+ if (isDrawn() && locatorId.equals(currentlySelected)) {
+ draw(subTab);
}
-
}
- private void draw(Canvas canvas) {
-// if (currentlyDisplayed != null && currentlyDisplayed != canvas && currentlyDisplayed.isDrawn()) {
-// currentlyDisplayed.hide();
-// // removeMember(currentlyDisplayed);
-// }
+ private void draw(SubTab subTab) {
- if (currentlyDisplayed != null) {
- currentlyDisplayed.getCanvas().hide();
- // removeMember(currentlyDisplayed);
- }
++ // if (currentlyDisplayed != null) {
++ // currentlyDisplayed.getCanvas().hide();
++ // // removeMember(currentlyDisplayed);
++ // }
+ Canvas canvas = subTab.getCanvas();
if (canvas != null) {
if (hasMember(canvas)) {
canvas.show();
@@@ -183,31 -191,27 +196,49 @@@
return currentIndex;
}
- public SubTab getSubTab(String locatorId) {
- return subtabs.get(locatorId);
- }
-
- public boolean selectTab(String locatorId) {
++ public boolean selectTabByLocatorId(String locatorId) {
+ boolean foundTab = false;
+ currentlySelected = locatorId;
+ int i = 0;
+ for (String sub : subtabs.keySet()) {
+ if (sub.equals(locatorId)) {
+ currentIndex = i;
+ foundTab = true;
+ break;
+ }
+ i++;
+ }
+
+ if (isDrawn()) {
+ ((Button) buttonBar.getMember(currentIndex)).select();
+ draw(subtabs.get(locatorId));
+ }
+
+ return foundTab;
+ }
+
+ public boolean selectTab(String title) {
+ boolean foundTab = false;
- currentlySelected = title;
+ int i = 0;
+ for (String sub : subtabs.keySet()) {
- if (sub.equals(title)) {
++ SubTab subtab = subtabs.get(sub);
++ if (subtab.getTitle().equals(title)) {
++ this.currentlySelected = subtab.getLocatorId();
+ currentIndex = i;
+ foundTab = true;
+ break;
+ }
+ i++;
+ }
+
+ if (isDrawn()) {
+ ((Button) buttonBar.getMember(currentIndex)).select();
- draw(subtabs.get(title));
++ draw(subtabs.get(currentlySelected));
+ }
+
+ return foundTab;
+ }
+
// ------- Event support -------
// Done with a separate handler manager from parent class on purpose (compatibility issue)
@@@ -219,7 -223,22 +250,22 @@@
public void fireSubTabSelection() {
TwoLevelTabSelectedEvent event = new TwoLevelTabSelectedEvent("?", currentlySelected, -1, currentIndex,
- currentlyDisplayed);
+ currentlyDisplayed.getCanvas());
hm.fireEvent(event);
}
+
+ public Canvas getCurrentCanvas() {
- return currentlyDisplayed != null ? currentlyDisplayed : subtabs.get(currentlySelected);
++ return currentlyDisplayed != null ? currentlyDisplayed.getCanvas() : subtabs.get(currentlySelected).getCanvas();
+ }
+
+ /**
+ * Destroy all the currently held views so that they can be replaced with new versions
+ */
+ public void destroyViews() {
- for (Canvas subtabCanvas : subtabs.values()) {
- if (subtabCanvas != null) {
- subtabCanvas.destroy();
++ for (SubTab subtab : subtabs.values()) {
++ if (subtab.getCanvas() != null) {
++ subtab.getCanvas().destroy();
+ }
+ }
+ }
}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index a96c372,22e25f4..b167872
--- 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
@@@ -56,8 -58,12 +58,11 @@@ public class Table extends LocatableHLa
private static final SelectionEnablement DEFAULT_SELECTION_ENABLEMENT = SelectionEnablement.ALWAYS;
-
+ protected VLayout contents;
+
private HTMLFlow title;
+ private HLayout titleLayout;
private Canvas titleComponent;
private ListGrid listGrid;
@@@ -132,13 -141,24 +144,22 @@@
setWidth100();
setHeight100();
+ setOverflow(Overflow.HIDDEN);
- // Title
- title = new HTMLFlow();
- setTableTitle(tableTitle);
+ this.tableTitle = tableTitle;
+ this.criteria = criteria;
+ this.sortSpecifiers = sortSpecifiers;
+ this.excludedFieldNames = excludedFieldNames;
+ this.autoFetchData = autoFetchData;
+ }
+
-
+ @Override
+ protected void onInit() {
+ super.onInit();
-// Grid
- listGrid = new LocatableListGrid(tableTitle);
- listGrid.setAutoFetchData(autoFetchData);
+
++ listGrid = new LocatableListGrid(getLocatorId());
++ listGrid.setAutoFetchData(autoFetchData);
- // Grid
- listGrid = new LocatableListGrid(locatorId);
if (criteria != null) {
listGrid.setInitialCriteria(criteria);
}
@@@ -158,21 -177,69 +178,57 @@@
//listGrid.setRecordCanSelectProperty("foobar");
listGrid.setRecordEditProperty("foobar");
+ if (dataSource != null) {
+ listGrid.setDataSource(dataSource);
+ }
+
+ contents = new VLayout();
+ contents.setWidth100();
+ contents.setHeight100();
+ addMember(contents);
+
+ contents.addMember(listGrid);
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
-
-
-
+ for (Canvas child : contents.getMembers()) {
+ contents.removeChild(child);
+ }
+
-
-
+ // Title
+ title = new HTMLFlow();
+ setTableTitle(tableTitle);
+
-
+ if (showHeader) {
+ titleLayout = new HLayout();
+ titleLayout.setAutoHeight();
+ titleLayout.setAlign(VerticalAlignment.BOTTOM);
+
+ }
+
-
-
-
+ // Add components to the view
+ if (showHeader) {
- contents.addMember(titleLayout,0);
++ contents.addMember(titleLayout, 0);
+ }
+
+ contents.addMember(listGrid);
+
// Footer
footer = new ToolStrip();
footer.setPadding(5);
footer.setWidth100();
footer.setMembersMargin(15);
+ contents.addMember(footer);
- tableInfo = new Label("Total: " + listGrid.getTotalRows());
-
+ // The ListGrid has been created and configured
+ // Now give extensions a chance to configure the table
+ configureTable();
- this.excludedFieldNames = excludedFieldNames;
- }
--
- @Override
- protected void onInit() {
- super.onInit();
+ tableInfo = new Label("Total: " + listGrid.getTotalRows());
-
// 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).
@@@ -184,20 -251,10 +240,8 @@@
tableInfo.setWrap(false);
- }
--
- @Override
- protected void onDraw() {
- super.onDraw();
-
- removeMembers(getMembers());
-
if (showHeader) {
- HLayout titleLayout = new HLayout();
- titleLayout.setAutoHeight();
- titleLayout.setAlign(VerticalAlignment.BOTTOM);
--
if (headerIcon != null) {
Img img = new Img(headerIcon, 24, 24);
img.setPadding(4);
@@@ -278,11 -333,17 +320,15 @@@
- addMember(footer);
}
}
- protected void setListGrid(ListGrid listGrid) {
- this.listGrid = listGrid;
-
+ /**
+ * Overriding components can use this as a chance to configure the list grid after it has been
+ * created but before it has been drawn to the DOM. This is also the proper place to add table
+ * actions so that they're rendered in the footer.
+ */
+ protected void configureTable() {
+
}
-
public boolean isShowHeader() {
return showHeader;
}
@@@ -351,12 -410,12 +395,13 @@@
this.titleComponent = canvas;
}
- public void addTableAction(String title, TableAction tableAction) {
- this.addTableAction(title, null, null, tableAction);
+ public void addTableAction(String locatorId, String title, TableAction tableAction) {
+ this.addTableAction(locatorId, title, null, null, tableAction);
}
- public void addTableAction(String title, SelectionEnablement enablement, String confirmation,
- TableAction tableAction) {
+ public void addTableAction(String locatorId, String title, SelectionEnablement enablement, String confirmation,
+ TableAction tableAction) {
++
if (enablement == null) {
enablement = DEFAULT_SELECTION_ENABLEMENT;
}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
index 0000000,c1d484b..78988c5
mode 000000,100644..100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
@@@ -1,0 -1,161 +1,156 @@@
+ /*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+ package org.rhq.enterprise.gui.coregui.client.components.table;
+
+ import com.google.gwt.user.client.History;
+ import com.smartgwt.client.data.Criteria;
+ import com.smartgwt.client.data.SortSpecifier;
+ import com.smartgwt.client.types.AnimationEffect;
+ import com.smartgwt.client.widgets.AnimationCallback;
+ import com.smartgwt.client.widgets.Canvas;
+ import com.smartgwt.client.widgets.grid.events.CellDoubleClickEvent;
+ import com.smartgwt.client.widgets.grid.events.CellDoubleClickHandler;
+ import com.smartgwt.client.widgets.layout.VLayout;
+
+ import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+ import org.rhq.enterprise.gui.coregui.client.ViewPath;
+ import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
+
+ /**
+ * @author Greg Hinkle
+ */
+ public abstract class TableSection extends Table implements BookmarkableView {
+
- private int detailsId;
-
+ private VLayout detailsHolder;
+
+ private Canvas detailsView;
+
+ private String basePath;
+
- protected TableSection(String tableTitle) {
- super(tableTitle);
++ protected TableSection(String locatorId, String tableTitle) {
++ super(locatorId, tableTitle);
+ }
+
- protected TableSection(String tableTitle, Criteria criteria) {
- super(tableTitle, criteria);
++ protected TableSection(String locatorId, String tableTitle, Criteria criteria) {
++ super(locatorId, tableTitle, criteria);
+ }
+
- protected TableSection(String tableTitle, SortSpecifier[] sortSpecifiers) {
- super(tableTitle, sortSpecifiers);
++ protected TableSection(String locatorId, String tableTitle, SortSpecifier[] sortSpecifiers) {
++ super(locatorId, tableTitle, sortSpecifiers);
+ }
+
- protected TableSection(String tableTitle, boolean autoFetchData) {
- super(tableTitle, autoFetchData);
++ protected TableSection(String locatorId, String tableTitle, boolean autoFetchData) {
++ super(locatorId, tableTitle, autoFetchData);
+ }
+
- protected TableSection(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers, String[] excludedFieldNames) {
- super(tableTitle, criteria, sortSpecifiers, excludedFieldNames);
++ protected TableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers,
++ String[] excludedFieldNames) {
++ super(locatorId, tableTitle, criteria, sortSpecifiers, excludedFieldNames);
+ }
+
- protected TableSection(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers, String[] excludedFieldNames, boolean autoFetchData) {
- super(tableTitle, criteria, sortSpecifiers, excludedFieldNames, autoFetchData);
++ protected TableSection(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers,
++ String[] excludedFieldNames, boolean autoFetchData) {
++ super(locatorId, tableTitle, criteria, sortSpecifiers, excludedFieldNames, autoFetchData);
+ }
+
-
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ detailsHolder = new VLayout();
+ detailsHolder.setWidth100();
+ detailsHolder.setHeight100();
+ detailsHolder.hide();
+
+ addMember(detailsHolder);
+
+ }
+
-
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ getListGrid().addCellDoubleClickHandler(new CellDoubleClickHandler() {
+ @Override
+ public void onCellDoubleClick(CellDoubleClickEvent event) {
+
+ int id = event.getRecord().getAttributeAsInt("id");
+
+ showDetails(id);
+ }
+ });
+
-
+ }
+
+ public void showDetails(int id) {
+ History.newItem(basePath + "/" + id);
+ }
+
+ public abstract Canvas getDetailsView(int id);
+
-
+ @Override
+ public void renderView(ViewPath viewPath) {
+
+ basePath = viewPath.getPathToCurrent();
+
+ if (!viewPath.isEnd()) {
+
+ int id = Integer.parseInt(viewPath.getCurrent().getPath());
+
+ detailsView = getDetailsView(id);
+
+ if (detailsView instanceof BookmarkableView) {
+
+ ((BookmarkableView) detailsView).renderView(viewPath);
+ }
+
-
+ contents.animateHide(AnimationEffect.FADE, new AnimationCallback() {
+ @Override
+ public void execute(boolean b) {
+ detailsView.setWidth100();
+ detailsView.setHeight100();
+
- detailsHolder.addMember(new BackButton("Back to List", basePath));
++ detailsHolder.addMember(new BackButton(extendLocatorId("BackButton"), "Back to List", basePath));
+ detailsHolder.addMember(detailsView);
+ detailsHolder.animateShow(AnimationEffect.FADE);
+ }
+ });
+
+ } else {
+ if (contents != null) {
+ contents.animateShow(AnimationEffect.FADE, new AnimationCallback() {
+ @Override
+ public void execute(boolean b) {
+ if (detailsHolder != null && detailsHolder.isVisible()) {
+ detailsHolder.animateHide(AnimationEffect.FADE);
+
+ for (Canvas child : detailsHolder.getMembers()) {
+ detailsHolder.removeMember(child);
+ }
+ }
+ }
+ });
+ }
+ }
+ }
+ }
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
index bf79f2b,08b9581..18bb864
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
@@@ -50,14 -54,8 +50,15 @@@ import org.rhq.core.domain.tagging.Tag
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+ import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.Locatable;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDialog;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableImg;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
@@@ -126,7 -125,9 +127,8 @@@ public class TagEditorView extends Loca
tagLayout.setHeight(18);
//tagLayout.set
- HTMLFlow tagString = new HTMLFlow("<a href=\"#Tag/" + tag.toString() + "\">" + tag.toString() + "</a>");
- HTMLFlow tagString = new HTMLFlow(
- "<a href=\"" + LinkManager.getTagLink(tag.toString()) + "\">" +
- tag.toString() + "</a>");
++ HTMLFlow tagString = new HTMLFlow("<a href=\"" + LinkManager.getTagLink(tag.toString()) + "\">"
++ + tag.toString() + "</a>");
tagString.setAutoWidth();
tagLayout.addMember(tagString);
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
index e7d4f01,2eb5b64..72cf55e
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
@@@ -57,6 -58,14 +57,11 @@@ public class FavoriteResourcesPortlet e
setShowHeader(false);
setShowFooter(false);
-
-
-
+ }
+
+ @Override
+ protected void configureTable() {
+ super.configureTable();
Set<Integer> favoriteIds = CoreGUI.getUserPreferences().getFavoriteResources();
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java
index 47bfa5f,47bfa5f..510de03
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java
@@@ -24,6 -24,6 +24,7 @@@ import com.smartgwt.client.types.Select
import com.smartgwt.client.types.SortDirection;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
++
import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
@@@ -38,9 -38,9 +39,9 @@@ public abstract class AbstractMeasureme
private static final SortSpecifier[] SORT_SPECIFIERS = new SortSpecifier[] { new SortSpecifier(
MeasurementDataTraitCriteria.SORT_FIELD_NAME, SortDirection.ASCENDING) };
-- public AbstractMeasurementDataTraitListView(String title, AbstractMeasurementDataTraitDataSource dataSource,
-- Criteria criteria, String[] excludedFieldNames) {
-- super(title, criteria, SORT_SPECIFIERS, excludedFieldNames);
++ public AbstractMeasurementDataTraitListView(String locatorId, String title,
++ AbstractMeasurementDataTraitDataSource dataSource, Criteria criteria, String[] excludedFieldNames) {
++ super(locatorId, title, criteria, SORT_SPECIFIERS, excludedFieldNames);
setDataSource(dataSource);
}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java
index b01bbf9,45d6b07..bdd4f8d
--- 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
@@@ -43,20 -43,20 +43,19 @@@ public class ResourceGroupListView exte
private static final String DEFAULT_TITLE = "Resource Groups";
- public ResourceGroupListView() {
- this(DEFAULT_TITLE);
+ public ResourceGroupListView(String locatorId) {
+ this(locatorId, DEFAULT_TITLE);
}
- public ResourceGroupListView(String title) {
- super(title);
+ public ResourceGroupListView(String locatorId, String title) {
+ super(locatorId, title);
- setWidth100();
- setHeight100();
}
- public ResourceGroupListView(Criteria criteria, String title) {
- super(title, criteria);
+ public ResourceGroupListView(String locatorId, Criteria criteria, String title) {
+ super(locatorId, title, criteria);
- setWidth100();
- setHeight100();
+
+ final ResourceGroupsDataSource datasource = ResourceGroupsDataSource.getInstance();
+ setDataSource(datasource);
-
}
@Override
@@@ -65,9 -64,7 +63,6 @@@
// setHeaderIcon("?_24.png");
- final ResourceGroupsDataSource datasource = ResourceGroupsDataSource.getInstance();
- setDataSource(datasource);
--
getListGrid().setSelectionType(SelectionStyle.SIMPLE);
//table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
getListGrid().setResizeFieldsInRealTime(true);
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
index 31a93ad,5fb98f3..9e3f983
--- 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
@@@ -31,21 -30,23 +30,21 @@@ import org.rhq.enterprise.gui.coregui.c
/**
* @author Greg Hinkle
*/
- public class GroupDefinitionListView extends LocatableVLayout {
+ public class GroupDefinitionListView extends Table {
- public GroupDefinitionListView() {
- super("Group Definitions");
+ public GroupDefinitionListView(String locatorId) {
- super(locatorId);
-
- setWidth100();
- setHeight100();
++ super(locatorId, "Group Definitions");
final GroupDefinitionDataSource datasource = new GroupDefinitionDataSource();
+ setDataSource(datasource);
-
-
+ }
- Table table = new Table(getLocatorId(), "Group Definitions");
- table.setDataSource(datasource);
+ @Override
+ protected void configureTable() {
+ super.configureTable();
- table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
- table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
+ getListGrid().setSelectionType(SelectionStyle.SIMPLE);
+ getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsView.java
index e071fe8,e071fe8..269420c
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsView.java
@@@ -19,6 -19,6 +19,7 @@@
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.traits;
import com.smartgwt.client.data.Criteria;
++
import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractMeasurementDataTraitListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits.TraitsDataSource;
@@@ -34,8 -34,8 +35,8 @@@ public class TraitsView extends Abstrac
private static final String[] EXCLUDED_FIELD_NAMES = new String[] { MeasurementDataTraitCriteria.FILTER_FIELD_GROUP_ID };
-- public TraitsView(int groupId) {
-- super(TITLE, new TraitsDataSource(groupId), createCriteria(groupId), EXCLUDED_FIELD_NAMES);
++ public TraitsView(String locatorId, int groupId) {
++ super(locatorId, TITLE, new TraitsDataSource(groupId), createCriteria(groupId), EXCLUDED_FIELD_NAMES);
// TODO (ips): add column for Resource name
// TODO (ips): group rows by trait
}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 534a0de,cd1c48b..f6554ff
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@@ -21,9 -22,15 +22,14 @@@ import java.util.EnumSet
import java.util.Set;
import com.google.gwt.user.client.History;
+ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Side;
+ import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.layout.VLayout;
+ import com.smartgwt.client.widgets.tab.Tab;
+ import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
+ import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.ResourceTypeFacet;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.composite.ResourcePermission;
@@@ -44,24 -52,26 +52,27 @@@ import org.rhq.enterprise.gui.coregui.c
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.PluginConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.schedules.SchedulesView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits.TraitsView;
+ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.DashboardView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.OverviewView;
+ import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* Right panel of the Resource view.
*
* @author Greg Hinkle
*/
- public class ResourceDetailView extends LocatableVLayout implements BookmarkableView, ResourceSelectListener,
- TwoLevelTabSelectedHandler {
-public class ResourceDetailView extends VLayout implements BookmarkableView,
- TwoLevelTabSelectedHandler {
++public class ResourceDetailView extends LocatableVLayout implements BookmarkableView, TwoLevelTabSelectedHandler {
private static final String DEFAULT_TAB_NAME = "Summary";
+ private int resourceId;
private ResourceComposite resourceComposite;
+ private TwoLevelTabSet topTabSet;
+
private TwoLevelTab summaryTab;
private TwoLevelTab monitoringTab;
private TwoLevelTab inventoryTab;
@@@ -97,10 -85,9 +108,13 @@@
private ResourceTitleBar titleBar;
+ private String tabName;
+ private String subTabName;
+
+ public ResourceDetailView(String locatorId) {
+ super(locatorId);
+ }
+
@Override
protected void onDraw() {
super.onDraw();
@@@ -190,48 -148,47 +204,53 @@@
final Resource resource = this.resourceComposite.getResource();
this.titleBar.setResource(resource);
+ for (Tab top : topTabSet.getTabs()) {
+
- ((TwoLevelTab)top).getLayout().destroyViews();
++ ((TwoLevelTab) top).getLayout().destroyViews();
+
+ }
+
-
- summaryTab.updateSubTab("Overview", new OverviewView(this.resourceComposite));
- summaryTab.updateSubTab("Dashboard", new DashboardView(this.resourceComposite));
- summaryTab.updateSubTab("Timeline", new FullHTMLPane("/rhq/resource/summary/timeline-plain.xhtml?id="
- + resource.getId()));
-
- monitoringTab.updateSubTab("Graphs", new GraphListView(resource)); // new FullHTMLPane("/rhq/common/monitor/graphs.xhtml?id=" + resource.getId()));
- monitoringTab.updateSubTab("Tables", new FullHTMLPane("/rhq/common/monitor/tables-plain.xhtml?id="
+ this.summaryOverview.setCanvas(new OverviewView(this.resourceComposite));
+ this.summaryDashboard.setCanvas(new DashboardView(this.resourceComposite));
+ this.summaryTimeline.setCanvas(new FullHTMLPane("/rhq/resource/summary/timeline-plain.xhtml?id="
+ + resource.getId()));
+ summaryTab.updateSubTab(this.summaryOverview);
+ summaryTab.updateSubTab(this.summaryDashboard);
+ summaryTab.updateSubTab(this.summaryTimeline);
+
+ this.monitorGraphs.setCanvas(new GraphListView(extendLocatorId(resource.getName()), resource));
+ this.monitorTables.setCanvas(new FullHTMLPane("/rhq/common/monitor/tables-plain.xhtml?id=" + resource.getId()));
+ this.monitorTraits
+ .setCanvas(new FullHTMLPane("/rhq/resource/monitor/traits-plain.xhtml?id=" + resource.getId()));
+ this.monitorAvail.setCanvas(new FullHTMLPane("/rhq/resource/monitor/availabilityHistory-plain.xhtml?id="
+ + resource.getId()));
+ this.monitorSched.setCanvas(new SchedulesView(monitoringTab.extendLocatorId("Schedules"), resource.getId()));
+ this.monitorCallTime.setCanvas(new FullHTMLPane("/rhq/resource/monitor/response-plain.xhtml?id="
+ resource.getId()));
- monitoringTab.updateSubTab("Traits", new TraitsView(resource.getId()));
- //new FullHTMLPane("/rhq/resource/monitor/traits-plain.xhtml?id=" + resource.getId()));
- monitoringTab.updateSubTab("Availability", new FullHTMLPane(
- "/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId()));
- monitoringTab.updateSubTab("Schedules", new SchedulesView(resource.getId()));
- //new FullHTMLPane("/rhq/resource/monitor/schedules-plain.xhtml?id=" + resource.getId()));
- monitoringTab.updateSubTab("Call Time", new FullHTMLPane("/rhq/resource/monitor/response-plain.xhtml?id="
- + resource.getId()));
-
- inventoryTab.updateSubTab("Children", ResourceSearchView.getChildrenOf(resource.getId()));
- inventoryTab.updateSubTab("Connection Settings", new PluginConfigurationEditView(resource)); // new ConfigurationEditor(resource.getId(), resource.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin));
+ monitoringTab.updateSubTab(this.monitorGraphs);
+ monitoringTab.updateSubTab(this.monitorTables);
+ monitoringTab.updateSubTab(this.monitorTraits);
+ monitoringTab.updateSubTab(this.monitorAvail);
+ monitoringTab.updateSubTab(this.monitorSched);
+ monitoringTab.updateSubTab(this.monitorCallTime);
+
+ this.inventoryChildren.setCanvas(ResourceSearchView.getChildrenOf(resource.getId()));
+ this.inventoryConn.setCanvas(new PluginConfigurationEditView(resource));
+ inventoryTab.updateSubTab(this.inventoryChildren);
+ inventoryTab.updateSubTab(this.inventoryConn);
// comment out GWT-based operation history until...
// 1) user can delete history if they possess the appropriate permissions
// 2) user can see both operation arguments and results in the history details pop-up
// 3) operation arguments/results become read-only configuration data in the history details pop-up
// 4) user can navigate to the group operation that spawned this resource operation history, if appropriate
- //operationsTab.updateSubTab("History", OperationHistoryView.getResourceHistoryView(resource));
- operationsTab.updateSubTab("History", OperationHistoryView.getResourceHistoryView(resourceComposite));
++ this.opHistory.setCanvas(OperationHistoryView.getResourceHistoryView(operationsTab.extendLocatorId("History"),
++ resourceComposite));
// note: enabled operation execution/schedules from left-nav, if it doesn't already exist
- this.opHistory.setCanvas(new FullHTMLPane("/rhq/resource/operation/resourceOperationHistory-plain.xhtml?id="
- + resource.getId()));
-// operationsTab.updateSubTab("History", new FullHTMLPane(
-// "/rhq/resource/operation/resourceOperationHistory-plain.xhtml?id=" + resource.getId()));
- operationsTab.updateSubTab("Scheduled", new FullHTMLPane(
- "/rhq/resource/operation/resourceOperationSchedules-plain.xhtml?id=" + resource.getId()));
-
- configurationTab.updateSubTab("Current", new ResourceConfigurationEditView(resource));
- configurationTab.updateSubTab("History", ConfigurationHistoryView.getHistoryOf(resource.getId()));
+ this.opSched.setCanvas(new FullHTMLPane("/rhq/resource/operation/resourceOperationSchedules-plain.xhtml?id="
+ + resource.getId()));
+ operationsTab.updateSubTab(this.opHistory);
+ operationsTab.updateSubTab(this.opSched);
// comment out GWT-based alert definitions/history views until...
// 1) new workflow is implement for alert definition creation, with particular attention to interaction model for alert notifications
@@@ -239,40 -196,27 +258,42 @@@
// 3) user can enable/disable/delete alert definitions if they possess the appropriate permissions
// 4) user can search alert history by: date alert was fired, alert priority, or alert definition
//alertsTab.updateSubTab("History", new ResourceAlertHistoryView(resource.getId()));
- alertsTab.updateSubTab("History", new FullHTMLPane("/rhq/resource/alert/listAlertHistory-plain.xhtml?id="
- + resource.getId()));
- alertsTab.updateSubTab("Definitions", new ResourceAlertDefinitionsView(resource));
- alertsTab.updateSubTab("DELETEME", new FullHTMLPane("/rhq/resource/alert/listAlertDefinitions-plain.xhtml?id="
- + resource.getId()));
++
+ this.alertHistory.setCanvas(new FullHTMLPane("/rhq/resource/alert/listAlertHistory-plain.xhtml?id="
+ + resource.getId()));
+ this.alertDef.setCanvas(new ResourceAlertDefinitionsView(alertsTab.getLocatorId(), resource));
+ this.alertDelete.setCanvas(new FullHTMLPane("/rhq/resource/alert/listAlertDefinitions-plain.xhtml?id="
+ + resource.getId()));
+ alertsTab.updateSubTab(this.alertHistory);
+ alertsTab.updateSubTab(this.alertDef);
+ alertsTab.updateSubTab(this.alertDelete);
+
+ this.configCurrent.setCanvas(new ResourceConfigurationEditView(resource));
+ this.configHistory.setCanvas(ConfigurationHistoryView.getHistoryOf(configurationTab.getLocatorId(), resource
+ .getId()));
+ configurationTab.updateSubTab(this.configCurrent);
+ configurationTab.updateSubTab(this.configHistory);
// comment out GWT-based view until...
// 1) user can search event history by: metric display range, event source, event details, event severity
// 2) user can delete events if they possess the appropriate permissions
//eventsTab.updateSubTab("History", EventHistoryView.createResourceHistoryView(resource.getId()));
- eventsTab.updateSubTab("History", new FullHTMLPane("/rhq/resource/events/history-plain.xhtml?id="
- + resource.getId()));
-
- contentTab.updateSubTab("Deployed", new FullHTMLPane("/rhq/resource/content/view-plain.xhtml?id="
- + resource.getId()));
- contentTab.updateSubTab("New", new FullHTMLPane("/rhq/resource/content/deploy-plain.xhtml?id="
- + resource.getId()));
- contentTab.updateSubTab("Subscriptions", new FullHTMLPane("/rhq/resource/content/subscription-plain.xhtml?id="
- + resource.getId()));
- contentTab.updateSubTab("History", new FullHTMLPane("/rhq/resource/content/history-plain.xhtml?id="
- + resource.getId()));
++
+ this.eventHistory
+ .setCanvas(new FullHTMLPane("/rhq/resource/events/history-plain.xhtml?id=" + resource.getId()));
+ eventsTab.updateSubTab(this.eventHistory);
+
+ this.contentDeployed
+ .setCanvas(new FullHTMLPane("/rhq/resource/content/view-plain.xhtml?id=" + resource.getId()));
+ this.contentNew.setCanvas(new FullHTMLPane("/rhq/resource/content/deploy-plain.xhtml?id=" + resource.getId()));
+ this.contentSubscrip.setCanvas(new FullHTMLPane("/rhq/resource/content/subscription-plain.xhtml?id="
+ + resource.getId()));
+ this.contentHistory.setCanvas(new FullHTMLPane("/rhq/resource/content/history-plain.xhtml?id="
+ + resource.getId()));
+ contentTab.updateSubTab(contentDeployed);
+ contentTab.updateSubTab(contentNew);
+ contentTab.updateSubTab(contentSubscrip);
+ contentTab.updateSubTab(contentHistory);
// topTabSet.setSelectedTab(selectedTab);
@@@ -321,28 -267,99 +342,92 @@@
topTabSet.markForRedraw();
}
-
public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
if (this.resourceComposite == null) {
- History.fireCurrentHistoryState();
-// History.fireCurrentHistoryState();
++ // History.fireCurrentHistoryState();
} else {
// Switch tabs directly, rather than letting the history framework do it, to avoid redrawing the outer views.
- selectTab(tabSelectedEvent.getId(), tabSelectedEvent.getSubTabId());
-// selectTab(tabSelectedEvent.getId(), tabSelectedEvent.getSubTabId());
-
++ // selectTab(tabSelectedEvent.getId(), tabSelectedEvent.getSubTabId());
+
String tabPath = "/" + tabSelectedEvent.getId() + "/" + tabSelectedEvent.getSubTabId();
- String path = "Resource/" + this.resourceComposite.getResource().getId() + tabPath;
+ String path = "Resource/" + resourceId + tabPath;
// But still add an item to the history, specifying false to tell it not to fire an event.
History.newItem(path, true);
}
}
-
public void renderView(ViewPath viewPath) {
// e.g. #Resource/10010/Inventory/Overview
- String tabName = (!viewPath.isEnd()) ? viewPath.getCurrent().getPath() : null; // e.g. "Inventory"
- String subTabName = (viewPath.viewsLeft() >= 1) ? viewPath.getNext().getPath() : null; // e.g. "Overview"
- selectTab(tabName, subTabName);
+ // ^ Current Path
+ int resourceId = Integer.parseInt(viewPath.getCurrent().getPath());
+
-
+ viewPath.next();
+
-
+ tabName = (!viewPath.isEnd()) ? viewPath.getCurrent().getPath() : null; // e.g. "Inventory"
+ subTabName = (viewPath.viewsLeft() >= 1) ? viewPath.getNext().getPath() : null; // e.g. "Overview"
+
+ viewPath.next();
+ viewPath.next();
+
+ if (this.resourceId != resourceId) {
+ // A different resource or first load, go get data
+ loadSelectedResource(resourceId, viewPath);
+ } else {
+ // same resource just switch tabs
+ selectTab(tabName, subTabName, viewPath);
+ }
+
+ }
+
-
+ public void loadSelectedResource(final int resourceId, final ViewPath viewPath) {
+ this.resourceId = resourceId;
+
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterId(resourceId);
+ criteria.fetchTags(true);
+ //criteria.fetchParentResource(true);
+ GWTServiceLookup.getResourceService().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.goTo(InventoryView.VIEW_PATH);
- }
-
- public void onSuccess(PageList<ResourceComposite> result) {
- if (result.isEmpty()) {
- //noinspection ThrowableInstanceNeverThrown
- onFailure(new Exception("Resource with id [" + resourceId + "] does not exist."));
- } else {
- final ResourceComposite resourceComposite = result.get(0);
- loadResourceType(resourceComposite, viewPath);
- }
++ 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.goTo(InventoryView.VIEW_PATH);
++ }
++
++ public void onSuccess(PageList<ResourceComposite> result) {
++ if (result.isEmpty()) {
++ //noinspection ThrowableInstanceNeverThrown
++ onFailure(new Exception("Resource with id [" + resourceId + "] does not exist."));
++ } else {
++ final ResourceComposite resourceComposite = result.get(0);
++ loadResourceType(resourceComposite, viewPath);
+ }
- });
++ }
++ });
+ }
+
-
+ private void loadResourceType(final ResourceComposite resourceComposite, final ViewPath viewPath) {
+ final Resource resource = resourceComposite.getResource();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- resource.getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.content, ResourceTypeRepository.MetadataType.operations,
- ResourceTypeRepository.MetadataType.events,
- ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- resourceComposite.getResource().setResourceType(type);
- ResourceDetailView.this.resourceComposite = resourceComposite;
- updateDetailViews(resourceComposite);
- selectTab(tabName, subTabName, viewPath);
-
- }
- });
++ resource.getResourceType().getId(),
++ EnumSet.of(ResourceTypeRepository.MetadataType.content, ResourceTypeRepository.MetadataType.operations,
++ ResourceTypeRepository.MetadataType.events,
++ ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
++ new ResourceTypeRepository.TypeLoadedCallback() {
++ public void onTypesLoaded(ResourceType type) {
++ resourceComposite.getResource().setResourceType(type);
++ ResourceDetailView.this.resourceComposite = resourceComposite;
++ updateDetailViews(resourceComposite);
++ selectTab(tabName, subTabName, viewPath);
++
++ }
++ });
}
- public void selectTab(String tabName, String subtabName) {
-
+ public void selectTab(String tabName, String subtabName, ViewPath viewPath) {
if (tabName == null) {
tabName = DEFAULT_TAB_NAME;
}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
index 0c618cf,2d75b2b..6fd53c6
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
@@@ -87,24 -87,21 +87,24 @@@ public class ResourceTitleBar extends L
badge = new Img("types/Service_up_24.png", 24, 24);
- TagEditorView tagEditorView = new TagEditorView(getLocatorId(), resource.getTags(), false,
- TagEditorView tagEditorView = new TagEditorView(resource.getTags(), false, new TagsChangedCallback() {
- public void tagsChanged(final HashSet<Tag> tags) {
- GWTServiceLookup.getTagService().updateResourceTags(resource.getId(), tags, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to update resource tags", caught);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Resource tags updated", Message.Severity.Info));
- // update what is essentially our local cache
- resource.setTags(tags);
- }
- });
- }
- });
++ TagEditorView tagEditorView = new TagEditorView(extendLocatorId("TagEdit"), resource.getTags(), false,
+ new TagsChangedCallback() {
+ public void tagsChanged(final HashSet<Tag> tags) {
+ GWTServiceLookup.getTagService().updateResourceTags(resource.getId(), tags,
+ new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update resource tags", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Resource tags updated", Message.Severity.Info));
+ // update what is essentially our local cache
+ resource.setTags(tags);
+ }
+ });
+ }
+ });
loadTags(tagEditorView);
@@@ -119,43 -117,43 +119,45 @@@
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterId(resource.getId());
criteria.fetchTags(true);
- GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Could not load resource tags", caught);
- }
-
- public void onSuccess(PageList<Resource> result) {
- LinkedHashSet<Tag> tags = new LinkedHashSet<Tag>();
- tags.addAll(result.get(0).getTags());
- tagEditorView.setTags(tags);
- }
- });
+ GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
+ new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Could not load resource tags", caught);
+ }
+
+ public void onSuccess(PageList<Resource> result) {
+ LinkedHashSet<Tag> tags = new LinkedHashSet<Tag>();
+ tags.addAll(result.get(0).getTags());
+ tagEditorView.setTags(tags);
+ }
+ });
}
-
public void setResource(Resource resource) {
- this.resource = resource;
- update();
+ if (this.resource == null || this.resource.getId() != resource.getId()) {
+ this.resource = resource;
+ update();
- this.title.setContents("<span class=\"SectionHeader\">" + resource.getName()
- + "</span> <span class=\"subtitle\">" + resource.getResourceType().getName() + "</span>");
- this.title.setContents("<span class=\"SectionHeader\">" + resource.getName() + "</span> <span class=\"subtitle\">" + resource.getResourceType().getName() + "</span>");
++ this.title.setContents("<span class=\"SectionHeader\">" + resource.getName()
++ + "</span> <span class=\"subtitle\">" + resource.getResourceType().getName() + "</span>");
- Set<Integer> favorites = CoreGUI.getUserPreferences().getFavoriteResources();
- this.favorite = favorites.contains(resource.getId());
- updateFavoriteButton();
+ Set<Integer> favorites = CoreGUI.getUserPreferences().getFavoriteResources();
+ this.favorite = favorites.contains(resource.getId());
+ updateFavoriteButton();
- this.availabilityImage.setSrc("resources/availability_"
- + (resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "green" : "red")
- + "_24.png");
- this.availabilityImage.setSrc("resources/availability_" +
- (resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "green" : "red") +
- "_24.png");
++ this.availabilityImage.setSrc("resources/availability_"
++ + (resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "green" : "red")
++ + "_24.png");
- String category = this.resource.getResourceType().getCategory().getDisplayName();
+ String category = this.resource.getResourceType().getCategory().getDisplayName();
- String avail = (resource.getCurrentAvailability() != null && resource.getCurrentAvailability()
- .getAvailabilityType() != null) ? (resource.getCurrentAvailability().getAvailabilityType().name()
- .toLowerCase()) : "down";
- badge.setSrc("types/" + category + "_" + avail + "_24.png");
- String avail = (resource.getCurrentAvailability() != null && resource.getCurrentAvailability().getAvailabilityType() != null)
- ? (resource.getCurrentAvailability().getAvailabilityType().name().toLowerCase()) : "down";
++ String avail = (resource.getCurrentAvailability() != null && resource.getCurrentAvailability()
++ .getAvailabilityType() != null) ? (resource.getCurrentAvailability().getAvailabilityType().name()
++ .toLowerCase()) : "down";
+ badge.setSrc("types/" + category + "_" + avail + "_24.png");
- markForRedraw();
+ markForRedraw();
+ }
}
private void updateFavoriteButton() {
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
index 93ee9b9,15ee729..7882473
--- 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
@@@ -18,26 -18,14 +18,14 @@@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
- import java.util.EnumSet;
-
- import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.layout.HLayout;
- import org.rhq.core.domain.criteria.ResourceCriteria;
- import org.rhq.core.domain.resource.Resource;
- import org.rhq.core.domain.resource.ResourceType;
- import org.rhq.core.domain.resource.composite.ResourceComposite;
- import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
- import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
- import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
- import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
- import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
/**
* @author Greg Hinkle
@@@ -46,11 -34,8 +34,8 @@@ public class ResourceTopView extends Lo
private Canvas contentCanvas;
- private ResourceComposite currentResource;
- //private Resource resourcePlatform;
-
private ResourceTreeView treeView;
- private ResourceDetailView detailView = new ResourceDetailView();
+ private ResourceDetailView detailView = new ResourceDetailView(getLocatorId());
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
@@@ -74,70 -60,9 +59,6 @@@
- // created above
- // 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.goTo(InventoryView.VIEW_PATH);
- }
--
- public void onSuccess(PageList<ResourceComposite> result) {
- if (result.isEmpty()) {
- //noinspection ThrowableInstanceNeverThrown
- onFailure(new Exception("Resource with id [" + resourceId + "] does not exist."));
- } else {
- final ResourceComposite resourceComposite = result.get(0);
- loadResourceType(resourceComposite, view);
- }
- }
- });
- }
-
- private void loadResourceType(final ResourceComposite resourceComposite, final ViewPath view) {
- final Resource resource = resourceComposite.getResource();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- resource.getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.content, ResourceTypeRepository.MetadataType.operations,
- ResourceTypeRepository.MetadataType.events,
- ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- resource.setResourceType(type);
- completeSetSelectedResource(resourceComposite, view);
- }
- });
- }
-
- 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();
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsView.java
index 8ae344c,8ae344c..8a9c9c7
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsView.java
@@@ -19,6 -19,6 +19,7 @@@
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits;
import com.smartgwt.client.data.Criteria;
++
import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractMeasurementDataTraitListView;
@@@ -33,8 -33,8 +34,8 @@@ public class TraitsView extends Abstrac
private static final String[] EXCLUDED_FIELD_NAMES = new String[] { MeasurementDataTraitCriteria.FILTER_FIELD_RESOURCE_ID };
-- public TraitsView(int resourceId) {
-- super(TITLE, new TraitsDataSource(resourceId), createCriteria(resourceId), EXCLUDED_FIELD_NAMES);
++ public TraitsView(String locatorId, int resourceId) {
++ super(locatorId, TITLE, new TraitsDataSource(resourceId), createCriteria(resourceId), EXCLUDED_FIELD_NAMES);
}
private static Criteria createCriteria(int resourceId) {
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
index d946cdc,b26407d..fa40404
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
@@@ -52,45 -46,40 +46,37 @@@ import org.rhq.enterprise.gui.coregui.c
/**
* @author Greg Hinkle
*/
- public class OperationHistoryView extends LocatableVLayout {
+ public class OperationHistoryView extends TableSection {
- Table table;
- Resource resource;
- Criteria criteria;
+ private ResourceComposite composite;
+ private Resource resource;
-
- public OperationHistoryView() {
- super("Operation History");
+ public OperationHistoryView(String locatorId) {
- super(locatorId);
++ super(locatorId, "Operation History");
setWidth100();
setHeight100();
- }
- public OperationHistoryView(String locatorId, Resource resource) {
- super(locatorId);
- this.resource = resource;
- this.criteria = new Criteria("resourceId", String.valueOf(resource.getId()));
- }
+ setDataSource(new OperationHistoryDataSource());
- @Override
- protected void onInit() {
- super.onInit();
}
- @Override
- protected void onDraw() {
- super.onDraw();
- public OperationHistoryView(ResourceComposite resourceComposite) {
- super("Operation History", new Criteria("resourceId", String.valueOf(resourceComposite.getResource().getId())));
++ public OperationHistoryView(String locatorId, ResourceComposite resourceComposite) {
++ super(locatorId, "Operation History", new Criteria("resourceId", String.valueOf(resourceComposite.getResource()
++ .getId())));
+ this.composite = resourceComposite;
+ this.resource = resourceComposite.getResource();
- if (criteria == null) {
- table = new Table(getLocatorId(), "Operation History");
- } else {
- table = new Table(getLocatorId(), "Operation History", criteria);
- }
+ setDataSource(new OperationHistoryDataSource());
- table.setDataSource(new OperationHistoryDataSource());
+ }
+
-
-
+ @Override
+ protected void configureTable() {
- table.getListGrid().getField("id").setWidth(40);
- table.getListGrid().getField("operationName").setWidth("*");
- table.getListGrid().getField("status").setWidth(100);
- table.getListGrid().getField("status").setCellFormatter(new CellFormatter() {
-
+ getListGrid().getField("id").setWidth(40);
+ getListGrid().getField("operationName").setWidth("*");
+ getListGrid().getField("status").setWidth(100);
+ getListGrid().getField("status").setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
OperationRequestStatus status = OperationRequestStatus.valueOf((String) o);
String icon = "";
@@@ -113,89 -102,73 +99,65 @@@
}
});
- table.getListGrid().getField("startedTime").setWidth(120);
-
-
+ getListGrid().getField("startedTime").setWidth(120);
if (this.resource == null) {
- table.getListGrid().getField("resource").setWidth(300);
- table.getListGrid().getField("resource").setCellFormatter(new CellFormatter() {
+ getListGrid().getField("resource").setWidth(300);
+ getListGrid().getField("resource").setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
Resource res = (Resource) o;
return "<a href=\"#Resource/" + res.getId() + "\">" + res.getName() + "</a>";
}
});
} else {
- table.getListGrid().hideField("resource");
+ getListGrid().hideField("resource");
}
- table.getListGrid().addRecordDoubleClickHandler(new RecordDoubleClickHandler() {
- public void onRecordDoubleClick(RecordDoubleClickEvent recordDoubleClickEvent) {
- ResourceOperationHistory history = (ResourceOperationHistory) recordDoubleClickEvent.getRecord()
- .getAttributeAsObject("entity");
-
- showDetails(history);
- }
- });
-
- table.addTableAction(extendLocatorId("Details"), "Details", Table.SelectionEnablement.SINGLE, null,
++ addTableAction(extendLocatorId("Details"), "Details", Table.SelectionEnablement.SINGLE, null,
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ ResourceOperationHistory history = (ResourceOperationHistory) selection[0]
+ .getAttributeAsObject("entity");
- showDetails(history);
-
-
- addTableAction("Details", Table.SelectionEnablement.SINGLE, null, new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- ResourceOperationHistory history = (ResourceOperationHistory) selection[0].getAttributeAsObject("entity");
-
- showDetails(history.getId());
- }
- });
-
++ showDetails(history.getId());
+ }
+ });
- if (resource != null) {
+ if (resource != null && composite.getResourcePermission().isControl()) {
final Menu operationMenu = new Menu();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- resource.getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.operations),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- for (final OperationDefinition od : type.getOperationDefinitions()) {
- MenuItem menuItem = new MenuItem(od.getDisplayName());
- operationMenu.addItem(menuItem);
- menuItem.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent event) {
- new OperationCreateWizard(resource, od).startOperationWizard();
- }
- });
- }
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ for (final OperationDefinition od : type.getOperationDefinitions()) {
+ MenuItem menuItem = new MenuItem(od.getDisplayName());
+ operationMenu.addItem(menuItem);
+ menuItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ new OperationCreateWizard(resource, od).startOperationWizard();
+ }
+ });
}
- });
+ }
+ });
IMenuButton operationsButton = new IMenuButton("Run Operation", operationMenu);
operationsButton.setShowMenuBelow(false);
- table.addExtraWidget(operationsButton);
+ addExtraWidget(operationsButton);
}
- addMember(table);
-
}
- private void showDetails(ResourceOperationHistory history) {
- ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
--
- criteria.addFilterId(history.getId());
-
- criteria.fetchOperationDefinition(true);
- criteria.fetchParameters(true);
- criteria.fetchResults(true);
-
- GWTServiceLookup.getOperationService().findResourceOperationHistoriesByCriteria(criteria,
- new AsyncCallback<PageList<ResourceOperationHistory>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failure loading operation history", caught);
- }
+ @Override
+ public Canvas getDetailsView(int id) {
+ OperationDetailsView detailsView = new OperationDetailsView();
- public void onSuccess(PageList<ResourceOperationHistory> result) {
- ResourceOperationHistory item = result.get(0);
- OperationDetailsView.displayDetailsDialog(item);
- }
- });
+ return detailsView;
}
- public static OperationHistoryView getResourceHistoryView(String locatorId, Resource resource) {
++ public static OperationHistoryView getResourceHistoryView(String locatorId, ResourceComposite resource) {
- public static OperationHistoryView getResourceHistoryView(ResourceComposite resource) {
-
- return new OperationHistoryView(resource);
+ return new OperationHistoryView(locatorId, resource);
}
+
}
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java
index 2c614a0,59cc36f..9d68c48
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java
@@@ -32,18 -32,23 +32,17 @@@ import org.rhq.enterprise.gui.coregui.c
*/
public class MeasurementOOBView extends Table {
-
- public MeasurementOOBView() {
- super("Suspect Metrics");
-
+ public MeasurementOOBView(String locatorId) {
+ super(locatorId, "Suspect Metrics");
setDataSource(new MeasurementOOBDataSource());
--
- getListGrid().setAlternateRecordStyles(false);
-
-
}
@Override
- protected void onInit() {
- super.onInit();
+ protected void configureTable() {
+
+ getListGrid().setAlternateRecordStyles(false);
-
getListGrid().getField("resourceName").setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
return "<a href=\"#Resource/" + listGridRecord.getAttribute("resourceId") + "\">" + o + "</a>";
commit 030243ff0d6524ba6913003f8a07b4190d497b47
Merge: 308415f... cb6fd0c...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Aug 24 13:53:56 2010 -0400
Merge branch 'master' into master-jay
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
index 1f955f6,83d3481..ab863ad
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@@ -97,9 -100,11 +98,11 @@@ public class AlertsView extends Table
listGrid.getField("conditionText").setWidth("30%");
listGrid.getField("conditionValue").setWidth("10%");
listGrid.getField("resourceName").setWidth("20%");
-// listGrid.getField("recoveryInfo").setWidth("20%");
+ // listGrid.getField("recoveryInfo").setWidth("20%");
listGrid.getField("priority").setWidth("7%");
- listGrid.getField("ctime").setWidth("13%");
+ ListGridField ctimeField = listGrid.getField("ctime");
+ ctimeField.setWidth("13%");
+ ctimeField.setCellFormatter(new TimestampCellFormatter());
listGrid.getField("ack").setWidth("5%");
listGrid.getField("resourceName").setCellFormatter(new CellFormatter() {
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java
index 30aa7e5,bcb0f00..604f4a8
--- 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
@@@ -67,7 -69,8 +69,8 @@@ public abstract class AbstractMeasureme
intervalField.setCellFormatter(new MillisecondsCellFormatter());
intervalField.setWidth("25%");
+ // Add action buttons and widgets.
- addTableAction("Enable", Table.SelectionEnablement.ANY, null, new TableAction() {
+ addTableAction(extendLocatorId("Enable"), "Enable", Table.SelectionEnablement.ANY, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
getDataSource().enableSchedules(AbstractMeasurementScheduleListView.this);
}
commit 308415fb717eb6675bb8ee366145ce6132d14f35
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Aug 24 13:34:08 2010 -0400
Selenium Work - Make breadcrumb, inventory section stack and footer
widgets locatable.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
index 17e9237..0d23ba9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
@@ -21,11 +21,14 @@ package org.rhq.enterprise.gui.coregui.client;
import com.google.gwt.user.client.Window;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
+
/**
* GWT widget for the breadcrumb trail, which is displayed at the top of each page.
*
@@ -47,8 +50,11 @@ public class BreadcrumbTrailPane extends ToolStrip {
public void refresh(ViewPath viewPath) {
try {
-
- removeMembers(getMembers());
+ // before rebuilding the trail, remove the current members, and destroy them to avoid ID conflicts
+ for (Canvas currentMember : getMembers()) {
+ removeMember(currentMember);
+ currentMember.destroy();
+ }
LayoutSpacer ls = new LayoutSpacer();
ls.setWidth(5);
@@ -104,7 +110,8 @@ public class BreadcrumbTrailPane extends ToolStrip {
private Label getCrumb(Breadcrumb crumb, String path) {
Label l = null;
if (crumb.isHyperlink()) {
- l = new Label("<a href=\"#" + path.toString() + crumb.getName() + "\">" + crumb.getDisplayName() + "</a>");
+ l = new LocatableLabel(crumb.getName(), "<a href=\"#" + path.toString() + crumb.getName() + "\">"
+ + crumb.getDisplayName() + "</a>");
} else {
l = new Label(crumb.getDisplayName());
}
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 8d44d49..0d662e4 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
@@ -224,7 +224,7 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
canvas.setHeight100();
rootCanvas.addMember(canvas);
- rootCanvas.addMember(new Footer());
+ rootCanvas.addMember(new Footer("CoreFooter"));
rootCanvas.draw();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
index 334a2aa..66b94dc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/Footer.java
@@ -25,7 +25,6 @@ import com.smartgwt.client.types.VerticalAlignment;
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.toolbar.ToolStrip;
import com.smartgwt.client.widgets.toolbar.ToolStripSeparator;
import org.rhq.core.domain.alert.Alert;
@@ -34,55 +33,53 @@ import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.footer.FavoritesButton;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.message.MessageCenterView;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
/**
* @author Greg Hinkle
*/
-public class Footer extends ToolStrip {
+public class Footer extends LocatableToolStrip {
MessageCenterView recentMessage;
- public Footer() {
- super();
+ public Footer(String locatorId) {
+ super(locatorId);
setHeight(30);
setAlign(VerticalAlignment.CENTER);
-// setPadding(5);
+ // setPadding(5);
setWidth100();
setMembersMargin(15);
}
-
@Override
protected void onDraw() {
super.onDraw();
-
Label loggedInAs = new Label("Logged in as " + CoreGUI.getSessionSubject().getName());
loggedInAs.setWrap(false);
loggedInAs.setMargin(5);
loggedInAs.setValign(VerticalAlignment.CENTER);
-
addMember(loggedInAs);
addMember(new ToolStripSeparator());
- recentMessage = new MessageCenterView();
+ recentMessage = new MessageCenterView(extendLocatorId("MessageCenter"));
recentMessage.setWidth("*");
addMember(recentMessage);
addMember(new ToolStripSeparator());
- addMember(new FavoritesButton());
-
- addMember(new AlertsMessage());
+ addMember(new FavoritesButton(extendLocatorId("Favorites")));
+ addMember(new AlertsMessage(extendLocatorId("Alerts")));
}
-
- public static class AlertsMessage extends Label {
- public AlertsMessage() {
+ public static class AlertsMessage extends LocatableLabel {
+ public AlertsMessage(String locatorId) {
+ super(locatorId);
setHeight(30);
setPadding(5);
@@ -116,19 +113,20 @@ public class Footer extends ToolStrip {
public void refresh() {
AlertCriteria alertCriteria = new AlertCriteria();
- alertCriteria.setPaging(1,1);
+ alertCriteria.setPaging(1, 1);
// last eight hours
alertCriteria.addFilterStartTime(System.currentTimeMillis() - (1000L * 60 * 60 * 8));
- GWTServiceLookup.getAlertService().findAlertsByCriteria(alertCriteria, new AsyncCallback<PageList<Alert>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Latest alerts lookup failed", caught);
- }
+ GWTServiceLookup.getAlertService().findAlertsByCriteria(alertCriteria,
+ new AsyncCallback<PageList<Alert>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Latest alerts lookup failed", caught);
+ }
- public void onSuccess(PageList<Alert> result) {
- drawAlerts(result);
- }
- });
+ public void onSuccess(PageList<Alert> result) {
+ drawAlerts(result);
+ }
+ });
}
public void drawAlerts(PageList<Alert> alerts) {
@@ -144,5 +142,4 @@ public class Footer extends ToolStrip {
}
}
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
index 636c45e..0d04750 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
@@ -26,7 +26,6 @@ import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.menu.IMenuButton;
import com.smartgwt.client.widgets.menu.Menu;
import com.smartgwt.client.widgets.menu.MenuItem;
import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
@@ -36,15 +35,16 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIMenuButton;
/**
* @author Greg Hinkle
* @author Ian Springer
*/
-public class FavoritesButton extends IMenuButton {
+public class FavoritesButton extends LocatableIMenuButton {
- public FavoritesButton() {
- super("Favorites");
+ public FavoritesButton(String locatorId) {
+ super(locatorId, "Favorites");
final Menu favoritesMenu = new Menu();
setMenu(favoritesMenu);
@@ -81,28 +81,29 @@ public class FavoritesButton extends IMenuButton {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterIds(resourceIds);
GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
- new AsyncCallback<PageList<Resource>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load favorite Resources.", caught);
- }
+ new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load favorite Resources.", caught);
+ }
- public void onSuccess(PageList<Resource> resources) {
- for (Resource resource : resources) {
- MenuItem item = idToMenuItemMap.get(resource.getId());
- // TODO: Ideally, we should use ResourceManagerLocal.disambiguate() here to obtain
- // disambiguated Resource names.
- item.setTitle(resource.getName());
+ public void onSuccess(PageList<Resource> resources) {
+ for (Resource resource : resources) {
+ MenuItem item = idToMenuItemMap.get(resource.getId());
+ // TODO: Ideally, we should use ResourceManagerLocal.disambiguate() here to obtain
+ // disambiguated Resource names.
+ item.setTitle(resource.getName());
- String category = resource.getResourceType().getCategory().getDisplayName();
+ String category = resource.getResourceType().getCategory().getDisplayName();
- String avail = (resource.getCurrentAvailability() != null && resource.getCurrentAvailability().getAvailabilityType() != null)
- ? (resource.getCurrentAvailability().getAvailabilityType().name().toLowerCase()) : "down";
- item.setIcon("types/" + category + "_" + avail + "_16.png");
- }
- favoritesMenu.setItems(items);
- favoritesMenu.showContextMenu();
+ String avail = (resource.getCurrentAvailability() != null && resource
+ .getCurrentAvailability().getAvailabilityType() != null) ? (resource
+ .getCurrentAvailability().getAvailabilityType().name().toLowerCase()) : "down";
+ item.setIcon("types/" + category + "_" + avail + "_16.png");
}
- });
+ favoritesMenu.setItems(items);
+ favoritesMenu.showContextMenu();
+ }
+ });
}
}
});
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 883b689..82f26cd 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
@@ -41,6 +41,7 @@ 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.LocatableHLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableSectionStack;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
/**
@@ -91,7 +92,7 @@ public class InventoryView extends LocatableHLayout implements BookmarkableView
contentCanvas.setWidth("*");
contentCanvas.setHeight100();
- sectionStack = new SectionStack();
+ sectionStack = new LocatableSectionStack(getLocatorId());
sectionStack.setShowResizeBar(true);
sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
sectionStack.setWidth(250);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
index ef68794..0ede8cd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/MessageCenterView.java
@@ -35,7 +35,6 @@ import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ButtonItem;
import com.smartgwt.client.widgets.form.fields.FormItemIcon;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-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.IMenuButton;
@@ -44,14 +43,18 @@ import com.smartgwt.client.widgets.menu.MenuItem;
import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIMenuButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class MessageCenterView extends HLayout implements MessageCenter.MessageListener {
+public class MessageCenterView extends LocatableHLayout implements MessageCenter.MessageListener {
- public MessageCenterView() {
- super(5);
+ public MessageCenterView(String locatorId) {
+ super(locatorId, 5);
setHeight100();
setAlign(Alignment.LEFT);
setAlign(VerticalAlignment.CENTER);
@@ -65,7 +68,7 @@ public class MessageCenterView extends HLayout implements MessageCenter.MessageL
final Menu recentEventsMenu = new Menu();
- IMenuButton recentEventsButton = new IMenuButton("Messages", recentEventsMenu);
+ IMenuButton recentEventsButton = new LocatableIMenuButton(getLocatorId(), "Messages", recentEventsMenu);
recentEventsButton.setTop(5);
recentEventsButton.setShowMenuBelow(false);
recentEventsButton.setAutoFit(true);
@@ -95,7 +98,7 @@ public class MessageCenterView extends HLayout implements MessageCenter.MessageL
}
});
- VLayout vl = new VLayout();
+ VLayout vl = new LocatableVLayout(getLocatorId());
vl.setAutoWidth();
vl.setAlign(Alignment.LEFT);
vl.setAlign(VerticalAlignment.CENTER);
@@ -106,7 +109,7 @@ public class MessageCenterView extends HLayout implements MessageCenter.MessageL
}
private void showDetails(Message message) {
- DynamicForm form = new DynamicForm();
+ DynamicForm form = new LocatableDynamicForm(getLocatorId());
form.setWrapItemTitles(false);
StaticTextItem title = new StaticTextItem("title", "Title");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableButton.java
index 42fcba2..5559ca4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableButton.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableButton.java
@@ -17,8 +17,7 @@ public class LocatableButton extends Button {
*/
public LocatableButton(String locatorId, String title) {
super(title);
- String unsafeId = this.getScClassName() + "-" + locatorId;
- setID(SeleniumUtility.getSafeId(unsafeId));
+ SeleniumUtility.setID(this, locatorId);
}
}
commit aba06a3ab5c0a49da116dd6cdb31d230e47ccdff
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Aug 24 13:32:32 2010 -0400
Selenium Work
- Add a few more Locatable wrapper class
- Centralize ID setting logic and make ID override optional (as set in
SeleniumUtility.java)
- Add eager-destroy of existing widgets that will conflict with the ID
being set on a new widget.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableDialog.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableDialog.java
index b5b841a..b66cab0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableDialog.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableDialog.java
@@ -20,8 +20,7 @@ public class LocatableDialog extends Dialog implements Locatable {
public LocatableDialog(String locatorId) {
super();
this.locatorId = locatorId;
- String unsafeId = this.getScClassName() + "-" + locatorId;
- setID(SeleniumUtility.getSafeId(unsafeId));
+ SeleniumUtility.setID(this, locatorId);
}
public String getLocatorId() {
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
index c1c15af..bf03a4a 100644
--- 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
@@ -20,8 +20,7 @@ public class LocatableDynamicForm extends DynamicForm implements Locatable {
public LocatableDynamicForm(String locatorId) {
super();
this.locatorId = locatorId;
- String unsafeId = this.getScClassName() + "-" + locatorId;
- setID(SeleniumUtility.getSafeId(unsafeId));
+ SeleniumUtility.setID(this, locatorId);
}
public String getLocatorId() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.java
index 36a40c4..357d634 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.java
@@ -19,9 +19,24 @@ public class LocatableHLayout extends HLayout implements Locatable {
*/
public LocatableHLayout(String locatorId) {
super();
+ init(locatorId);
+ }
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ * @param membersMargin
+ */
+ public LocatableHLayout(String locatorId, int membersMargin) {
+ super(membersMargin);
+ init(locatorId);
+ }
+
+ private void init(String locatorId) {
this.locatorId = locatorId;
- String unsafeId = this.getScClassName() + "-" + locatorId;
- setID(SeleniumUtility.getSafeId(unsafeId));
+ SeleniumUtility.setID(this, locatorId);
}
public String getLocatorId() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHTMLPane.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHTMLPane.java
index c86b4ec..a7b8ea2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHTMLPane.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHTMLPane.java
@@ -20,8 +20,7 @@ public class LocatableHTMLPane extends HTMLPane implements Locatable {
public LocatableHTMLPane(String locatorId) {
super();
this.locatorId = locatorId;
- String unsafeId = this.getScClassName() + "-" + locatorId;
- setID(SeleniumUtility.getSafeId(unsafeId));
+ SeleniumUtility.setID(this, locatorId);
}
public String getLocatorId() {
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
index 021c98f..d733bd1 100644
--- 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
@@ -17,8 +17,7 @@ public class LocatableIButton extends IButton {
*/
public LocatableIButton(String locatorId, String title) {
super(title);
- String unsafeId = this.getScClassName() + "-" + locatorId;
- setID(SeleniumUtility.getSafeId(unsafeId));
+ SeleniumUtility.setID(this, locatorId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIMenuButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIMenuButton.java
new file mode 100644
index 0000000..3895af9
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIMenuButton.java
@@ -0,0 +1,49 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.menu.IMenuButton;
+import com.smartgwt.client.widgets.menu.Menu;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.menu.IMenuButton that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableIMenuButton extends IMenuButton implements Locatable {
+
+ private String locatorId;
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ */
+ public LocatableIMenuButton(String locatorId, String title) {
+ super(title);
+ init(locatorId);
+ }
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ */
+ public LocatableIMenuButton(String locatorId, String title, Menu menu) {
+ super(title, menu);
+ init(locatorId);
+ }
+
+ private void init(String locatorId) {
+ this.locatorId = locatorId;
+ SeleniumUtility.setID(this, locatorId);
+ }
+
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ public String extendLocatorId(String extension) {
+ return this.locatorId + "-" + extension;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableImg.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableImg.java
index 1d1ae6e..7e50f7e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableImg.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableImg.java
@@ -18,8 +18,7 @@ public class LocatableImg extends Img {
*/
public LocatableImg(String locatorId, String src, int width, int height) {
super(src, width, height);
- String unsafeId = this.getScClassName() + "-" + locatorId;
- setID(SeleniumUtility.getSafeId(unsafeId));
+ SeleniumUtility.setID(this, locatorId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableLabel.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableLabel.java
new file mode 100644
index 0000000..710dc58
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableLabel.java
@@ -0,0 +1,49 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.Label;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.Label that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableLabel extends Label implements Locatable {
+
+ private String locatorId;
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ */
+ public LocatableLabel(String locatorId) {
+ super();
+ init(locatorId);
+ }
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ */
+ public LocatableLabel(String locatorId, String contents) {
+ super(contents);
+ init(locatorId);
+ }
+
+ private void init(String locatorId) {
+ this.locatorId = locatorId;
+ SeleniumUtility.setID(this, locatorId);
+ }
+
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ public String extendLocatorId(String extension) {
+ return this.locatorId + "-" + extension;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableLayout.java
index 5d1be5b..04a37d1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableLayout.java
@@ -20,8 +20,7 @@ public class LocatableLayout extends Layout implements Locatable {
public LocatableLayout(String locatorId) {
super();
this.locatorId = locatorId;
- String unsafeId = this.getScClassName() + "-" + locatorId;
- setID(SeleniumUtility.getSafeId(unsafeId));
+ SeleniumUtility.setID(this, locatorId);
}
public String getLocatorId() {
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
index 6eba310..66eb349 100644
--- 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
@@ -20,8 +20,7 @@ public class LocatableListGrid extends ListGrid implements Locatable {
public LocatableListGrid(String locatorId) {
super();
this.locatorId = locatorId;
- String unsafeId = this.getScClassName() + "-" + locatorId;
- setID(SeleniumUtility.getSafeId(unsafeId));
+ SeleniumUtility.setID(this, locatorId);
}
public String getLocatorId() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableSectionStack.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableSectionStack.java
new file mode 100644
index 0000000..c4b5aa6
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableSectionStack.java
@@ -0,0 +1,34 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.layout.SectionStack;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.layout.SectionStack that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableSectionStack extends SectionStack implements Locatable {
+
+ private String locatorId;
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ */
+ public LocatableSectionStack(String locatorId) {
+ super();
+ this.locatorId = locatorId;
+ SeleniumUtility.setID(this, locatorId);
+ }
+
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ public String extendLocatorId(String extension) {
+ return this.locatorId + "-" + extension;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableStretchImgButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableStretchImgButton.java
index 818f339..fd3b85e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableStretchImgButton.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableStretchImgButton.java
@@ -18,8 +18,7 @@ public class LocatableStretchImgButton extends StretchImgButton {
*/
public LocatableStretchImgButton(String locatorId) {
super();
- String unsafeId = this.getScClassName() + "-" + locatorId;
- setID(SeleniumUtility.getSafeId(unsafeId));
+ SeleniumUtility.setID(this, locatorId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTab.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTab.java
index 768ba40..fa0338c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTab.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTab.java
@@ -53,8 +53,10 @@ public class LocatableTab extends Tab implements Locatable {
private void init(String locatorId) {
this.locatorId = locatorId;
- String unsafeId = "Tab-" + locatorId;
- setID(SeleniumUtility.getSafeId(unsafeId));
+ if (!SeleniumUtility.isUseDefaultIds()) {
+ String unsafeId = "Tab-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
+ }
}
public String getLocatorId() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTabSet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTabSet.java
index 3dd875a..ce21a34 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTabSet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTabSet.java
@@ -38,8 +38,7 @@ public class LocatableTabSet extends TabSet {
public LocatableTabSet(String locatorId) {
super();
this.locatorId = locatorId;
- String unsafeId = this.getScClassName() + "-" + locatorId;
- setID(SeleniumUtility.getSafeId(unsafeId));
+ SeleniumUtility.setID(this, locatorId);
}
/**
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTileLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTileLayout.java
index 1cb7dce..3b8fa15 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTileLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTileLayout.java
@@ -20,8 +20,7 @@ public class LocatableTileLayout extends TileLayout implements Locatable {
public LocatableTileLayout(String locatorId) {
super();
this.locatorId = locatorId;
- String unsafeId = this.getScClassName() + "-" + locatorId;
- setID(SeleniumUtility.getSafeId(unsafeId));
+ SeleniumUtility.setID(this, locatorId);
}
public String getLocatorId() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableToolStrip.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableToolStrip.java
new file mode 100644
index 0000000..62d113e
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableToolStrip.java
@@ -0,0 +1,34 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.toolbar.ToolStrip that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableToolStrip extends ToolStrip implements Locatable {
+
+ private String locatorId;
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ */
+ public LocatableToolStrip(String locatorId) {
+ super();
+ this.locatorId = locatorId;
+ SeleniumUtility.setID(this, locatorId);
+ }
+
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ public String extendLocatorId(String extension) {
+ return this.locatorId + "-" + extension;
+ }
+
+}
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
index 8058c93..18bcd13 100644
--- 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
@@ -16,9 +16,7 @@ public class LocatableTransferImgButton extends TransferImgButton {
* @param img not null.
*/
public LocatableTransferImgButton(TransferImg img) {
- super(img);
- String safeId = this.getScClassName() + "-" + getSuffix(img);
- setID(safeId);
+ this(getSuffix(img), img);
}
/**
@@ -30,11 +28,10 @@ public class LocatableTransferImgButton extends TransferImgButton {
*/
public LocatableTransferImgButton(String locatorId, TransferImg img) {
super(img);
- String unsafeId = this.getScClassName() + "-" + locatorId;
- setID(SeleniumUtility.getSafeId(unsafeId));
+ SeleniumUtility.setID(this, locatorId);
}
- private String getSuffix(TransferImg img) {
+ static private String getSuffix(TransferImg img) {
if (TransferImgButton.LEFT == img)
return "LEFT";
if (TransferImgButton.LEFT_ALL == img)
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
index a93e6bd..8771010 100644
--- 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
@@ -20,8 +20,7 @@ public class LocatableTreeGrid extends TreeGrid implements Locatable {
public LocatableTreeGrid(String locatorId) {
super();
this.locatorId = locatorId;
- String unsafeId = this.getScClassName() + "-" + locatorId;
- setID(SeleniumUtility.getSafeId(unsafeId));
+ SeleniumUtility.setID(this, locatorId);
}
public String getLocatorId() {
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
index 8e8fb22..00946ed 100644
--- 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
@@ -32,16 +32,16 @@ public class LocatableVLayout extends VLayout implements Locatable {
* ID Format: "scClassname-locatorId"
* </pre>
* @param locatorId not null or empty.
+ * @param membersMargin
*/
public LocatableVLayout(String locatorId, int membersMargin) {
- super();
+ super(membersMargin);
init(locatorId);
}
private void init(String locatorId) {
this.locatorId = locatorId;
- String unsafeId = this.getScClassName() + "-" + locatorId;
- setID(SeleniumUtility.getSafeId(unsafeId));
+ SeleniumUtility.setID(this, locatorId);
}
public String getLocatorId() {
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
index a4d01ea..ac930e2 100644
--- 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
@@ -3,6 +3,11 @@ 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;
+import com.smartgwt.client.widgets.Canvas;
+
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
/**
* Utilities for assisting with Selenium Automation
@@ -11,34 +16,51 @@ import com.smartgwt.client.widgets.BaseWidget;
*/
public class SeleniumUtility {
+ private static final boolean USE_DEFAULT_IDS = false;
+
/** 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
+ * ID Format: "scClassname-locatorId"
* </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);
+ static public <T extends BaseWidget> T setID(final T widget, String locatorId) {
+ if (!USE_DEFAULT_IDS) {
+ String unsafeId = widget.getScClassName() + "-" + locatorId;
+ String safeId = SeleniumUtility.getSafeId(unsafeId, DEFAULT_ID);
+ Canvas canvasWithId = Canvas.getById(safeId);
+ if (null != canvasWithId) {
+ try {
+ canvasWithId.destroy();
+ CoreGUI.getMessageCenter().notify(
+ new Message("ID Conflict resolved: " + safeId, getSmallStackTrace(null), Severity.Info));
+ } catch (Throwable t) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("ID Conflict unresolved: " + getSmallStackTrace(t), Severity.Info));
+ }
+ }
+ widget.setID(SeleniumUtility.getSafeId(unsafeId, DEFAULT_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());
+ static private String getSmallStackTrace(Throwable t) {
+ StringBuilder smallStack = new StringBuilder();
+
+ StackTraceElement[] stack = (null == t) ? new Exception().getStackTrace() : t.getStackTrace();
+ for (int i = 1; i < stack.length; i++) {
+ StackTraceElement ste = stack[i];
+ if (ste.getClassName().startsWith("org.rhq")) {
+ smallStack.append(ste.toString());
+ smallStack.append("\n");
+ }
+ }
+ return smallStack.toString();
}
/**
@@ -54,8 +76,11 @@ public class SeleniumUtility {
* @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);
+ if (!USE_DEFAULT_IDS) {
+ String id = getSafeId(unsafeId, String.valueOf(uiObject.hashCode()));
+ uiObject.getElement().setAttribute("id", id);
+ }
+
return uiObject;
}
@@ -84,7 +109,6 @@ public class SeleniumUtility {
* @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);
}
@@ -106,4 +130,8 @@ public class SeleniumUtility {
String safeId = unsafeId.replace(" ", "").replace(".", "");
return safeId;
}
+
+ static public boolean isUseDefaultIds() {
+ return USE_DEFAULT_IDS;
+ }
}
commit ffd2535ded451f6b7859239d4957f52cc5817b67
Merge: af8597f... 593d4cf...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Aug 23 15:07:42 2010 -0400
Merge branch 'master' into master-jay
commit af8597f5af214d8b44aee79d2eaaa8071bbb412f
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Aug 23 14:51:08 2010 -0400
Selenium Work - Adding locatorId infrastructure and explicit locatorIds
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 0d79e07..8d44d49 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
@@ -257,27 +257,27 @@ public class CoreGUI implements EntryPoint, ValueChangeHandler<String> {
Canvas canvas;
if (breadcrumbName.equals("Administration")) {
- canvas = new AdministrationView();
+ canvas = new AdministrationView("CoreAdministration");
} else if (breadcrumbName.equals("Demo")) {
canvas = new DemoCanvas();
} else if (breadcrumbName.equals("Inventory")) {
- canvas = new InventoryView();
+ canvas = new InventoryView("CoreInventory");
} else if (breadcrumbName.equals("Resource")) {
- canvas = new ResourceTopView();
+ canvas = new ResourceTopView("CoreResource");
} else if (breadcrumbName.equals("ResourceGroup")) {
- canvas = new ResourceGroupTopView();
+ canvas = new ResourceGroupTopView("CoreGroup");
} else if (breadcrumbName.equals("Dashboard")) {
- canvas = new DashboardsView();
+ canvas = new DashboardsView("CoreDashboard");
} else if (breadcrumbName.equals("Bundles")) {
- canvas = new BundleTopView();
+ canvas = new BundleTopView("CoreBundle");
} else if (breadcrumbName.equals("LogOut")) {
canvas = new LoginView(true);
} else if (breadcrumbName.equals("Tag")) {
- canvas = new TaggedView();
+ canvas = new TaggedView("CoreTag");
} else if (breadcrumbName.equals("Subsystems")) {
- canvas = new AlertsView();
+ canvas = new AlertsView("CoreAlert");
} else if (breadcrumbName.equals("Reports")) {
- canvas = new ReportTopView();
+ canvas = new ReportTopView("CoreReport");
} else {
canvas = null;
}
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 3fc37f4..06004a0 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
@@ -59,7 +59,7 @@ public class DemoCanvas extends Canvas {
final Tab configTab = new Tab("Configuration Editor");
//Tab alertHistoryTab = new Tab("Alert History");
- tagTab.setPane(new TagCloudView());
+ tagTab.setPane(new TagCloudView("TagTabTagCloud"));
selectorTab.setPane(new ResourceSelector("Demo Resource Selector"));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index 5779155..b6308aa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -25,7 +25,6 @@ import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.SectionStack;
import com.smartgwt.client.widgets.layout.SectionStackSection;
import com.smartgwt.client.widgets.tree.Tree;
@@ -41,11 +40,12 @@ import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
import org.rhq.enterprise.gui.coregui.client.admin.users.UsersView;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.ResourceAutodiscoveryView;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
/**
* @author Greg Hinkle
*/
-public class AdministrationView extends HLayout implements BookmarkableView {
+public class AdministrationView extends LocatableHLayout implements BookmarkableView {
public static final String VIEW_PATH = "Administration";
@@ -57,6 +57,10 @@ public class AdministrationView extends HLayout implements BookmarkableView {
private Canvas contentCanvas;
private LinkedHashMap<String, TreeGrid> treeGrids = new LinkedHashMap<String, TreeGrid>();
+ public AdministrationView(String locatorId) {
+ super(locatorId);
+ }
+
@Override
protected void onInit() {
super.onInit();
@@ -221,11 +225,11 @@ public class AdministrationView extends HLayout implements BookmarkableView {
} else if ("Security".equals(section)) {
if ("Manage Users".equals(page)) {
- content = new UsersView();
+ content = new UsersView(extendLocatorId("Users"));
} else if ("Manage Roles".equals(page)) {
- content = new RolesView();
+ content = new RolesView(extendLocatorId("Roles"));
} else if ("Auto Discovery Queue".equals(page)) {
- content = new ResourceAutodiscoveryView();
+ content = new ResourceAutodiscoveryView(extendLocatorId("ADQ"));
} else if ("Remote Agent Install".equals(page)) {
content = new RemoteAgentInstallView();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
index 7c0f175..c00947d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
@@ -18,26 +18,27 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.roles;
-import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
-import org.rhq.enterprise.gui.coregui.client.ViewPath;
-import org.rhq.enterprise.gui.coregui.client.components.table.Table;
-import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
-
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class RolesView extends VLayout implements BookmarkableView {
-
+public class RolesView extends LocatableVLayout implements BookmarkableView {
+ public RolesView(String locatorId) {
+ super(locatorId);
+ }
@Override
protected void onInit() {
@@ -48,8 +49,7 @@ public class RolesView extends VLayout implements BookmarkableView {
final RolesDataSource datasource = RolesDataSource.getInstance();
-
- final Table table = new Table("Roles");
+ final Table table = new Table(getLocatorId(), "Roles");
table.setHeight("50%");
table.setShowResizeBar(true);
table.setResizeBarTarget("next");
@@ -58,38 +58,29 @@ public class RolesView extends VLayout implements BookmarkableView {
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
-
ListGridField nameField = new ListGridField("name", "Name");
table.getListGrid().setFields(idField, nameField);
+ table.addTableAction("RemoveRole", "Remove", Table.SelectionEnablement.ANY,
+ "Are you sure you want to delete # roles?", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ table.getListGrid().removeSelectedData();
+ }
+ });
-
- table.addTableAction("Remove",
- Table.SelectionEnablement.ANY,
- "Are you sure you want to delete # roles?",
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- table.getListGrid().removeSelectedData();
- }
- });
-
- table.addTableAction("Add Role",
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- createRole();
- }
- });
-
+ table.addTableAction("AddRole", "Add Role", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ createRole();
+ }
+ });
addMember(table);
-
final RoleEditView roleEditor = new RoleEditView();
roleEditor.setOverflow(Overflow.AUTO);
addMember(roleEditor);
-
table.getListGrid().addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
@@ -101,8 +92,6 @@ public class RolesView extends VLayout implements BookmarkableView {
});
}
-
-
public void createRole() {
RoleEditView editView = new RoleEditView();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index bc070bf..6e49288 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@ -18,27 +18,26 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.users;
-import org.rhq.enterprise.gui.coregui.client.components.table.Table;
-import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
-
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.SectionStackSection;
-import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
+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.util.selenium.LocatableVLayout;
+
/**
* @author Greg Hinkle
*/
-public class UsersView extends VLayout {
+public class UsersView extends LocatableVLayout {
- public UsersView() {
- super();
+ public UsersView(String locatorId) {
+ super(locatorId);
setWidth100();
setHeight100();
}
@@ -47,15 +46,13 @@ public class UsersView extends VLayout {
protected void onInit() {
super.onInit();
-
final UsersDataSource datasource = UsersDataSource.getInstance();
- final Table table = new Table("Users");
+ final Table table = new Table(getLocatorId(), "Users");
table.setHeight("50%");
table.setShowResizeBar(true);
table.setDataSource(datasource);
-
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
@@ -69,22 +66,18 @@ public class UsersView extends VLayout {
toolStrip.setWidth100();
toolStrip.setMembersMargin(15);
- table.addTableAction("Remove",
- Table.SelectionEnablement.ANY,
- "Are you sure you want to delete # users?",
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- table.getListGrid().removeSelectedData();
- }
- });
-
- table.addTableAction("Add User",
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- createUser();
- }
- });
+ table.addTableAction("RemoveUser", "Remove", Table.SelectionEnablement.ANY,
+ "Are you sure you want to delete # users?", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ table.getListGrid().removeSelectedData();
+ }
+ });
+ table.addTableAction("AddUser", "Add User", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ createUser();
+ }
+ });
final UserEditView userEditor = new UserEditView();
@@ -102,15 +95,12 @@ public class UsersView extends VLayout {
}
});
-
addMember(table);
addMember(userEditor);
}
-
public void createUser() {
-
UserEditView.editNew();
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
index 8983ffe..1f955f6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@ -56,10 +56,9 @@ import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
public class AlertsView extends Table {
private static final String TITLE = "Alerts";
- private static final SortSpecifier[] SORT_SPECIFIERS = new SortSpecifier[]{
- new SortSpecifier(AlertCriteria.SORT_FIELD_CTIME, SortDirection.DESCENDING),
- new SortSpecifier(AlertCriteria.SORT_FIELD_NAME, SortDirection.ASCENDING)
- };
+ private static final SortSpecifier[] SORT_SPECIFIERS = new SortSpecifier[] {
+ new SortSpecifier(AlertCriteria.SORT_FIELD_CTIME, SortDirection.DESCENDING),
+ new SortSpecifier(AlertCriteria.SORT_FIELD_NAME, SortDirection.ASCENDING) };
private static final String DELETE_CONFIRM_MESSAGE = "Are you sure you want to delete the selected alert(s)?";
@@ -70,14 +69,14 @@ public class AlertsView extends Table {
String[] excludedFieldNames;
boolean showDetails;
- public AlertsView() {
- this(null, null);
+ public AlertsView(String locatorId) {
+ this(locatorId, null, null);
showDetails = false;
}
- public AlertsView(Criteria criteria, String[] excludedFieldNames) {
- super(TITLE, criteria, SORT_SPECIFIERS, excludedFieldNames);
+ public AlertsView(String locatorId, Criteria criteria, String[] excludedFieldNames) {
+ super(locatorId, TITLE, criteria, SORT_SPECIFIERS, excludedFieldNames);
this.dataSource = new AlertDataSource();
@@ -87,7 +86,6 @@ public class AlertsView extends Table {
showDetails = false;
}
-
@Override
protected void onInit() {
super.onInit();
@@ -99,23 +97,25 @@ public class AlertsView extends Table {
listGrid.getField("conditionText").setWidth("30%");
listGrid.getField("conditionValue").setWidth("10%");
listGrid.getField("resourceName").setWidth("20%");
-// listGrid.getField("recoveryInfo").setWidth("20%");
+ // listGrid.getField("recoveryInfo").setWidth("20%");
listGrid.getField("priority").setWidth("7%");
listGrid.getField("ctime").setWidth("13%");
listGrid.getField("ack").setWidth("5%");
listGrid.getField("resourceName").setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- return "<a href=\"" + LinkManager.getResourceLink(listGridRecord.getAttributeAsInt("resourceId")) + "\">" + o + "</a>";
+ return "<a href=\"" + LinkManager.getResourceLink(listGridRecord.getAttributeAsInt("resourceId"))
+ + "\">" + o + "</a>";
}
});
- addTableAction("Delete", Table.SelectionEnablement.ANY, DELETE_CONFIRM_MESSAGE, new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- AlertsView.this.dataSource.deleteAlerts(AlertsView.this);
- }
- });
- addTableAction("Acknowledge", Table.SelectionEnablement.ANY, null, new TableAction() {
+ addTableAction("DeleteAlert", "Delete", Table.SelectionEnablement.ANY, DELETE_CONFIRM_MESSAGE,
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ AlertsView.this.dataSource.deleteAlerts(AlertsView.this);
+ }
+ });
+ addTableAction("AcknowledgeAlert", "Acknowledge", Table.SelectionEnablement.ANY, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
AlertsView.this.dataSource.acknowledgeAlerts(AlertsView.this);
}
@@ -144,10 +144,9 @@ public class AlertsView extends Table {
});
}
-
-// // Add the details panel as the bottom half of the view.
-// // Default is the "nothing selected" message
-// addMember(getNoAlertSelectedMessage());
+ // // Add the details panel as the bottom half of the view.
+ // // Default is the "nothing selected" message
+ // addMember(getNoAlertSelectedMessage());
}
@@ -157,7 +156,7 @@ public class AlertsView extends Table {
generalTab.setPane(getDetailsTableForAlert(record));
Tab conditionsTab = new Tab("Conditions");
conditionsTab.setPane(getConditionsForAlert(record));
- Tab notificationsTab = new Tab("Notificatons");
+ Tab notificationsTab = new Tab("Notifications");
notificationsTab.setPane(getNotificationsForAlert(record));
tabset.addTab(generalTab);
@@ -216,7 +215,6 @@ public class AlertsView extends Table {
recoveryItem.setValue(record.getAttribute("recoveryInfo"));
items.add(recoveryItem);
-
form.setItems(items.toArray(new FormItem[items.size()]));
return form;
@@ -226,13 +224,12 @@ public class AlertsView extends Table {
DataClass[] input = record.getAttributeAsRecordArray("notificationLogs");
- Table notifTable = new Table("Notifications", false);
+ Table notifTable = new Table(extendLocatorId("Notifications"), "Notifications", false);
notifTable.setHeight("35%");
notifTable.setWidth100();
ListGrid grid = notifTable.getListGrid();
grid.setData((Record[]) input);
-
ListGridField sender = new ListGridField(SENDER, "Sender");
sender.setWidth("10%");
ListGridField status = new ListGridField("status", "Result");
@@ -254,7 +251,7 @@ public class AlertsView extends Table {
DataClass[] input = record.getAttributeAsRecordArray("conditionLogs");
String mode = record.getAttribute("conditionExpression");
- Table table = new Table("Conditions: match = " + mode, false);
+ Table table = new Table(extendLocatorId("ConditionLog"), "Conditions: match = " + mode, false);
table.setHeight("35%");
table.setWidth100();
ListGrid grid = table.getListGrid();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
index f7257f4..21565e1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/AbstractAlertDefinitionsView.java
@@ -22,13 +22,13 @@ import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.alert.AlertDefinition;
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.table.Table.SelectionEnablement;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* Superclass to the different alert definition views. This should be subclassed
@@ -36,12 +36,13 @@ import org.rhq.enterprise.gui.coregui.client.components.table.Table.SelectionEna
*
* @author John Mazzitelli
*/
-public abstract class AbstractAlertDefinitionsView extends VLayout {
+public abstract class AbstractAlertDefinitionsView extends LocatableVLayout {
private SingleAlertDefinitionView singleAlertDefinitionView;
private Table alertDefinitionsTable;
- public AbstractAlertDefinitionsView() {
+ public AbstractAlertDefinitionsView(String locatorId) {
+ super(locatorId);
setWidth100();
setHeight100();
setMembersMargin(10);
@@ -52,7 +53,7 @@ public abstract class AbstractAlertDefinitionsView extends VLayout {
super.onDraw();
Criteria criteria = getCriteria();
- alertDefinitionsTable = new Table(getTableTitle(), criteria);
+ alertDefinitionsTable = new Table(extendLocatorId("AlertDef"), getTableTitle(), criteria);
alertDefinitionsTable.setDataSource(getAlertDefinitionDataSource());
alertDefinitionsTable.getListGrid().setUseAllDataSourceFields(true);
@@ -77,7 +78,7 @@ public abstract class AbstractAlertDefinitionsView extends VLayout {
boolean permitted = isAllowedToModifyAlerts();
- alertDefinitionsTable.addTableAction("New", (permitted) ? SelectionEnablement.ALWAYS
+ alertDefinitionsTable.addTableAction(extendLocatorId("New"), "New", (permitted) ? SelectionEnablement.ALWAYS
: SelectionEnablement.NEVER, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
newButtonPressed(selection);
@@ -85,7 +86,7 @@ public abstract class AbstractAlertDefinitionsView extends VLayout {
}
});
- alertDefinitionsTable.addTableAction("Enable", (permitted) ? SelectionEnablement.ANY
+ alertDefinitionsTable.addTableAction(extendLocatorId("Enable"), "Enable", (permitted) ? SelectionEnablement.ANY
: SelectionEnablement.NEVER, "Are You Sure?", new TableAction() {
public void executeAction(ListGridRecord[] selection) {
enableButtonPressed(selection);
@@ -93,15 +94,15 @@ public abstract class AbstractAlertDefinitionsView extends VLayout {
}
});
- alertDefinitionsTable.addTableAction("Disable", (permitted) ? SelectionEnablement.ANY
- : SelectionEnablement.NEVER, "Are You Sure?", new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- disableButtonPressed(selection);
- CoreGUI.refresh();
- }
- });
+ alertDefinitionsTable.addTableAction(extendLocatorId("Disable"), "Disable",
+ (permitted) ? SelectionEnablement.ANY : SelectionEnablement.NEVER, "Are You Sure?", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ disableButtonPressed(selection);
+ CoreGUI.refresh();
+ }
+ });
- alertDefinitionsTable.addTableAction("Delete", (permitted) ? SelectionEnablement.ANY
+ alertDefinitionsTable.addTableAction(extendLocatorId("Delete"), "Delete", (permitted) ? SelectionEnablement.ANY
: SelectionEnablement.NEVER, "Are You Sure?", new TableAction() {
public void executeAction(ListGridRecord[] selection) {
deleteButtonPressed(selection);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java
index 7283f8f..491baee 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/GroupAlertDefinitionsView.java
@@ -38,8 +38,8 @@ public class GroupAlertDefinitionsView extends AbstractAlertDefinitionsView {
private ResourceGroup group;
- public GroupAlertDefinitionsView(ResourceGroup group) {
- super();
+ public GroupAlertDefinitionsView(String locatorId, ResourceGroup group) {
+ super(locatorId);
this.group = group;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
index 84dd71c..acc88c2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
@@ -41,8 +41,8 @@ public class ResourceAlertDefinitionsView extends AbstractAlertDefinitionsView {
private Resource resource;
- public ResourceAlertDefinitionsView(Resource resource) {
- super();
+ public ResourceAlertDefinitionsView(String locatorId, Resource resource) {
+ super(locatorId);
this.resource = resource;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
index e9674ad..4e0ca75 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/TemplateAlertDefinitionsView.java
@@ -38,8 +38,8 @@ public class TemplateAlertDefinitionsView extends AbstractAlertDefinitionsView {
private ResourceType resourceType;
- public TemplateAlertDefinitionsView(ResourceType resourceType) {
- super();
+ public TemplateAlertDefinitionsView(String locatorId, ResourceType resourceType) {
+ super(locatorId);
this.resourceType = resourceType;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
index 5ea41cf..6917f54 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java
@@ -21,7 +21,6 @@ package org.rhq.enterprise.gui.coregui.client.bundle;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.SectionStack;
import com.smartgwt.client.widgets.layout.SectionStackSection;
import com.smartgwt.client.widgets.layout.VLayout;
@@ -33,11 +32,12 @@ import org.rhq.enterprise.gui.coregui.client.bundle.list.BundleView;
import org.rhq.enterprise.gui.coregui.client.bundle.list.BundlesListView;
import org.rhq.enterprise.gui.coregui.client.bundle.tree.BundleTreeView;
import org.rhq.enterprise.gui.coregui.client.content.repository.tree.ContentRepositoryTreeView;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
/**
* @author Greg Hinkle
*/
-public class BundleTopView extends HLayout implements BookmarkableView {
+public class BundleTopView extends LocatableHLayout implements BookmarkableView {
private BundleTreeView bundleTreeView;
private VLayout contentCanvas;
@@ -46,7 +46,8 @@ public class BundleTopView extends HLayout implements BookmarkableView {
private BundleView bundleView;
private BundlesListView bundlesListView;
- public BundleTopView() {
+ public BundleTopView(String locatorId) {
+ super(locatorId);
setOverflow(Overflow.AUTO);
setWidth100();
setHeight100();
@@ -97,10 +98,8 @@ public class BundleTopView extends HLayout implements BookmarkableView {
bundleTreeView.refresh();
}
-
bundleTreeView.selectPath(viewPath);
-
if (viewPath.isEnd()) {
if (currentNextPath == null && bundlesListView != null) {
// refresh
@@ -109,14 +108,14 @@ public class BundleTopView extends HLayout implements BookmarkableView {
bundlesListView.refresh();
} else {
currentNextPath = null;
- this.bundlesListView = new BundlesListView();
+ this.bundlesListView = new BundlesListView(getLocatorId());
setContent(this.bundlesListView);
}
} else {
viewPath.getCurrent().getBreadcrumbs().clear();
if (!viewPath.getNext().equals(currentNextPath)) {
currentNextPath = viewPath.getNext();
- bundleView = new BundleView();
+ bundleView = new BundleView(getLocatorId());
setContent(bundleView);
bundleView.renderView(viewPath.next());
} else {
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 e4281f6..fe4fb1f 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
@@ -26,6 +26,7 @@ import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
/**
* @author John Mazzitelli
@@ -40,7 +41,7 @@ public class BundleSummaryStep extends AbstractWizardStep {
public Canvas getCanvas() {
- DynamicForm form = getDynamicForm();
+ DynamicForm form = new LocatableDynamicForm("BundleCreateSummary");
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 98490d6..34e343e 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
@@ -42,6 +42,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.LocatableVLayout;
public class BundleUploadDataStep extends AbstractWizardStep {
@@ -55,7 +56,7 @@ public class BundleUploadDataStep extends AbstractWizardStep {
}
public Canvas getCanvas() {
- final VLayout mainLayout = getVLayout();
+ final VLayout mainLayout = new LocatableVLayout("BundleCreateUploadData");
mainLayout.setMargin(Integer.valueOf(20));
mainLayout.setWidth100();
mainLayout.setHeight(10);
@@ -183,8 +184,8 @@ public class BundleUploadDataStep extends AbstractWizardStep {
nameLabel.setLayoutAlign(VerticalAlignment.CENTER);
indivLayout.addMember(nameLabel);
- final BundleFileUploadForm uploadForm = new BundleFileUploadForm(this.wizard.getBundleVersion(),
- fileToBeUploaded, false, (isAlreadyUploaded) ? Boolean.TRUE : null);
+ final BundleFileUploadForm uploadForm = new BundleFileUploadForm("BundleFile-" + fileToBeUploaded,
+ this.wizard.getBundleVersion(), fileToBeUploaded, false, (isAlreadyUploaded) ? Boolean.TRUE : null);
uploadForm.setWidth("75%");
indivLayout.addMember(uploadForm);
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 00f7b5b..bccf37b 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
@@ -71,7 +71,7 @@ public class BundleUploadDistroFileStep extends AbstractWizardStep {
radioItems.put("Recipe", createRecipeForm());
mainCanvasForm = new DynamicForm();
- radioGroup = new RadioGroupWithComponentsItem("bundleDistroRadioGroup", "Bundle Distribution", radioItems,
+ radioGroup = new RadioGroupWithComponentsItem("bundleDistRadioGroup", "Bundle Distribution", radioItems,
mainCanvasForm);
radioGroup.setShowTitle(false);
@@ -129,7 +129,7 @@ public class BundleUploadDistroFileStep extends AbstractWizardStep {
urlTextItem.setRequired(false);
urlTextItem.setShowTitle(false);
urlTextItem.setWidth(400);
- DynamicForm urlForm = new LocatableDynamicForm("URL");
+ DynamicForm urlForm = new LocatableDynamicForm("BundleDistUrl");
urlForm.setPadding(20);
urlForm.setWidth100();
urlForm.setItems(urlTextItem);
@@ -137,7 +137,7 @@ public class BundleUploadDistroFileStep extends AbstractWizardStep {
}
private BundleDistributionFileUploadForm createUploadForm() {
- uploadDistroForm = new BundleDistributionFileUploadForm(false);
+ uploadDistroForm = new BundleDistributionFileUploadForm("BundleCreateUploadDistFile", false);
uploadDistroForm.setPadding(20);
uploadDistroForm.addFormHandler(new DynamicFormHandler() {
public void onSubmitComplete(DynamicFormSubmitCompleteEvent event) {
@@ -153,7 +153,7 @@ public class BundleUploadDistroFileStep extends AbstractWizardStep {
}
private DynamicForm createRecipeForm() {
- recipeForm = new DynamicCallbackForm("recipeForm");
+ recipeForm = new DynamicCallbackForm("BundleRecipe", "recipeForm");
recipeForm.setMargin(Integer.valueOf(20));
recipeForm.setShowInlineErrors(false);
@@ -165,7 +165,7 @@ public class BundleUploadDistroFileStep extends AbstractWizardStep {
upload.setShowTitle(false);
upload.setVisible(false);
- final TextFileRetrieverForm textFileRetrieverForm = new TextFileRetrieverForm();
+ final TextFileRetrieverForm textFileRetrieverForm = new TextFileRetrieverForm("BundleCreateRecipeUpload");
upload.setCanvas(textFileRetrieverForm);
showUpload.addClickHandler(new ClickHandler() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
deleted file mode 100644
index b173219..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/create/BundleUploadRecipeStep.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.enterprise.gui.coregui.client.bundle.create;
-
-import java.util.HashMap;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Img;
-import com.smartgwt.client.widgets.form.fields.CanvasItem;
-import com.smartgwt.client.widgets.form.fields.LinkItem;
-import com.smartgwt.client.widgets.form.fields.TextAreaItem;
-import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
-import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
-
-import org.rhq.core.domain.bundle.BundleVersion;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicCallbackForm;
-import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicFormHandler;
-import org.rhq.enterprise.gui.coregui.client.components.upload.DynamicFormSubmitCompleteEvent;
-import org.rhq.enterprise.gui.coregui.client.components.upload.TextFileRetrieverForm;
-import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
-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;
-
-public class BundleUploadRecipeStep extends AbstractWizardStep {
-
- private DynamicCallbackForm form;
- private final AbstractBundleCreateWizard wizard;
- private TextAreaItem recipe;
- private CanvasItem validatingItem;
-
- public BundleUploadRecipeStep(AbstractBundleCreateWizard bundleCreationWizard) {
- this.wizard = bundleCreationWizard;
- }
-
- public Canvas getCanvas() {
- if (form == null) {
- form = new DynamicCallbackForm("uploadRecipeStepForm");
- form.setWidth100();
- form.setMargin(Integer.valueOf(20));
- form.setShowInlineErrors(false);
-
- final LinkItem showUpload = new LinkItem("showUpload");
- showUpload.setValue("Click To Upload A Recipe File");
- showUpload.setShowTitle(false);
-
- final CanvasItem upload = new CanvasItem("upload");
- upload.setShowTitle(false);
- upload.setVisible(false);
-
- final TextFileRetrieverForm textFileRetrieverForm = new TextFileRetrieverForm();
- upload.setCanvas(textFileRetrieverForm);
-
- showUpload.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- form.hideItem(showUpload.getName());
- form.showItem(upload.getName());
- }
- });
-
- recipe = new TextAreaItem("recipe");
- recipe.setShowTitle(false);
- recipe.setRequired(true);
- recipe.setColSpan(2);
- recipe.setWidth("*");
- recipe.setHeight(220);
-
- textFileRetrieverForm.addFormHandler(new DynamicFormHandler() {
- public void onSubmitComplete(DynamicFormSubmitCompleteEvent event) {
- wizard.setRecipe(event.getResults());
- recipe.setValue(event.getResults());
- textFileRetrieverForm.retrievalStatus(true);
- form.showItem(showUpload.getName());
- form.hideItem(upload.getName());
- }
- });
-
- validatingItem = new CanvasItem("validating", "Validating");
- validatingItem.setCanvas(new Img("ajax-loader.gif", 16, 16));
- validatingItem.setVisible(false);
-
- form.setItems(showUpload, upload, recipe, validatingItem);
- } else {
- // we are traversing back to this step - don't allow the recipe to change if we've already created the bundle version
- if (wizard.getBundleVersion() != null) {
- recipe.setValue(wizard.getBundleVersion().getRecipe());
- recipe.setDisabled(Boolean.TRUE);
- form.hideItem("showUpload");
- form.hideItem("upload");
- }
- }
- return form;
- }
-
- public boolean nextPage() {
-
- if (wizard.getBundleVersion() != null) {
- return true;
- } else {
- if (form.validate()) {
- validateAndCreateRecipe(); // this will move to the next step for us
- }
- return false;
- }
-
- }
-
- public String getName() {
- return "Provide Bundle Recipe";
- }
-
- private void validateAndCreateRecipe() {
- form.showItem(validatingItem.getName());
- setButtonsDisableMode(true);
-
- wizard.setRecipe(recipe.getValue().toString());
-
- BundleGWTServiceAsync bundleServer = GWTServiceLookup.getBundleService();
- bundleServer.createBundleVersionViaRecipe(this.wizard.getRecipe(), new AsyncCallback<BundleVersion>() {
- public void onSuccess(BundleVersion result) {
- form.hideItem(validatingItem.getName());
-
- CoreGUI.getMessageCenter().notify(
- new Message("Created bundle [" + result.getName() + "] version [" + result.getVersion() + "]",
- Message.Severity.Info));
- wizard.setBundleVersion(result);
- wizard.getView().incrementStep();
- setButtonsDisableMode(false);
- CoreGUI.refresh();
- }
-
- public void onFailure(Throwable caught) {
- form.hideItem(validatingItem.getName());
-
- HashMap<String, String> errors = new HashMap<String, String>();
- errors.put(recipe.getName(), "Invalid Recipe: " + caught.getMessage());
- form.setErrors(errors, true);
- CoreGUI.getErrorHandler().handleError("Failed to create bundle", caught);
- wizard.setBundleVersion(null);
- wizard.setRecipe("");
- setButtonsDisableMode(false);
- }
- });
- }
-
- private void setButtonsDisableMode(boolean disabled) {
- wizard.getView().getCancelButton().setDisabled(disabled);
- wizard.getView().getNextButton().setDisabled(disabled);
- wizard.getView().getPreviousButton().setDisabled(disabled);
- }
-}
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 b69f2ed..ca30431 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
@@ -33,6 +33,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.LocatableVLayout;
/**
* @author Jay Shaughnessy
@@ -55,7 +56,7 @@ public class DeployStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (canvas == null) {
- canvas = getVLayout();
+ canvas = new LocatableVLayout("BundleDeployDeploy");
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 a2b2b97..63750d8 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
@@ -31,6 +31,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
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.selenium.LocatableDynamicForm;
/**
* @author Jay Shaughnessy
@@ -52,7 +53,7 @@ public class GetDeploymentInfoStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (form == null) {
- form = getDynamicForm();
+ form = new LocatableDynamicForm("BundleDeployGetDepInfo");
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 c29ff74..0079fc8 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
@@ -27,6 +27,7 @@ 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.components.wizard.AbstractWizardStep;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
public class GetDeploymentOptionsStep extends AbstractWizardStep {
@@ -47,7 +48,7 @@ public class GetDeploymentOptionsStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (form == null) {
- form = getDynamicForm();
+ form = new LocatableDynamicForm("BundleDeployGetDepOptions");
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 1ca7062..0c8cf78 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
@@ -38,6 +38,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.LocatableVLayout;
public class GetDestinationStep extends AbstractWizardStep {
@@ -59,7 +60,7 @@ public class GetDestinationStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (this.form == null) {
- this.form = getVLayout();
+ this.form = new LocatableVLayout("BundleDeployGetDest");
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 2671e04..a77338d 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(getName());
+ this.selector = new BundleSelector("BundleDeploySelectBundle");
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 ef41a78..71f0a38 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
@@ -37,6 +37,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
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.selenium.LocatableDynamicForm;
public class SelectBundleVersionStep extends AbstractWizardStep {
@@ -66,7 +67,7 @@ public class SelectBundleVersionStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (form == null) {
- form = getDynamicForm();
+ form = new LocatableDynamicForm("BundleDeploySelectBundleVersion");
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/deployment/BundleDeploymentListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
index 8cd574c..7751ac1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
@@ -25,15 +25,11 @@ package org.rhq.enterprise.gui.coregui.client.bundle.deployment;
import java.util.HashMap;
import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.widgets.Canvas;
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.bundle.Bundle;
import org.rhq.core.domain.bundle.BundleDeploymentStatus;
-import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
/**
@@ -41,11 +37,10 @@ import org.rhq.enterprise.gui.coregui.client.components.table.Table;
*/
public class BundleDeploymentListView extends Table {
- public BundleDeploymentListView(Criteria criteria) {
- super("Bundle Deployments", criteria);
+ public BundleDeploymentListView(String locatorId, Criteria criteria) {
+ super(locatorId, "Bundle Deployments", criteria);
}
-
@Override
protected void onInit() {
super.onInit();
@@ -57,16 +52,16 @@ public class BundleDeploymentListView extends Table {
getListGrid().getField("name").setWidth("25%");
getListGrid().getField("name").setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord record, int i, int i1) {
- return "<a href=\"#Bundles/Bundle/" + record.getAttribute("bundleId") + "/deployments/" + record.getAttribute("id") + "\">" + String.valueOf(o) + "</a>";
+ return "<a href=\"#Bundles/Bundle/" + record.getAttribute("bundleId") + "/deployments/"
+ + record.getAttribute("id") + "\">" + String.valueOf(o) + "</a>";
}
});
-
getListGrid().getField("bundleVersionVersion").setWidth("80");
getListGrid().getField("bundleVersionVersion").setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
return "<a href=\"#Bundles/Bundle/" + listGridRecord.getAttribute("bundleId") + "/versions/"
- + listGridRecord.getAttribute("bundleVersionId") + "\">" + o + "</a>";
+ + listGridRecord.getAttribute("bundleVersionId") + "\">" + o + "</a>";
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
index 595a216..0e6d7ec 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
@@ -31,7 +31,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.AnimationEffect;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.LinkItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
@@ -66,11 +65,13 @@ import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallb
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.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class BundleDeploymentView extends VLayout implements BookmarkableView {
+public class BundleDeploymentView extends LocatableVLayout implements BookmarkableView {
private BundleGWTServiceAsync bundleService;
private BundleDeployment deployment;
@@ -79,7 +80,8 @@ public class BundleDeploymentView extends VLayout implements BookmarkableView {
private VLayout detail;
- public BundleDeploymentView() {
+ public BundleDeploymentView(String locatorId) {
+ super(locatorId);
setWidth100();
setHeight100();
setMargin(10);
@@ -91,12 +93,12 @@ public class BundleDeploymentView extends VLayout implements BookmarkableView {
this.version = bundleDeployment.getBundleVersion();
this.bundle = bundleDeployment.getBundleVersion().getBundle();
- addMember(new BackButton("Back to Destination: " + deployment.getDestination().getName(), "Bundles/Bundle/" + version.getBundle().getId() + "/destinations/" + deployment.getDestination().getId()));
-
+ addMember(new BackButton(getLocatorId(), "Back to Destination: " + deployment.getDestination().getName(),
+ "Bundles/Bundle/" + version.getBundle().getId() + "/destinations/" + deployment.getDestination().getId()));
addMember(new HeaderLabel(Canvas.getImgURL("subsystems/bundle/BundleDeployment_24.png"), deployment.getName()));
- DynamicForm form = new DynamicForm();
+ LocatableDynamicForm form = new LocatableDynamicForm(getLocatorId());
form.setNumCols(4);
LinkItem bundleName = new LinkItem("bundle");
@@ -107,21 +109,23 @@ public class BundleDeploymentView extends VLayout implements BookmarkableView {
CanvasItem tagItem = new CanvasItem("tag");
tagItem.setShowTitle(false);
- TagEditorView tagEditor = new TagEditorView(version.getTags(), false, new TagsChangedCallback() {
- public void tagsChanged(HashSet<Tag> tags) {
- GWTServiceLookup.getTagService().updateBundleDeploymentTags(deployment.getId(), tags,
+ TagEditorView tagEditor = new TagEditorView(form.getLocatorId(), version.getTags(), false,
+ new TagsChangedCallback() {
+ public void tagsChanged(HashSet<Tag> tags) {
+ GWTServiceLookup.getTagService().updateBundleDeploymentTags(deployment.getId(), tags,
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to update bundle deployment's tags", caught);
+ CoreGUI.getErrorHandler().handleError("Failed to update bundle deployment's tags",
+ caught);
}
public void onSuccess(Void result) {
CoreGUI.getMessageCenter().notify(
- new Message("Bundle Deployment Tags updated", Message.Severity.Info));
+ new Message("Bundle Deployment Tags updated", Message.Severity.Info));
}
});
- }
- });
+ }
+ });
tagEditor.setVertical(true);
tagItem.setCanvas(tagEditor);
tagItem.setRowSpan(4);
@@ -135,7 +139,6 @@ public class BundleDeploymentView extends VLayout implements BookmarkableView {
destinationGroup.setLinkTitle(deployment.getDestination().getGroup().getName());
destinationGroup.setTarget("_self");
-
StaticTextItem path = new StaticTextItem("path", "Path");
path.setValue(deployment.getDestination().getDeployDir());
@@ -153,12 +156,10 @@ public class BundleDeploymentView extends VLayout implements BookmarkableView {
detail.setAutoHeight();
detail.hide();
addMember(detail);
-
}
private Table createDeploymentsTable() {
- Table table = new Table("Deployment Machines");
-
+ Table table = new Table(getLocatorId(), "Deployment Machines");
table.setTitleComponent(new HTMLFlow("Select a row to show install details."));
@@ -175,11 +176,11 @@ public class BundleDeploymentView extends VLayout implements BookmarkableView {
});
resourceIcon.setWidth(30);
-
ListGridField resource = new ListGridField("resource", "Platform");
resource.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- return "<a href=\"" + LinkManager.getResourceLink(listGridRecord.getAttributeAsInt("resourceId")) + "\">" + o + "</a>";
+ return "<a href=\"" + LinkManager.getResourceLink(listGridRecord.getAttributeAsInt("resourceId"))
+ + "\">" + o + "</a>";
}
});
@@ -195,7 +196,6 @@ public class BundleDeploymentView extends VLayout implements BookmarkableView {
status.setValueIconHeight(11);
status.setWidth(80);
-
table.getListGrid().setFields(resourceIcon, resource, resourceVersion, status);
ArrayList<ListGridRecord> records = new ArrayList<ListGridRecord>();
@@ -203,8 +203,8 @@ public class BundleDeploymentView extends VLayout implements BookmarkableView {
ListGridRecord record = new ListGridRecord();
record.setAttribute("resource", rd.getResource().getName());
-
- record.setAttribute("resourceAvailability", rd.getResource().getCurrentAvailability().getAvailabilityType().name());
+ record.setAttribute("resourceAvailability", rd.getResource().getCurrentAvailability().getAvailabilityType()
+ .name());
record.setAttribute("resourceId", rd.getResource().getId());
record.setAttribute("resourceVersion", rd.getResource().getVersion());
record.setAttribute("status", rd.getStatus().name());
@@ -220,9 +220,9 @@ public class BundleDeploymentView extends VLayout implements BookmarkableView {
if (selectionEvent.getState()) {
BundleResourceDeployment bundleResourceDeployment = (BundleResourceDeployment) selectionEvent
- .getRecord().getAttributeAsObject("entity");
+ .getRecord().getAttributeAsObject("entity");
BundleResourceDeploymentHistoryListView detailView = new BundleResourceDeploymentHistoryListView(
- bundleResourceDeployment);
+ bundleResourceDeployment);
detail.removeMembers(detail.getMembers());
detail.addMember(detailView);
@@ -260,7 +260,6 @@ public class BundleDeploymentView extends VLayout implements BookmarkableView {
final ViewId viewId = viewPath.getCurrent();
-
BundleDeploymentCriteria criteria = new BundleDeploymentCriteria();
criteria.addFilterId(bundleDeploymentId);
criteria.fetchBundleVersion(true);
@@ -298,27 +297,26 @@ public class BundleDeploymentView extends VLayout implements BookmarkableView {
criteria.fetchResource(true);
criteria.fetchBundleDeployment(true);
bundleService.findBundleResourceDeploymentsByCriteria(criteria,
- new AsyncCallback<PageList<BundleResourceDeployment>>() {
-
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load deployment detail", caught);
- }
-
- public void onSuccess(PageList<BundleResourceDeployment> result) {
-
- deployment.setResourceDeployments(result);
+ new AsyncCallback<PageList<BundleResourceDeployment>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load deployment detail", caught);
+ }
- viewPath.getViewForIndex(2).getBreadcrumbs().set(0, new Breadcrumb(String.valueOf(bundle.getId()), bundle.getName()));
- viewId.getBreadcrumbs().set(0,new Breadcrumb(String.valueOf(deployment.getId()), deployment.getName()));
- CoreGUI.refreshBreadCrumbTrail();
+ public void onSuccess(PageList<BundleResourceDeployment> result) {
+ deployment.setResourceDeployments(result);
+ viewPath.getViewForIndex(2).getBreadcrumbs().set(0,
+ new Breadcrumb(String.valueOf(bundle.getId()), bundle.getName()));
+ viewId.getBreadcrumbs().set(0,
+ new Breadcrumb(String.valueOf(deployment.getId()), deployment.getName()));
+ CoreGUI.refreshBreadCrumbTrail();
- viewBundleDeployment(deployment, viewPath.getCurrent());
+ viewBundleDeployment(deployment, viewPath.getCurrent());
- }
- });
+ }
+ });
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
index 0cd85a4..cdf87b2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
@@ -37,15 +37,13 @@ import org.rhq.enterprise.gui.coregui.client.components.table.Table;
*/
public class BundleDestinationListView extends Table {
-
-
- public BundleDestinationListView() {
- super("Bundle Destinations");
+ public BundleDestinationListView(String locatorId) {
+ super(locatorId, "Bundle Destinations");
}
- public BundleDestinationListView(Criteria criteria) {
- super("Bundle Destinations", criteria);
+ public BundleDestinationListView(String locatorId, Criteria criteria) {
+ super(locatorId, "Bundle Destinations", criteria);
setHeaderIcon("subsystems/bundle/BundleDestination_24.png");
}
@@ -53,18 +51,17 @@ public class BundleDestinationListView extends Table {
protected void onInit() {
super.onInit();
-
setDataSource(new BundleDestinationDataSource());
getListGrid().getField("id").setWidth(45);
getListGrid().getField("name").setWidth("20%");
getListGrid().getField("name").setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- return "<a href=\"#Bundles/Bundles/" + listGridRecord.getAttribute("bundleId") + "/destinations/" + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
+ return "<a href=\"#Bundles/Bundles/" + listGridRecord.getAttribute("bundleId") + "/destinations/"
+ + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
}
});
-
getListGrid().getField("description").setWidth("15%");
//getListGrid().getField("bundleName").setWidth("20%");
getListGrid().hideField("bundleName");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
index 7fdb852..2228dc5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationView.java
@@ -22,9 +22,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.bundle.destination;
-import java.util.ArrayList;
import java.util.Date;
-import java.util.HashMap;
import java.util.HashSet;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -33,18 +31,11 @@ import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.LinkItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-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.bundle.Bundle;
-import org.rhq.core.domain.bundle.BundleDeployment;
-import org.rhq.core.domain.bundle.BundleDeploymentStatus;
import org.rhq.core.domain.bundle.BundleDestination;
import org.rhq.core.domain.criteria.BundleDestinationCriteria;
import org.rhq.core.domain.tagging.Tag;
@@ -65,11 +56,14 @@ import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallb
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.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class BundleDestinationView extends VLayout implements BookmarkableView {
+public class BundleDestinationView extends LocatableVLayout implements BookmarkableView {
private BundleGWTServiceAsync bundleService;
private BundleDestination destination;
@@ -77,8 +71,8 @@ public class BundleDestinationView extends VLayout implements BookmarkableView {
private Canvas detail;
-
- public BundleDestinationView() {
+ public BundleDestinationView(String locatorId) {
+ super(locatorId);
setWidth100();
setHeight100();
setMargin(10);
@@ -89,14 +83,15 @@ public class BundleDestinationView extends VLayout implements BookmarkableView {
this.destination = bundleDestination;
this.bundle = bundleDestination.getBundle();
- addMember(new BackButton("Back to Bundle: " + bundle.getName(),"Bundles/Bundle/" + bundle.getId()));
+ addMember(new BackButton(getLocatorId(), "Back to Bundle: " + bundle.getName(), "Bundles/Bundle/"
+ + bundle.getId()));
addMember(new HeaderLabel(Canvas.getImgURL("subsystems/bundle/BundleDestination_24.png"), destination.getName()));
- DynamicForm form = new DynamicForm();
+ LocatableDynamicForm form = new LocatableDynamicForm(getLocatorId());
form.setWidth100();
form.setNumCols(4);
- form.setColWidths("20%","30%","25%","25%");
+ form.setColWidths("20%", "30%", "25%", "25%");
LinkItem bundleName = new LinkItem("bundle");
bundleName.setTitle("Bundle");
@@ -106,28 +101,30 @@ public class BundleDestinationView extends VLayout implements BookmarkableView {
CanvasItem tagItem = new CanvasItem("tag");
tagItem.setShowTitle(false);
- TagEditorView tagEditor = new TagEditorView(destination.getTags(), false, new TagsChangedCallback() {
- public void tagsChanged(HashSet<Tag> tags) {
- GWTServiceLookup.getTagService().updateBundleDestinationTags(destination.getId(), tags,
+ TagEditorView tagEditor = new TagEditorView(form.extendLocatorId("Tags"), destination.getTags(), false,
+ new TagsChangedCallback() {
+ public void tagsChanged(HashSet<Tag> tags) {
+ GWTServiceLookup.getTagService().updateBundleDestinationTags(destination.getId(), tags,
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to update bundle destination's tags", caught);
+ CoreGUI.getErrorHandler().handleError("Failed to update bundle destination's tags",
+ caught);
}
public void onSuccess(Void result) {
CoreGUI.getMessageCenter().notify(
- new Message("Bundle Destination Tags updated", Message.Severity.Info));
+ new Message("Bundle Destination Tags updated", Message.Severity.Info));
}
});
- }
- });
+ }
+ });
tagEditor.setVertical(true);
tagItem.setCanvas(tagEditor);
tagItem.setRowSpan(4);
CanvasItem actionItem = new CanvasItem("actions");
actionItem.setShowTitle(false);
- actionItem.setCanvas(getActionLayout());
+ actionItem.setCanvas(getActionLayout(form.extendLocatorId("actions")));
actionItem.setRowSpan(4);
StaticTextItem created = new StaticTextItem("created", "Created");
@@ -151,17 +148,16 @@ public class BundleDestinationView extends VLayout implements BookmarkableView {
deployments.setShowResizeBar(true);
addMember(createDeploymentsTable());
-
detail = new Canvas();
detail.setHeight("50%");
detail.hide();
addMember(detail);
}
- private Canvas getActionLayout() {
- VLayout actionLayout = new VLayout();
+ private Canvas getActionLayout(String locatorId) {
+ LocatableVLayout actionLayout = new LocatableVLayout(locatorId);
actionLayout.setMembersMargin(10);
- IButton deployButton = new IButton("Deploy");
+ IButton deployButton = new LocatableIButton(actionLayout.extendLocatorId("Deploy"), "Deploy");
deployButton.setIcon("subsystems/bundle/BundleAction_Deploy_16.png");
deployButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -170,7 +166,7 @@ public class BundleDestinationView extends VLayout implements BookmarkableView {
});
actionLayout.addMember(deployButton);
- IButton revertButton = new IButton("Revert");
+ IButton revertButton = new LocatableIButton(actionLayout.extendLocatorId("Revert"), "Revert");
revertButton.setIcon("subsystems/bundle/BundleAction_Revert_16.png");
revertButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -186,54 +182,53 @@ public class BundleDestinationView extends VLayout implements BookmarkableView {
Criteria criteria = new Criteria();
criteria.addCriteria("bundleDestinationId", destination.getId());
- return new BundleDeploymentListView(criteria);
-
-
- /* Table table = new Table("Deployment History");
-
- ListGridField name = new ListGridField("name", "Name");
- name.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- return "<a href=\"#Bundles/Bundle/" + bundle.getId() + "/deployments/"
- + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
- }
- });
-
- ListGridField version = new ListGridField("version", "Version");
- ListGridField description = new ListGridField("description", "Description");
- ListGridField installDate = new ListGridField("installDate", "Install Date");
- ListGridField status = new ListGridField("status", "Status");
- HashMap<String, String> statusIcons = new HashMap<String, String>();
- statusIcons.put(BundleDeploymentStatus.IN_PROGRESS.name(), "subsystems/bundle/install-loader.gif");
- statusIcons.put(BundleDeploymentStatus.FAILURE.name(), "subsystems/bundle/Warning_11.png");
- statusIcons.put(BundleDeploymentStatus.MIXED.name(), "subsystems/bundle/Warning_11.png");
- statusIcons.put(BundleDeploymentStatus.WARN.name(), "subsystems/bundle/Warning_11.png");
- statusIcons.put(BundleDeploymentStatus.SUCCESS.name(), "subsystems/bundle/Ok_11.png");
- status.setValueIcons(statusIcons);
- status.setValueIconHeight(11);
- status.setWidth(80);
-
-
- table.getListGrid().setFields(name, version, description, installDate, status);
-
- ArrayList<ListGridRecord> records = new ArrayList<ListGridRecord>();
- for (BundleDeployment rd : destination.getDeployments()) {
- ListGridRecord record = new ListGridRecord();
-
- record.setAttribute("name", rd.getName());
- record.setAttribute("description", rd.getDescription());
- record.setAttribute("bundleId", bundle.getId());
- record.setAttribute("version", rd.getBundleVersion().getName());
- record.setAttribute("status", rd.getStatus().name());
- record.setAttribute("id", rd.getId());
- record.setAttribute("entity", rd);
- record.setAttribute("installDate", new Date(rd.getCtime()));
- records.add(record);
- }
-
- table.getListGrid().setData(records.toArray(new ListGridRecord[records.size()]));
-
- return table;*/
+ return new BundleDeploymentListView(extendLocatorId("Deployments"), criteria);
+
+ /* Table table = new Table("Deployment History");
+
+ ListGridField name = new ListGridField("name", "Name");
+ name.setCellFormatter(new CellFormatter() {
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ return "<a href=\"#Bundles/Bundle/" + bundle.getId() + "/deployments/"
+ + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
+ }
+ });
+
+ ListGridField version = new ListGridField("version", "Version");
+ ListGridField description = new ListGridField("description", "Description");
+ ListGridField installDate = new ListGridField("installDate", "Install Date");
+ ListGridField status = new ListGridField("status", "Status");
+ HashMap<String, String> statusIcons = new HashMap<String, String>();
+ statusIcons.put(BundleDeploymentStatus.IN_PROGRESS.name(), "subsystems/bundle/install-loader.gif");
+ statusIcons.put(BundleDeploymentStatus.FAILURE.name(), "subsystems/bundle/Warning_11.png");
+ statusIcons.put(BundleDeploymentStatus.MIXED.name(), "subsystems/bundle/Warning_11.png");
+ statusIcons.put(BundleDeploymentStatus.WARN.name(), "subsystems/bundle/Warning_11.png");
+ statusIcons.put(BundleDeploymentStatus.SUCCESS.name(), "subsystems/bundle/Ok_11.png");
+ status.setValueIcons(statusIcons);
+ status.setValueIconHeight(11);
+ status.setWidth(80);
+
+
+ table.getListGrid().setFields(name, version, description, installDate, status);
+
+ ArrayList<ListGridRecord> records = new ArrayList<ListGridRecord>();
+ for (BundleDeployment rd : destination.getDeployments()) {
+ ListGridRecord record = new ListGridRecord();
+
+ record.setAttribute("name", rd.getName());
+ record.setAttribute("description", rd.getDescription());
+ record.setAttribute("bundleId", bundle.getId());
+ record.setAttribute("version", rd.getBundleVersion().getName());
+ record.setAttribute("status", rd.getStatus().name());
+ record.setAttribute("id", rd.getId());
+ record.setAttribute("entity", rd);
+ record.setAttribute("installDate", new Date(rd.getCtime()));
+ records.add(record);
+ }
+
+ table.getListGrid().setData(records.toArray(new ListGridRecord[records.size()]));
+
+ return table;*/
}
public void renderView(final ViewPath viewPath) {
@@ -257,11 +252,11 @@ public class BundleDestinationView extends VLayout implements BookmarkableView {
final BundleDestination destination = result.get(0);
-
- viewPath.getViewForIndex(2).getBreadcrumbs().set(0, new Breadcrumb(String.valueOf(destination.getBundle().getId()), destination.getBundle().getName()));
- viewId.getBreadcrumbs().set(0,new Breadcrumb(String.valueOf(destination.getId()), destination.getName()));
+ viewPath.getViewForIndex(2).getBreadcrumbs().set(0,
+ new Breadcrumb(String.valueOf(destination.getBundle().getId()), destination.getBundle().getName()));
+ viewId.getBreadcrumbs().set(0,
+ new Breadcrumb(String.valueOf(destination.getId()), destination.getName()));
CoreGUI.refreshBreadCrumbTrail();
-
viewBundleDestination(destination, viewPath.getCurrent());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
index 61310e8..0206f68 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java
@@ -24,26 +24,19 @@ 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.Overflow;
-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.Canvas;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-import com.smartgwt.client.widgets.grid.CellFormatter;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;
import org.rhq.core.domain.bundle.Bundle;
-import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.tagging.Tag;
import org.rhq.core.domain.util.PageList;
@@ -61,26 +54,31 @@ import org.rhq.enterprise.gui.coregui.client.bundle.version.BundleVersionView;
import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
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.tagging.TagEditorView;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallback;
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.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTab;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTabSet;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-public class BundleView extends VLayout implements BookmarkableView {
+public class BundleView extends LocatableVLayout implements BookmarkableView {
+
+ LocatableDynamicForm form;
private int bundleBeingViewed = 0;
private HeaderLabel headerLabel;
- DynamicForm form;
private Table bundleVersionsTable;
private BundleGWTServiceAsync bundleManager = GWTServiceLookup.getBundleService();
private Bundle bundle;
- public BundleView() {
- super();
+ public BundleView(String locatorId) {
+ super(locatorId);
setWidth100();
setHeight100();
setPadding(10);
@@ -90,7 +88,6 @@ public class BundleView extends VLayout implements BookmarkableView {
@Override
protected void onInit() {
super.onInit();
-
}
public void viewBundle(Bundle bundle, ViewId nextViewId) {
@@ -98,8 +95,7 @@ public class BundleView extends VLayout implements BookmarkableView {
this.bundle = bundle;
- addMember(new BackButton("Back to All Bundles", "Bundles"));
-
+ addMember(new BackButton(getLocatorId(), "Back to All Bundles", "Bundles"));
headerLabel = new HeaderLabel("subsystems/bundle/Bundle_24.png", bundle.getName());
@@ -107,7 +103,7 @@ public class BundleView extends VLayout implements BookmarkableView {
addMember(createSummaryForm());
- TabSet tabs = new TabSet();
+ TabSet tabs = new LocatableTabSet(getLocatorId());
Tab versionsTab = createVersionsTab();
tabs.addTab(versionsTab);
@@ -129,23 +125,23 @@ public class BundleView extends VLayout implements BookmarkableView {
}
private Tab createDestinationsTab() {
- Tab destinationsTab = new Tab("Destinations");
+ LocatableTab destinationsTab = new LocatableTab(extendLocatorId("Destinations"), "Destinations");
Criteria criteria = new Criteria();
criteria.addCriteria("bundleId", bundle.getId());
- destinationsTab.setPane(new BundleDestinationListView(criteria));
+ destinationsTab.setPane(new BundleDestinationListView(destinationsTab.getLocatorId(), criteria));
return destinationsTab;
}
private Tab createVersionsTab() {
- Tab versionsTab = new Tab("Versions");
+ LocatableTab versionsTab = new LocatableTab(extendLocatorId("Versions"), "Versions");
Criteria criteria = new Criteria();
criteria.addCriteria("bundleId", bundleBeingViewed);
- bundleVersionsTable = new BundleVersionListView(criteria);
+ bundleVersionsTable = new BundleVersionListView(versionsTab.getLocatorId(), criteria);
versionsTab.setPane(bundleVersionsTable);
@@ -154,9 +150,9 @@ public class BundleView extends VLayout implements BookmarkableView {
private DynamicForm createSummaryForm() {
- form = new DynamicForm();
+ form = new LocatableDynamicForm(getLocatorId());
form.setWidth100();
- form.setColWidths("20%","30%","25%","25%");
+ form.setColWidths("20%", "30%", "25%", "25%");
form.setNumCols(4);
form.setWrapItemTitles(false);
form.setPadding(10);
@@ -178,19 +174,22 @@ public class BundleView extends VLayout implements BookmarkableView {
private CanvasItem getTagItem() {
- TagEditorView tagEditor = new TagEditorView(bundle.getTags(), false, new TagsChangedCallback() {
- public void tagsChanged(HashSet<Tag> tags) {
- GWTServiceLookup.getTagService().updateBundleTags(bundleBeingViewed, tags, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to update bundle's tags", caught);
- }
+ TagEditorView tagEditor = new TagEditorView(form.getLocatorId(), bundle.getTags(), false,
+ new TagsChangedCallback() {
+ public void tagsChanged(HashSet<Tag> tags) {
+ GWTServiceLookup.getTagService().updateBundleTags(bundleBeingViewed, tags,
+ new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update bundle's tags", caught);
+ }
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Bundle tags updated", Message.Severity.Info));
- }
- });
- }
- });
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Bundle tags updated", Message.Severity.Info));
+ }
+ });
+ }
+ });
tagEditor.setVertical(true);
CanvasItem tagItem = new CanvasItem("tags");
@@ -202,9 +201,9 @@ public class BundleView extends VLayout implements BookmarkableView {
}
private CanvasItem getActionItem() {
- VLayout layout = new VLayout(10);
+ VLayout layout = new LocatableVLayout(form.getLocatorId(), 10);
- IButton deleteButton = new IButton("Delete");
+ IButton deleteButton = new LocatableIButton(form.extendLocatorId("Delete"), "Delete");
deleteButton.setIcon("subsystems/bundle/BundleAction_Delete_16.png");
deleteButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -214,12 +213,14 @@ public class BundleView extends VLayout implements BookmarkableView {
bundleManager.deleteBundle(bundleBeingViewed, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(
- "Failed to delete bundle [" + bundle.getName() + "]", caught);
+ "Failed to delete bundle [" + bundle.getName() + "]", caught);
}
public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message("Deleted bundle [" + bundle.getName() + "]", Message.Severity.Info));
+ CoreGUI.getMessageCenter()
+ .notify(
+ new Message("Deleted bundle [" + bundle.getName() + "]",
+ Message.Severity.Info));
History.newItem("Bundles"); // Bundle is deleted, go back to all bundles view
}
});
@@ -229,8 +230,7 @@ public class BundleView extends VLayout implements BookmarkableView {
}
});
-
- IButton deployButton = new IButton("Deploy");
+ IButton deployButton = new LocatableIButton(form.extendLocatorId("Deploy"), "Deploy");
deployButton.setIcon("subsystems/bundle/BundleAction_Deploy_16.png");
deployButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -244,14 +244,14 @@ public class BundleView extends VLayout implements BookmarkableView {
bundleManager.findBundlesByCriteria(bc, new AsyncCallback<PageList<Bundle>>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(
- "Failed to load bundle to deploy [" + bundle.getName() + "]", caught);
+ "Failed to load bundle to deploy [" + bundle.getName() + "]", caught);
}
public void onSuccess(PageList<Bundle> result) {
if (result == null || result.size() != 1) {
CoreGUI.getMessageCenter().notify(
- new Message("Failed to get single bundle to deploy [" + bundle.getName() + "]",
- Message.Severity.Error));
+ new Message("Failed to get single bundle to deploy [" + bundle.getName() + "]",
+ Message.Severity.Error));
return;
}
new BundleDeployWizard(result.get(0).getId()).startBundleWizard();
@@ -263,7 +263,6 @@ public class BundleView extends VLayout implements BookmarkableView {
layout.addMember(deleteButton);
layout.addMember(deployButton);
-
CanvasItem actionItem = new CanvasItem("actions");
actionItem.setRowSpan(3);
actionItem.setShowTitle(false);
@@ -271,7 +270,6 @@ public class BundleView extends VLayout implements BookmarkableView {
return actionItem;
}
-
public void renderView(final ViewPath viewPath) {
int bundleId = Integer.parseInt(viewPath.getCurrent().getPath());
@@ -290,19 +288,20 @@ public class BundleView extends VLayout implements BookmarkableView {
criteria.fetchTags(true);
GWTServiceLookup.getBundleService().findBundlesByCriteria(criteria,
- new AsyncCallback<PageList<Bundle>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load bundle", caught);
- }
+ new AsyncCallback<PageList<Bundle>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load bundle", caught);
+ }
- public void onSuccess(PageList<Bundle> result) {
- Bundle bundle = result.get(0);
- viewId.getBreadcrumbs().set(0, new Breadcrumb(String.valueOf(bundle.getId()), bundle.getName()));
- viewBundle(bundle, viewPath.getCurrent());
-// viewId.getBreadcrumbs().add(new Breadcrumb(String.valueOf(bundle.getId()), bundle.getName()));
- CoreGUI.refreshBreadCrumbTrail();
- }
- });
+ public void onSuccess(PageList<Bundle> result) {
+ Bundle bundle = result.get(0);
+ viewId.getBreadcrumbs().set(0,
+ new Breadcrumb(String.valueOf(bundle.getId()), bundle.getName()));
+ viewBundle(bundle, viewPath.getCurrent());
+ // viewId.getBreadcrumbs().add(new Breadcrumb(String.valueOf(bundle.getId()), bundle.getName()));
+ CoreGUI.refreshBreadCrumbTrail();
+ }
+ });
}
} else {
bundleBeingViewed = 0;
@@ -313,7 +312,7 @@ public class BundleView extends VLayout implements BookmarkableView {
} else {
// one version
removeMembers(getMembers());
- BundleVersionView view = new BundleVersionView();
+ BundleVersionView view = new BundleVersionView(getLocatorId());
addMember(view);
view.renderView(viewPath.next());
}
@@ -324,7 +323,7 @@ public class BundleView extends VLayout implements BookmarkableView {
} else {
// one version
removeMembers(getMembers());
- BundleDeploymentView view = new BundleDeploymentView();
+ BundleDeploymentView view = new BundleDeploymentView(getLocatorId());
addMember(view);
view.renderView(viewPath.next());
}
@@ -335,7 +334,7 @@ public class BundleView extends VLayout implements BookmarkableView {
} else {
// one version
removeMembers(getMembers());
- BundleDestinationView view = new BundleDestinationView();
+ BundleDestinationView view = new BundleDestinationView(getLocatorId());
addMember(view);
view.renderView(viewPath.next());
}
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 8b2726c..6f26471 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
@@ -43,14 +43,14 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
*/
public class BundlesListView extends Table {
- public BundlesListView() {
- super("Bundles");
+ public BundlesListView(String locatorId) {
+ super(locatorId, "Bundles");
setWidth100();
setHeight100();
}
- public BundlesListView(Criteria criteria) {
- super("Bundles", criteria);
+ public BundlesListView(String locatorId, Criteria criteria) {
+ super(locatorId, "Bundles", criteria);
}
@Override
@@ -79,38 +79,39 @@ public class BundlesListView extends Table {
getListGrid().setSelectionType(SelectionStyle.SIMPLE);
// getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
- addTableAction("New", Table.SelectionEnablement.ALWAYS, null, new TableAction() {
+ addTableAction(extendLocatorId("New"), "New", Table.SelectionEnablement.ALWAYS, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
new BundleCreateWizard().startBundleWizard();
}
});
- addTableAction("Delete", Table.SelectionEnablement.ANY, "Delete the selected bundles?", new TableAction() {
- public void executeAction(ListGridRecord[] selections) {
- BundlesWithLatestVersionDataSource ds = (BundlesWithLatestVersionDataSource) getDataSource();
- for (ListGridRecord selection : selections) {
- BundleGWTServiceAsync bundleManager = GWTServiceLookup.getBundleService();
- final BundleWithLatestVersionComposite object = ds.copyValues(selection);
- bundleManager.deleteBundle(object.getBundleId(), new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- "Failed to delete bundle [" + object.getBundleName() + "]", caught);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(
- new Message("Deleted bundle [" + object.getBundleName() + "]", Severity.Info));
-
- CoreGUI.refresh();
- }
- });
+ addTableAction(extendLocatorId("Delete"), "Delete", Table.SelectionEnablement.ANY,
+ "Delete the selected bundles?", new TableAction() {
+ public void executeAction(ListGridRecord[] selections) {
+ BundlesWithLatestVersionDataSource ds = (BundlesWithLatestVersionDataSource) getDataSource();
+ for (ListGridRecord selection : selections) {
+ BundleGWTServiceAsync bundleManager = GWTServiceLookup.getBundleService();
+ final BundleWithLatestVersionComposite object = ds.copyValues(selection);
+ bundleManager.deleteBundle(object.getBundleId(), new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to delete bundle [" + object.getBundleName() + "]", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Deleted bundle [" + object.getBundleName() + "]", Severity.Info));
+
+ CoreGUI.refresh();
+ }
+ });
+ }
}
- }
- });
+ });
// can change this back to SINGLE selection when we feel like it. currently allowing the wizard to
// select the bundle.
- addTableAction("Deploy", Table.SelectionEnablement.ALWAYS, null, new TableAction() {
+ addTableAction(extendLocatorId("Deploy"), "Deploy", Table.SelectionEnablement.ALWAYS, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
if (selection.length == 0) {
new BundleDeployWizard().startBundleWizard();
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 87002c3..1cbba62 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
@@ -34,6 +34,7 @@ import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardSte
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.selenium.LocatableVLayout;
/**
* @author Jay Shaughnessy
@@ -56,7 +57,7 @@ public class ConfirmationStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (layout == null) {
- layout = getVLayout();
+ layout = new LocatableVLayout("BundleRevertConfirmation");
layout.setMembersMargin(10);
BundleDeploymentCriteria c = new BundleDeploymentCriteria();
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 f008b99..9bbf683 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
@@ -31,6 +31,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
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.selenium.LocatableDynamicForm;
/**
* @author Jay Shaughnessy
@@ -52,7 +53,7 @@ public class GetRevertInfoStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (form == null) {
- form = getDynamicForm();
+ form = new LocatableDynamicForm("BundleRevertGetRevertInfo");
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 bf1413c..aa37548 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
@@ -33,6 +33,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.LocatableVLayout;
/**
* @author Jay Shaughnessy
@@ -55,7 +56,7 @@ public class RevertStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (canvas == null) {
- canvas = getVLayout();
+ canvas = new LocatableVLayout("BundleRevertRevert");
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/version/BundleVersionListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java
index 4c83319..438473d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java
@@ -36,12 +36,12 @@ import org.rhq.enterprise.gui.coregui.client.components.table.Table;
*/
public class BundleVersionListView extends Table {
-
- public BundleVersionListView() {
+ public BundleVersionListView(String locatorId) {
+ super(locatorId);
}
- public BundleVersionListView(Criteria criteria) {
- super("Bundle Versions", criteria);
+ public BundleVersionListView(String locatorId, Criteria criteria) {
+ super(locatorId, "Bundle Versions", criteria);
setHeaderIcon("subsystems/bundle/BundleVersion_24.png");
}
@@ -58,7 +58,8 @@ public class BundleVersionListView extends Table {
getListGrid().getField("name").setWidth("25%");
getListGrid().getField("name").setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- return "<a href=\"#Bundles/Bundle/" + listGridRecord.getAttribute("bundleId") + "/versions/" + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
+ return "<a href=\"#Bundles/Bundle/" + listGridRecord.getAttribute("bundleId") + "/versions/"
+ + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
}
});
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
index 574e149..984a22d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionView.java
@@ -28,13 +28,9 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.TitleOrientation;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.TextAreaItem;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;
@@ -55,15 +51,20 @@ import org.rhq.enterprise.gui.coregui.client.components.tagging.TagEditorView;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallback;
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.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTab;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTabSet;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class BundleVersionView extends VLayout implements BookmarkableView {
+public class BundleVersionView extends LocatableVLayout implements BookmarkableView {
private BundleVersion version;
- public BundleVersionView() {
+ public BundleVersionView(String locatorId) {
+ super(locatorId);
setWidth100();
setHeight100();
}
@@ -71,20 +72,20 @@ public class BundleVersionView extends VLayout implements BookmarkableView {
public void viewBundleVersion(BundleVersion version, ViewId nextViewId) {
this.version = version;
-
- TabSet tabs = new TabSet();
+ TabSet tabs = new LocatableTabSet(getLocatorId());
tabs.addTab(createSummaryTab());
tabs.addTab(createLiveDeploymentsTab());
tabs.addTab(createFilesTab());
-// tabs.addTab(createUpdateHistoryTab());
-
+ // tabs.addTab(createUpdateHistoryTab());
- addMember(new BackButton("Back to Bundle: " + version.getBundle().getName(),"Bundles/Bundle/" + version.getBundle().getId()));
+ addMember(new BackButton(getLocatorId(), "Back to Bundle: " + version.getBundle().getName(), "Bundles/Bundle/"
+ + version.getBundle().getId()));
- addMember(new HeaderLabel(Canvas.getImgURL("subsystems/bundle/BundleVersion_24.png"), version.getName() + ": " + version.getVersion()));
+ addMember(new HeaderLabel(Canvas.getImgURL("subsystems/bundle/BundleVersion_24.png"), version.getName() + ": "
+ + version.getVersion()));
addMember(tabs);
@@ -101,50 +102,49 @@ public class BundleVersionView extends VLayout implements BookmarkableView {
markForRedraw();
}
-
private Tab createSummaryTab() {
- Tab tab = new Tab("Summary");
+ LocatableTab tab = new LocatableTab(extendLocatorId("Summary"), "Summary");
- DynamicForm form = new DynamicForm();
+ LocatableDynamicForm form = new LocatableDynamicForm(tab.getLocatorId());
form.setWidth100();
form.setHeight100();
form.setNumCols(4);
- StaticTextItem versionItem = new StaticTextItem("version","Version");
+ StaticTextItem versionItem = new StaticTextItem("version", "Version");
versionItem.setValue(version.getVersion());
CanvasItem tagItem = new CanvasItem("tag");
tagItem.setShowTitle(false);
- TagEditorView tagEditor = new TagEditorView(version.getTags(), false, new TagsChangedCallback() {
- public void tagsChanged(HashSet<Tag> tags) {
- GWTServiceLookup.getTagService().updateBundleVersionTags(version.getId(), tags, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to update bundle version's tags", caught);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Bundle Version tags updated", Message.Severity.Info));
- }
- });
- }
- });
+ TagEditorView tagEditor = new TagEditorView(form.getLocatorId(), version.getTags(), false,
+ new TagsChangedCallback() {
+ public void tagsChanged(HashSet<Tag> tags) {
+ GWTServiceLookup.getTagService().updateBundleVersionTags(version.getId(), tags,
+ new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update bundle version's tags", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Bundle Version tags updated", Message.Severity.Info));
+ }
+ });
+ }
+ });
tagEditor.setVertical(true);
tagItem.setCanvas(tagEditor);
tagItem.setRowSpan(4);
- StaticTextItem descriptionItem = new StaticTextItem("description","Description");
+ StaticTextItem descriptionItem = new StaticTextItem("description", "Description");
descriptionItem.setValue(version.getDescription());
- StaticTextItem liveDeploymentsItem = new StaticTextItem("deployments","Deployments");
+ StaticTextItem liveDeploymentsItem = new StaticTextItem("deployments", "Deployments");
liveDeploymentsItem.setValue(version.getBundleDeployments().size());
- StaticTextItem filesItems = new StaticTextItem("files","Files");
+ StaticTextItem filesItems = new StaticTextItem("files", "Files");
filesItems.setValue(version.getBundleFiles().size());
-
-
-
- TextAreaItem recipeItem = new TextAreaItem("recipe","Recipe");
+ TextAreaItem recipeItem = new TextAreaItem("recipe", "Recipe");
recipeItem.setDisabled(true);
recipeItem.setTitleOrientation(TitleOrientation.TOP);
recipeItem.setColSpan(4);
@@ -152,8 +152,7 @@ public class BundleVersionView extends VLayout implements BookmarkableView {
recipeItem.setHeight("*");
recipeItem.setValue(version.getRecipe());
-
- form.setFields(versionItem,tagItem, descriptionItem, liveDeploymentsItem, filesItems, recipeItem);
+ form.setFields(versionItem, tagItem, descriptionItem, liveDeploymentsItem, filesItems, recipeItem);
tab.setPane(form);
@@ -161,37 +160,26 @@ public class BundleVersionView extends VLayout implements BookmarkableView {
}
private Tab createLiveDeploymentsTab() {
- Tab tab = new Tab("Deployments");
+ LocatableTab tab = new LocatableTab(extendLocatorId("Deployments"), "Deployments");
Criteria criteria = new Criteria();
criteria.setAttribute("bundleVersionId", version.getId());
- BundleDeploymentListView table = new BundleDeploymentListView(criteria);
-
- tab.setPane(table);
+ tab.setPane(new BundleDeploymentListView(tab.getLocatorId(), criteria));
return tab;
}
private Tab createFilesTab() {
- Tab tab = new Tab("Files");
+ LocatableTab tab = new LocatableTab(extendLocatorId("Files"), "Files");
- FileListView filesView = new FileListView(version.getId());
+ FileListView filesView = new FileListView(tab.getLocatorId(), version.getId());
tab.setPane(filesView);
return tab;
}
- private Tab createUpdateHistoryTab() {
- Tab tab = new Tab("Update History");
-
- return tab;
- }
-
-
-
-
public void renderView(final ViewPath viewPath) {
int bundleVersionId = Integer.parseInt(viewPath.getCurrent().getPath());
@@ -206,20 +194,21 @@ public class BundleVersionView extends VLayout implements BookmarkableView {
criteria.fetchTags(true);
GWTServiceLookup.getBundleService().findBundleVersionsByCriteria(criteria,
- new AsyncCallback<PageList<BundleVersion>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load budle version", caught);
- }
-
- public void onSuccess(PageList<BundleVersion> result) {
- BundleVersion version = result.get(0);
- viewBundleVersion(version, viewPath.getCurrent());
- viewPath.getViewForIndex(2).getBreadcrumbs().set(0, new Breadcrumb(String.valueOf(version.getBundle().getId()), version.getBundle().getName()));
- viewId.getBreadcrumbs().set(0,new Breadcrumb(String.valueOf(version.getId()), version.getVersion()));
- CoreGUI.refreshBreadCrumbTrail();
- }
- });
-
+ new AsyncCallback<PageList<BundleVersion>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load budle version", caught);
+ }
+
+ public void onSuccess(PageList<BundleVersion> result) {
+ BundleVersion version = result.get(0);
+ viewBundleVersion(version, viewPath.getCurrent());
+ viewPath.getViewForIndex(2).getBreadcrumbs().set(0,
+ new Breadcrumb(String.valueOf(version.getBundle().getId()), version.getBundle().getName()));
+ viewId.getBreadcrumbs().set(0,
+ new Breadcrumb(String.valueOf(version.getId()), version.getVersion()));
+ CoreGUI.refreshBreadCrumbTrail();
+ }
+ });
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java
index cf27a27..e91bfa0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/file/FileListView.java
@@ -28,10 +28,8 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.bundle.BundleFile;
-import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.core.domain.criteria.BundleFileCriteria;
import org.rhq.core.domain.measurement.MeasurementConverterClient;
import org.rhq.core.domain.measurement.MeasurementUnits;
@@ -39,23 +37,23 @@ import org.rhq.core.domain.util.PageList;
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.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class FileListView extends VLayout {
+public class FileListView extends LocatableVLayout {
private int bundleVersionId;
-
- public FileListView(int bundleVersionId) {
+ public FileListView(String locatorId, int bundleVersionId) {
+ super(locatorId);
this.bundleVersionId = bundleVersionId;
}
-
private void viewFiles(PageList<BundleFile> files) {
- Table table = new Table("Bundle Files");
+ Table table = new Table(getLocatorId(), "Bundle Files");
ListGrid listGrid = table.getListGrid();
@@ -68,7 +66,6 @@ public class FileListView extends VLayout {
ListGridField size = new ListGridField("size", "File Size");
name.setWidth("20%");
-
listGrid.setFields(id, name, size);
listGrid.setData(buildRecords(files));
@@ -77,29 +74,26 @@ public class FileListView extends VLayout {
}
-
@Override
protected void onDraw() {
super.onDraw();
-
BundleFileCriteria criteria = new BundleFileCriteria();
criteria.addFilterBundleVersionId(bundleVersionId);
criteria.fetchPackageVersion(true);
GWTServiceLookup.getBundleService().findBundleFilesByCriteria(criteria,
- new AsyncCallback<PageList<BundleFile>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load bundle file data", caught);
- }
-
- public void onSuccess(PageList<BundleFile> result) {
- viewFiles(result);
- }
- });
+ new AsyncCallback<PageList<BundleFile>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load bundle file data", caught);
+ }
+
+ public void onSuccess(PageList<BundleFile> result) {
+ viewFiles(result);
+ }
+ });
}
-
private ListGridRecord[] buildRecords(List<BundleFile> files) {
ListGridRecord[] records = new ListGridRecord[files.size()];
@@ -111,13 +105,12 @@ public class FileListView extends VLayout {
Long size = file.getPackageVersion().getFileSize();
if (size != null) {
- record.setAttribute("size",
- MeasurementConverterClient.format(size.doubleValue(), MeasurementUnits.BYTES, true));
+ record.setAttribute("size", MeasurementConverterClient.format(size.doubleValue(),
+ MeasurementUnits.BYTES, true));
}
records[i++] = record;
}
return records;
}
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/buttons/BackButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/buttons/BackButton.java
index a53e8e0..5708fb8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/buttons/BackButton.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/buttons/BackButton.java
@@ -23,23 +23,23 @@
package org.rhq.enterprise.gui.coregui.client.components.buttons;
import com.google.gwt.user.client.History;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.StretchImgButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableStretchImgButton;
+
/**
* @author Greg Hinkle
*/
-public class BackButton extends StretchImgButton {
-
+public class BackButton extends LocatableStretchImgButton {
- public BackButton() {
+ public BackButton(String locatorId) {
+ super(locatorId);
setSrc("buttons/back/back.png");
}
- public BackButton(String title, final String anchor) {
- this();
+ public BackButton(String locatorId, String title, final String anchor) {
+ this(locatorId);
setTitle("<b>" + title + "</b>");
addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
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 1b49027..2fb9688 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
@@ -52,7 +52,8 @@ public class RadioGroupWithComponentsItem extends CanvasItem {
super(name, title);
this.valueMap = valueMap;
this.form = form;
- this.canvas = new RGWCCanvas(title);
+ // since the name is an internal identifier I think it can be used as the locatorId
+ this.canvas = new RGWCCanvas(name);
this.selected = null;
setCanvas(this.canvas);
}
@@ -71,8 +72,8 @@ public class RadioGroupWithComponentsItem extends CanvasItem {
public class RGWCCanvas extends LocatableDynamicForm {
- public RGWCCanvas(String id) {
- super(id);
+ public RGWCCanvas(String locatorId) {
+ super(locatorId);
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 ecdf5eb..0a46217 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
@@ -73,12 +73,11 @@ public abstract class AbstractSelector<T> extends LocatableVLayout {
protected Criteria latestCriteria;
- public AbstractSelector(String id) {
- super(id);
- String safeId = getID();
+ public AbstractSelector(String locatorId) {
+ super(locatorId);
hlayout = new HLayout();
- availableGrid = new LocatableListGrid(safeId + "-availableGrid");
- assignedGrid = new LocatableListGrid(safeId + "-assignedGrid");
+ availableGrid = new LocatableListGrid(extendLocatorId("availableGrid"));
+ assignedGrid = new LocatableListGrid(extendLocatorId("assignedGrid"));
}
public void setAssigned(ListGridRecord[] assignedRecords) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java
new file mode 100644
index 0000000..a0f4ab9
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java
@@ -0,0 +1,56 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.gui.coregui.client.components.tab;
+
+import com.smartgwt.client.widgets.Canvas;
+
+/**
+ * Simple class to provide a SubTab a locatorId.
+ *
+ * @author Jay Shaughnessy
+ */
+public class SubTab {
+ private String locatorId;
+ private String title;
+ private Canvas canvas;
+
+ public SubTab(String locatorId, String title, Canvas canvas) {
+ super();
+ this.title = title;
+ this.canvas = canvas;
+ }
+
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public Canvas getCanvas() {
+ return canvas;
+ }
+
+ public void setCanvas(Canvas canvas) {
+ this.canvas = canvas;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index afec88d..bb7ece4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -21,7 +21,6 @@ package org.rhq.enterprise.gui.coregui.client.components.tab;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
-import java.util.Map;
import java.util.Set;
import com.google.gwt.event.shared.HandlerManager;
@@ -32,26 +31,28 @@ import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
/**
* @author Greg Hinkle
*/
-public class SubTabLayout extends VLayout {
+public class SubTabLayout extends LocatableVLayout {
private ToolStrip buttonBar;
- private LinkedHashMap<String, Canvas> subtabs = new LinkedHashMap<String, Canvas>();
+ private LinkedHashMap<String, SubTab> subtabs = new LinkedHashMap<String, SubTab>();
private HashMap<String, Button> subTabButtons = new HashMap<String, Button>();
private Set<String> disabledSubTabs = new HashSet<String>();
- Canvas currentlyDisplayed;
+ SubTab currentlyDisplayed;
String currentlySelected;
int currentIndex = 0;
- public SubTabLayout() {
- super();
+ public SubTabLayout(String locatorId) {
+ super(locatorId);
setOverflow(Overflow.AUTO);
}
@@ -74,20 +75,22 @@ public class SubTabLayout extends VLayout {
int i = 0;
- for (final String title : subtabs.keySet()) {
+ for (final String locatorId : subtabs.keySet()) {
+
+ SubTab subTab = subtabs.get(locatorId);
if (currentlySelected == null) {
- currentlyDisplayed = subtabs.get(title);
- currentlySelected = title;
+ currentlyDisplayed = subTab;
+ currentlySelected = locatorId;
}
- Button button = new Button(title);
+ Button button = new LocatableButton(locatorId, subTab.getTitle());
button.setShowRollOver(false);
button.setActionType(SelectionType.RADIO);
button.setRadioGroup("subtabs");
button.setBorder(null);
button.setAutoFit(true);
- if (disabledSubTabs.contains(title)) {
+ if (disabledSubTabs.contains(locatorId)) {
button.disable();
} else {
button.enable();
@@ -102,52 +105,53 @@ public class SubTabLayout extends VLayout {
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- currentlySelected = title;
+ currentlySelected = locatorId;
currentIndex = index;
fireSubTabSelection();
- draw(subtabs.get(title));
+ draw(subtabs.get(locatorId));
}
});
- subTabButtons.put(title,button);
+ subTabButtons.put(locatorId, button);
buttonBar.addMember(button);
-
}
// Initial settings
selectTab(currentlySelected);
}
- public void enableSubTab(String title) {
- disabledSubTabs.remove(title);
- if (subTabButtons.containsKey(title)) {
- subTabButtons.get(title).enable();
+ public void enableSubTab(String locatorId) {
+ disabledSubTabs.remove(locatorId);
+ if (subTabButtons.containsKey(locatorId)) {
+ subTabButtons.get(locatorId).enable();
markForRedraw();
}
}
- public void disableSubTab(String title) {
- disabledSubTabs.add(title);
- if (subTabButtons.containsKey(title)) {
- subTabButtons.get(title).disable();
+ public void disableSubTab(String locatorId) {
+ disabledSubTabs.add(locatorId);
+ if (subTabButtons.containsKey(locatorId)) {
+ subTabButtons.get(locatorId).disable();
markForRedraw();
}
}
- public void updateSubTab(String title, Canvas canvas) {
- subtabs.put(title, canvas);
- if (isDrawn() && title.equals(currentlySelected)) {
- draw(canvas);
+ public void updateSubTab(SubTab subTab) {
+ String locatorId = subTab.getLocatorId();
+ subtabs.put(locatorId, subTab);
+ if (isDrawn() && locatorId.equals(currentlySelected)) {
+ draw(subTab);
}
-
}
- private void draw(Canvas canvas) {
+ private void draw(SubTab subTab) {
if (currentlyDisplayed != null) {
- currentlyDisplayed.hide();
+ currentlyDisplayed.getCanvas().hide();
// removeMember(currentlyDisplayed);
}
+
+ Canvas canvas = subTab.getCanvas();
if (canvas != null) {
if (hasMember(canvas)) {
canvas.show();
@@ -158,7 +162,7 @@ public class SubTabLayout extends VLayout {
addMember(canvas);
markForRedraw();
}
- currentlyDisplayed = canvas;
+ currentlyDisplayed = subTab;
}
}
@@ -166,23 +170,29 @@ public class SubTabLayout extends VLayout {
subtabs.clear();
}
- public void registerSubTab(String title, Canvas canvas) {
+ public void registerSubTab(SubTab subTab) {
+ String locatorId = subTab.getLocatorId();
+
if (currentlySelected == null) {
- currentlySelected = title;
+ currentlySelected = locatorId;
}
- subtabs.put(title, canvas);
+ subtabs.put(locatorId, subTab);
}
public int getCurrentIndex() {
return currentIndex;
}
- public boolean selectTab(String title) {
+ public SubTab getSubTab(String locatorId) {
+ return subtabs.get(locatorId);
+ }
+
+ public boolean selectTab(String locatorId) {
boolean foundTab = false;
- currentlySelected = title;
+ currentlySelected = locatorId;
int i = 0;
for (String sub : subtabs.keySet()) {
- if (sub.equals(title)) {
+ if (sub.equals(locatorId)) {
currentIndex = i;
foundTab = true;
break;
@@ -192,7 +202,7 @@ public class SubTabLayout extends VLayout {
if (isDrawn()) {
((Button) buttonBar.getMember(currentIndex)).select();
- draw(subtabs.get(title));
+ draw(subtabs.get(locatorId));
}
return foundTab;
@@ -209,7 +219,7 @@ public class SubTabLayout extends VLayout {
public void fireSubTabSelection() {
TwoLevelTabSelectedEvent event = new TwoLevelTabSelectedEvent("?", currentlySelected, -1, currentIndex,
- currentlyDisplayed);
+ currentlyDisplayed.getCanvas());
hm.fireEvent(event);
}
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
index cc5cac4..c78db8a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
@@ -19,29 +19,29 @@
package org.rhq.enterprise.gui.coregui.client.components.tab;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.tab.Tab;
+
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTab;
/**
* @author Greg Hinkle
*/
-public class TwoLevelTab extends Tab {
+public class TwoLevelTab extends LocatableTab {
private SubTabLayout layout;
+ public TwoLevelTab(String locatorId, String title, String icon) {
+ super(locatorId, title, icon);
- public TwoLevelTab(String title, String icon) {
- super(title, icon);
-
- layout = new SubTabLayout();
+ layout = new SubTabLayout(locatorId);
}
- public void updateSubTab(String tab, Canvas canvas) {
- layout.updateSubTab(tab, canvas);
+ public void updateSubTab(SubTab subTab) {
+ layout.updateSubTab(subTab);
}
- public void registerSubTabs(String... tabs) {
- for (String tab : tabs) {
- layout.registerSubTab(tab, null);
+ public void registerSubTabs(SubTab... subTabs) {
+ for (SubTab subTab : subTabs) {
+ layout.registerSubTab(subTab);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
index e5cacf8..56c7e22 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
@@ -21,14 +21,19 @@ package org.rhq.enterprise.gui.coregui.client.components.tab;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.event.shared.HandlerRegistration;
import com.smartgwt.client.widgets.tab.Tab;
-import com.smartgwt.client.widgets.tab.TabSet;
import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTabSet;
+
/**
* @author Greg Hinkle
*/
-public class TwoLevelTabSet extends TabSet implements TabSelectedHandler, TwoLevelTabSelectedHandler {
+public class TwoLevelTabSet extends LocatableTabSet implements TabSelectedHandler, TwoLevelTabSelectedHandler {
+
+ public TwoLevelTabSet(String locatorId) {
+ super(locatorId);
+ }
public void setTabs(TwoLevelTab... tabs) {
super.setTabs(tabs);
@@ -36,33 +41,28 @@ public class TwoLevelTabSet extends TabSet implements TabSelectedHandler, TwoLev
tab.getLayout().addTwoLevelTabSelectedHandler(this);
- updateTab(tab,tab.getPane());
+ updateTab(tab, tab.getPane());
}
addTabSelectedHandler(this);
}
-
// ------- Event support -------
// Done with a separate handler manager from parent class on purpose (compatibility issue)
private HandlerManager m = new HandlerManager(this);
public HandlerRegistration addTwoLevelTabSelectedHandler(TwoLevelTabSelectedHandler handler) {
- return m.addHandler(TwoLevelTabSelectedEvent.TYPE,handler);
+ return m.addHandler(TwoLevelTabSelectedEvent.TYPE, handler);
}
public void onTabSelected(TabSelectedEvent tabSelectedEvent) {
TwoLevelTab tab = (TwoLevelTab) getSelectedTab();
- TwoLevelTabSelectedEvent event = new TwoLevelTabSelectedEvent(
- getSelectedTab().getTitle(),
- tab.getLayout().currentlySelected,
- tabSelectedEvent.getTabNum(),
- tab.getLayout().getCurrentIndex(),
- tab.getLayout().currentlyDisplayed
- );
+ TwoLevelTabSelectedEvent event = new TwoLevelTabSelectedEvent(getSelectedTab().getTitle(),
+ tab.getLayout().currentlySelected, tabSelectedEvent.getTabNum(), tab.getLayout().getCurrentIndex(), tab
+ .getLayout().currentlyDisplayed.getCanvas());
m.fireEvent(event);
}
@@ -83,4 +83,3 @@ public class TwoLevelTabSet extends TabSet implements TabSelectedHandler, TwoLev
return null;
}
}
-
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 43e45aa..a96c372 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
@@ -101,33 +101,34 @@ public class Table extends LocatableVLayout {
private List<TableActionInfo> tableActions = new ArrayList<TableActionInfo>();
private List<Canvas> extraWidgets = new ArrayList<Canvas>();
- public Table() {
- this(null, null, null, null, true);
+ public Table(String locatorId) {
+ this(locatorId, null, null, null, null, true);
}
- public Table(String tableTitle) {
- this(tableTitle, null, null, null, true);
+ public Table(String locatorId, String tableTitle) {
+ this(locatorId, tableTitle, null, null, null, true);
}
- public Table(String tableTitle, Criteria criteria) {
- this(tableTitle, criteria, null, null, true);
+ public Table(String locatorId, String tableTitle, Criteria criteria) {
+ this(locatorId, tableTitle, criteria, null, null, true);
}
- public Table(String tableTitle, SortSpecifier[] sortSpecifiers) {
- this(tableTitle, null, sortSpecifiers, null, true);
+ public Table(String locatorId, String tableTitle, SortSpecifier[] sortSpecifiers) {
+ this(locatorId, tableTitle, null, sortSpecifiers, null, true);
}
- public Table(String tableTitle, boolean autoFetchData) {
- this(tableTitle, null, null, null, autoFetchData);
+ public Table(String locatorId, String tableTitle, boolean autoFetchData) {
+ this(locatorId, tableTitle, null, null, null, autoFetchData);
}
- public Table(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers, String[] excludedFieldNames) {
- this(tableTitle, criteria, sortSpecifiers, excludedFieldNames, true);
+ public Table(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers,
+ String[] excludedFieldNames) {
+ this(locatorId, tableTitle, criteria, sortSpecifiers, excludedFieldNames, true);
}
- public Table(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers, String[] excludedFieldNames,
- boolean autoFetchData) {
- super(tableTitle);
+ public Table(String locatorId, String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers,
+ String[] excludedFieldNames, boolean autoFetchData) {
+ super(locatorId);
setWidth100();
setHeight100();
@@ -137,7 +138,7 @@ public class Table extends LocatableVLayout {
setTableTitle(tableTitle);
// Grid
- listGrid = new LocatableListGrid(tableTitle);
+ listGrid = new LocatableListGrid(locatorId);
if (criteria != null) {
listGrid.setInitialCriteria(criteria);
}
@@ -219,7 +220,7 @@ public class Table extends LocatableVLayout {
footer.removeMembers(footer.getMembers());
for (final TableActionInfo tableAction : tableActions) {
- IButton button = new LocatableIButton(tableAction.title);
+ IButton button = new LocatableIButton(tableAction.getLocatorId(), tableAction.getTitle());
button.setDisabled(true);
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -250,7 +251,7 @@ public class Table extends LocatableVLayout {
footer.addMember(new LayoutSpacer());
- IButton refreshButton = new LocatableIButton("Refresh");
+ IButton refreshButton = new LocatableIButton("Refresh", "Refresh");
refreshButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
listGrid.invalidateCache();
@@ -350,16 +351,16 @@ public class Table extends LocatableVLayout {
this.titleComponent = canvas;
}
- public void addTableAction(String title, TableAction tableAction) {
- this.addTableAction(title, null, null, tableAction);
+ public void addTableAction(String locatorId, String title, TableAction tableAction) {
+ this.addTableAction(locatorId, title, null, null, tableAction);
}
- public void addTableAction(String title, SelectionEnablement enablement, String confirmation,
+ public void addTableAction(String locatorId, String title, SelectionEnablement enablement, String confirmation,
TableAction tableAction) {
if (enablement == null) {
enablement = DEFAULT_SELECTION_ENABLEMENT;
}
- TableActionInfo info = new TableActionInfo(title, enablement, tableAction);
+ TableActionInfo info = new TableActionInfo(locatorId, title, enablement, tableAction);
info.confirmMessage = confirmation;
tableActions.add(info);
}
@@ -415,16 +416,46 @@ public class Table extends LocatableVLayout {
private static class TableActionInfo {
- public String title;
- public SelectionEnablement enablement;
- TableAction action;
- String confirmMessage;
- IButton actionButton;
+ private String locatorId;
+ private String title;
+ private SelectionEnablement enablement;
+ private TableAction action;
+ private String confirmMessage;
+ private IButton actionButton;
- protected TableActionInfo(String title, SelectionEnablement enablement, TableAction action) {
+ protected TableActionInfo(String locatorId, String title, SelectionEnablement enablement, TableAction action) {
+ this.locatorId = locatorId;
this.title = title;
this.enablement = enablement;
this.action = action;
}
+
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public SelectionEnablement getEnablement() {
+ return enablement;
+ }
+
+ public IButton getActionButton() {
+ return actionButton;
+ }
+
+ String getConfirmMessage() {
+ return confirmMessage;
+ }
+
+ void setConfirmMessage(String confirmMessage) {
+ this.confirmMessage = confirmMessage;
+ }
+
+ void setActionButton(IButton actionButton) {
+ this.actionButton = actionButton;
+ }
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
index 6219504..bf79f2b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
@@ -23,42 +23,27 @@
package org.rhq.enterprise.gui.coregui.client.components.tagging;
import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.types.TextMatchStyle;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Dialog;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.events.HoverEvent;
-import com.smartgwt.client.widgets.events.HoverHandler;
import com.smartgwt.client.widgets.events.MouseOutEvent;
import com.smartgwt.client.widgets.events.MouseOutHandler;
import com.smartgwt.client.widgets.events.MouseOverEvent;
import com.smartgwt.client.widgets.events.MouseOverHandler;
-import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
-import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
-import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
-import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
-import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
-import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.Layout;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
-import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.criteria.TagCriteria;
import org.rhq.core.domain.tagging.Tag;
@@ -66,24 +51,31 @@ import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.Locatable;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDialog;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableImg;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class TagEditorView extends Layout {
+public class TagEditorView extends LocatableLayout {
private LinkedHashSet<Tag> tags = new LinkedHashSet<Tag>();
private boolean editing = false;
-
- private DynamicForm form;
private boolean readOnly;
private TagsChangedCallback callback;
private boolean vertical = false;
private boolean alwaysEdit = false;
- public TagEditorView(Set<Tag> tags, boolean readOnly, TagsChangedCallback callback) {
+ public TagEditorView(String locatorId, Set<Tag> tags, boolean readOnly, TagsChangedCallback callback) {
+ super(locatorId);
+
if (tags != null) {
this.tags.addAll(tags);
}
@@ -116,13 +108,12 @@ public class TagEditorView extends Layout {
setup();
}
-
private void setup() {
for (Canvas child : getMembers()) {
child.destroy();
}
- Layout layout = vertical ? new VLayout() : new HLayout();
+ Layout layout = vertical ? new LocatableVLayout(getLocatorId()) : new LocatableHLayout(getLocatorId());
if (!vertical)
layout.setMembersMargin(8);
@@ -131,13 +122,11 @@ public class TagEditorView extends Layout {
layout.addMember(title);
for (final Tag tag : tags) {
- HLayout tagLayout = new HLayout();
+ LocatableHLayout tagLayout = new LocatableHLayout(((Locatable) layout).extendLocatorId(tag.getName()));
tagLayout.setHeight(18);
//tagLayout.set
- HTMLFlow tagString = new HTMLFlow(
- "<a href=\"#Tag/" + tag.toString() + "\">" +
- tag.toString() + "</a>");
+ HTMLFlow tagString = new HTMLFlow("<a href=\"#Tag/" + tag.toString() + "\">" + tag.toString() + "</a>");
tagString.setAutoWidth();
tagLayout.addMember(tagString);
@@ -147,7 +136,8 @@ public class TagEditorView extends Layout {
spacer.setHeight(16);
spacer.setWidth(16);
- final Img remove = new Img("[skin]/images/actions/remove.png", 16, 16);
+ final Img remove = new LocatableImg(tagLayout.getLocatorId(), "[skin]/images/actions/remove.png", 16,
+ 16);
remove.setTooltip("Click to remove this tag");
remove.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -171,18 +161,15 @@ public class TagEditorView extends Layout {
remove.hide();
}
});
-
}
tagLayout.setHeight(16);
layout.addMember(tagLayout);
-
-
}
-
if (!readOnly) {
- final Img modeImg = new Img("[skin]/images/actions/add.png", 16, 16);
+ final Img modeImg = new LocatableImg(((Locatable) layout).getLocatorId(), "[skin]/images/actions/add.png",
+ 16, 16);
modeImg.setTooltip("Click to edit tags");
modeImg.addClickHandler(new ClickHandler() {
@@ -194,48 +181,45 @@ public class TagEditorView extends Layout {
layout.addMember(modeImg);
}
-
layout.setAutoWidth();
addMember(layout);
markForRedraw();
}
-
private void showTagInput(int left, int top) {
- form = new DynamicForm();
- final Dialog dialog = new Dialog();
-
+ final LocatableDialog dialog = new LocatableDialog(getLocatorId());
+ final LocatableDynamicForm form = new LocatableDynamicForm(dialog.getLocatorId());
final ComboBoxItem tagInput = new ComboBoxItem("tag");
+
tagInput.setShowTitle(false);
tagInput.setHideEmptyPickList(true);
-// tagInput.setOptionDataSource(new TaggingDataSource());
+ // tagInput.setOptionDataSource(new TaggingDataSource());
TagCriteria criteria = new TagCriteria();
criteria.addSortNamespace(PageOrdering.ASC);
criteria.addSortSemantic(PageOrdering.ASC);
criteria.addSortName(PageOrdering.ASC);
- GWTServiceLookup.getTagService().findTagsByCriteria(criteria,
- new AsyncCallback<PageList<Tag>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load tags", caught);
- }
-
- public void onSuccess(PageList<Tag> result) {
- String[] values = new String[result.size()];
- int i = 0;
- for (Tag tag : result) {
- values[i++] = tag.toString();
- }
- tagInput.setValueMap(values);
- }
- });
+ GWTServiceLookup.getTagService().findTagsByCriteria(criteria, new AsyncCallback<PageList<Tag>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load tags", caught);
+ }
+ public void onSuccess(PageList<Tag> result) {
+ String[] values = new String[result.size()];
+ int i = 0;
+ for (Tag tag : result) {
+ values[i++] = tag.toString();
+ }
+ tagInput.setValueMap(values);
+ }
+ });
tagInput.setValueField("tag");
tagInput.setDisplayField("tag");
tagInput.setType("comboBox");
tagInput.setTextMatchStyle(TextMatchStyle.SUBSTRING);
- tagInput.setTooltip("Enter a tag in the format \"(namespace:)(semantic=)tagname\" (e.g. it:env=QA, or owner=John)");
+ tagInput
+ .setTooltip("Enter a tag in the format \"(namespace:)(semantic=)tagname\" (e.g. it:env=QA, or owner=John)");
/*tagInput.addBlurHandler(new BlurHandler() {
public void onBlur(BlurEvent blurEvent) {
String tag = form.getValueAsString("tag");
@@ -243,7 +227,7 @@ public class TagEditorView extends Layout {
Tag newTag = new Tag(tag);
tags.add(newTag);
save();
-// TagEditorView.this.setup();
+ // TagEditorView.this.setup();
}
}
});*/
@@ -256,7 +240,7 @@ public class TagEditorView extends Layout {
tags.add(newTag);
save();
dialog.destroy();
-// TagEditorView.this.setup();
+ // TagEditorView.this.setup();
}
}
}
@@ -271,7 +255,6 @@ public class TagEditorView extends Layout {
dialog.setWidth(200);
dialog.setHeight(30);
-
dialog.setShowToolbar(false);
Map bodyDefaults = new HashMap();
@@ -287,7 +270,6 @@ public class TagEditorView extends Layout {
dialog.show();
dialog.moveTo(left - 8, top - 4);
tagInput.focusInItem();
-
}
private void save() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleDistributionFileUploadForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleDistributionFileUploadForm.java
index a835f23..65f2cc3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleDistributionFileUploadForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleDistributionFileUploadForm.java
@@ -50,9 +50,9 @@ public class BundleDistributionFileUploadForm extends DynamicCallbackForm {
private final FormItemIcon iconRed;
private final boolean showUploadButton;
- public BundleDistributionFileUploadForm(boolean showUploadButton) {
+ public BundleDistributionFileUploadForm(String locatorId, boolean showUploadButton) {
- super("Distribution File");
+ super(locatorId, "Distribution File");
this.showUploadButton = showUploadButton;
setEncoding(Encoding.MULTIPART);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
index 0fe9264..cded781 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/BundleFileUploadForm.java
@@ -53,10 +53,10 @@ public class BundleFileUploadForm extends DynamicCallbackForm {
private final FormItemIcon iconRed;
private final FormItemIcon iconGrey;
- public BundleFileUploadForm(BundleVersion bundleVersion, String name, boolean showNameLabel,
+ public BundleFileUploadForm(String locatorId, BundleVersion bundleVersion, String name, boolean showNameLabel,
Boolean isAlreadyUploaded) {
- super(name);
+ super(locatorId, name);
this.bundleVersion = bundleVersion;
this.name = name;
this.showNameLabel = showNameLabel;
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 691bb32..1d386b5 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
@@ -36,8 +36,8 @@ public class DynamicCallbackForm extends LocatableDynamicForm implements Dynamic
private DynamicCallbackFormHandlerCollection formHandlers;
private static DynamicCallbackFormImpl impl = GWT.create(DynamicCallbackFormImpl.class);
- public DynamicCallbackForm(String frameName) {
- super(frameName);
+ public DynamicCallbackForm(String locatorId, String frameName) {
+ super(locatorId);
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/upload/TextFileRetrieverForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
index 7863b4f..be0f0a9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/TextFileRetrieverForm.java
@@ -41,8 +41,8 @@ public class TextFileRetrieverForm extends DynamicCallbackForm {
private ButtonItem uploadButton = null;
private UploadItem textFile;
- public TextFileRetrieverForm() {
- super("textFileRetriever");
+ public TextFileRetrieverForm(String locatorId) {
+ super(locatorId, "textFileRetriever");
setNumCols(8);
setEncoding(Encoding.MULTIPART);
setAction(GWT.getModuleBaseURL() + "/FileUploadServlet");
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 d899ace..1fd87f8 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,11 +19,6 @@
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 {
@@ -38,20 +33,4 @@ 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 79ab556..19e6719 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
@@ -158,7 +158,7 @@ public class WizardView extends VLayout {
}
private void setupButtons() {
- cancelButton = new LocatableIButton(CANCEL);
+ cancelButton = new LocatableIButton("Cancel", CANCEL);
cancelButton.setDisabled(false);
cancelButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -166,7 +166,7 @@ public class WizardView extends VLayout {
closeDialog();
}
});
- previousButton = new LocatableIButton(PREVIOUS);
+ previousButton = new LocatableIButton("Previous", PREVIOUS);
previousButton.setDisabled(true);
previousButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
@@ -177,7 +177,7 @@ public class WizardView extends VLayout {
}
}
});
- nextButton = new LocatableIButton(NEXT);
+ nextButton = new LocatableIButton("Next", NEXT);
nextButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
index a82393c..5bf7fbd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
@@ -33,7 +33,6 @@ import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;
import com.smartgwt.client.widgets.tab.events.CloseClickHandler;
@@ -56,11 +55,12 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MashupPortl
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MessagePortlet;
import org.rhq.enterprise.gui.coregui.client.gwt.DashboardGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class DashboardsView extends VLayout implements BookmarkableView {
+public class DashboardsView extends LocatableVLayout implements BookmarkableView {
private TabSet tabSet;
@@ -75,15 +75,14 @@ public class DashboardsView extends VLayout implements BookmarkableView {
private DashboardGWTServiceAsync dashboardService = GWTServiceLookup.getDashboardService();
-
private String selectedTab;
- public DashboardsView() {
+ public DashboardsView(String locatorId) {
+ super(locatorId);
setOverflow(Overflow.AUTO);
setPadding(5);
setWidth100();
setHeight100();
-
}
@Override
@@ -108,7 +107,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
removeMembers(getMembers());
this.dashboards = dashboards;
-
tabSet = new TabSet();
tabSet.setWidth100();
@@ -116,7 +114,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
tabSet.setCanCloseTabs(true);
-
editButton = new IButton(editMode ? "View Mode" : "Edit Mode");
editButton.setAutoFit(true);
editButton.addClickHandler(new ClickHandler() {
@@ -127,7 +124,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
}
});
-
final IButton newDashboardButton = new IButton("New Dashboard");
newDashboardButton.setAutoFit(true);
newDashboardButton.addClickHandler(new ClickHandler() {
@@ -142,7 +138,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
tabSet.setTabBarControls(buttons);
-
tabSet.addTabSelectedHandler(new TabSelectedHandler() {
public void onTabSelected(TabSelectedEvent tabSelectedEvent) {
History.newItem("Dashboard/" + tabSelectedEvent.getTab().getTitle(), false);
@@ -159,7 +154,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
tab.setPane(dashboardView);
tab.setCanClose(true);
-
tabSet.addTab(tab);
if (dashboard.getName().equals(selectedTab)) {
tabSet.selectTab(tab);
@@ -169,15 +163,16 @@ public class DashboardsView extends VLayout implements BookmarkableView {
tabSet.addCloseClickHandler(new CloseClickHandler() {
public void onCloseClick(final TabCloseClickEvent tabCloseClickEvent) {
final DashboardView dashboardView = (DashboardView) tabCloseClickEvent.getTab().getPane();
- SC.ask("Are you sure you want to delete [" + tabCloseClickEvent.getTab().getTitle() + "]?", new BooleanCallback() {
- public void execute(Boolean aBoolean) {
- if (aBoolean) {
- dashboardView.delete();
- } else {
- tabCloseClickEvent.cancel();
+ SC.ask("Are you sure you want to delete [" + tabCloseClickEvent.getTab().getTitle() + "]?",
+ new BooleanCallback() {
+ public void execute(Boolean aBoolean) {
+ if (aBoolean) {
+ dashboardView.delete();
+ } else {
+ tabCloseClickEvent.cancel();
+ }
}
- }
- });
+ });
}
});
@@ -185,7 +180,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
}
-
protected Dashboard getDefaultDashboard() {
Dashboard dashboard = new Dashboard();
@@ -194,7 +188,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
dashboard.setColumnWidths("32%", "68%");
dashboard.getConfiguration().put(new PropertySimple(Dashboard.CFG_BACKGROUND, "#F1F2F3"));
-
DashboardPortlet summary = new DashboardPortlet("Inventory Summary", InventorySummaryView.KEY, 230);
dashboard.addPortlet(summary, 0, 0);
@@ -202,29 +195,29 @@ public class DashboardsView extends VLayout implements BookmarkableView {
dashboard.addPortlet(tagCloud, 0, 1);
// Experimental
-// StoredPortlet platformSummary = new StoredPortlet("Platform Summary", PlatformPortletView.KEY, 300);
-// col2.add(platformSummary);
-
+ // StoredPortlet platformSummary = new StoredPortlet("Platform Summary", PlatformPortletView.KEY, 300);
+ // col2.add(platformSummary);
DashboardPortlet welcome = new DashboardPortlet("Welcome To RHQ", MessagePortlet.KEY, 180);
- welcome.getConfiguration().put(new PropertySimple("message", "<h1>Welcome to RHQ</h1>\n" +
- "<p>The RHQ project is an abstraction and plug-in based systems management suite that provides " +
- "extensible and integrated systems management for multiple products and platforms across a set " +
- "of core features. The project is designed with layered modules that provide a flexible " +
- "architecture for deployment. It delivers a core user interface that delivers audited and " +
- "historical management across an entire enterprise. A Server/Agent architecture provides " +
- "remote management and plugins implement all specific support for managed products.</p>\n" +
- "<p>This default dashboard can be edited by clicking the \"edit mode\" button above.</p>"));
+ welcome.getConfiguration().put(
+ new PropertySimple("message", "<h1>Welcome to RHQ</h1>\n"
+ + "<p>The RHQ project is an abstraction and plug-in based systems management suite that provides "
+ + "extensible and integrated systems management for multiple products and platforms across a set "
+ + "of core features. The project is designed with layered modules that provide a flexible "
+ + "architecture for deployment. It delivers a core user interface that delivers audited and "
+ + "historical management across an entire enterprise. A Server/Agent architecture provides "
+ + "remote management and plugins implement all specific support for managed products.</p>\n"
+ + "<p>This default dashboard can be edited by clicking the \"edit mode\" button above.</p>"));
dashboard.addPortlet(welcome, 1, 0);
DashboardPortlet news = new DashboardPortlet("RHQ News", MashupPortlet.KEY, 320);
- news.getConfiguration().put(new PropertySimple("address", "http://rhq-project.org/display/RHQ/RHQ+News?decorator=popup"));
+ news.getConfiguration().put(
+ new PropertySimple("address", "http://rhq-project.org/display/RHQ/RHQ+News?decorator=popup"));
dashboard.addPortlet(news, 1, 1);
-//
+ //
DashboardPortlet discoveryQueue = new DashboardPortlet("Discovery Queue", AutodiscoveryPortlet.KEY, 250);
dashboard.addPortlet(discoveryQueue, 1, 2);
-
DashboardPortlet recentAlerts = new DashboardPortlet("Recent Alerts", RecentAlertsPortlet.KEY, 250);
dashboard.addPortlet(recentAlerts, 1, 3);
@@ -235,7 +228,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
}
-
public void addNewDashboard() {
Dashboard dashboard = new Dashboard();
@@ -276,7 +268,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
editButton.setTitle(editMode ? "View Mode" : "Edit Mode");
dashboardView.setEditMode(editMode);
-
}
});
}
@@ -288,7 +279,6 @@ public class DashboardsView extends VLayout implements BookmarkableView {
}
}
-
public void renderView(ViewPath viewPath) {
if (!viewPath.isEnd()) {
selectedTab = viewPath.getCurrent().getPath();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
index 7d208f1..d09186d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
@@ -24,15 +24,13 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import com.smartgwt.client.widgets.Canvas;
-
import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.queue.AutodiscoveryPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.resource.FavoriteResourcesPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.resource.graph.GraphPortlet;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.platform.PlatformPortletView;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts.RecentAlertsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.imported.RecentlyAddedView;
-import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.platform.PlatformPortletView;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary.InventorySummaryView;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary.TagCloudPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MashupPortlet;
@@ -43,13 +41,11 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util.MessagePort
*/
public class PortletFactory {
-
private static Map<String, PortletViewFactory> registeredPortlets;
static {
registeredPortlets = new HashMap<String, PortletViewFactory>();
-
registeredPortlets.put(InventorySummaryView.KEY, InventorySummaryView.Factory.INSTANCE);
registeredPortlets.put(RecentlyAddedView.KEY, RecentlyAddedView.Factory.INSTANCE);
registeredPortlets.put(PlatformPortletView.KEY, PlatformPortletView.Factory.INSTANCE);
@@ -70,17 +66,19 @@ public class PortletFactory {
public static Portlet buildPortlet(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
-
PortletViewFactory viewFactory = registeredPortlets.get(storedPortlet.getPortletKey());
- Canvas canvas = null;
- Portlet view = viewFactory.getInstance();
+ // TODO: Note, we're using a sequence generated ID here as a locatorId. This is not optimal for repeatable
+ // tests as a change in the number of default portlets, or a change in test order could make a test
+ // non-repeatable. But, at the moment we lack the infrastructure to generate a unique, predictable id.
+ Portlet view = viewFactory.getInstance(storedPortlet.getPortletKey() + "-"
+ + Integer.toString(storedPortlet.getId()));
view.configure(portletWindow, storedPortlet);
return view;
-
}
+ @SuppressWarnings("unchecked")
public static List<String> getRegisteredPortlets() {
ArrayList portlets = new ArrayList(registeredPortlets.keySet());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletViewFactory.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletViewFactory.java
index b58e070..c14e6ab 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletViewFactory.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletViewFactory.java
@@ -23,6 +23,5 @@ package org.rhq.enterprise.gui.coregui.client.dashboard;
*/
public interface PortletViewFactory {
- Portlet getInstance();
-
+ Portlet getInstance(String locatorId);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java
index 65c237a..fe33c31 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java
@@ -18,7 +18,6 @@
*/
package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.queue;
-import com.google.gwt.core.client.GWT;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.form.DynamicForm;
@@ -36,8 +35,8 @@ public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements P
public static final String KEY = "Discovery Queue";
- public AutodiscoveryPortlet() {
- super(true);
+ public AutodiscoveryPortlet(String locatorId) {
+ super(locatorId, true);
}
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
@@ -45,19 +44,20 @@ public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements P
}
public Canvas getHelpCanvas() {
- return new HTMLFlow("This portlet offers the ability to import newly discovered resources into the inventory " +
- "for monitoring and management or to ingnore them from further action.");
+ return new HTMLFlow("This portlet offers the ability to import newly discovered resources into the inventory "
+ + "for monitoring and management or to ingnore them from further action.");
}
public DynamicForm getCustomSettingsForm() {
- return null; // TODO: Implement this method.
+ return null; // TODO: Implement this method.
}
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- public final Portlet getInstance() {
- return GWT.create(AutodiscoveryPortlet.class);
+ public final Portlet getInstance(String locatorId) {
+ //return GWT.create(AutodiscoveryPortlet.class);
+ return new AutodiscoveryPortlet(locatorId);
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
index f92e7a2..e7d4f01 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
@@ -24,7 +24,6 @@ package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.resou
import java.util.Set;
-import com.google.gwt.core.client.GWT;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
@@ -52,19 +51,17 @@ public class FavoriteResourcesPortlet extends ResourceSearchView implements Port
private DashboardPortlet storedPortlet;
private PortletWindow portletWindow;
- public FavoriteResourcesPortlet() {
- super();
+ public FavoriteResourcesPortlet(String locatorId) {
+ super(locatorId);
setOverflow(Overflow.HIDDEN);
setShowHeader(false);
setShowFooter(false);
-
Set<Integer> favoriteIds = CoreGUI.getUserPreferences().getFavoriteResources();
Integer[] favArray = favoriteIds.toArray(new Integer[favoriteIds.size()]);
-
Criteria criteria = new Criteria();
if (favoriteIds.isEmpty()) {
criteria.addCriteria("id", -1);
@@ -93,19 +90,18 @@ public class FavoriteResourcesPortlet extends ResourceSearchView implements Port
getListGrid().setViewState(state);
}
-
}
public Canvas getHelpCanvas() {
return new HTMLFlow("This portlet displays your favorite resources");
}
-
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- public final Portlet getInstance() {
- return GWT.create(FavoriteResourcesPortlet.class);
+ public final Portlet getInstance(String locatorId) {
+ //return GWT.create(FavoriteResourcesPortlet.class);
+ return new FavoriteResourcesPortlet(locatorId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java
index 580100c..af48596 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java
@@ -18,7 +18,6 @@
*/
package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.resource.graph;
-import com.google.gwt.core.client.GWT;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
@@ -30,16 +29,15 @@ import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
-import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
import org.rhq.core.domain.configuration.definition.PropertySimpleType;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.enterprise.gui.coregui.client.components.lookup.ResourceLookupComboBoxItem;
import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
-import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.ResourceScheduledMetricDatasource;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.SmallGraphView;
@@ -51,15 +49,14 @@ public class GraphPortlet extends SmallGraphView implements CustomSettingsPortle
public static final String KEY = "Resource Graph";
-
-
private PortletWindow portletWindow;
private DashboardPortlet storedPortlet;
public static final String CFG_RESOURCE_ID = "resourceId";
public static final String CFG_DEFINITION_ID = "definitionId";
- public GraphPortlet() {
+ public GraphPortlet(String locatorId) {
+ super(locatorId);
setOverflow(Overflow.HIDDEN);
}
@@ -78,17 +75,18 @@ public class GraphPortlet extends SmallGraphView implements CustomSettingsPortle
public ConfigurationDefinition getConfigurationDefinition() {
ConfigurationDefinition def = new ConfigurationDefinition("Graph Config", "Configuration of the graph portlet");
- def.put(new PropertyDefinitionSimple(CFG_RESOURCE_ID, "The resource to graph", true, PropertySimpleType.INTEGER));
- def.put(new PropertyDefinitionSimple(CFG_DEFINITION_ID, "The metric definition id to graph", true, PropertySimpleType.INTEGER));
+ def
+ .put(new PropertyDefinitionSimple(CFG_RESOURCE_ID, "The resource to graph", true,
+ PropertySimpleType.INTEGER));
+ def.put(new PropertyDefinitionSimple(CFG_DEFINITION_ID, "The metric definition id to graph", true,
+ PropertySimpleType.INTEGER));
return def;
}
-
-
@Override
protected void onDraw() {
- removeMembers(getMembers());
+ removeMembers(getMembers());
if (storedPortlet.getConfiguration().getSimple(CFG_RESOURCE_ID) != null) {
super.onDraw();
} else {
@@ -99,8 +97,8 @@ public class GraphPortlet extends SmallGraphView implements CustomSettingsPortle
public DynamicForm getCustomSettingsForm() {
final DynamicForm form = new DynamicForm();
-
- final ResourceLookupComboBoxItem resourceLookupComboBoxItem = new ResourceLookupComboBoxItem(CFG_RESOURCE_ID, "Resource");
+ final ResourceLookupComboBoxItem resourceLookupComboBoxItem = new ResourceLookupComboBoxItem(CFG_RESOURCE_ID,
+ "Resource");
resourceLookupComboBoxItem.setWidth(300);
final SelectItem metric = new SelectItem(CFG_DEFINITION_ID, "Metric") {
@@ -121,30 +119,33 @@ public class GraphPortlet extends SmallGraphView implements CustomSettingsPortle
metric.setDisplayField("displayName");
metric.setOptionDataSource(new ResourceScheduledMetricDatasource());
+ resourceLookupComboBoxItem
+ .addChangedHandler(new com.smartgwt.client.widgets.form.fields.events.ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
- resourceLookupComboBoxItem.addChangedHandler(new com.smartgwt.client.widgets.form.fields.events.ChangedHandler() {
- public void onChanged(ChangedEvent
- event) {
-
- if (form.getValue(CFG_RESOURCE_ID) instanceof Integer) {
- metric.fetchData();
- form.clearValue("defininitionId");
+ if (form.getValue(CFG_RESOURCE_ID) instanceof Integer) {
+ metric.fetchData();
+ form.clearValue("defininitionId");
+ }
}
- }
- });
+ });
if (storedPortlet.getConfiguration().getSimple(CFG_RESOURCE_ID) != null) {
- form.setValue(CFG_RESOURCE_ID, storedPortlet.getConfiguration().getSimple(CFG_RESOURCE_ID).getIntegerValue());
- form.setValue(CFG_DEFINITION_ID, storedPortlet.getConfiguration().getSimple(CFG_DEFINITION_ID).getIntegerValue());
+ form.setValue(CFG_RESOURCE_ID, storedPortlet.getConfiguration().getSimple(CFG_RESOURCE_ID)
+ .getIntegerValue());
+ form.setValue(CFG_DEFINITION_ID, storedPortlet.getConfiguration().getSimple(CFG_DEFINITION_ID)
+ .getIntegerValue());
}
form.setFields(resourceLookupComboBoxItem, metric);
form.addSubmitValuesHandler(new SubmitValuesHandler() {
public void onSubmitValues(SubmitValuesEvent submitValuesEvent) {
- storedPortlet.getConfiguration().put(new PropertySimple(CFG_RESOURCE_ID, form.getValue(CFG_RESOURCE_ID)));
- storedPortlet.getConfiguration().put(new PropertySimple(CFG_DEFINITION_ID, form.getValue(CFG_DEFINITION_ID)));
-
+ storedPortlet.getConfiguration().put(
+ new PropertySimple(CFG_RESOURCE_ID, form.getValue(CFG_RESOURCE_ID)));
+ storedPortlet.getConfiguration().put(
+ new PropertySimple(CFG_DEFINITION_ID, form.getValue(CFG_DEFINITION_ID)));
+
}
});
@@ -154,8 +155,9 @@ public class GraphPortlet extends SmallGraphView implements CustomSettingsPortle
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- public final Portlet getInstance() {
- return GWT.create(GraphPortlet.class);
+ public final Portlet getInstance(String locatorId) {
+ //return GWT.create(GraphPortlet.class);
+ return new GraphPortlet(locatorId);
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java
index ea30685..a02cdd4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformPortletView.java
@@ -21,7 +21,6 @@ package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.platform;
import java.util.HashMap;
import java.util.Set;
-import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Autofit;
@@ -30,7 +29,6 @@ import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.form.DynamicForm;
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.layout.HLayout;
@@ -54,29 +52,28 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.MeasurementDataGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceTypeGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
/**
* @author Greg Hinkle
*/
-public class PlatformPortletView extends ListGrid implements Portlet {
-
+public class PlatformPortletView extends LocatableListGrid implements Portlet {
private MeasurementDataGWTServiceAsync measurementService = GWTServiceLookup.getMeasurementDataService();
private ResourceTypeGWTServiceAsync typeService = GWTServiceLookup.getResourceTypeGWTService();
-
private HashMap<Integer, ResourceType> types = new HashMap<Integer, ResourceType>();
private HashMap<Integer, PlatformMetricDefinitions> platformMetricDefinitionsHashMap = new HashMap<Integer, PlatformMetricDefinitions>();
public static final String KEY = "Platforms Summary";
+ public PlatformPortletView(String locatorId) {
+ super(locatorId);
- public PlatformPortletView() {
setWidth100();
setHeight100();
prefetch();
-
setShowRecordComponents(true);
setShowRecordComponentsByCell(true);
@@ -84,12 +81,11 @@ public class PlatformPortletView extends ListGrid implements Portlet {
setAutoFitData(Autofit.HORIZONTAL);
setDataSource(new PlatformMetricDataSource(this));
- setInitialCriteria(new Criteria(ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.PLATFORM.name()));
-
+ setInitialCriteria(new Criteria(ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.PLATFORM
+ .name()));
}
-
private void prefetch() {
ResourceTypeCriteria typeCriteria = new ResourceTypeCriteria();
@@ -110,11 +106,8 @@ public class PlatformPortletView extends ListGrid implements Portlet {
});
}
-
private void buildUI() {
-
-
ListGridField nameField = new ListGridField("name", "Name", 250);
nameField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
@@ -123,7 +116,6 @@ public class PlatformPortletView extends ListGrid implements Portlet {
});
setFields(nameField);
-
getField("icon").setWidth(25);
hideField("id");
@@ -132,46 +124,41 @@ public class PlatformPortletView extends ListGrid implements Portlet {
hideField("category");
hideField("currentAvailability");
-
this.fetchData(new Criteria(ResourceDataSourceField.CATEGORY.propertyName(), ResourceCategory.PLATFORM.name()));
}
-
protected void loadMetricsForResource(Resource resource, final ListGridRecord record) {
final PlatformMetricDefinitions pmd = platformMetricDefinitionsHashMap.get(resource.getResourceType().getId());
- measurementService.findLiveData(
- resource.getId(),
- pmd.getDefinitionIds(),
- new AsyncCallback<Set<MeasurementData>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load platform metrics", caught);
- }
+ measurementService.findLiveData(resource.getId(), pmd.getDefinitionIds(),
+ new AsyncCallback<Set<MeasurementData>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load platform metrics", caught);
+ }
- public void onSuccess(Set<MeasurementData> result) {
+ public void onSuccess(Set<MeasurementData> result) {
- for (MeasurementData data : result) {
- if (data instanceof MeasurementDataNumeric) {
- record.setAttribute(data.getName(), ((MeasurementDataNumeric) data).getValue());
- }
+ for (MeasurementData data : result) {
+ if (data instanceof MeasurementDataNumeric) {
+ record.setAttribute(data.getName(), ((MeasurementDataNumeric) data).getValue());
}
+ }
- /*double idle = record.getAttributeAsDouble(CPUMetric.Idle.property);
- record.setAttribute("cpu", 1 - idle);
+ /*double idle = record.getAttributeAsDouble(CPUMetric.Idle.property);
+ record.setAttribute("cpu", 1 - idle);
- double totalMem = record.getAttributeAsDouble(MemoryMetric.Total.property);
- double usedMem = record.getAttributeAsDouble(MemoryMetric.Used.property);
- double percent = usedMem / totalMem;
- record.setAttribute("memory", percent);
- */
+ double totalMem = record.getAttributeAsDouble(MemoryMetric.Total.property);
+ double usedMem = record.getAttributeAsDouble(MemoryMetric.Used.property);
+ double percent = usedMem / totalMem;
+ record.setAttribute("memory", percent);
+ */
- setSortField(1);
- refreshFields();
- markForRedraw();
- }
- });
+ setSortField(1);
+ refreshFields();
+ markForRedraw();
+ }
+ });
}
-
private void setTypes(PageList<ResourceType> types) {
for (ResourceType platformType : types) {
@@ -214,10 +201,9 @@ public class PlatformPortletView extends ListGrid implements Portlet {
}
public DynamicForm getCustomSettingsForm() {
- return null; // TODO: Implement this method.
+ return null; // TODO: Implement this method.
}
-
@Override
protected Canvas createRecordComponent(ListGridRecord listGridRecord, Integer colNum) {
@@ -233,7 +219,8 @@ public class PlatformPortletView extends ListGrid implements Portlet {
double value = listGridRecord.getAttributeAsDouble(CPUMetric.Idle.property);
value = 1 - value;
- HTMLFlow text = new HTMLFlow(MeasurementConverterClient.format(value, MeasurementUnits.PERCENTAGE, true));
+ HTMLFlow text = new HTMLFlow(MeasurementConverterClient.format(value, MeasurementUnits.PERCENTAGE,
+ true));
text.setAutoWidth();
bar.addMember(text);
@@ -247,11 +234,9 @@ public class PlatformPortletView extends ListGrid implements Portlet {
second.setWidth((100 - (value * 100)) + "%");
bar.addMember(second);
-
return bar;
}
-
} else if (fieldName.equals("memory")) {
if (listGridRecord.getAttribute(MemoryMetric.Total.property) != null) {
HLayout bar = new HLayout();
@@ -262,7 +247,8 @@ public class PlatformPortletView extends ListGrid implements Portlet {
double value = listGridRecord.getAttributeAsDouble(MemoryMetric.Used.property);
double percent = value / total;
- HTMLFlow text = new HTMLFlow(MeasurementConverterClient.format(percent, MeasurementUnits.PERCENTAGE, true));
+ HTMLFlow text = new HTMLFlow(MeasurementConverterClient.format(percent,
+ MeasurementUnits.PERCENTAGE, true));
text.setAutoWidth();
bar.addMember(text);
@@ -276,7 +262,6 @@ public class PlatformPortletView extends ListGrid implements Portlet {
second.setWidth((100 - (percent * 100)) + "%");
bar.addMember(second);
-
return bar;
}
@@ -290,7 +275,6 @@ public class PlatformPortletView extends ListGrid implements Portlet {
}
-
private enum MemoryMetric {
Used("Native.MemoryInfo.used"), Free("Native.MemoryInfo.free"), Total("Native.MemoryInfo.total");
@@ -305,7 +289,6 @@ public class PlatformPortletView extends ListGrid implements Portlet {
}
}
-
private enum CPUMetric {
Idle("CpuPerc.idle"), System("CpuPerc.sys"), User("CpuPerc.user"), Wait("CpuPerc.wait");
@@ -334,30 +317,28 @@ public class PlatformPortletView extends ListGrid implements Portlet {
}
}
-
private static class PlatformMetricDefinitions {
MeasurementDefinition freeMemory, usedMemory, totalMemory;
MeasurementDefinition freeSwap, usedSwap, totalSwap;
MeasurementDefinition idleCpu, systemCpu, userCpu, waitCpu;
- MeasurementDefinition[] definitions = new MeasurementDefinition[]{freeMemory, usedMemory, totalMemory, freeSwap, usedSwap, totalSwap, idleCpu, systemCpu, userCpu, waitCpu};
-
+ MeasurementDefinition[] definitions = new MeasurementDefinition[] { freeMemory, usedMemory, totalMemory,
+ freeSwap, usedSwap, totalSwap, idleCpu, systemCpu, userCpu, waitCpu };
int[] getDefinitionIds() {
- return new int[]{freeMemory.getId(), usedMemory.getId(), totalMemory.getId(),
- freeSwap.getId(), usedSwap.getId(), totalSwap.getId(),
- idleCpu.getId(), systemCpu.getId(), userCpu.getId(), waitCpu.getId()};
+ return new int[] { freeMemory.getId(), usedMemory.getId(), totalMemory.getId(), freeSwap.getId(),
+ usedSwap.getId(), totalSwap.getId(), idleCpu.getId(), systemCpu.getId(), userCpu.getId(),
+ waitCpu.getId() };
}
-
}
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- public final Portlet getInstance() {
- return GWT.create(PlatformPortletView.class);
+ public final Portlet getInstance(String locatorId) {
+ return new PlatformPortletView(locatorId);
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
index 377e4c1..60a3783 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
@@ -18,7 +18,6 @@
*/
package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts;
-import com.google.gwt.core.client.GWT;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
@@ -37,7 +36,9 @@ public class RecentAlertsPortlet extends AlertsView implements Portlet {
public static final String KEY = "Recent Alerts";
- public RecentAlertsPortlet() {
+ public RecentAlertsPortlet(String locatorId) {
+ super(locatorId);
+
setShowHeader(false);
setShowFooter(false);
@@ -53,14 +54,14 @@ public class RecentAlertsPortlet extends AlertsView implements Portlet {
}
public DynamicForm getCustomSettingsForm() {
- return null; // TODO: Implement this method.
+ return null; // TODO: Implement this method.
}
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- public final Portlet getInstance() {
- return GWT.create(RecentAlertsPortlet.class);
+ public final Portlet getInstance(String locatorId) {
+ return new RecentAlertsPortlet(locatorId);
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedView.java
index 08b611c..3a551eb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedView.java
@@ -23,14 +23,12 @@
package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.imported;
-import com.google.gwt.core.client.GWT;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.form.DynamicForm;
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 com.smartgwt.client.widgets.tree.TreeGrid;
import org.rhq.core.domain.dashboard.DashboardPortlet;
@@ -38,15 +36,16 @@ import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-public class RecentlyAddedView extends VLayout implements Portlet {
-
+public class RecentlyAddedView extends LocatableVLayout implements Portlet {
public static final String KEY = "Recently Added Portlet";
private boolean simple = true;
- public RecentlyAddedView() {
+ public RecentlyAddedView(String locatorId) {
+ super(locatorId);
}
@Override
@@ -71,7 +70,6 @@ public class RecentlyAddedView extends VLayout implements Portlet {
treeGrid.setFields(resourceNameField, timestampField);
-
if (!simple) {
addMember(new HeaderLabel("Recently Added Resources"));
}
@@ -95,8 +93,8 @@ public class RecentlyAddedView extends VLayout implements Portlet {
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- public final Portlet getInstance() {
- return GWT.create(RecentlyAddedView.class);
+ public final Portlet getInstance(String locatorId) {
+ return new RecentlyAddedView(locatorId);
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java
index 2a1a341..859a7d5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java
@@ -26,7 +26,6 @@ package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary;
import java.util.ArrayList;
import java.util.List;
-import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
@@ -36,7 +35,6 @@ import com.smartgwt.client.widgets.form.fields.LinkItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
-import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.resource.InventorySummary;
@@ -47,15 +45,18 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceBossGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-public class InventorySummaryView extends VLayout implements Portlet {
+public class InventorySummaryView extends LocatableVLayout implements Portlet {
private ResourceBossGWTServiceAsync resourceBossService = GWTServiceLookup.getResourceBossService();
private DynamicForm form;
public static final String KEY = "Summary Counts";
- public InventorySummaryView() {
+ public InventorySummaryView(String locatorId) {
+ super(locatorId);
+
resourceBossService.getInventorySummaryForLoggedInUser(new AsyncCallback<InventorySummary>() {
public void onFailure(Throwable throwable) {
CoreGUI.getErrorHandler().handleError("Failed to retrieve inventory summary", throwable);
@@ -65,35 +66,35 @@ public class InventorySummaryView extends VLayout implements Portlet {
form = new DynamicForm();
List<FormItem> formItems = new ArrayList<FormItem>();
-// HeaderItem headerItem = new HeaderItem("header");
-// headerItem.setValue("Inventory Summary");
-// formItems.add(headerItem);
+ // HeaderItem headerItem = new HeaderItem("header");
+ // headerItem.setValue("Inventory Summary");
+ // formItems.add(headerItem);
- StaticTextItem platformTotal = createSummaryRow("platformTotal", "Platform Total",
- summary.getPlatformCount());
+ StaticTextItem platformTotal = createSummaryRow("platformTotal", "Platform Total", summary
+ .getPlatformCount());
formItems.add(platformTotal);
StaticTextItem serverTotal = createSummaryRow("serverTotal", "Server Total", summary.getServerCount());
formItems.add(serverTotal);
- StaticTextItem serviceTotal = createSummaryRow("serviceTotal", "Service Total",
- summary.getServiceCount());
+ StaticTextItem serviceTotal = createSummaryRow("serviceTotal", "Service Total", summary
+ .getServiceCount());
formItems.add(serviceTotal);
- StaticTextItem compatibleGroupTotal = createSummaryRow("compatibleGroupTotal", "Compatible Group Total",
- summary.getCompatibleGroupCount());
+ StaticTextItem compatibleGroupTotal = createSummaryRow("compatibleGroupTotal",
+ "Compatible Group Total", summary.getCompatibleGroupCount());
formItems.add(compatibleGroupTotal);
- StaticTextItem mixedGroupTotal = createSummaryRow("mixedGroupTotal", "Mixed Group Total",
- summary.getMixedGroupCount());
+ StaticTextItem mixedGroupTotal = createSummaryRow("mixedGroupTotal", "Mixed Group Total", summary
+ .getMixedGroupCount());
formItems.add(mixedGroupTotal);
- StaticTextItem groupDefinitionTotal = createSummaryRow("groupDefinitionTotal", "Group Definition Total",
- summary.getGroupDefinitionCount());
+ StaticTextItem groupDefinitionTotal = createSummaryRow("groupDefinitionTotal",
+ "Group Definition Total", summary.getGroupDefinitionCount());
formItems.add(groupDefinitionTotal);
StaticTextItem avergeMetricsTotal = createSummaryRow("averageMetricsTotal",
- "Average Metrics per Minute", summary.getScheduledMeasurementsPerMinute());
+ "Average Metrics per Minute", summary.getScheduledMeasurementsPerMinute());
formItems.add(avergeMetricsTotal);
form.setItems(formItems.toArray(new FormItem[formItems.size()]));
@@ -123,17 +124,19 @@ public class InventorySummaryView extends VLayout implements Portlet {
}
public Canvas getHelpCanvas() {
- return null; // TODO: Implement this method.
+ return null; // TODO: Implement this method.
}
public DynamicForm getCustomSettingsForm() {
- return null; // TODO: Implement this method.
+ return null; // TODO: Implement this method.
}
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- public final Portlet getInstance() {
- return GWT.create(InventorySummaryView.class);
+
+ public final Portlet getInstance(String locatorId) {
+ // return GWT.create(InventorySummaryView.class);
+ return new InventorySummaryView(locatorId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/TagCloudPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/TagCloudPortlet.java
index 8521be4..db78ffc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/TagCloudPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/TagCloudPortlet.java
@@ -22,13 +22,12 @@
*/
package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.summary;
-import com.google.gwt.core.client.GWT;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
-import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
import org.rhq.enterprise.gui.coregui.client.report.tag.TagCloudView;
@@ -39,8 +38,8 @@ public class TagCloudPortlet extends TagCloudView implements Portlet {
public static final String KEY = "TagCloud";
- public TagCloudPortlet() {
- super(true);
+ public TagCloudPortlet(String locatorId) {
+ super(locatorId, true);
}
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
@@ -48,17 +47,16 @@ public class TagCloudPortlet extends TagCloudView implements Portlet {
}
public Canvas getHelpCanvas() {
- return new HTMLFlow("The <b>Tag Cloud</b> portlet displays the relative tag counts in the system visible " +
- "to the current user.");
+ return new HTMLFlow("The <b>Tag Cloud</b> portlet displays the relative tag counts in the system visible "
+ + "to the current user.");
}
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- public final Portlet getInstance() {
- return GWT.create(TagCloudPortlet.class);
+ public final Portlet getInstance(String locatorId) {
+ return new TagCloudPortlet(locatorId);
}
}
}
-
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MashupPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MashupPortlet.java
index e4d4bef..48f3a0e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MashupPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MashupPortlet.java
@@ -22,11 +22,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util;
-import com.google.gwt.core.client.GWT;
import com.smartgwt.client.types.ContentsType;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.HTMLPane;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
@@ -36,28 +34,27 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.ConfigurablePortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
/**
* @author Greg Hinkle
*/
-public class MashupPortlet extends HTMLPane implements ConfigurablePortlet {
+public class MashupPortlet extends LocatableHTMLPane implements ConfigurablePortlet {
public static final String KEY = "Mashup";
- public MashupPortlet() {
+ public MashupPortlet(String locatorId) {
+ super(locatorId);
setContentsType(ContentsType.PAGE);
-
}
@Override
public void transformHTML(String s) {
super.transformHTML(s);
-
-
}
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
- String url = storedPortlet.getConfiguration().getSimpleValue("address",null);
+ String url = storedPortlet.getConfiguration().getSimpleValue("address", null);
if (url != null) {
setContentsURL(url);
} else {
@@ -70,7 +67,8 @@ public class MashupPortlet extends HTMLPane implements ConfigurablePortlet {
}
public ConfigurationDefinition getConfigurationDefinition() {
- ConfigurationDefinition definition = new ConfigurationDefinition("MashupPorlet Configuration", "The configuration settings for the mashup portlet.");
+ ConfigurationDefinition definition = new ConfigurationDefinition("MashupPorlet Configuration",
+ "The configuration settings for the mashup portlet.");
definition.put(new PropertyDefinitionSimple("address", "Web Address", true, PropertySimpleType.STRING));
@@ -80,8 +78,9 @@ public class MashupPortlet extends HTMLPane implements ConfigurablePortlet {
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- public final Portlet getInstance() {
- return GWT.create(MashupPortlet.class);
+ public final Portlet getInstance(String locatorId) {
+ //return GWT.create(MashupPortlet.class);
+ return new MashupPortlet(locatorId);
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MessagePortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MessagePortlet.java
index 429e6d7..f72bd8c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MessagePortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/util/MessagePortlet.java
@@ -22,11 +22,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.util;
-import com.google.gwt.core.client.GWT;
import com.smartgwt.client.types.ContentsType;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.HTMLPane;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
@@ -36,20 +34,22 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.ConfigurablePortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
/**
* @author Greg Hinkle
*/
-public class MessagePortlet extends HTMLPane implements ConfigurablePortlet {
+public class MessagePortlet extends LocatableHTMLPane implements ConfigurablePortlet {
public static final String KEY = "Message";
- public MessagePortlet() {
+ public MessagePortlet(String locatorId) {
+ super(locatorId);
setContentsType(ContentsType.PAGE);
}
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
- String contents = storedPortlet.getConfiguration().getSimpleValue("message",null);
+ String contents = storedPortlet.getConfiguration().getSimpleValue("message", null);
if (contents != null) {
setContents(contents);
} else {
@@ -62,7 +62,8 @@ public class MessagePortlet extends HTMLPane implements ConfigurablePortlet {
}
public ConfigurationDefinition getConfigurationDefinition() {
- ConfigurationDefinition definition = new ConfigurationDefinition("MessagePortlet Configuration", "The configuration settings for the message portlet.");
+ ConfigurationDefinition definition = new ConfigurationDefinition("MessagePortlet Configuration",
+ "The configuration settings for the message portlet.");
definition.put(new PropertyDefinitionSimple("message", "Message", true, PropertySimpleType.LONG_STRING));
@@ -72,8 +73,9 @@ public class MessagePortlet extends HTMLPane implements ConfigurablePortlet {
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
- public final Portlet getInstance() {
- return GWT.create(MessagePortlet.class);
+ public final Portlet getInstance(String locatorId) {
+ //return GWT.create(MessagePortlet.class);
+ return new MessagePortlet(locatorId);
}
}
}
\ No newline at end of file
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 55379d1..30aa7e5 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
@@ -41,9 +41,9 @@ public abstract class AbstractMeasurementScheduleListView extends Table {
private static final SortSpecifier[] SORT_SPECIFIERS = new SortSpecifier[] { new SortSpecifier(
MeasurementScheduleCriteria.SORT_FIELD_DISPLAY_NAME, SortDirection.ASCENDING) };
- public AbstractMeasurementScheduleListView(String title, AbstractMeasurementScheduleDataSource dataSource,
- Criteria criteria, String[] excludedFieldNames) {
- super(title, criteria, SORT_SPECIFIERS, excludedFieldNames);
+ public AbstractMeasurementScheduleListView(String locatorId, String title,
+ AbstractMeasurementScheduleDataSource dataSource, Criteria criteria, String[] excludedFieldNames) {
+ super(locatorId, title, criteria, SORT_SPECIFIERS, excludedFieldNames);
setDataSource(dataSource);
}
@@ -67,12 +67,12 @@ public abstract class AbstractMeasurementScheduleListView extends Table {
intervalField.setCellFormatter(new MillisecondsCellFormatter());
intervalField.setWidth("25%");
- addTableAction("Enable", Table.SelectionEnablement.ANY, null, new TableAction() {
+ addTableAction(extendLocatorId("Enable"), "Enable", Table.SelectionEnablement.ANY, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
getDataSource().enableSchedules(AbstractMeasurementScheduleListView.this);
}
});
- addTableAction("Disable", Table.SelectionEnablement.ANY, null, new TableAction() {
+ addTableAction(extendLocatorId("Disable"), "Disable", Table.SelectionEnablement.ANY, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
getDataSource().disableSchedules(AbstractMeasurementScheduleListView.this);
}
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 fe986b9..b01bbf9 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
@@ -43,18 +43,18 @@ public class ResourceGroupListView extends Table {
private static final String DEFAULT_TITLE = "Resource Groups";
- public ResourceGroupListView() {
- this(DEFAULT_TITLE);
+ public ResourceGroupListView(String locatorId) {
+ this(locatorId, DEFAULT_TITLE);
}
- public ResourceGroupListView(String title) {
- super(title);
+ public ResourceGroupListView(String locatorId, String title) {
+ super(locatorId, title);
setWidth100();
setHeight100();
}
- public ResourceGroupListView(Criteria criteria, String title) {
- super(title, criteria);
+ public ResourceGroupListView(String locatorId, Criteria criteria, String title) {
+ super(locatorId, title, criteria);
setWidth100();
setHeight100();
}
@@ -92,8 +92,8 @@ public class ResourceGroupListView extends Table {
getListGrid().setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField,
availabilityField);
- addTableAction("Delete", Table.SelectionEnablement.ANY, "Delete the selected resource groups?",
- new TableAction() {
+ addTableAction(extendLocatorId("Delete"), "Delete", Table.SelectionEnablement.ANY,
+ "Delete the selected resource groups?", new TableAction() {
public void executeAction(ListGridRecord[] selections) {
int[] groupIds = new int[selections.length];
int index = 0;
@@ -117,7 +117,7 @@ public class ResourceGroupListView extends Table {
}
});
- addTableAction("New", new TableAction() {
+ addTableAction(extendLocatorId("New"), "New", new TableAction() {
public void executeAction(ListGridRecord[] selection) {
new GroupCreateWizard(ResourceGroupListView.this).startBundleWizard();
}
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 8656997..31a93ad 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
@@ -24,23 +24,24 @@ 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.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class GroupDefinitionListView extends VLayout {
+public class GroupDefinitionListView extends LocatableVLayout {
- public GroupDefinitionListView() {
+ public GroupDefinitionListView(String locatorId) {
+ super(locatorId);
setWidth100();
setHeight100();
final GroupDefinitionDataSource datasource = new GroupDefinitionDataSource();
- Table table = new Table("Group Definitions");
+ Table table = new Table(getLocatorId(), "Group Definitions");
table.setDataSource(datasource);
table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index a9a6989..064e06a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -24,7 +24,6 @@ import java.util.Set;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Side;
-import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.resource.ResourceType;
@@ -37,6 +36,7 @@ import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
+import org.rhq.enterprise.gui.coregui.client.components.tab.SubTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedHandler;
@@ -46,6 +46,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary.OverviewView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* Right panel of the group view.
@@ -53,7 +54,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTyp
* @author Greg Hinkle
* @author Ian Springer
*/
-public class ResourceGroupDetailView extends VLayout implements BookmarkableView, TwoLevelTabSelectedHandler {
+public class ResourceGroupDetailView extends LocatableVLayout implements BookmarkableView, TwoLevelTabSelectedHandler {
private static final String DEFAULT_TAB_NAME = "Inventory";
private ResourceGroupComposite groupComposite;
@@ -69,8 +70,28 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
private TwoLevelTabSet topTabSet;
+ private SubTab summaryOverview;
+ private SubTab summaryTimeline;
+ private SubTab monitorGraphs;
+ private SubTab monitorTables;
+ private SubTab monitorSched;
+ private SubTab monitorCallTime;
+ private SubTab inventoryMembers;
+ private SubTab inventoryConn;
+ private SubTab opHistory;
+ private SubTab opSched;
+ private SubTab alertHistory;
+ private SubTab alertDef;
+ private SubTab configCurrent;
+ private SubTab configHistory;
+ private SubTab eventHistory;
+
private ResourceGroupTitleBar titleBar;
+ public ResourceGroupDetailView(String locatorId) {
+ super(locatorId);
+ }
+
@Override
protected void onDraw() {
super.onDraw();
@@ -80,40 +101,59 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
// The Tabs section
- topTabSet = new TwoLevelTabSet();
+ topTabSet = new TwoLevelTabSet(getLocatorId());
topTabSet.setTabBarPosition(Side.TOP);
topTabSet.setWidth100();
topTabSet.setHeight100();
topTabSet.setEdgeMarginSize(0);
topTabSet.setEdgeSize(0);
- summaryTab = new TwoLevelTab("Summary", "/images/icons/Service_up_16.png");
- summaryTab.registerSubTabs("Overview", "Timeline");
-
- monitoringTab = new TwoLevelTab("Monitoring", "/images/icons/Monitor_grey_16.png");
- monitoringTab.registerSubTabs("Graphs", "Tables", "Schedules", "Call Time");
-
- inventoryTab = new TwoLevelTab("Inventory", "/images/icons/Inventory_grey_16.png");
- inventoryTab.registerSubTabs("Members", "Connection Settings");
-
- operationsTab = new TwoLevelTab("Operations", "/images/icons/Operation_grey_16.png");
- operationsTab.registerSubTabs("History", "Scheduled");
-
- alertsTab = new TwoLevelTab("Alerts", "/images/icons/Alert_grey_16.png");
- alertsTab.registerSubTabs("History", "Definitions");
-
- configurationTab = new TwoLevelTab("Configuration", "/images/icons/Configure_grey_16.png");
- configurationTab.registerSubTabs("Current", "History");
-
- eventsTab = new TwoLevelTab("Events", "/images/icons/Events_grey_16.png");
- eventsTab.registerSubTabs("History");
+ summaryTab = new TwoLevelTab(topTabSet.extendLocatorId("Summary"), "Summary", "/images/icons/Service_up_16.png");
+ summaryOverview = new SubTab(summaryTab.extendLocatorId("Overview"), "Overview", null);
+ summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"), "Timeline", null);
+ summaryTab.registerSubTabs(summaryOverview, summaryTimeline);
+
+ monitoringTab = new TwoLevelTab(topTabSet.extendLocatorId("Monitoring"), "Monitoring",
+ "/images/icons/Monitor_grey_16.png");
+ monitorGraphs = new SubTab(monitoringTab.extendLocatorId("Graphs"), "Graphs", null);
+ monitorTables = new SubTab(monitoringTab.extendLocatorId("Tables"), "Tables", null);
+ monitorSched = new SubTab(monitoringTab.extendLocatorId("Schedules"), "Schedules", null);
+ monitorCallTime = new SubTab(monitoringTab.extendLocatorId("CallTime"), "Call Time", null);
+ monitoringTab.registerSubTabs(monitorGraphs, monitorTables, monitorSched, monitorCallTime);
+
+ inventoryTab = new TwoLevelTab(topTabSet.extendLocatorId("Inventory"), "Inventory",
+ "/images/icons/Inventory_grey_16.png");
+ inventoryMembers = new SubTab(inventoryTab.extendLocatorId("Members"), "Members", null);
+ inventoryConn = new SubTab(inventoryTab.extendLocatorId("ConnectionSettings"), "Connection Settings", null);
+ inventoryTab.registerSubTabs(this.inventoryMembers, this.inventoryConn);
+
+ operationsTab = new TwoLevelTab(topTabSet.extendLocatorId("Operations"), "Operations",
+ "/images/icons/Operation_grey_16.png");
+ this.opHistory = new SubTab(operationsTab.extendLocatorId("History"), "History", null);
+ this.opSched = new SubTab(operationsTab.extendLocatorId("Scheduled"), "Scheduled", null);
+ operationsTab.registerSubTabs(this.opHistory, this.opSched);
+
+ alertsTab = new TwoLevelTab(topTabSet.extendLocatorId("Alerts"), "Alerts", "/images/icons/Alert_grey_16.png");
+ this.alertHistory = new SubTab(alertsTab.extendLocatorId("History"), "History", null);
+ this.alertDef = new SubTab(alertsTab.extendLocatorId("Definitions"), "Definitions", null);
+ alertsTab.registerSubTabs(alertHistory, alertDef);
+
+ configurationTab = new TwoLevelTab(topTabSet.extendLocatorId("Configuration"), "Configuration",
+ "/images/icons/Configure_grey_16.png");
+ this.configCurrent = new SubTab(configurationTab.extendLocatorId("Current"), "Current", null);
+ this.configHistory = new SubTab(configurationTab.extendLocatorId("History"), "History", null);
+ configurationTab.registerSubTabs(this.configCurrent, this.configHistory);
+
+ eventsTab = new TwoLevelTab(topTabSet.extendLocatorId("Events"), "Events", "/images/icons/Events_grey_16.png");
+ this.eventHistory = new SubTab(eventsTab.extendLocatorId("History"), "History", null);
+ eventsTab.registerSubTabs(eventHistory);
topTabSet.setTabs(summaryTab, monitoringTab, inventoryTab, operationsTab, alertsTab, configurationTab,
eventsTab);
topTabSet.addTwoLevelTabSelectedHandler(this);
- titleBar = new ResourceGroupTitleBar();
+ titleBar = new ResourceGroupTitleBar(getLocatorId());
addMember(titleBar);
addMember(topTabSet);
@@ -130,39 +170,47 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
// FullHTMLPane timelinePane = new FullHTMLPane("/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId());
// summaryTab.updateSubTab("Overview", new DashboardView(resource));
// summaryTab.updateSubTab("Timeline", timelinePane);
- summaryTab.updateSubTab("Overview", new OverviewView(this.groupComposite));
+ this.summaryOverview.setCanvas(new OverviewView(this.groupComposite));
+ summaryTab.updateSubTab(this.summaryOverview);
int groupId = this.groupComposite.getResourceGroup().getId();
- monitoringTab.updateSubTab("Graphs", new FullHTMLPane("/rhq/group/monitor/graphs-plain.xhtml?groupId="
- + groupId));
- monitoringTab.updateSubTab("Tables", new FullHTMLPane("/rhq/group/monitor/tables-plain.xhtml?groupId="
- + groupId));
- monitoringTab.updateSubTab("Schedules", new SchedulesView(groupId));
-
- //new FullHTMLPane("/rhq/group/monitor/schedules-plain.xhtml?groupId=" + groupId));
- monitoringTab.updateSubTab("Call Time", new FullHTMLPane("/rhq/group/monitor/response-plain.xhtml?groupId="
- + groupId));
-
- inventoryTab.updateSubTab("Members", ResourceSearchView.getMembersOf(groupId));
+ this.monitorGraphs.setCanvas(new FullHTMLPane("/rhq/group/monitor/graphs-plain.xhtml?groupId=" + groupId));
+ this.monitorTables.setCanvas(new FullHTMLPane("/rhq/group/monitor/tables-plain.xhtml?groupId=" + groupId));
+ this.monitorSched.setCanvas(new SchedulesView("ResourceGroupMonSchedSubTab", groupId));
+ this.monitorCallTime.setCanvas(new FullHTMLPane("/rhq/group/monitor/response-plain.xhtml?groupId=" + groupId));
+ monitoringTab.updateSubTab(this.monitorGraphs);
+ monitoringTab.updateSubTab(this.monitorTables);
+ monitoringTab.updateSubTab(this.monitorSched);
+ monitoringTab.updateSubTab(this.monitorCallTime);
+
+ this.inventoryMembers.setCanvas(ResourceSearchView.getMembersOf(groupId));
+ inventoryTab.updateSubTab(this.inventoryMembers);
// inventoryTab.updateSubTab("Connection Settings", new GroupPluginConfigurationEditView(this.group.getId(), this.group.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin));
- operationsTab.updateSubTab("History", new FullHTMLPane(
- "/rhq/group/operation/groupOperationHistory-plain.xhtml?groupId=" + groupId));
- operationsTab.updateSubTab("Scheduled", new FullHTMLPane(
- "/rhq/group/operation/groupOperationSchedules-plain.xhtml?groupId=" + groupId));
+ this.opHistory.setCanvas(new FullHTMLPane("/rhq/group/operation/groupOperationHistory-plain.xhtml?groupId="
+ + groupId));
+ this.opSched.setCanvas(new FullHTMLPane("/rhq/group/operation/groupOperationSchedules-plain.xhtml?groupId="
+ + groupId));
+ operationsTab.updateSubTab(this.opHistory);
+ operationsTab.updateSubTab(this.opSched);
- configurationTab.updateSubTab("Current", new FullHTMLPane(
- "/rhq/group/configuration/viewCurrent-plain.xhtml?groupId=" + groupId));
- configurationTab.updateSubTab("History", new FullHTMLPane(
- "/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId));
+ this.alertHistory.setCanvas(new FullHTMLPane("/rhq/group/alert/listGroupAlertHistory-plain.xhtml?groupId="
+ + groupId));
+ this.alertDef.setCanvas(new FullHTMLPane("/rhq/group/alert/listGroupAlertDefinitions-plain.xhtml?groupId="
+ + groupId));
+ alertsTab.updateSubTab(this.alertHistory);
+ alertsTab.updateSubTab(this.alertDef);
- alertsTab.updateSubTab("History", new FullHTMLPane(
- "/rhq/group/alert/listGroupAlertHistory-plain.xhtml?groupId=" + groupId));
- alertsTab.updateSubTab("Definitions", new FullHTMLPane(
- "/rhq/group/alert/listGroupAlertDefinitions-plain.xhtml?groupId=" + groupId));
+ this.configCurrent.setCanvas(new FullHTMLPane("/rhq/group/configuration/viewCurrent-plain.xhtml?groupId="
+ + groupId));
+ this.configHistory
+ .setCanvas(new FullHTMLPane("/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId));
+ configurationTab.updateSubTab(this.configCurrent);
+ configurationTab.updateSubTab(this.configHistory);
- eventsTab.updateSubTab("History", new FullHTMLPane("/rhq/group/events/history-plain.xhtml?groupId=" + groupId));
+ this.eventHistory.setCanvas(new FullHTMLPane("/rhq/group/events/history-plain.xhtml?groupId=" + groupId));
+ eventsTab.updateSubTab(this.eventHistory);
// topTabSet.setSelectedTab(selectedTab);
@@ -212,8 +260,8 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
topTabSet.enableTab(inventoryTab);
// Inventory>Connection Settings subtab is only enabled for compat groups that define conn props.
- inventoryTab.setSubTabEnabled("Connection Settings",
- groupCategory == GroupCategory.COMPATIBLE && facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION));
+ inventoryTab.setSubTabEnabled("Connection Settings", groupCategory == GroupCategory.COMPATIBLE
+ && facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION));
// Monitoring and Alerts tabs are always enabled for compatible groups and always disabled for mixed groups.
if (groupCategory == GroupCategory.COMPATIBLE) {
@@ -292,4 +340,3 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
}
}
}
-
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
index e8ae5aa..27cfc12 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
@@ -28,13 +28,9 @@ import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
-import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.tagging.Tag;
@@ -44,12 +40,13 @@ import org.rhq.enterprise.gui.coregui.client.components.tagging.TagEditorView;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallback;
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.selenium.LocatableHLayout;
/**
* @author Greg Hinkle
* @author Ian Springer
*/
-public class ResourceGroupTitleBar extends HLayout {
+public class ResourceGroupTitleBar extends LocatableHLayout {
private static final String FAV_ICON = "Favorite_24_Selected.png";
private static final String NOT_FAV_ICON = "Favorite_24.png";
@@ -61,8 +58,8 @@ public class ResourceGroupTitleBar extends HLayout {
private Img availabilityImage;
private boolean favorite;
- public ResourceGroupTitleBar() {
- super();
+ public ResourceGroupTitleBar(String locatorId) {
+ super(locatorId);
setWidth100();
setHeight(30);
setPadding(5);
@@ -90,25 +87,27 @@ public class ResourceGroupTitleBar extends HLayout {
badge = new Img("types/Service_up_24.png", 24, 24);
- TagEditorView tagEditorView = new TagEditorView(group.getTags(), false, new TagsChangedCallback() {
- public void tagsChanged(final HashSet<Tag> tags) {
- GWTServiceLookup.getTagService().updateResourceGroupTags(group.getId(), tags, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to update resource group tags", caught);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Resource group tags updated", Message.Severity.Info));
- // update what is essentially our local cache
- group.setTags(tags);
- }
- });
- }
- });
+ TagEditorView tagEditorView = new TagEditorView(getLocatorId(), group.getTags(), false,
+ new TagsChangedCallback() {
+ public void tagsChanged(final HashSet<Tag> tags) {
+ GWTServiceLookup.getTagService().updateResourceGroupTags(group.getId(), tags,
+ new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update resource group tags", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Resource group tags updated", Message.Severity.Info));
+ // update what is essentially our local cache
+ group.setTags(tags);
+ }
+ });
+ }
+ });
loadTags(tagEditorView);
-
addMember(badge);
addMember(title);
addMember(tagEditorView);
@@ -120,43 +119,39 @@ public class ResourceGroupTitleBar extends HLayout {
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
criteria.addFilterId(group.getId());
criteria.fetchTags(true);
- GWTServiceLookup.getResourceGroupService().findResourceGroupsByCriteria(criteria, new AsyncCallback<PageList<ResourceGroup>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Could not load resource tags",caught);
- }
-
- public void onSuccess(PageList<ResourceGroup> result) {
- LinkedHashSet<Tag> tags = new LinkedHashSet<Tag>();
- tags.addAll(result.get(0).getTags());
- tagEditorView.setTags(tags);
- }
- });
+ GWTServiceLookup.getResourceGroupService().findResourceGroupsByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceGroup>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Could not load resource tags", caught);
+ }
+
+ public void onSuccess(PageList<ResourceGroup> result) {
+ LinkedHashSet<Tag> tags = new LinkedHashSet<Tag>();
+ tags.addAll(result.get(0).getTags());
+ tagEditorView.setTags(tags);
+ }
+ });
}
-
-
public void setGroup(ResourceGroup group) {
this.group = group;
update();
- this.title.setContents("<span class=\"SectionHeader\">" + group.getName() + "</span> <span class=\"subtitle\">" + group.getGroupCategory().name() + "</span>");
+ this.title.setContents("<span class=\"SectionHeader\">" + group.getName()
+ + "</span> <span class=\"subtitle\">" + group.getGroupCategory().name() + "</span>");
Set<Integer> favorites = CoreGUI.getUserPreferences().getFavoriteResourceGroups();
this.favorite = favorites.contains(group.getId());
updateFavoriteButton();
- this.availabilityImage.setSrc("resources/availability_" +
- (true ? "green" : "red") + //todo
- "_24.png");
-
+ this.availabilityImage.setSrc("resources/availability_" + (true ? "green" : "red") + //todo
+ "_24.png");
-
String category = this.group.getGroupCategory() == GroupCategory.COMPATIBLE ? "Cluster" : "Group";
-
String avail = "up"; // todo
-// (resource.getCurrentAvailability() != null && resource.getCurrentAvailability().getAvailabilityType() != null)
-// ? (resource.getCurrentAvailability().getAvailabilityType().name().toLowerCase()) : "down";
+ // (resource.getCurrentAvailability() != null && resource.getCurrentAvailability().getAvailabilityType() != null)
+ // ? (resource.getCurrentAvailability().getAvailabilityType().name().toLowerCase()) : "down";
badge.setSrc("types/" + category + "_" + avail + "_24.png");
markForRedraw();
@@ -180,13 +175,15 @@ public class ResourceGroupTitleBar extends HLayout {
public class UpdateFavoritesCallback implements AsyncCallback<Subject> {
public void onSuccess(Subject subject) {
- CoreGUI.getMessageCenter().notify(new Message((favorite ? "Added " : "Removed ") + " Group "
- + ResourceGroupTitleBar.this.group.getName() + " as a favorite.", Message.Severity.Info));
+ CoreGUI.getMessageCenter().notify(
+ new Message((favorite ? "Added " : "Removed ") + " Group " + ResourceGroupTitleBar.this.group.getName()
+ + " as a favorite.", Message.Severity.Info));
updateFavoriteButton();
}
public void onFailure(Throwable throwable) {
- CoreGUI.getMessageCenter().notify(new Message("Failed to " + (favorite ? "add " : "remove ") + " Group "
+ CoreGUI.getMessageCenter().notify(
+ new Message("Failed to " + (favorite ? "add " : "remove ") + " Group "
+ ResourceGroupTitleBar.this.group.getName() + " as a favorite.", Message.Severity.Error));
// Revert back to our original favorite status, since the server update failed.
toggleFavoriteLocally();
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 53d259b..f313480 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
@@ -24,7 +24,6 @@ package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
@@ -37,11 +36,12 @@ 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.resource.InventoryView;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
/**
* @author Greg Hinkle
*/
-public class ResourceGroupTopView extends HLayout implements BookmarkableView {
+public class ResourceGroupTopView extends LocatableHLayout implements BookmarkableView {
private Canvas contentCanvas;
@@ -52,8 +52,8 @@ public class ResourceGroupTopView extends HLayout implements BookmarkableView {
private ResourceGroupGWTServiceAsync groupService = GWTServiceLookup.getResourceGroupService();
- public ResourceGroupTopView() {
-
+ public ResourceGroupTopView(String locatorId) {
+ super(locatorId);
}
@Override
@@ -69,7 +69,7 @@ public class ResourceGroupTopView extends HLayout implements BookmarkableView {
contentCanvas = new Canvas();
addMember(contentCanvas);
- detailView = new ResourceGroupDetailView();
+ detailView = new ResourceGroupDetailView(getLocatorId());
// treeView.addResourceSelectListener(detailView);
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 89273ff..eb7a19a 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
@@ -33,8 +33,9 @@ public class SchedulesView extends AbstractMeasurementScheduleListView {
private static final String[] EXCLUDED_FIELD_NAMES = new String[] { MeasurementScheduleCriteria.FILTER_FIELD_RESOURCE_GROUP_ID };
- public SchedulesView(int resourceGroupId) {
- super(TITLE, new SchedulesDataSource(resourceGroupId), createCriteria(resourceGroupId), EXCLUDED_FIELD_NAMES);
+ public SchedulesView(String locatorId, int resourceGroupId) {
+ super(locatorId, 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/groups/wizard/GroupCreateStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
index 8a2a8cc..73fff22 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
@@ -38,6 +38,7 @@ import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.enterprise.gui.coregui.client.components.form.RadioGroupWithComponentsItem;
import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypePluginTreeDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
/**
* @author Greg Hinkle
@@ -50,7 +51,7 @@ public class GroupCreateStep extends AbstractWizardStep {
if (form == null) {
- form = getDynamicForm();
+ form = new LocatableDynamicForm("GroupCreate");
form.setValuesManager(new ValuesManager());
form.setWidth100();
form.setNumCols(2);
@@ -83,7 +84,8 @@ public class GroupCreateStep extends AbstractWizardStep {
form2.setFields(typeSelectItem);
options.put("Compatible", form2);
- RadioGroupWithComponentsItem kind = new RadioGroupWithComponentsItem("kind", "Group Type", options, form);
+ RadioGroupWithComponentsItem kind = new RadioGroupWithComponentsItem("groupType", "Group Type", options,
+ form);
kind.setValue("Mixed");
form.setFields(name, description, location, recursive, kind);
@@ -95,7 +97,7 @@ public class GroupCreateStep extends AbstractWizardStep {
public boolean nextPage() {
boolean valid = form.validate();
if (valid) {
- RadioGroupWithComponentsItem kind = (RadioGroupWithComponentsItem) form.getField("kind");
+ RadioGroupWithComponentsItem kind = (RadioGroupWithComponentsItem) form.getField("groupType");
if ("Compatible".equals(kind.getSelected())) {
DynamicForm form2 = (DynamicForm) kind.getSelectedComponent();
valid = (null != form2.getValue("type"));
@@ -115,7 +117,7 @@ public class GroupCreateStep extends AbstractWizardStep {
group.setLocation(form.getValueAsString("location"));
group.setRecursive(form.getValue("recursive") != null ? true : false);
- RadioGroupWithComponentsItem kind = (RadioGroupWithComponentsItem) form.getField("kind");
+ RadioGroupWithComponentsItem kind = (RadioGroupWithComponentsItem) form.getField("groupType");
if ("Compatible".equals(kind.getSelected())) {
DynamicForm form2 = (DynamicForm) kind.getSelectedComponent();
if (null != form2.getValue("type")) {
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 4026e47..883b689 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
@@ -26,7 +26,6 @@ import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.SectionStack;
import com.smartgwt.client.widgets.layout.SectionStackSection;
import com.smartgwt.client.widgets.tree.Tree;
@@ -41,12 +40,13 @@ 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.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
/**
* @author Greg Hinkle
*/
-public class InventoryView extends HLayout implements BookmarkableView {
+public class InventoryView extends LocatableHLayout implements BookmarkableView {
public static final String VIEW_PATH = "Inventory";
@@ -76,6 +76,10 @@ public class InventoryView extends HLayout implements BookmarkableView {
private SectionStack sectionStack;
+ public InventoryView(String locatorId) {
+ super(locatorId);
+ }
+
@Override
protected void onInit() {
super.onInit();
@@ -121,7 +125,7 @@ public class InventoryView extends HLayout implements BookmarkableView {
}
private ResourceSearchView buildResourceSearchView() {
- ResourceSearchView searchView = new ResourceSearchView();
+ ResourceSearchView searchView = new ResourceSearchView(extendLocatorId("Inventory"));
searchView.addResourceSelectedListener(new ResourceSelectListener() {
public void onResourceSelected(ResourceComposite resourceComposite) {
//CoreGUI.setContent(new ResourceView(resource));
@@ -219,35 +223,38 @@ public class InventoryView extends HLayout implements BookmarkableView {
if (SECTION_RESOURCES.equals(section)) {
if (PAGE_RESOURCES.equals(page)) {
- content = new ResourceSearchView(null, PAGE_RESOURCES);
+ content = new ResourceSearchView(extendLocatorId("AllResources"), null, PAGE_RESOURCES);
} else if (PAGE_PLATFORMS.equals(page)) {
- content = new ResourceSearchView(new Criteria(ResourceDataSourceField.CATEGORY.propertyName(),
- ResourceCategory.PLATFORM.name()), PAGE_PLATFORMS);
+ content = new ResourceSearchView(extendLocatorId("Platforms"), 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);
+ content = new ResourceSearchView(extendLocatorId("Servers"), 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);
+ content = new ResourceSearchView(extendLocatorId("Services"), 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, PAGE_DOWN);
+ content = new ResourceSearchView(extendLocatorId("DownResources"), criteria, PAGE_DOWN);
}
} else if (SECTION_GROUPS.equals(section)) {
if (PAGE_GROUPS.equals(page)) {
- content = new ResourceGroupListView();
+ content = new ResourceGroupListView(extendLocatorId("AllGroups"));
} else if (PAGE_COMPATIBLE_GROUPS.equals(page)) {
- content = new ResourceGroupListView(new Criteria("category", "compatible"), PAGE_COMPATIBLE_GROUPS);
+ content = new ResourceGroupListView(extendLocatorId("Compatible"), new Criteria("category",
+ "compatible"), PAGE_COMPATIBLE_GROUPS);
} else if (PAGE_MIXED_GROUPS.equals(page)) {
- content = new ResourceGroupListView(new Criteria("category", "mixed"), PAGE_MIXED_GROUPS);
+ content = new ResourceGroupListView(extendLocatorId("Mixed"), new Criteria("category", "mixed"),
+ PAGE_MIXED_GROUPS);
} else if (PAGE_GROUP_DEFINITIONS.equals(page)) {
- content = new GroupDefinitionListView();
+ content = new GroupDefinitionListView(extendLocatorId("Definitions"));
} else if (PAGE_PROBLEM_GROUPS.equals(page)) {
- content = new ResourceGroupListView(new Criteria("availability", "down"), PAGE_PROBLEM_GROUPS);
+ content = new ResourceGroupListView(extendLocatorId("DownGroups"),
+ new Criteria("availability", "down"), PAGE_PROBLEM_GROUPS);
}
}
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 98e5ab9..d54a0f5 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
@@ -58,30 +58,31 @@ public class ResourceSearchView extends Table {
/**
* A list of all Resources in the system.
*/
- public ResourceSearchView() {
- this(null);
+ public ResourceSearchView(String locatorId) {
+ this(locatorId, null);
}
- public ResourceSearchView(String title, String[] excludeFields) {
- this(null, title, null, excludeFields);
+ public ResourceSearchView(String locatorId, String title, String[] excludeFields) {
+ this(locatorId, null, title, null, excludeFields);
}
/**
* A Resource list filtered by a given criteria.
*/
- public ResourceSearchView(Criteria criteria) {
- this(criteria, DEFAULT_TITLE);
+ public ResourceSearchView(String locatorId, Criteria criteria) {
+ this(locatorId, criteria, DEFAULT_TITLE);
}
- public ResourceSearchView(Criteria criteria, String title) {
- this(criteria, title, null, null);
+ public ResourceSearchView(String locatorId, Criteria criteria, String title) {
+ this(locatorId, criteria, title, null, null);
}
/**
* A Resource list filtered by a given criteria with the given title.
*/
- public ResourceSearchView(Criteria criteria, String title, SortSpecifier[] sortSpecifier, String[] excludeFields) {
- super(title, criteria, sortSpecifier, excludeFields);
+ public ResourceSearchView(String locatorId, Criteria criteria, String title, SortSpecifier[] sortSpecifier,
+ String[] excludeFields) {
+ super(locatorId, title, criteria, sortSpecifier, excludeFields);
setHeaderIcon("types/Platform_up_24.png");
@@ -122,7 +123,7 @@ public class ResourceSearchView extends Table {
getListGrid().setFields(idField, iconField, nameField, descriptionField, typeNameField, pluginNameField,
categoryField, availabilityField);
- addTableAction("Uninventory", Table.SelectionEnablement.ANY,
+ addTableAction(extendLocatorId("Uninventory"), "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];
@@ -180,11 +181,13 @@ public class ResourceSearchView extends Table {
// -------- Static Utility loaders ------------
public static ResourceSearchView getChildrenOf(int resourceId) {
- return new ResourceSearchView(new Criteria("parentId", String.valueOf(resourceId)), "Child Resources");
+ return new ResourceSearchView("ResourceSearchChildren", new Criteria("parentId", String.valueOf(resourceId)),
+ "Child Resources");
}
public static ResourceSearchView getMembersOf(int groupId) {
- return new ResourceSearchView(new Criteria("groupId", String.valueOf(groupId)), "Member Resources");
+ return new ResourceSearchView("ResourceSearchMemberOf", new Criteria("groupId", String.valueOf(groupId)),
+ "Member Resources");
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
index cd5e060..71e6c61 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/CustomResourceTreeGrid.java
@@ -18,18 +18,21 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
-import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.domain.resource.Resource;
-
import com.smartgwt.client.data.Record;
-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.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
+
/**
* @author Greg Hinkle
*/
-public class CustomResourceTreeGrid extends TreeGrid {
+public class CustomResourceTreeGrid extends LocatableTreeGrid {
+ public CustomResourceTreeGrid(String locatorId) {
+ super(locatorId);
+ }
@Override
protected String getIcon(Record record, boolean defaultState) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java
index 3c72ba7..e16f7a0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/NewResourceTreeView.java
@@ -31,7 +31,6 @@ import com.smartgwt.client.widgets.events.CloseClickHandler;
import com.smartgwt.client.widgets.events.CloseClientEvent;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.menu.Menu;
import com.smartgwt.client.widgets.menu.MenuItem;
import com.smartgwt.client.widgets.menu.MenuItemSeparator;
@@ -40,8 +39,6 @@ import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
import com.smartgwt.client.widgets.tree.Tree;
import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeNode;
-import com.smartgwt.client.widgets.tree.events.DataArrivedEvent;
-import com.smartgwt.client.widgets.tree.events.DataArrivedHandler;
import com.smartgwt.client.widgets.tree.events.NodeContextClickEvent;
import com.smartgwt.client.widgets.tree.events.NodeContextClickHandler;
@@ -71,12 +68,12 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation
import org.rhq.enterprise.gui.coregui.client.inventory.resource.factory.ResourceFactoryCreateWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class NewResourceTreeView extends VLayout {
+public class NewResourceTreeView extends LocatableVLayout {
private Resource selectedResource;
private Resource rootResource;
@@ -89,8 +86,8 @@ public class NewResourceTreeView extends VLayout {
private boolean initialSelect = false;
- public NewResourceTreeView() {
- super();
+ public NewResourceTreeView(String locatorId) {
+ super(locatorId);
setWidth("250");
setHeight100();
@@ -104,12 +101,12 @@ public class NewResourceTreeView extends VLayout {
private void buildTree() {
- treeGrid = new CustomResourceTreeGrid();
+ treeGrid = new CustomResourceTreeGrid(getLocatorId());
treeGrid.setOpenerImage("resources/dir.png");
treeGrid.setOpenerIconSize(16);
-// treeGrid.setAutoFetchData(true);
+ // treeGrid.setAutoFetchData(true);
treeGrid.setAnimateFolders(false);
treeGrid.setSelectionType(SelectionStyle.SINGLE);
treeGrid.setShowRollOver(false);
@@ -118,16 +115,15 @@ public class NewResourceTreeView extends VLayout {
treeGrid.setLeaveScrollbarGap(false);
-
contextMenu = new Menu();
MenuItem item = new MenuItem("Expand node");
-
treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (!selectionEvent.isRightButtonDown() && selectionEvent.getState()) {
if (treeGrid.getSelectedRecord() instanceof ResourceTreeDatasource.ResourceTreeNode) {
- ResourceTreeDatasource.ResourceTreeNode node = (ResourceTreeDatasource.ResourceTreeNode) treeGrid.getSelectedRecord();
+ ResourceTreeDatasource.ResourceTreeNode node = (ResourceTreeDatasource.ResourceTreeNode) treeGrid
+ .getSelectedRecord();
System.out.println("Resource selected in tree: " + node.getResource());
String newToken = "Resource/" + node.getResource().getId();
@@ -145,11 +141,9 @@ public class NewResourceTreeView extends VLayout {
}
});
-
// This constructs the context menu for the resource at the time of the click.
setContextMenu(contextMenu);
-
treeGrid.addNodeContextClickHandler(new NodeContextClickHandler() {
public void onNodeContextClick(final NodeContextClickEvent event) {
event.getNode();
@@ -164,7 +158,6 @@ public class NewResourceTreeView extends VLayout {
});
}
-
private void showContextMenu(ResourceTreeDatasource.TypeTreeNode node) {
contextMenu.setItems(new MenuItem(node.getName()));
@@ -174,24 +167,24 @@ public class NewResourceTreeView extends VLayout {
private void showContextMenu(final ResourceTreeDatasource.ResourceTreeNode node) {
ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- node.getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children, ResourceTypeRepository.MetadataType.subCategory,
- ResourceTypeRepository.MetadataType.pluginConfigurationDefinition, ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- buildResourceContextMenu(node.getResource(), type);
- contextMenu.showContextMenu();
- }
- });
+ node.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children,
+ ResourceTypeRepository.MetadataType.subCategory,
+ ResourceTypeRepository.MetadataType.pluginConfigurationDefinition,
+ ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ buildResourceContextMenu(node.getResource(), type);
+ contextMenu.showContextMenu();
+ }
+ });
}
-
private void buildResourceContextMenu(final Resource resource, final ResourceType resourceType) {
contextMenu.setItems(new MenuItem(resource.getName()));
contextMenu.addItem(new MenuItem("Type: " + resourceType.getName()));
-
MenuItem editPluginConfiguration = new MenuItem("Plugin Configuration");
editPluginConfiguration.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
@@ -206,7 +199,8 @@ public class NewResourceTreeView extends VLayout {
configEditor.setShowModalMask(true);
configEditor.setCanDragResize(true);
configEditor.centerInPage();
- configEditor.addItem(new ConfigurationEditor(resourceId, resourceTypeId, ConfigurationEditor.ConfigType.plugin));
+ configEditor.addItem(new ConfigurationEditor(resourceId, resourceTypeId,
+ ConfigurationEditor.ConfigType.plugin));
configEditor.show();
}
@@ -214,7 +208,6 @@ public class NewResourceTreeView extends VLayout {
editPluginConfiguration.setEnabled(resourceType.getPluginConfigurationDefinition() != null);
contextMenu.addItem(editPluginConfiguration);
-
MenuItem editResourceConfiguration = new MenuItem("Resource Configuration");
editResourceConfiguration.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
@@ -235,7 +228,8 @@ public class NewResourceTreeView extends VLayout {
configEditor.destroy();
}
});
- configEditor.addItem(new ConfigurationEditor(resourceId, resourceTypeId, ConfigurationEditor.ConfigType.resource));
+ configEditor.addItem(new ConfigurationEditor(resourceId, resourceTypeId,
+ ConfigurationEditor.ConfigType.resource));
configEditor.show();
}
@@ -245,7 +239,6 @@ public class NewResourceTreeView extends VLayout {
contextMenu.addItem(new MenuItemSeparator());
-
// Operations Menu
MenuItem operations = new MenuItem("Operations");
Menu opSubMenu = new Menu();
@@ -263,10 +256,8 @@ public class NewResourceTreeView extends VLayout {
operations.setSubmenu(opSubMenu);
contextMenu.addItem(operations);
-
contextMenu.addItem(buildMetricsMenu(resourceType));
-
// Create Menu
MenuItem createChildMenu = new MenuItem("Create Child");
Menu createChildSubMenu = new Menu();
@@ -286,7 +277,6 @@ public class NewResourceTreeView extends VLayout {
createChildMenu.setEnabled(createChildSubMenu.getItems().length > 0);
contextMenu.addItem(createChildMenu);
-
// Manually Add Menu
MenuItem importChildMenu = new MenuItem("Import");
Menu importChildSubMenu = new Menu();
@@ -304,36 +294,32 @@ public class NewResourceTreeView extends VLayout {
contextMenu.addItem(importChildMenu);
}
-
private void loadManuallyAddServersToPlatforms(final Menu manuallyAddMenu) {
ResourceTypeGWTServiceAsync rts = GWTServiceLookup.getResourceTypeGWTService();
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
criteria.addFilterSupportsManualAdd(true);
criteria.fetchParentResourceTypes(true);
- rts.findResourceTypesByCriteria(criteria,
- new AsyncCallback<PageList<ResourceType>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load platform manual add children", caught);
- }
+ rts.findResourceTypesByCriteria(criteria, new AsyncCallback<PageList<ResourceType>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load platform manual add children", caught);
+ }
- public void onSuccess(PageList<ResourceType> result) {
- for (ResourceType type : result) {
- if (type.getParentResourceTypes() == null || type.getParentResourceTypes().isEmpty()) {
- MenuItem item = new MenuItem(type.getName());
- manuallyAddMenu.addItem(item);
- }
- }
+ public void onSuccess(PageList<ResourceType> result) {
+ for (ResourceType type : result) {
+ if (type.getParentResourceTypes() == null || type.getParentResourceTypes().isEmpty()) {
+ MenuItem item = new MenuItem(type.getName());
+ manuallyAddMenu.addItem(item);
}
- });
+ }
+ }
+ });
}
-
private MenuItem buildMetricsMenu(final ResourceType type) {
MenuItem measurements = new MenuItem("Measurements");
final Menu measurementsSubMenu = new Menu();
-
GWTServiceLookup.getDashboardService().findDashboardsForSubject(new AsyncCallback<List<Dashboard>>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError("Failed to load user dashboards", caught);
@@ -348,7 +334,6 @@ public class NewResourceTreeView extends VLayout {
Menu defSubItem = new Menu();
defItem.setSubmenu(defSubItem);
-
for (final Dashboard d : result) {
MenuItem addToDBItem = new MenuItem("Add chart to Dashboard: " + d.getName());
defSubItem.addItem(addToDBItem);
@@ -356,28 +341,34 @@ public class NewResourceTreeView extends VLayout {
addToDBItem.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent menuItemClickEvent) {
- DashboardPortlet p = new DashboardPortlet(def.getDisplayName() + " Chart", GraphPortlet.KEY, 250);
- p.getConfiguration().put(new PropertySimple(GraphPortlet.CFG_RESOURCE_ID, selectedResource.getId()));
- p.getConfiguration().put(new PropertySimple(GraphPortlet.CFG_DEFINITION_ID, def.getId()));
+ DashboardPortlet p = new DashboardPortlet(def.getDisplayName() + " Chart",
+ GraphPortlet.KEY, 250);
+ p.getConfiguration().put(
+ new PropertySimple(GraphPortlet.CFG_RESOURCE_ID, selectedResource.getId()));
+ p.getConfiguration().put(
+ new PropertySimple(GraphPortlet.CFG_DEFINITION_ID, def.getId()));
d.addPortlet(p, 0, 0);
- GWTServiceLookup.getDashboardService().storeDashboard(d, new AsyncCallback<Dashboard>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to save dashboard to server", caught);
- }
+ GWTServiceLookup.getDashboardService().storeDashboard(d,
+ new AsyncCallback<Dashboard>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to save dashboard to server",
+ caught);
+ }
- public void onSuccess(Dashboard result) {
- CoreGUI.getMessageCenter().notify(new Message("Saved dashboard " + result.getName() + " to server", Message.Severity.Info));
- }
- });
+ public void onSuccess(Dashboard result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Saved dashboard " + result.getName() + " to server",
+ Message.Severity.Info));
+ }
+ });
}
});
}
-
}
}
@@ -388,8 +379,8 @@ public class NewResourceTreeView extends VLayout {
Resource getResource(int resourceId) {
if (this.treeGrid != null && this.treeGrid.getTree() != null) {
- ResourceTreeDatasource.ResourceTreeNode treeNode =
- (ResourceTreeDatasource.ResourceTreeNode) this.treeGrid.getTree().findById(String.valueOf(resourceId));
+ ResourceTreeDatasource.ResourceTreeNode treeNode = (ResourceTreeDatasource.ResourceTreeNode) this.treeGrid
+ .getTree().findById(String.valueOf(resourceId));
if (treeNode != null) {
return treeNode.getResource();
}
@@ -406,7 +397,7 @@ public class NewResourceTreeView extends VLayout {
TreeNode node = null;
if (treeGrid != null && treeGrid.getTree() != null
- && (node = treeGrid.getTree().findById(String.valueOf(selectedResource.getId()))) != null) {
+ && (node = treeGrid.getTree().findById(String.valueOf(selectedResource.getId()))) != null) {
// This is the case where the tree was previously loaded and we get fired to look at a different
// node in the same tree and just have to switch the selection
@@ -418,7 +409,6 @@ public class NewResourceTreeView extends VLayout {
treeGrid.deselectAllRecords();
treeGrid.selectRecord(node);
-
// Update breadcrumbs
viewId.getBreadcrumbs().clear();
for (int i = parents.length - 1; i >= 0; i--) {
@@ -435,7 +425,6 @@ public class NewResourceTreeView extends VLayout {
final ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
-
resourceService.getPlatformForResource(selectedResource.getId(), new AsyncCallback<Resource>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError("adasdf", caught);
@@ -448,17 +437,16 @@ public class NewResourceTreeView extends VLayout {
criteria.addFilterRootResourceId(rootResource.getId());
criteria.setPageControl(PageControl.getUnlimitedInstance());
- resourceService.findResourcesByCriteria(criteria,
- new AsyncCallback<PageList<Resource>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("lkasldf", caught);
- }
+ resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("lkasldf", caught);
+ }
- public void onSuccess(PageList<Resource> result) {
+ public void onSuccess(PageList<Resource> result) {
- loadTree(rootResource.getId(), result);
- }
- });
+ loadTree(rootResource.getId(), result);
+ }
+ });
}
});
@@ -471,19 +459,18 @@ public class NewResourceTreeView extends VLayout {
}
this.buildTree();
- HashMap<Integer,Resource> data = new HashMap<Integer, Resource>();
+ HashMap<Integer, Resource> data = new HashMap<Integer, Resource>();
for (Resource res : result) {
- data.put(res.getId(),res);
+ data.put(res.getId(), res);
}
Tree tree = new Tree();
-
+
tree.setRoot(NewResourceTreeDataSource.build(rootId, data));
treeGrid.setData(tree);
addMember(this.treeGrid);
}
-
private void adjustBreadcrumb(TreeNode node, ViewId viewId) {
if (node instanceof ResourceTreeDatasource.ResourceTreeNode) {
@@ -491,19 +478,16 @@ public class NewResourceTreeView extends VLayout {
String display = node.getName() + " <span class=\"subtitle\">" + nr.getResourceType().getName() + "</span>";
String icon = "types/" + nr.getResourceType().getCategory().getDisplayName() + "_up_16.png";
-
- viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"),
- display, icon, true));
+ viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), display, icon, true));
} else {
-// if (node.getName() != null) {
-// viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), node.getName(), null, true));
-// }
+ // if (node.getName() != null) {
+ // viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), node.getName(), null, true));
+ // }
}
}
-
public void addResourceSelectListener(ResourceSelectListener listener) {
this.selectListeners.add(listener);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 5c0671c..534a0de 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -22,7 +22,6 @@ import java.util.Set;
import com.google.gwt.user.client.History;
import com.smartgwt.client.types.Side;
-import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceTypeFacet;
@@ -33,6 +32,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.alert.definitions.ResourceAlertDefinitionsView;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
+import org.rhq.enterprise.gui.coregui.client.components.tab.SubTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedHandler;
@@ -46,19 +46,22 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitorin
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.schedules.SchedulesView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.DashboardView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.OverviewView;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* Right panel of the Resource view.
*
* @author Greg Hinkle
*/
-public class ResourceDetailView extends VLayout implements BookmarkableView, ResourceSelectListener,
+public class ResourceDetailView extends LocatableVLayout implements BookmarkableView, ResourceSelectListener,
TwoLevelTabSelectedHandler {
private static final String DEFAULT_TAB_NAME = "Summary";
private ResourceComposite resourceComposite;
+ private TwoLevelTabSet topTabSet;
+
private TwoLevelTab summaryTab;
private TwoLevelTab monitoringTab;
private TwoLevelTab inventoryTab;
@@ -68,10 +71,35 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
private TwoLevelTab eventsTab;
private TwoLevelTab contentTab;
- private TwoLevelTabSet topTabSet;
+ private SubTab summaryOverview;
+ private SubTab summaryDashboard;
+ private SubTab summaryTimeline;
+ private SubTab monitorGraphs;
+ private SubTab monitorTables;
+ private SubTab monitorTraits;
+ private SubTab monitorAvail;
+ private SubTab monitorSched;
+ private SubTab monitorCallTime;
+ private SubTab inventoryChildren;
+ private SubTab inventoryConn;
+ private SubTab opHistory;
+ private SubTab opSched;
+ private SubTab alertHistory;
+ private SubTab alertDef;
+ private SubTab alertDelete;
+ private SubTab configCurrent;
+ private SubTab configHistory;
+ private SubTab eventHistory;
+ private SubTab contentDeployed;
+ private SubTab contentNew;
+ private SubTab contentSubscrip;
+ private SubTab contentHistory;
private ResourceTitleBar titleBar;
+ public ResourceDetailView(String locatorId) {
+ super(locatorId);
+ }
@Override
protected void onDraw() {
@@ -82,43 +110,72 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
// The Tabs section
- topTabSet = new TwoLevelTabSet();
+ topTabSet = new TwoLevelTabSet(getLocatorId());
topTabSet.setTabBarPosition(Side.TOP);
topTabSet.setWidth100();
topTabSet.setHeight100();
topTabSet.setEdgeMarginSize(0);
topTabSet.setEdgeSize(0);
- summaryTab = new TwoLevelTab("Summary", "/images/icons/Service_up_16.png");
- summaryTab.registerSubTabs("Overview", "Dashboard", "Timeline");
-
- monitoringTab = new TwoLevelTab("Monitoring", "/images/icons/Monitor_grey_16.png");
- monitoringTab.registerSubTabs("Graphs", "Tables", "Traits", "Availability", "Schedules", "Call Time");
-
- inventoryTab = new TwoLevelTab("Inventory", "/images/icons/Inventory_grey_16.png");
- inventoryTab.registerSubTabs("Children", "Connection Settings");
-
- operationsTab = new TwoLevelTab("Operations", "/images/icons/Operation_grey_16.png");
- operationsTab.registerSubTabs("History", "Scheduled");
-
- alertsTab = new TwoLevelTab("Alerts", "/images/icons/Alert_grey_16.png");
- alertsTab.registerSubTabs("History", "Definitions", "DELETEME");
-
- configurationTab = new TwoLevelTab("Configuration", "/images/icons/Configure_grey_16.png");
- configurationTab.registerSubTabs("Current", "History");
-
- eventsTab = new TwoLevelTab("Events", "/images/icons/Events_grey_16.png");
- eventsTab.registerSubTabs("History");
-
- contentTab = new TwoLevelTab("Content", "/images/icons/Content_grey_16.png");
- contentTab.registerSubTabs("Deployed", "New", "Subscriptions", "History");
+ summaryTab = new TwoLevelTab(topTabSet.extendLocatorId("Summary"), "Summary", "/images/icons/Service_up_16.png");
+ summaryOverview = new SubTab(summaryTab.extendLocatorId("Overview"), "Overview", null);
+ summaryDashboard = new SubTab(summaryTab.extendLocatorId("Dashboard"), "Dashboard", null);
+ summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"), "Timeline", null);
+ summaryTab.registerSubTabs(summaryOverview, summaryDashboard, summaryTimeline);
+
+ monitoringTab = new TwoLevelTab(topTabSet.extendLocatorId("Monitoring"), "Monitoring",
+ "/images/icons/Monitor_grey_16.png");
+ monitorGraphs = new SubTab(monitoringTab.extendLocatorId("Graphs"), "Graphs", null);
+ monitorTables = new SubTab(monitoringTab.extendLocatorId("Tables"), "Tables", null);
+ monitorTraits = new SubTab(monitoringTab.extendLocatorId("Traits"), "Traits", null);
+ monitorAvail = new SubTab(monitoringTab.extendLocatorId("Availability"), "Availability", null);
+ monitorSched = new SubTab(monitoringTab.extendLocatorId("Schedules"), "Schedules", null);
+ monitorCallTime = new SubTab(monitoringTab.extendLocatorId("CallTime"), "Call Time", null);
+ monitoringTab.registerSubTabs(monitorGraphs, monitorTables, monitorTraits, monitorAvail, monitorSched,
+ monitorCallTime);
+
+ inventoryTab = new TwoLevelTab(topTabSet.extendLocatorId("Inventory"), "Inventory",
+ "/images/icons/Inventory_grey_16.png");
+ inventoryChildren = new SubTab(inventoryTab.extendLocatorId("Children"), "Children", null);
+ inventoryConn = new SubTab(inventoryTab.extendLocatorId("ConnectionSettings"), "Connection Settings", null);
+ inventoryTab.registerSubTabs(this.inventoryChildren, this.inventoryConn);
+
+ operationsTab = new TwoLevelTab(topTabSet.extendLocatorId("Operations"), "Operations",
+ "/images/icons/Operation_grey_16.png");
+ this.opHistory = new SubTab(operationsTab.extendLocatorId("History"), "History", null);
+ this.opSched = new SubTab(operationsTab.extendLocatorId("Scheduled"), "Scheduled", null);
+ operationsTab.registerSubTabs(this.opHistory, this.opSched);
+
+ alertsTab = new TwoLevelTab(topTabSet.extendLocatorId("Alerts"), "Alerts", "/images/icons/Alert_grey_16.png");
+ this.alertHistory = new SubTab(alertsTab.extendLocatorId("History"), "History", null);
+ this.alertDef = new SubTab(alertsTab.extendLocatorId("Definitions"), "Definitions", null);
+ this.alertDelete = new SubTab(alertsTab.extendLocatorId("DELETEME"), "DELETEME", null);
+ alertsTab.registerSubTabs(alertHistory, alertDef, alertDelete);
+
+ configurationTab = new TwoLevelTab(topTabSet.extendLocatorId("Configuration"), "Configuration",
+ "/images/icons/Configure_grey_16.png");
+ this.configCurrent = new SubTab(configurationTab.extendLocatorId("Current"), "Current", null);
+ this.configHistory = new SubTab(configurationTab.extendLocatorId("History"), "History", null);
+ configurationTab.registerSubTabs(this.configCurrent, this.configHistory);
+
+ eventsTab = new TwoLevelTab(topTabSet.extendLocatorId("Events"), "Events", "/images/icons/Events_grey_16.png");
+ this.eventHistory = new SubTab(eventsTab.extendLocatorId("History"), "History", null);
+ eventsTab.registerSubTabs(eventHistory);
+
+ contentTab = new TwoLevelTab(topTabSet.extendLocatorId("Content"), "Content",
+ "/images/icons/Content_grey_16.png");
+ this.contentDeployed = new SubTab(contentTab.extendLocatorId("Deployed"), "Deployed", null);
+ this.contentNew = new SubTab(contentTab.extendLocatorId("New"), "New", null);
+ this.contentSubscrip = new SubTab(contentTab.extendLocatorId("Subscriptions"), "Subscriptions", null);
+ this.contentHistory = new SubTab(contentTab.extendLocatorId("History"), "History", null);
+ contentTab.registerSubTabs(contentDeployed, contentNew, contentSubscrip, contentHistory);
topTabSet.setTabs(summaryTab, monitoringTab, inventoryTab, operationsTab, alertsTab, configurationTab,
eventsTab, contentTab);
topTabSet.addTwoLevelTabSelectedHandler(this);
- titleBar = new ResourceTitleBar();
+ titleBar = new ResourceTitleBar(getLocatorId());
addMember(titleBar);
addMember(topTabSet);
@@ -133,25 +190,34 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
final Resource resource = this.resourceComposite.getResource();
this.titleBar.setResource(resource);
- summaryTab.updateSubTab("Overview", new OverviewView(this.resourceComposite));
- summaryTab.updateSubTab("Dashboard", new DashboardView(this.resourceComposite));
- summaryTab.updateSubTab("Timeline", new FullHTMLPane("/rhq/resource/summary/timeline-plain.xhtml?id="
+ this.summaryOverview.setCanvas(new OverviewView(this.resourceComposite));
+ this.summaryDashboard.setCanvas(new DashboardView(this.resourceComposite));
+ this.summaryTimeline.setCanvas(new FullHTMLPane("/rhq/resource/summary/timeline-plain.xhtml?id="
+ resource.getId()));
-
- monitoringTab.updateSubTab("Graphs", new GraphListView(resource)); // new FullHTMLPane("/rhq/common/monitor/graphs.xhtml?id=" + resource.getId()));
- monitoringTab.updateSubTab("Tables", new FullHTMLPane("/rhq/common/monitor/tables-plain.xhtml?id="
- + resource.getId()));
- monitoringTab.updateSubTab("Traits", new FullHTMLPane("/rhq/resource/monitor/traits-plain.xhtml?id="
+ summaryTab.updateSubTab(this.summaryOverview);
+ summaryTab.updateSubTab(this.summaryDashboard);
+ summaryTab.updateSubTab(this.summaryTimeline);
+
+ this.monitorGraphs.setCanvas(new GraphListView(extendLocatorId(resource.getName()), resource));
+ this.monitorTables.setCanvas(new FullHTMLPane("/rhq/common/monitor/tables-plain.xhtml?id=" + resource.getId()));
+ this.monitorTraits
+ .setCanvas(new FullHTMLPane("/rhq/resource/monitor/traits-plain.xhtml?id=" + resource.getId()));
+ this.monitorAvail.setCanvas(new FullHTMLPane("/rhq/resource/monitor/availabilityHistory-plain.xhtml?id="
+ resource.getId()));
- monitoringTab.updateSubTab("Availability", new FullHTMLPane(
- "/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId()));
- monitoringTab.updateSubTab("Schedules", new SchedulesView(resource.getId()));
- //new FullHTMLPane("/rhq/resource/monitor/schedules-plain.xhtml?id=" + resource.getId()));
- monitoringTab.updateSubTab("Call Time", new FullHTMLPane("/rhq/resource/monitor/response-plain.xhtml?id="
+ this.monitorSched.setCanvas(new SchedulesView(monitoringTab.extendLocatorId("Schedules"), resource.getId()));
+ this.monitorCallTime.setCanvas(new FullHTMLPane("/rhq/resource/monitor/response-plain.xhtml?id="
+ resource.getId()));
-
- inventoryTab.updateSubTab("Children", ResourceSearchView.getChildrenOf(resource.getId()));
- inventoryTab.updateSubTab("Connection Settings", new PluginConfigurationEditView(resource)); // new ConfigurationEditor(resource.getId(), resource.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin));
+ monitoringTab.updateSubTab(this.monitorGraphs);
+ monitoringTab.updateSubTab(this.monitorTables);
+ monitoringTab.updateSubTab(this.monitorTraits);
+ monitoringTab.updateSubTab(this.monitorAvail);
+ monitoringTab.updateSubTab(this.monitorSched);
+ monitoringTab.updateSubTab(this.monitorCallTime);
+
+ this.inventoryChildren.setCanvas(ResourceSearchView.getChildrenOf(resource.getId()));
+ this.inventoryConn.setCanvas(new PluginConfigurationEditView(resource));
+ inventoryTab.updateSubTab(this.inventoryChildren);
+ inventoryTab.updateSubTab(this.inventoryConn);
// comment out GWT-based operation history until...
// 1) user can delete history if they possess the appropriate permissions
@@ -160,13 +226,12 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
// 4) user can navigate to the group operation that spawned this resource operation history, if appropriate
//operationsTab.updateSubTab("History", OperationHistoryView.getResourceHistoryView(resource));
// note: enabled operation execution/schedules from left-nav, if it doesn't already exist
- operationsTab.updateSubTab("History", new FullHTMLPane(
- "/rhq/resource/operation/resourceOperationHistory-plain.xhtml?id=" + resource.getId()));
- operationsTab.updateSubTab("Scheduled", new FullHTMLPane(
- "/rhq/resource/operation/resourceOperationSchedules-plain.xhtml?id=" + resource.getId()));
-
- configurationTab.updateSubTab("Current", new ResourceConfigurationEditView(resource));
- configurationTab.updateSubTab("History", ConfigurationHistoryView.getHistoryOf(resource.getId()));
+ this.opHistory.setCanvas(new FullHTMLPane("/rhq/resource/operation/resourceOperationHistory-plain.xhtml?id="
+ + resource.getId()));
+ this.opSched.setCanvas(new FullHTMLPane("/rhq/resource/operation/resourceOperationSchedules-plain.xhtml?id="
+ + resource.getId()));
+ operationsTab.updateSubTab(this.opHistory);
+ operationsTab.updateSubTab(this.opSched);
// comment out GWT-based alert definitions/history views until...
// 1) new workflow is implement for alert definition creation, with particular attention to interaction model for alert notifications
@@ -174,35 +239,46 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
// 3) user can enable/disable/delete alert definitions if they possess the appropriate permissions
// 4) user can search alert history by: date alert was fired, alert priority, or alert definition
//alertsTab.updateSubTab("History", new ResourceAlertHistoryView(resource.getId()));
- alertsTab.updateSubTab("History", new FullHTMLPane("/rhq/resource/alert/listAlertHistory-plain.xhtml?id="
+ this.alertHistory.setCanvas(new FullHTMLPane("/rhq/resource/alert/listAlertHistory-plain.xhtml?id="
+ resource.getId()));
- alertsTab.updateSubTab("Definitions", new ResourceAlertDefinitionsView(resource));
- alertsTab.updateSubTab("DELETEME", new FullHTMLPane("/rhq/resource/alert/listAlertDefinitions-plain.xhtml?id="
+ this.alertDef.setCanvas(new ResourceAlertDefinitionsView(alertsTab.getLocatorId(), resource));
+ this.alertDelete.setCanvas(new FullHTMLPane("/rhq/resource/alert/listAlertDefinitions-plain.xhtml?id="
+ resource.getId()));
+ alertsTab.updateSubTab(this.alertHistory);
+ alertsTab.updateSubTab(this.alertDef);
+ alertsTab.updateSubTab(this.alertDelete);
+
+ this.configCurrent.setCanvas(new ResourceConfigurationEditView(resource));
+ this.configHistory.setCanvas(ConfigurationHistoryView.getHistoryOf(configurationTab.getLocatorId(), resource
+ .getId()));
+ configurationTab.updateSubTab(this.configCurrent);
+ configurationTab.updateSubTab(this.configHistory);
// comment out GWT-based view until...
// 1) user can search event history by: metric display range, event source, event details, event severity
// 2) user can delete events if they possess the appropriate permissions
//eventsTab.updateSubTab("History", EventHistoryView.createResourceHistoryView(resource.getId()));
- eventsTab.updateSubTab("History", new FullHTMLPane("/rhq/resource/events/history-plain.xhtml?id="
- + resource.getId()));
-
- contentTab.updateSubTab("Deployed", new FullHTMLPane("/rhq/resource/content/view-plain.xhtml?id="
- + resource.getId()));
- contentTab.updateSubTab("New", new FullHTMLPane("/rhq/resource/content/deploy-plain.xhtml?id="
+ this.eventHistory
+ .setCanvas(new FullHTMLPane("/rhq/resource/events/history-plain.xhtml?id=" + resource.getId()));
+ eventsTab.updateSubTab(this.eventHistory);
+
+ this.contentDeployed
+ .setCanvas(new FullHTMLPane("/rhq/resource/content/view-plain.xhtml?id=" + resource.getId()));
+ this.contentNew.setCanvas(new FullHTMLPane("/rhq/resource/content/deploy-plain.xhtml?id=" + resource.getId()));
+ this.contentSubscrip.setCanvas(new FullHTMLPane("/rhq/resource/content/subscription-plain.xhtml?id="
+ resource.getId()));
- contentTab.updateSubTab("Subscriptions", new FullHTMLPane("/rhq/resource/content/subscription-plain.xhtml?id="
- + resource.getId()));
- contentTab.updateSubTab("History", new FullHTMLPane("/rhq/resource/content/history-plain.xhtml?id="
+ this.contentHistory.setCanvas(new FullHTMLPane("/rhq/resource/content/history-plain.xhtml?id="
+ resource.getId()));
+ contentTab.updateSubTab(contentDeployed);
+ contentTab.updateSubTab(contentNew);
+ contentTab.updateSubTab(contentSubscrip);
+ contentTab.updateSubTab(contentHistory);
// topTabSet.setSelectedTab(selectedTab);
completeTabUpdate();
-
}
-
private void completeTabUpdate() {
ResourcePermission permissions = this.resourceComposite.getResourcePermission();
@@ -245,7 +321,6 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
topTabSet.markForRedraw();
}
-
public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
if (this.resourceComposite == null) {
History.fireCurrentHistoryState();
@@ -260,7 +335,6 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
}
}
-
public void renderView(ViewPath viewPath) {
// e.g. #Resource/10010/Inventory/Overview
String tabName = (!viewPath.isEnd()) ? viewPath.getCurrent().getPath() : null; // e.g. "Inventory"
@@ -268,7 +342,6 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
selectTab(tabName, subTabName);
}
-
public void selectTab(String tabName, String subtabName) {
if (tabName == null) {
tabName = DEFAULT_TAB_NAME;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
index 7d0c499..0c618cf 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
@@ -18,7 +18,16 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.criteria.ResourceCriteria;
@@ -31,23 +40,13 @@ import org.rhq.enterprise.gui.coregui.client.components.tagging.TagEditorView;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallback;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.Img;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.layout.HLayout;
-
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.Set;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
/**
* @author Greg Hinkle
* @author Ian Springer
*/
-public class ResourceTitleBar extends HLayout {
+public class ResourceTitleBar extends LocatableHLayout {
private static final String FAV_ICON = "Favorite_24_Selected.png";
private static final String NOT_FAV_ICON = "Favorite_24.png";
@@ -59,8 +58,8 @@ public class ResourceTitleBar extends HLayout {
private Img availabilityImage;
private boolean favorite;
- public ResourceTitleBar() {
- super();
+ public ResourceTitleBar(String locatorId) {
+ super(locatorId);
setWidth100();
setHeight(30);
setPadding(5);
@@ -88,25 +87,27 @@ public class ResourceTitleBar extends HLayout {
badge = new Img("types/Service_up_24.png", 24, 24);
- TagEditorView tagEditorView = new TagEditorView(resource.getTags(), false, new TagsChangedCallback() {
- public void tagsChanged(final HashSet<Tag> tags) {
- GWTServiceLookup.getTagService().updateResourceTags(resource.getId(), tags, new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to update resource tags", caught);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Resource tags updated", Message.Severity.Info));
- // update what is essentially our local cache
- resource.setTags(tags);
- }
- });
- }
- });
+ TagEditorView tagEditorView = new TagEditorView(getLocatorId(), resource.getTags(), false,
+ new TagsChangedCallback() {
+ public void tagsChanged(final HashSet<Tag> tags) {
+ GWTServiceLookup.getTagService().updateResourceTags(resource.getId(), tags,
+ new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update resource tags", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Resource tags updated", Message.Severity.Info));
+ // update what is essentially our local cache
+ resource.setTags(tags);
+ }
+ });
+ }
+ });
loadTags(tagEditorView);
-
addMember(badge);
addMember(title);
addMember(tagEditorView);
@@ -118,39 +119,40 @@ public class ResourceTitleBar extends HLayout {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterId(resource.getId());
criteria.fetchTags(true);
- GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Could not load resource tags",caught);
- }
-
- public void onSuccess(PageList<Resource> result) {
- LinkedHashSet<Tag> tags = new LinkedHashSet<Tag>();
- tags.addAll(result.get(0).getTags());
- tagEditorView.setTags(tags);
- }
- });
+ GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
+ new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Could not load resource tags", caught);
+ }
+
+ public void onSuccess(PageList<Resource> result) {
+ LinkedHashSet<Tag> tags = new LinkedHashSet<Tag>();
+ tags.addAll(result.get(0).getTags());
+ tagEditorView.setTags(tags);
+ }
+ });
}
-
-
public void setResource(Resource resource) {
this.resource = resource;
update();
- this.title.setContents("<span class=\"SectionHeader\">" + resource.getName() + "</span> <span class=\"subtitle\">" + resource.getResourceType().getName() + "</span>");
+ this.title.setContents("<span class=\"SectionHeader\">" + resource.getName()
+ + "</span> <span class=\"subtitle\">" + resource.getResourceType().getName() + "</span>");
Set<Integer> favorites = CoreGUI.getUserPreferences().getFavoriteResources();
this.favorite = favorites.contains(resource.getId());
updateFavoriteButton();
- this.availabilityImage.setSrc("resources/availability_" +
- (resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "green" : "red") +
- "_24.png");
+ this.availabilityImage.setSrc("resources/availability_"
+ + (resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "green" : "red")
+ + "_24.png");
String category = this.resource.getResourceType().getCategory().getDisplayName();
- String avail = (resource.getCurrentAvailability() != null && resource.getCurrentAvailability().getAvailabilityType() != null)
- ? (resource.getCurrentAvailability().getAvailabilityType().name().toLowerCase()) : "down";
+ String avail = (resource.getCurrentAvailability() != null && resource.getCurrentAvailability()
+ .getAvailabilityType() != null) ? (resource.getCurrentAvailability().getAvailabilityType().name()
+ .toLowerCase()) : "down";
badge.setSrc("types/" + category + "_" + avail + "_24.png");
markForRedraw();
@@ -175,13 +177,15 @@ public class ResourceTitleBar extends HLayout {
public class UpdateFavoritesCallback implements AsyncCallback<Subject> {
public void onSuccess(Subject subject) {
- CoreGUI.getMessageCenter().notify(new Message((favorite ? "Added " : "Removed ") + " Resource "
+ CoreGUI.getMessageCenter().notify(
+ new Message((favorite ? "Added " : "Removed ") + " Resource "
+ ResourceTitleBar.this.resource.getName() + " as a favorite.", Message.Severity.Info));
updateFavoriteButton();
}
public void onFailure(Throwable throwable) {
- CoreGUI.getMessageCenter().notify(new Message("Failed to " + (favorite ? "add " : "remove ") + " Resource "
+ CoreGUI.getMessageCenter().notify(
+ new Message("Failed to " + (favorite ? "add " : "remove ") + " Resource "
+ ResourceTitleBar.this.resource.getName() + " as a favorite.", Message.Severity.Error));
// Revert back to our original favorite status, since the server update failed.
toggleFavoriteLocally();
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 b4f140b..93ee9b9 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
@@ -22,7 +22,6 @@ import java.util.EnumSet;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
@@ -38,11 +37,12 @@ import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
/**
* @author Greg Hinkle
*/
-public class ResourceTopView extends HLayout implements BookmarkableView {
+public class ResourceTopView extends LocatableHLayout implements BookmarkableView {
private Canvas contentCanvas;
@@ -50,12 +50,12 @@ public class ResourceTopView extends HLayout implements BookmarkableView {
//private Resource resourcePlatform;
private ResourceTreeView treeView;
- private ResourceDetailView detailView = new ResourceDetailView();
+ private ResourceDetailView detailView = new ResourceDetailView(getLocatorId());
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
- public ResourceTopView() {
-
+ public ResourceTopView(String locatorId) {
+ super(locatorId);
}
@Override
@@ -65,7 +65,7 @@ public class ResourceTopView extends HLayout implements BookmarkableView {
setWidth100();
setHeight100();
- treeView = new ResourceTreeView();
+ treeView = new ResourceTreeView(getLocatorId());
addMember(treeView);
contentCanvas = new Canvas();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index f01e0e6..2c4f50d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -33,7 +33,6 @@ import com.smartgwt.client.widgets.events.CloseClickHandler;
import com.smartgwt.client.widgets.events.CloseClientEvent;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.menu.Menu;
import com.smartgwt.client.widgets.menu.MenuItem;
import com.smartgwt.client.widgets.menu.MenuItemSeparator;
@@ -71,15 +70,15 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation
import org.rhq.enterprise.gui.coregui.client.inventory.resource.factory.ResourceFactoryCreateWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class ResourceTreeView extends VLayout {
+public class ResourceTreeView extends LocatableVLayout {
private int selectedResourceId;
- private Resource selectedResource;
private Resource rootResource;
private TreeGrid treeGrid;
@@ -91,8 +90,8 @@ public class ResourceTreeView extends VLayout {
private boolean initialSelect = false;
- public ResourceTreeView() {
- super();
+ public ResourceTreeView(String locatorId) {
+ super(locatorId);
setWidth("250");
setHeight100();
@@ -101,12 +100,11 @@ public class ResourceTreeView extends VLayout {
}
public void onInit() {
-
}
private void buildTree() {
- treeGrid = new CustomResourceTreeGrid();
+ treeGrid = new CustomResourceTreeGrid(getLocatorId());
treeGrid.setOpenerImage("resources/dir.png");
treeGrid.setOpenerIconSize(16);
@@ -119,17 +117,16 @@ public class ResourceTreeView extends VLayout {
treeGrid.setShowHeader(false);
treeGrid.setLeaveScrollbarGap(false);
-
contextMenu = new Menu();
MenuItem item = new MenuItem("Expand node");
-
treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (!selectionEvent.isRightButtonDown() && selectionEvent.getState()) {
if (treeGrid.getSelectedRecord() instanceof ResourceTreeDatasource.ResourceTreeNode) {
- ResourceTreeDatasource.ResourceTreeNode node = (ResourceTreeDatasource.ResourceTreeNode) treeGrid.getSelectedRecord();
+ ResourceTreeDatasource.ResourceTreeNode node = (ResourceTreeDatasource.ResourceTreeNode) treeGrid
+ .getSelectedRecord();
System.out.println("Resource selected in tree: " + node.getResource());
String newToken = "Resource/" + node.getResource().getId();
@@ -146,12 +143,9 @@ public class ResourceTreeView extends VLayout {
}
});
-
// This constructs the context menu for the resource at the time of the click.
setContextMenu(contextMenu);
-
-
treeGrid.addNodeContextClickHandler(new NodeContextClickHandler() {
public void onNodeContextClick(final NodeContextClickEvent event) {
event.getNode();
@@ -165,26 +159,26 @@ public class ResourceTreeView extends VLayout {
}
});
- treeGrid.addDataArrivedHandler(new DataArrivedHandler() {
- public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
- if (!initialSelect) {
+ treeGrid.addDataArrivedHandler(new DataArrivedHandler() {
+ public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
+ if (!initialSelect) {
- updateBreadcrumb();
- }
+ updateBreadcrumb();
}
- });
+ }
+ });
}
private void updateBreadcrumb() {
TreeNode selectedNode = treeGrid.getTree().findById(String.valueOf(selectedResourceId));
-// System.out.println("Trying to preopen: " + selectedNode);
+ // System.out.println("Trying to preopen: " + selectedNode);
if (selectedNode != null) {
TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
treeGrid.getTree().openFolders(parents);
treeGrid.getTree().openFolder(selectedNode);
for (TreeNode p : parents) {
-// System.out.println("open? " + treeGrid.getTree().isOpen(p) + " node: " + p.getName());
+ // System.out.println("open? " + treeGrid.getTree().isOpen(p) + " node: " + p.getName());
}
treeGrid.selectRecord(selectedNode);
@@ -204,7 +198,6 @@ public class ResourceTreeView extends VLayout {
}
}
-
private void showContextMenu(ResourceTreeDatasource.TypeTreeNode node) {
contextMenu.setItems(new MenuItem(node.getName()));
@@ -214,24 +207,24 @@ public class ResourceTreeView extends VLayout {
private void showContextMenu(final ResourceTreeDatasource.ResourceTreeNode node) {
ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- node.getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children, ResourceTypeRepository.MetadataType.subCategory,
- ResourceTypeRepository.MetadataType.pluginConfigurationDefinition, ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- buildResourceContextMenu(node.getResource(), type);
- contextMenu.showContextMenu();
- }
- });
+ node.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.children,
+ ResourceTypeRepository.MetadataType.subCategory,
+ ResourceTypeRepository.MetadataType.pluginConfigurationDefinition,
+ ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ buildResourceContextMenu(node.getResource(), type);
+ contextMenu.showContextMenu();
+ }
+ });
}
-
private void buildResourceContextMenu(final Resource resource, final ResourceType resourceType) {
contextMenu.setItems(new MenuItem(resource.getName()));
contextMenu.addItem(new MenuItem("Type: " + resourceType.getName()));
-
MenuItem editPluginConfiguration = new MenuItem("Plugin Configuration");
editPluginConfiguration.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
@@ -246,7 +239,8 @@ public class ResourceTreeView extends VLayout {
configEditor.setShowModalMask(true);
configEditor.setCanDragResize(true);
configEditor.centerInPage();
- configEditor.addItem(new ConfigurationEditor(resourceId, resourceTypeId, ConfigurationEditor.ConfigType.plugin));
+ configEditor.addItem(new ConfigurationEditor(resourceId, resourceTypeId,
+ ConfigurationEditor.ConfigType.plugin));
configEditor.show();
}
@@ -254,7 +248,6 @@ public class ResourceTreeView extends VLayout {
editPluginConfiguration.setEnabled(resourceType.getPluginConfigurationDefinition() != null);
contextMenu.addItem(editPluginConfiguration);
-
MenuItem editResourceConfiguration = new MenuItem("Resource Configuration");
editResourceConfiguration.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
@@ -275,7 +268,8 @@ public class ResourceTreeView extends VLayout {
configEditor.destroy();
}
});
- configEditor.addItem(new ConfigurationEditor(resourceId, resourceTypeId, ConfigurationEditor.ConfigType.resource));
+ configEditor.addItem(new ConfigurationEditor(resourceId, resourceTypeId,
+ ConfigurationEditor.ConfigType.resource));
configEditor.show();
}
@@ -285,7 +279,6 @@ public class ResourceTreeView extends VLayout {
contextMenu.addItem(new MenuItemSeparator());
-
// Operations Menu
MenuItem operations = new MenuItem("Operations");
Menu opSubMenu = new Menu();
@@ -298,15 +291,16 @@ public class ResourceTreeView extends VLayout {
criteria.addFilterId(selectedResourceId);
GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
- new AsyncCallback<PageList<Resource>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to get resource to run operation",caught);
- }
+ new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler()
+ .handleError("Failed to get resource to run operation", caught);
+ }
- public void onSuccess(PageList<Resource> result) {
- new OperationCreateWizard(result.get(0), operationDefinition).startOperationWizard();
- }
- });
+ public void onSuccess(PageList<Resource> result) {
+ new OperationCreateWizard(result.get(0), operationDefinition).startOperationWizard();
+ }
+ });
}
});
@@ -317,12 +311,8 @@ public class ResourceTreeView extends VLayout {
operations.setSubmenu(opSubMenu);
contextMenu.addItem(operations);
-
-
contextMenu.addItem(buildMetricsMenu(resourceType));
-
-
// Create Menu
MenuItem createChildMenu = new MenuItem("Create Child");
Menu createChildSubMenu = new Menu();
@@ -342,7 +332,6 @@ public class ResourceTreeView extends VLayout {
createChildMenu.setEnabled(createChildSubMenu.getItems().length > 0);
contextMenu.addItem(createChildMenu);
-
// Manually Add Menu
MenuItem importChildMenu = new MenuItem("Import");
Menu importChildSubMenu = new Menu();
@@ -360,38 +349,32 @@ public class ResourceTreeView extends VLayout {
contextMenu.addItem(importChildMenu);
}
-
private void loadManuallyAddServersToPlatforms(final Menu manuallyAddMenu) {
ResourceTypeGWTServiceAsync rts = GWTServiceLookup.getResourceTypeGWTService();
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
criteria.addFilterSupportsManualAdd(true);
criteria.fetchParentResourceTypes(true);
- rts.findResourceTypesByCriteria(criteria,
- new AsyncCallback<PageList<ResourceType>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load platform manual add children",caught);
- }
+ rts.findResourceTypesByCriteria(criteria, new AsyncCallback<PageList<ResourceType>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load platform manual add children", caught);
+ }
- public void onSuccess(PageList<ResourceType> result) {
- for (ResourceType type : result) {
- if (type.getParentResourceTypes() == null || type.getParentResourceTypes().isEmpty()) {
- MenuItem item = new MenuItem(type.getName());
- manuallyAddMenu.addItem(item);
- }
- }
+ public void onSuccess(PageList<ResourceType> result) {
+ for (ResourceType type : result) {
+ if (type.getParentResourceTypes() == null || type.getParentResourceTypes().isEmpty()) {
+ MenuItem item = new MenuItem(type.getName());
+ manuallyAddMenu.addItem(item);
}
- });
+ }
+ }
+ });
}
-
private MenuItem buildMetricsMenu(final ResourceType type) {
MenuItem measurements = new MenuItem("Measurements");
final Menu measurementsSubMenu = new Menu();
-
-
-
GWTServiceLookup.getDashboardService().findDashboardsForSubject(new AsyncCallback<List<Dashboard>>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError("Failed to load user dashboards", caught);
@@ -413,28 +396,34 @@ public class ResourceTreeView extends VLayout {
addToDBItem.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent menuItemClickEvent) {
- DashboardPortlet p = new DashboardPortlet(def.getDisplayName() + " Chart", GraphPortlet.KEY, 250);
- p.getConfiguration().put(new PropertySimple(GraphPortlet.CFG_RESOURCE_ID, selectedResourceId));
- p.getConfiguration().put(new PropertySimple(GraphPortlet.CFG_DEFINITION_ID, def.getId()));
+ DashboardPortlet p = new DashboardPortlet(def.getDisplayName() + " Chart",
+ GraphPortlet.KEY, 250);
+ p.getConfiguration().put(
+ new PropertySimple(GraphPortlet.CFG_RESOURCE_ID, selectedResourceId));
+ p.getConfiguration().put(
+ new PropertySimple(GraphPortlet.CFG_DEFINITION_ID, def.getId()));
d.addPortlet(p, 0, 0);
- GWTServiceLookup.getDashboardService().storeDashboard(d, new AsyncCallback<Dashboard>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to save dashboard to server", caught);
- }
+ GWTServiceLookup.getDashboardService().storeDashboard(d,
+ new AsyncCallback<Dashboard>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to save dashboard to server",
+ caught);
+ }
- public void onSuccess(Dashboard result) {
- CoreGUI.getMessageCenter().notify(new Message("Saved dashboard " + result.getName() + " to server", Message.Severity.Info));
- }
- });
+ public void onSuccess(Dashboard result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Saved dashboard " + result.getName() + " to server",
+ Message.Severity.Info));
+ }
+ });
}
});
}
-
}
}
@@ -445,8 +434,8 @@ public class ResourceTreeView extends VLayout {
Resource getResource(int resourceId) {
if (this.treeGrid != null && this.treeGrid.getTree() != null) {
- ResourceTreeDatasource.ResourceTreeNode treeNode =
- (ResourceTreeDatasource.ResourceTreeNode) this.treeGrid.getTree().findById(String.valueOf(resourceId));
+ ResourceTreeDatasource.ResourceTreeNode treeNode = (ResourceTreeDatasource.ResourceTreeNode) this.treeGrid
+ .getTree().findById(String.valueOf(resourceId));
if (treeNode != null) {
return treeNode.getResource();
}
@@ -463,7 +452,7 @@ public class ResourceTreeView extends VLayout {
TreeNode node = null;
if (treeGrid != null && treeGrid.getTree() != null
- && (node = treeGrid.getTree().findById(String.valueOf(selectedResourceId))) != null) {
+ && (node = treeGrid.getTree().findById(String.valueOf(selectedResourceId))) != null) {
// This is the case where the tree was previously loaded and we get fired to look at a different
// node in the same tree and just have to switch the selection
@@ -475,7 +464,6 @@ public class ResourceTreeView extends VLayout {
treeGrid.deselectAllRecords();
treeGrid.selectRecord(node);
-
updateBreadcrumb();
/*
TODO DELETEME
@@ -488,7 +476,7 @@ public class ResourceTreeView extends VLayout {
adjustBreadcrumb(node, viewId);
CoreGUI.refreshBreadCrumbTrail();
-*/
+ */
} else {
@@ -513,31 +501,25 @@ public class ResourceTreeView extends VLayout {
setRootResource(root);
-
-
-
ResourceTreeDatasource dataSource = new ResourceTreeDatasource(result);
treeGrid.setDataSource(dataSource);
// GH: couldn't get initial data to mix with the datasource... so i put the inital data in
// the first datasource request
-// treeGrid.setInitialData(selectedLineage);
+ // treeGrid.setInitialData(selectedLineage);
addMember(treeGrid);
-
- treeGrid.fetchData(treeGrid.getCriteria(),new DSCallback() {
+ treeGrid.fetchData(treeGrid.getCriteria(), new DSCallback() {
public void execute(DSResponse dsResponse, Object o, DSRequest dsRequest) {
System.out.println("Here!!!!!");
updateBreadcrumb();
}
});
-
-
TreeNode selectedNode = treeGrid.getTree().findById(String.valueOf(selectedResourceId));
-// System.out.println("Trying to preopen: " + selectedNode);
+ // System.out.println("Trying to preopen: " + selectedNode);
if (selectedNode != null) {
-// System.out.println("Preopen node!!!");
+ // System.out.println("Preopen node!!!");
TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
treeGrid.getTree().openFolders(parents);
treeGrid.getTree().openFolder(selectedNode);
@@ -556,46 +538,50 @@ public class ResourceTreeView extends VLayout {
} else {
initialSelect = false;
- 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) {
-
- treeGrid.getTree().linkNodes(ResourceTreeDatasource.build(result));
-
- TreeNode selectedNode = treeGrid.getTree().findById(String.valueOf(selectedResourceId));
- if (selectedNode != null) {
- treeGrid.deselectAllRecords();
- treeGrid.selectRecord(selectedNode);
-
- TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
- treeGrid.getTree().openFolders(parents);
- treeGrid.getTree().openFolder(selectedNode);
-
- /*
- todo deleteme
- // Update breadcrumbs
- viewId.getBreadcrumbs().clear();
- for (int i = parents.length - 1; i >= 0; i--) {
- TreeNode n = parents[i];
- adjustBreadcrumb(n, viewId);
- }
- adjustBreadcrumb(selectedNode, viewId);
- CoreGUI.refreshBreadCrumbTrail();*/
-
- } else {
- CoreGUI.getMessageCenter().notify(new Message("Failed to select resource [" + selectedResourceId + "] in tree.", Message.Severity.Warning));
+ 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) {
+
+ treeGrid.getTree().linkNodes(ResourceTreeDatasource.build(result));
+
+ TreeNode selectedNode = treeGrid.getTree().findById(
+ String.valueOf(selectedResourceId));
+ if (selectedNode != null) {
+ treeGrid.deselectAllRecords();
+ treeGrid.selectRecord(selectedNode);
+
+ TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
+ treeGrid.getTree().openFolders(parents);
+ treeGrid.getTree().openFolder(selectedNode);
+
+ /*
+ todo deleteme
+ // Update breadcrumbs
+ viewId.getBreadcrumbs().clear();
+ for (int i = parents.length - 1; i >= 0; i--) {
+ TreeNode n = parents[i];
+ adjustBreadcrumb(n, viewId);
}
+ adjustBreadcrumb(selectedNode, viewId);
+ CoreGUI.refreshBreadCrumbTrail();*/
-
+ } else {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Failed to select resource [" + selectedResourceId
+ + "] in tree.", Message.Severity.Warning));
}
- });
+ }
+ });
}
TreeNode selectedNode = treeGrid.getTree().findById(String.valueOf(selectedResourceId));
-// System.out.println("Trying to preopen: " + selectedNode);
+ // System.out.println("Trying to preopen: " + selectedNode);
if (selectedNode != null) {
TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
@@ -608,7 +594,6 @@ public class ResourceTreeView extends VLayout {
}
}
-
private void adjustBreadcrumb(TreeNode node, ViewId viewId) {
if (node instanceof ResourceTreeDatasource.ResourceTreeNode) {
@@ -616,19 +601,16 @@ public class ResourceTreeView extends VLayout {
String display = node.getName() + " <span class=\"subtitle\">" + nr.getResourceType().getName() + "</span>";
String icon = "types/" + nr.getResourceType().getCategory().getDisplayName() + "_up_16.png";
-
- viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"),
- display, icon, true));
+ viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), display, icon, true));
} else {
-// if (node.getName() != null) {
-// viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), node.getName(), null, true));
-// }
+ // if (node.getName() != null) {
+ // viewId.getBreadcrumbs().add(new Breadcrumb(node.getAttribute("id"), node.getName(), null, true));
+ // }
}
}
-
/*private List<Resource> preload(final List<Resource> lineage) {
final ArrayList<Resource> list = new ArrayList<Resource>(lineage);
@@ -664,6 +646,3 @@ public class ResourceTreeView extends VLayout {
setSelectedResource(resourceId);
}
}
-
-
-
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java
index 32c0f44..6143c6d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/alert/ResourceAlertHistoryView.java
@@ -23,22 +23,20 @@
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.alert;
import com.smartgwt.client.data.Criteria;
+
import org.rhq.core.domain.criteria.AlertCriteria;
-import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.composite.ResourceComposite;
-import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.enterprise.gui.coregui.client.alert.AlertsView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
/**
* @author Ian Springer
*/
-public class ResourceAlertHistoryView extends AlertsView
- implements ResourceSelectListener {
+public class ResourceAlertHistoryView extends AlertsView implements ResourceSelectListener {
private static final String[] EXCLUDED_FIELD_NAMES = new String[] { AlertCriteria.SORT_FIELD_RESOURCE_ID };
- public ResourceAlertHistoryView(int resourceId) {
- super(createCriteria(resourceId), EXCLUDED_FIELD_NAMES);
+ public ResourceAlertHistoryView(String locatorId, int resourceId) {
+ super(locatorId, createCriteria(resourceId), EXCLUDED_FIELD_NAMES);
}
public void onResourceSelected(ResourceComposite resourceComposite) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index 721fd06..472ee86 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -22,23 +22,16 @@ import java.util.ArrayList;
import java.util.EnumSet;
import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.types.SelectionAppearance;
-import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.widgets.Canvas;
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.CellDoubleClickEvent;
import com.smartgwt.client.widgets.grid.events.CellDoubleClickHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.operation.OperationRequestStatus;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
@@ -46,63 +39,57 @@ import org.rhq.enterprise.gui.coregui.client.components.configuration.Configurat
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.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class ConfigurationHistoryView extends VLayout {
+public class ConfigurationHistoryView extends LocatableVLayout {
private Integer resourceId;
-
-
- public ConfigurationHistoryView() {
+ public ConfigurationHistoryView(String locatorId) {
+ super(locatorId);
setWidth100();
setHeight100();
setAnimateMembers(true);
}
-
- public ConfigurationHistoryView(final int resourceId) {
- this();
+ public ConfigurationHistoryView(String locatorId, final int resourceId) {
+ this(locatorId);
this.resourceId = resourceId;
-
}
-
@Override
protected void onDraw() {
super.onDraw();
Criteria criteria = new Criteria();
if (resourceId != null) {
- criteria.addCriteria("resourceId", (int)resourceId);
+ criteria.addCriteria("resourceId", (int) resourceId);
}
-
final ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
-
- Table table = new Table("Configuration History", criteria);
+ Table table = new Table(getLocatorId(), "Configuration History", criteria);
table.setDataSource(datasource);
table.getListGrid().setUseAllDataSourceFields(true);
-
ListGrid grid = table.getListGrid();
grid.getField("id").setWidth(60);
grid.getField("createdTime").setWidth(200);
if (resourceId != null) {
- grid.hideField("resource");
+ grid.hideField("resource");
} else {
grid.getField("resource").setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- Resource res = (Resource) o;
- return "<a href=\"#Resource/" + res.getId() + "\">" + res.getName() + "</a>";
- }
- });
+ public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
+ Resource res = (Resource) o;
+ return "<a href=\"#Resource/" + res.getId() + "\">" + res.getName() + "</a>";
+ }
+ });
}
grid.getField("status").setWidth(100);
@@ -111,16 +98,16 @@ public class ConfigurationHistoryView extends VLayout {
ConfigurationUpdateStatus status = ConfigurationUpdateStatus.valueOf((String) o);
String icon = "";
switch (status) {
- case INPROGRESS:
- break;
- case SUCCESS:
- icon = "_ok";
- break;
- case FAILURE:
- icon = "_failed";
- break;
- case NOCHANGE:
- break;
+ case INPROGRESS:
+ break;
+ case SUCCESS:
+ icon = "_ok";
+ break;
+ case FAILURE:
+ icon = "_failed";
+ break;
+ case NOCHANGE:
+ break;
}
return Canvas.imgHTML("subsystems/configure/Configure" + icon + "_16.png", 16, 16) + o;
@@ -129,28 +116,26 @@ public class ConfigurationHistoryView extends VLayout {
grid.getField("subject").setWidth(150);
-
-
- table.addTableAction("Remove", Table.SelectionEnablement.ANY,
- "Are you sure you want to delete # configurations?",
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- // TODO: Implement this method.
- CoreGUI.getErrorHandler().handleError("Not implemented");
- }
- });
-
- table.addTableAction("Compare", Table.SelectionEnablement.MULTIPLE, null,
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- ArrayList<ResourceConfigurationUpdate> configs = new ArrayList<ResourceConfigurationUpdate>();
- for (ListGridRecord record : selection) {
- ResourceConfigurationUpdate update = (ResourceConfigurationUpdate) record.getAttributeAsObject("entity");
- configs.add(update);
- }
- ConfigurationComparisonView.displayComparisonDialog(configs);
+ table.addTableAction(extendLocatorId("Remove"), "Remove", Table.SelectionEnablement.ANY,
+ "Are you sure you want to delete # configurations?", new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ // TODO: Implement this method.
+ CoreGUI.getErrorHandler().handleError("Not implemented");
+ }
+ });
+
+ table.addTableAction(extendLocatorId("Compare"), "Compare", Table.SelectionEnablement.MULTIPLE, null,
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ ArrayList<ResourceConfigurationUpdate> configs = new ArrayList<ResourceConfigurationUpdate>();
+ for (ListGridRecord record : selection) {
+ ResourceConfigurationUpdate update = (ResourceConfigurationUpdate) record
+ .getAttributeAsObject("entity");
+ configs.add(update);
}
- });
+ ConfigurationComparisonView.displayComparisonDialog(configs);
+ }
+ });
table.getListGrid().addCellDoubleClickHandler(new CellDoubleClickHandler() {
public void onCellDoubleClick(CellDoubleClickEvent cellDoubleClickEvent) {
@@ -159,15 +144,15 @@ public class ConfigurationHistoryView extends VLayout {
}
});
- table.addTableAction("Show Details", Table.SelectionEnablement.SINGLE, null,
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
+ table.addTableAction(extendLocatorId("ShowDetail"), "Show Details", Table.SelectionEnablement.SINGLE, null,
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
- ListGridRecord record = selection[0];
+ ListGridRecord record = selection[0];
- showDetails(record);
- }
- });
+ showDetails(record);
+ }
+ });
addMember(table);
}
@@ -175,35 +160,30 @@ public class ConfigurationHistoryView extends VLayout {
public static void showDetails(ListGridRecord record) {
final ResourceConfigurationUpdate update = (ResourceConfigurationUpdate) record.getAttributeAsObject("entity");
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- update.getResource().getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypeLoadedCallback() {
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(update.getResource().getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
+ public void onTypesLoaded(ResourceType type) {
- ConfigurationDefinition definition = type.getResourceConfigurationDefinition();
+ ConfigurationDefinition definition = type.getResourceConfigurationDefinition();
+ ConfigurationHistoryDetailView detailView = new ConfigurationHistoryDetailView();
- ConfigurationHistoryDetailView detailView = new ConfigurationHistoryDetailView();
+ detailView.setConfiguration(definition, update.getConfiguration());
- detailView.setConfiguration(definition, update.getConfiguration());
+ detailView.displayInDialog();
- detailView.displayInDialog();
-
- }
- });
+ }
+ });
}
-
// -------- Static Utility loaders ------------
+ public static ConfigurationHistoryView getHistoryOf(String locatorId, int resourceId) {
- public static ConfigurationHistoryView getHistoryOf(int resourceId) {
-
-
- return new ConfigurationHistoryView(resourceId);
+ return new ConfigurationHistoryView(locatorId, resourceId);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/event/EventHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/event/EventHistoryView.java
index a876bfe..a1e45ce 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/event/EventHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/event/EventHistoryView.java
@@ -37,13 +37,12 @@ import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
*/
public class EventHistoryView extends Table {
-
- public EventHistoryView(Criteria criteria) {
- super("Event History", criteria);
+ public EventHistoryView(String locatorId, Criteria criteria) {
+ super(locatorId, "Event History", criteria);
setDataSource(new EventDatasource());
-// getListGrid().getField("id").setWidth(60);
+ // getListGrid().getField("id").setWidth(60);
getListGrid().getField("severity").setWidth(120);
getListGrid().getField("severity").setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
@@ -58,12 +57,11 @@ public class EventHistoryView extends Table {
}
});
- addTableAction("Details", SelectionEnablement.SINGLE, null,
- new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- showEventDetails(selection[0]);
- }
- });
+ addTableAction(extendLocatorId("Detail"), "Details", SelectionEnablement.SINGLE, null, new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ showEventDetails(selection[0]);
+ }
+ });
getListGrid().getField("sourceLocation").setWidth(200);
getListGrid().getField("timestamp").setWidth(160);
@@ -73,9 +71,9 @@ public class EventHistoryView extends Table {
new EventDetailsView(record).displayInDialog();
}
- public static EventHistoryView createResourceHistoryView(int resourceId) {
+ public static EventHistoryView createResourceHistoryView(String locatorId, int resourceId) {
Criteria criteria = new Criteria();
- criteria.addCriteria("resourceId",resourceId);
- return new EventHistoryView(criteria);
+ criteria.addCriteria("resourceId", resourceId);
+ return new EventHistoryView(locatorId, criteria);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
index 770c43b..5eeb915 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java
@@ -18,6 +18,17 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.EnumSet;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Label;
+
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.DisplayType;
import org.rhq.core.domain.measurement.MeasurementDefinition;
@@ -30,34 +41,23 @@ import org.rhq.enterprise.gui.coregui.client.components.measurement.MeasurementR
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.layout.VLayout;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.EnumSet;
-import java.util.List;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class GraphListView extends VLayout implements ResourceSelectListener {
+public class GraphListView extends LocatableVLayout implements ResourceSelectListener {
private Resource resource;
private Label loadingLabel = new Label("Loading...");
+ public GraphListView(String locatorId, Resource resource) {
+ super(locatorId);
- public GraphListView(Resource resource) {
this.resource = resource;
setOverflow(Overflow.AUTO);
}
-
@Override
protected void onDraw() {
super.onDraw();
@@ -68,7 +68,7 @@ public class GraphListView extends VLayout implements ResourceSelectListener {
addMember(new AvailabilityBarView(resource));
-// addMember(loadingLabel);
+ // addMember(loadingLabel);
addMember(new MeasurementRangeEditor());
@@ -77,74 +77,65 @@ public class GraphListView extends VLayout implements ResourceSelectListener {
}
}
-
private void buildGraphs() {
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- resource.getResourceType().getId(), EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(final ResourceType type) {
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(final ResourceType type) {
- final ArrayList<MeasurementDefinition> measurementDefinitions = new ArrayList<MeasurementDefinition>();
+ final ArrayList<MeasurementDefinition> measurementDefinitions = new ArrayList<MeasurementDefinition>();
- for (MeasurementDefinition def : type.getMetricDefinitions()) {
- if (def.getDataType() == DataType.MEASUREMENT && def.getDisplayType() == DisplayType.SUMMARY) {
- measurementDefinitions.add(def);
- }
+ for (MeasurementDefinition def : type.getMetricDefinitions()) {
+ if (def.getDataType() == DataType.MEASUREMENT && def.getDisplayType() == DisplayType.SUMMARY) {
+ measurementDefinitions.add(def);
}
+ }
- Collections.sort(measurementDefinitions, new Comparator<MeasurementDefinition>() {
- public int compare(MeasurementDefinition o1, MeasurementDefinition o2) {
- return new Integer(o1.getDisplayOrder()).compareTo(o2.getDisplayOrder());
- }
- });
-
- int[] measDefIdArray = new int[measurementDefinitions.size()];
- for (int i = 0; i < measDefIdArray.length; i++) {
- measDefIdArray[i] = measurementDefinitions.get(i).getId();
+ Collections.sort(measurementDefinitions, new Comparator<MeasurementDefinition>() {
+ public int compare(MeasurementDefinition o1, MeasurementDefinition o2) {
+ return new Integer(o1.getDisplayOrder()).compareTo(o2.getDisplayOrder());
}
+ });
- GWTServiceLookup.getMeasurementDataService().findDataForResource(
- resource.getId(),
- measDefIdArray,
- System.currentTimeMillis() - (1000L * 60 * 60 * 8),
- System.currentTimeMillis(),
- 60,
- new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load data for graphs",caught);
- loadingLabel.setContents("failed to load graphs");
- }
+ int[] measDefIdArray = new int[measurementDefinitions.size()];
+ for (int i = 0; i < measDefIdArray.length; i++) {
+ measDefIdArray[i] = measurementDefinitions.get(i).getId();
+ }
- public void onSuccess(List<List<MeasurementDataNumericHighLowComposite>> result) {
- if (result.isEmpty()) {
- loadingLabel.setContents("No graphs available");
- } else {
- loadingLabel.hide();
- int i = 0;
- for (List<MeasurementDataNumericHighLowComposite> data : result) {
- buildGraph(measurementDefinitions.get(i++), data);
- }
- }
+ GWTServiceLookup.getMeasurementDataService().findDataForResource(resource.getId(), measDefIdArray,
+ System.currentTimeMillis() - (1000L * 60 * 60 * 8), System.currentTimeMillis(), 60,
+ new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load data for graphs", caught);
+ loadingLabel.setContents("failed to load graphs");
+ }
+
+ public void onSuccess(List<List<MeasurementDataNumericHighLowComposite>> result) {
+ if (result.isEmpty()) {
+ loadingLabel.setContents("No graphs available");
+ } else {
+ loadingLabel.hide();
+ int i = 0;
+ for (List<MeasurementDataNumericHighLowComposite> data : result) {
+ buildGraph(measurementDefinitions.get(i++), data);
}
}
- );
+ }
+ });
- }
}
- );
+ });
}
-
private void buildGraph(MeasurementDefinition def, List<MeasurementDataNumericHighLowComposite> data) {
- SmallGraphView graph = new SmallGraphView(resource.getId(), def, data);
+ SmallGraphView graph = new SmallGraphView(extendLocatorId(def.getName()), resource.getId(), def, data);
graph.setWidth("95%");
graph.setHeight(220);
addMember(graph);
}
-
public void onResourceSelected(ResourceComposite resourceComposite) {
this.resource = resourceComposite.getResource();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
index c1dd21b..fc7a16f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
@@ -51,7 +51,6 @@ import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.events.MouseOutEvent;
import com.smartgwt.client.widgets.events.MouseOutHandler;
import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.measurement.MeasurementConverterClient;
@@ -64,15 +63,18 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class SmallGraphView extends VLayout {
+public class SmallGraphView extends LocatableVLayout {
private static final String INSTRUCTIONS = "Point your mouse to a data point on the chart";
- private static final String[] MONTH_NAMES = {"jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"};
+ private static final String[] MONTH_NAMES = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct",
+ "nov", "dec" };
private final Label selectedPointLabel = new Label(INSTRUCTIONS);
private final Label positionLabel = new Label();
@@ -86,26 +88,28 @@ public class SmallGraphView extends VLayout {
private MeasurementDefinition definition;
private List<MeasurementDataNumericHighLowComposite> data;
-
- public SmallGraphView() {
- super();
+ public SmallGraphView(String locatorId) {
+ super(locatorId);
}
+ public SmallGraphView(String locatorId, int resourceId, int definitionId) {
+ this(locatorId);
- public SmallGraphView(int resourceId, int definitionId) {
this.resourceId = resourceId;
this.definitionId = definitionId;
}
- public SmallGraphView(int resourceId, MeasurementDefinition def, List<MeasurementDataNumericHighLowComposite> data) {
- super();
+ public SmallGraphView(String locatorId, int resourceId, MeasurementDefinition def,
+ List<MeasurementDataNumericHighLowComposite> data) {
+ this(locatorId);
+
this.resourceId = resourceId;
this.definition = def;
this.data = data;
-// setHeight(250);
+ // setHeight(250);
setHeight100();
setWidth100();
-// setPadding(10);
+ // setPadding(10);
}
public String getName() {
@@ -138,7 +142,6 @@ public class SmallGraphView extends VLayout {
if (this.definition == null) {
-
ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
ResourceCriteria resourceCriteria = new ResourceCriteria();
@@ -150,48 +153,45 @@ public class SmallGraphView extends VLayout {
public void onSuccess(PageList<Resource> result) {
ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- result.get(0).getResourceType().getId(), EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(final ResourceType type) {
-
- for (MeasurementDefinition def : type.getMetricDefinitions()) {
- if (def.getId() == definitionId) {
- SmallGraphView.this.definition = def;
-
-
- GWTServiceLookup.getMeasurementDataService().findDataForResource(
- resourceId,
- new int[]{definitionId},
- System.currentTimeMillis() - (1000L * 60 * 60 * 8),
- System.currentTimeMillis(),
- 60,
- new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load data for graph", caught);
- }
-
- public void onSuccess(List<List<MeasurementDataNumericHighLowComposite>> result) {
- SmallGraphView.this.data = result.get(0);
-
-
- drawGraph();
- }
- });
- }
+ result.get(0).getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(final ResourceType type) {
+
+ for (MeasurementDefinition def : type.getMetricDefinitions()) {
+ if (def.getId() == definitionId) {
+ SmallGraphView.this.definition = def;
+
+ GWTServiceLookup.getMeasurementDataService().findDataForResource(resourceId,
+ new int[] { definitionId },
+ System.currentTimeMillis() - (1000L * 60 * 60 * 8),
+ System.currentTimeMillis(), 60,
+ new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to load data for graph", caught);
+ }
+
+ public void onSuccess(
+ List<List<MeasurementDataNumericHighLowComposite>> result) {
+ SmallGraphView.this.data = result.get(0);
+
+ drawGraph();
+ }
+ });
}
}
- });
+ }
+ });
}
});
-
} else {
drawGraph();
}
}
-
@Override
protected void onDetach() {
super.onDetach(); // TODO: Implement this method.
@@ -210,7 +210,7 @@ public class SmallGraphView extends VLayout {
private void drawGraph() {
- HLayout titleLayout = new HLayout();
+ HLayout titleLayout = new LocatableHLayout(getLocatorId());
if (definition != null) {
titleLayout.setAutoHeight();
@@ -221,12 +221,12 @@ public class SmallGraphView extends VLayout {
title.setWidth("*");
title.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- displayAsDialog();
+ displayAsDialog(extendLocatorId("Dialog"));
}
});
titleLayout.addMember(title);
- Img liveGraph = new Img("subsystems/monitor/Monitor_16.png",16,16);
+ Img liveGraph = new Img("subsystems/monitor/Monitor_16.png", 16, 16);
liveGraph.setTooltip("Click for a live graph of current values");
liveGraph.addClickHandler(new ClickHandler() {
@@ -239,18 +239,15 @@ public class SmallGraphView extends VLayout {
addMember(titleLayout);
}
-
PlotModel model = new PlotModel();
PlotOptions plotOptions = new PlotOptions();
plotOptions.setDefaultLineSeriesOptions(new LineSeriesOptions().setLineWidth(1).setShow(true));
plotOptions.setDefaultPointsOptions(new PointsSeriesOptions().setRadius(2).setShow(true));
plotOptions.setDefaultShadowSize(0);
-
-
// You need make the grid hoverable <<<<<<<<<
- plotOptions.setGridOptions(new GridOptions().setHoverable(true).setMouseActiveRadius(10).setAutoHighlight(true));
-
+ plotOptions
+ .setGridOptions(new GridOptions().setHoverable(true).setMouseActiveRadius(10).setAutoHighlight(true));
// create a series
if (definition != null && data != null) {
@@ -259,9 +256,9 @@ public class SmallGraphView extends VLayout {
// create the plot
SimplePlot plot = new SimplePlot(model, plotOptions);
- plot.setSize(String.valueOf(getInnerContentWidth()), String.valueOf(getInnerContentHeight() - titleLayout.getHeight() - 50));
-// "80%","80%");
-
+ plot.setSize(String.valueOf(getInnerContentWidth()), String.valueOf(getInnerContentHeight()
+ - titleLayout.getHeight() - 50));
+ // "80%","80%");
// add hover listener
plot.addHoverListener(new PlotHoverListener() {
@@ -280,7 +277,8 @@ public class SmallGraphView extends VLayout {
}
hoverLabel.redraw();
- selectedPointLabel.setContents("x: " + item.getDataPoint().getX() + ", y: " + item.getDataPoint().getY());
+ selectedPointLabel.setContents("x: " + item.getDataPoint().getX() + ", y: "
+ + item.getDataPoint().getY());
} else {
hoverLabel.animateHide(AnimationEffect.FADE);
selectedPointLabel.setContents(INSTRUCTIONS);
@@ -308,18 +306,19 @@ public class SmallGraphView extends VLayout {
// put it on a panel
-
addMember(new WidgetCanvas(plot));
- plot.setSize(String.valueOf(getInnerContentWidth()), String.valueOf(getInnerContentHeight() - titleLayout.getHeight() - 50));
+ plot.setSize(String.valueOf(getInnerContentWidth()), String.valueOf(getInnerContentHeight()
+ - titleLayout.getHeight() - 50));
}
private String getHover(PlotItem item) {
if (definition != null) {
com.google.gwt.i18n.client.DateTimeFormat df = DateTimeFormat.getMediumDateTimeFormat();
- return definition.getDisplayName() + ": " + MeasurementConverterClient.format(item.getDataPoint().getY(), definition.getUnits(), true)
- + "<br/>" + df.format(new Date((long) item.getDataPoint().getX()));
+ return definition.getDisplayName() + ": "
+ + MeasurementConverterClient.format(item.getDataPoint().getY(), definition.getUnits(), true) + "<br/>"
+ + df.format(new Date((long) item.getDataPoint().getX()));
} else {
return "x: " + item.getDataPoint().getX() + ", y: " + item.getDataPoint().getY();
}
@@ -332,32 +331,32 @@ public class SmallGraphView extends VLayout {
handler.add(new DataPoint(d.getTimestamp(), d.getValue()));
}
- plotOptions.setYAxisOptions(new AxisOptions().setTicks(5).setLabelWidth(70).setTickFormatter(new TickFormatter() {
- public String formatTickValue(double v, Axis axis) {
- return MeasurementConverterClient.format(v, definition.getUnits(), true);
- }
- }));
+ plotOptions.setYAxisOptions(new AxisOptions().setTicks(5).setLabelWidth(70).setTickFormatter(
+ new TickFormatter() {
+ public String formatTickValue(double v, Axis axis) {
+ return MeasurementConverterClient.format(v, definition.getUnits(), true);
+ }
+ }));
long max = System.currentTimeMillis();
long min = max - (1000L * 60 * 60 * 8);
-
int xTicks = getWidth() / 140;
- plotOptions.setXAxisOptions(new AxisOptions().setTicks(xTicks).setMinimum(min).setMaximum(max).setTickFormatter(new TickFormatter() {
- public String formatTickValue(double tickValue, Axis axis) {
- com.google.gwt.i18n.client.DateTimeFormat dateFormat = DateTimeFormat.getShortDateTimeFormat();
- return dateFormat.format(new Date((long) tickValue));
-// return String.valueOf(new Date((long) tickValue));
-// return MONTH_NAMES[(int) (tickValue - 1)];
- }
- }));
+ plotOptions.setXAxisOptions(new AxisOptions().setTicks(xTicks).setMinimum(min).setMaximum(max)
+ .setTickFormatter(new TickFormatter() {
+ public String formatTickValue(double tickValue, Axis axis) {
+ com.google.gwt.i18n.client.DateTimeFormat dateFormat = DateTimeFormat.getShortDateTimeFormat();
+ return dateFormat.format(new Date((long) tickValue));
+ // return String.valueOf(new Date((long) tickValue));
+ // return MONTH_NAMES[(int) (tickValue - 1)];
+ }
+ }));
}
-
- private void displayAsDialog() {
- SmallGraphView graph = new SmallGraphView(resourceId, definition, data);
+ private void displayAsDialog(String locatorId) {
+ SmallGraphView graph = new SmallGraphView(locatorId, resourceId, definition, data);
Window graphPopup = new Window();
graphPopup.setTitle("Detailed Graph");
graphPopup.setWidth(800);
@@ -370,7 +369,6 @@ public class SmallGraphView extends VLayout {
graphPopup.show();
}
-
@Override
protected void onDestroy() {
super.onDestroy();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java
index 61fdaa1..779e3f8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/calltime/CallTimeView.java
@@ -27,7 +27,6 @@ import com.smartgwt.client.widgets.Label;
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.Layout;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.measurement.DataType;
@@ -40,16 +39,18 @@ 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.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLayout;
/**
* @author Greg Hinkle
*/
-public class CallTimeView extends Layout {
+public class CallTimeView extends LocatableLayout {
private Resource resource;
private int scheduleId;
- public CallTimeView(Resource resource) {
+ public CallTimeView(String locatorId, Resource resource) {
+ super(locatorId);
this.resource = resource;
}
@@ -57,55 +58,51 @@ public class CallTimeView extends Layout {
protected void onDraw() {
super.onDraw();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- resource.getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
- for (final MeasurementDefinition def : type.getMetricDefinitions()) {
- if (def.getDataType() == DataType.CALLTIME) {
+ for (final MeasurementDefinition def : type.getMetricDefinitions()) {
+ if (def.getDataType() == DataType.CALLTIME) {
- ResourceCriteria criteria = new ResourceCriteria();
- criteria.addFilterId(resource.getId());
- criteria.fetchSchedules(true);
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterId(resource.getId());
+ criteria.fetchSchedules(true);
- GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
- new AsyncCallback<PageList<Resource>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load resource for call time",caught);
- }
+ GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
+ new AsyncCallback<PageList<Resource>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load resource for call time",
+ caught);
+ }
- public void onSuccess(PageList<Resource> result) {
- if (result.size() == 1) {
+ public void onSuccess(PageList<Resource> result) {
+ if (result.size() == 1) {
- Resource res = result.get(0);
- for (MeasurementSchedule s : res.getSchedules()) {
+ Resource res = result.get(0);
+ for (MeasurementSchedule s : res.getSchedules()) {
- if (s.getDefinition().getId() == def.getId()) {
+ if (s.getDefinition().getId() == def.getId()) {
- scheduleId = s.getId();
+ scheduleId = s.getId();
- setup();
- return;
- }
- }
+ setup();
+ return;
}
- setupNone();
}
}
- );
- break;
-
-
- }
-
+ setupNone();
+ }
+ });
+ break;
}
-
}
- });
+
+ }
+ });
}
@@ -115,7 +112,8 @@ public class CallTimeView extends Layout {
public void setup() {
- Table table = new Table("Call Time Data", new Criteria("scheduleId", String.valueOf(scheduleId)));
+ Table table = new Table(getLocatorId(), "Call Time Data",
+ new Criteria("scheduleId", String.valueOf(scheduleId)));
table.getListGrid().setAlternateRecordStyles(false);
table.setDataSource(new CallTimeDataSource());
table.getListGrid().setUseAllDataSourceFields(true);
@@ -128,17 +126,16 @@ public class CallTimeView extends Layout {
ListGridField average = new ListGridField("average", 70);
average.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- return format.format(((Number)o).doubleValue());
+ return format.format(((Number) o).doubleValue());
}
});
ListGridField maximum = new ListGridField("maximum", 70);
- ListGridField total = new ListGridField("total",70);
+ ListGridField total = new ListGridField("total", 70);
- table.getListGrid().setFields(callDestination,count, minimum, average, maximum, total);
+ table.getListGrid().setFields(callDestination, count, minimum, average, maximum, total);
addMember(table);
markForRedraw();
}
-
}
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 ca4f159..782b227 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
@@ -34,8 +34,8 @@ public class SchedulesView extends AbstractMeasurementScheduleListView {
private static final String[] EXCLUDED_FIELD_NAMES = new String[] { MeasurementScheduleCriteria.FILTER_FIELD_RESOURCE_ID };
- public SchedulesView(int resourceId) {
- super(TITLE, new SchedulesDataSource(resourceId), createCriteria(resourceId), EXCLUDED_FIELD_NAMES);
+ public SchedulesView(String locatorId, int resourceId) {
+ super(locatorId, TITLE, new SchedulesDataSource(resourceId), createCriteria(resourceId), EXCLUDED_FIELD_NAMES);
}
private static Criteria createCriteria(int resourceId) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
index b537f5d..d946cdc 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
@@ -27,7 +27,6 @@ import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.RecordDoubleClickEvent;
import com.smartgwt.client.widgets.grid.events.RecordDoubleClickHandler;
-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.MenuItem;
@@ -48,41 +47,42 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.OperationCreateWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.detail.OperationDetailsView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class OperationHistoryView extends VLayout {
+public class OperationHistoryView extends LocatableVLayout {
Table table;
Resource resource;
Criteria criteria;
- @Override
- protected void onInit() {
- super.onInit();
-
-
- }
-
- public OperationHistoryView() {
+ public OperationHistoryView(String locatorId) {
+ super(locatorId);
setWidth100();
setHeight100();
}
- public OperationHistoryView(Resource resource) {
+ public OperationHistoryView(String locatorId, Resource resource) {
+ super(locatorId);
this.resource = resource;
this.criteria = new Criteria("resourceId", String.valueOf(resource.getId()));
}
@Override
+ protected void onInit() {
+ super.onInit();
+ }
+
+ @Override
protected void onDraw() {
super.onDraw();
if (criteria == null) {
- table = new Table("Operation History");
+ table = new Table(getLocatorId(), "Operation History");
} else {
- table = new Table("Operation History", criteria);
+ table = new Table(getLocatorId(), "Operation History", criteria);
}
table.setDataSource(new OperationHistoryDataSource());
@@ -95,26 +95,24 @@ public class OperationHistoryView extends VLayout {
OperationRequestStatus status = OperationRequestStatus.valueOf((String) o);
String icon = "";
switch (status) {
- case INPROGRESS:
- break;
- case SUCCESS:
- icon = "_ok";
- break;
- case FAILURE:
- icon = "_failed";
- break;
- case CANCELED:
- icon = "_cancel";
- break;
+ case INPROGRESS:
+ break;
+ case SUCCESS:
+ icon = "_ok";
+ break;
+ case FAILURE:
+ icon = "_failed";
+ break;
+ case CANCELED:
+ icon = "_cancel";
+ break;
}
-
- return Canvas.imgHTML("subsystems/control/Operation" + icon + "_16.png", 16, 16) + status.getDisplayName();
+ return Canvas.imgHTML("subsystems/control/Operation" + icon + "_16.png", 16, 16)
+ + status.getDisplayName();
}
});
-
-
table.getListGrid().getField("startedTime").setWidth(120);
if (this.resource == null) {
@@ -131,47 +129,46 @@ public class OperationHistoryView extends VLayout {
table.getListGrid().addRecordDoubleClickHandler(new RecordDoubleClickHandler() {
public void onRecordDoubleClick(RecordDoubleClickEvent recordDoubleClickEvent) {
- ResourceOperationHistory history = (ResourceOperationHistory) recordDoubleClickEvent.getRecord().getAttributeAsObject("entity");
+ ResourceOperationHistory history = (ResourceOperationHistory) recordDoubleClickEvent.getRecord()
+ .getAttributeAsObject("entity");
showDetails(history);
}
});
+ table.addTableAction(extendLocatorId("Details"), "Details", Table.SelectionEnablement.SINGLE, null,
+ new TableAction() {
+ public void executeAction(ListGridRecord[] selection) {
+ ResourceOperationHistory history = (ResourceOperationHistory) selection[0]
+ .getAttributeAsObject("entity");
- table.addTableAction("Details", Table.SelectionEnablement.SINGLE, null, new TableAction() {
- public void executeAction(ListGridRecord[] selection) {
- ResourceOperationHistory history = (ResourceOperationHistory) selection[0].getAttributeAsObject("entity");
-
- showDetails(history);
- }
- });
-
+ showDetails(history);
+ }
+ });
if (resource != null) {
final Menu operationMenu = new Menu();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- resource.getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.operations),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- for (final OperationDefinition od : type.getOperationDefinitions()) {
- MenuItem menuItem = new MenuItem(od.getDisplayName());
- operationMenu.addItem(menuItem);
- menuItem.addClickHandler(new ClickHandler() {
- public void onClick(MenuItemClickEvent event) {
- new OperationCreateWizard(resource, od).startOperationWizard();
- }
- });
- }
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ for (final OperationDefinition od : type.getOperationDefinitions()) {
+ MenuItem menuItem = new MenuItem(od.getDisplayName());
+ operationMenu.addItem(menuItem);
+ menuItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ new OperationCreateWizard(resource, od).startOperationWizard();
+ }
+ });
}
- });
+ }
+ });
IMenuButton operationsButton = new IMenuButton("Run Operation", operationMenu);
operationsButton.setShowMenuBelow(false);
table.addExtraWidget(operationsButton);
}
-
addMember(table);
}
@@ -184,23 +181,21 @@ public class OperationHistoryView extends VLayout {
criteria.fetchParameters(true);
criteria.fetchResults(true);
- GWTServiceLookup.getOperationService().findResourceOperationHistoriesByCriteria(
- criteria, new AsyncCallback<PageList<ResourceOperationHistory>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failure loading operation history", caught);
- }
+ GWTServiceLookup.getOperationService().findResourceOperationHistoriesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceOperationHistory>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failure loading operation history", caught);
+ }
- public void onSuccess(PageList<ResourceOperationHistory> result) {
- ResourceOperationHistory item = result.get(0);
- OperationDetailsView.displayDetailsDialog(item);
- }
+ public void onSuccess(PageList<ResourceOperationHistory> result) {
+ ResourceOperationHistory item = result.get(0);
+ OperationDetailsView.displayDetailsDialog(item);
}
- );
+ });
}
+ public static OperationHistoryView getResourceHistoryView(String locatorId, Resource resource) {
- public static OperationHistoryView getResourceHistoryView(Resource resource) {
-
- return new OperationHistoryView(resource);
+ return new OperationHistoryView(locatorId, resource);
}
}
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 7713a23..674f366 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
@@ -44,6 +44,7 @@ import com.smartgwt.client.widgets.form.fields.TimeItem;
import com.smartgwt.client.widgets.form.validator.CustomValidator;
import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
/**
* @author Greg Hinkle
@@ -59,7 +60,7 @@ public class OperationSchedulingStep extends AbstractWizardStep implements ItemC
if (form == null) {
valuesManager = new ValuesManager();
- form = getDynamicForm();
+ form = new LocatableDynamicForm("OperationScheduling");
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/discovery/ResourceAutodiscoveryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
index cd52111..fdbedfa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
@@ -35,7 +35,6 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
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.toolbar.ToolStrip;
import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeGridField;
@@ -45,11 +44,12 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class ResourceAutodiscoveryView extends VLayout {
+public class ResourceAutodiscoveryView extends LocatableVLayout {
private boolean simple = false;
private TreeGrid treeGrid;
@@ -57,14 +57,14 @@ public class ResourceAutodiscoveryView extends VLayout {
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
-
- public ResourceAutodiscoveryView() {
+ public ResourceAutodiscoveryView(String locatorId) {
+ super(locatorId);
setWidth100();
setHeight100();
}
- public ResourceAutodiscoveryView(boolean simple) {
- this();
+ public ResourceAutodiscoveryView(String locatorId, boolean simple) {
+ this(locatorId);
this.simple = simple;
}
@@ -84,7 +84,6 @@ public class ResourceAutodiscoveryView extends VLayout {
title.setStyleName("HeaderLabel");
titleLayout.addMember(title);
-
DynamicForm form = new DynamicForm();
final SelectItem statusSelectItem = new SelectItem("statuses", "Displayed Statuses");
statusSelectItem.setValueMap("New", "Ignored", "New and Ignored");
@@ -92,7 +91,6 @@ public class ResourceAutodiscoveryView extends VLayout {
form.setItems(statusSelectItem);
titleLayout.addMember(form);
-
statusSelectItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent changedEvent) {
treeGrid.fetchData(new Criteria("statuses", (String) statusSelectItem.getValue()));
@@ -130,7 +128,6 @@ public class ResourceAutodiscoveryView extends VLayout {
treeGrid.setShowPartialSelection(true);
treeGrid.setCascadeSelection(true);
-
addMember(treeGrid);
footer = new ToolStrip();
@@ -140,17 +137,14 @@ public class ResourceAutodiscoveryView extends VLayout {
addMember(footer);
-
final IButton importButton = new IButton("Import");
final IButton ignoreButton = new IButton("Ignore");
final IButton unignoreButton = new IButton("Unignore");
-
footer.addMember(importButton);
footer.addMember(ignoreButton);
footer.addMember(unignoreButton);
-
importButton.setDisabled(true);
ignoreButton.setDisabled(true);
unignoreButton.setDisabled(true);
@@ -164,58 +158,53 @@ public class ResourceAutodiscoveryView extends VLayout {
}
});
+ importButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ resourceService.importResources(getSelectedIds(), new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to import resources", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Successfully imported the selected resources", Message.Severity.Info));
+ treeGrid.invalidateCache();
+ }
+ });
+ }
+ });
- importButton.addClickHandler(
- new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- resourceService.importResources(getSelectedIds(), new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to import resources", caught);
- }
+ ignoreButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ resourceService.ignoreResources(getSelectedIds(), new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to ignore resources", caught);
+ }
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Successfully imported the selected resources", Message.Severity.Info));
- treeGrid.invalidateCache();
- }
- });
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Successfully ignored the selected resources", Message.Severity.Info));
+ treeGrid.invalidateCache();
}
- }
- );
-
-
- ignoreButton.addClickHandler(
- new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- resourceService.ignoreResources(getSelectedIds(), new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to ignore resources", caught);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Successfully ignored the selected resources", Message.Severity.Info));
- treeGrid.invalidateCache();
- }
- });
+ });
+ }
+ });
+
+ unignoreButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ resourceService.unignoreResources(getSelectedIds(), new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to unignore resources", caught);
}
- }
- );
-
- unignoreButton.addClickHandler(
- new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- resourceService.unignoreResources(getSelectedIds(), new AsyncCallback<Void>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to unignore resources", caught);
- }
-
- public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Successfully unignored the selected resources", Message.Severity.Info));
- treeGrid.invalidateCache();
- }
- });
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Successfully unignored the selected resources", Message.Severity.Info));
+ treeGrid.invalidateCache();
}
- }
- );
+ });
+ }
+ });
}
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 1be6813..0db5af8 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
@@ -29,6 +29,7 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
import org.rhq.enterprise.gui.coregui.client.components.wizard.AbstractWizardStep;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
/**
* @author Greg Hinkle
@@ -46,7 +47,7 @@ public class ConfigurationTemplateStep extends AbstractWizardStep {
public Canvas getCanvas() {
if (form == null) {
- form = getDynamicForm();
+ form = new LocatableDynamicForm("ResFactConfigTemplate");
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/ResourceSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
index 2115988..7e96af8 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
@@ -64,7 +64,7 @@ public class ResourceSelector extends AbstractSelector<Resource> {
protected DynamicForm getAvailableFilterForm() {
if (null == availableFilterForm) {
- availableFilterForm = new LocatableDynamicForm("AvailableFilterForm");
+ availableFilterForm = new LocatableDynamicForm("ResSelectAvailFilterForm");
availableFilterForm.setNumCols(6);
final TextItem search = new TextItem("search", "Search");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
index c3bcddd..2891956 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
@@ -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.report;
import java.util.LinkedHashMap;
@@ -31,7 +31,6 @@ import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.SectionStack;
import com.smartgwt.client.widgets.layout.SectionStackSection;
import com.smartgwt.client.widgets.tree.Tree;
@@ -53,25 +52,28 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation
import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.ResourceAutodiscoveryView;
import org.rhq.enterprise.gui.coregui.client.report.measurement.MeasurementOOBView;
import org.rhq.enterprise.gui.coregui.client.report.tag.TaggedView;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
/**
* @author Greg Hinkle
*/
-public class ReportTopView extends HLayout implements BookmarkableView {
+public class ReportTopView extends LocatableHLayout implements BookmarkableView {
public static final String VIEW_PATH = "Reports";
-
private ViewId currentSectionViewId;
private ViewId currentPageViewId;
-
private SectionStack sectionStack;
private Canvas contentCanvas;
private Canvas currentContent;
private LinkedHashMap<String, TreeGrid> treeGrids = new LinkedHashMap<String, TreeGrid>();
+ public ReportTopView(String locatorId) {
+ super(locatorId);
+ }
+
@Override
protected void onInit() {
super.onInit();
@@ -89,13 +91,11 @@ public class ReportTopView extends HLayout implements BookmarkableView {
sectionStack.setWidth(250);
sectionStack.setHeight100();
-
treeGrids.put("Inventory", buildInventorySection());
-// treeGrids.put("Configuration", buildSystemConfigurationSection());
-// treeGrids.put("Cluster", buildManagementClusterSection());
+ // treeGrids.put("Configuration", buildSystemConfigurationSection());
+ // treeGrids.put("Cluster", buildManagementClusterSection());
treeGrids.put("Reports", buildReportsSection());
-
for (final String name : treeGrids.keySet()) {
TreeGrid grid = treeGrids.get(name);
@@ -107,7 +107,6 @@ public class ReportTopView extends HLayout implements BookmarkableView {
}
});
-
SectionStackSection section = new SectionStackSection(name);
section.setExpanded(true);
section.addItem(grid);
@@ -115,22 +114,18 @@ public class ReportTopView extends HLayout implements BookmarkableView {
sectionStack.addSection(section);
}
-
addMember(sectionStack);
addMember(contentCanvas);
}
-
private HTMLFlow defaultView() {
- String contents = "<h1>Reports</h1>\n" +
- "This section provides access to global reports.";
+ String contents = "<h1>Reports</h1>\n" + "This section provides access to global reports.";
HTMLFlow flow = new HTMLFlow(contents);
flow.setPadding(20);
return flow;
}
-
private TreeGrid buildInventorySection() {
final TreeGrid inventoryTreeGrid = new TreeGrid();
@@ -159,22 +154,14 @@ public class ReportTopView extends HLayout implements BookmarkableView {
final TreeNode platforms = new TreeNode("Platforms");
platforms.setIcon("types/Platform_up_16.png");
-
- tree.setRoot(new TreeNode("inventory",
- tagCloud,
- suspectMetrics,
- recentConfigurationChanges,
- recentOperations,
- recentAlerts,
- alertDefinitions,
- platforms));
+ tree.setRoot(new TreeNode("inventory", tagCloud, suspectMetrics, recentConfigurationChanges, recentOperations,
+ recentAlerts, alertDefinitions, platforms));
inventoryTreeGrid.setData(tree);
return inventoryTreeGrid;
}
-
private TreeGrid buildManagementClusterSection() {
final TreeGrid mgmtClusterTreeGrid = new TreeGrid();
@@ -187,18 +174,14 @@ public class ReportTopView extends HLayout implements BookmarkableView {
final TreeNode manageAffinityGroupsNode = new TreeNode("Affinity Groups");
final TreeNode managePartitionEventsNode = new TreeNode("Partition Events");
- tree.setRoot(new TreeNode("clustering",
- manageServersNode,
- manageAgentsNode,
- manageAffinityGroupsNode,
- managePartitionEventsNode));
+ tree.setRoot(new TreeNode("clustering", manageServersNode, manageAgentsNode, manageAffinityGroupsNode,
+ managePartitionEventsNode));
mgmtClusterTreeGrid.setData(tree);
return mgmtClusterTreeGrid;
}
-
private TreeGrid buildSystemConfigurationSection() {
final TreeGrid systemConfigTreeGrid = new TreeGrid();
@@ -212,15 +195,14 @@ public class ReportTopView extends HLayout implements BookmarkableView {
final TreeNode manageLicense = new TreeNode("License");
final TreeNode managePlugins = new TreeNode("Plugins");
- tree.setRoot(new TreeNode("System Configuration",
- manageSettings, manageTemplates, manageDownloads, manageLicense, managePlugins));
+ tree.setRoot(new TreeNode("System Configuration", manageSettings, manageTemplates, manageDownloads,
+ manageLicense, managePlugins));
systemConfigTreeGrid.setData(tree);
return systemConfigTreeGrid;
}
-
private TreeGrid buildReportsSection() {
final TreeGrid reportsTreeGrid = new TreeGrid();
@@ -238,7 +220,6 @@ public class ReportTopView extends HLayout implements BookmarkableView {
return reportsTreeGrid;
}
-
public void setContent(Canvas newContent) {
if (contentCanvas.getChildren().length > 0) {
@@ -252,7 +233,6 @@ public class ReportTopView extends HLayout implements BookmarkableView {
this.currentContent = newContent;
}
-
private void renderContentView(ViewPath viewPath) {
currentSectionViewId = viewPath.getCurrent();
@@ -263,35 +243,33 @@ public class ReportTopView extends HLayout implements BookmarkableView {
page = URL.decode(page);
-
Canvas content = null;
if ("Inventory".equals(section)) {
if ("Tag Cloud".equals(page)) {
- content = new TaggedView();
+ content = new TaggedView(extendLocatorId("TagCloud"));
} else if ("Suspect Metrics".equals(page)) {
- content = new MeasurementOOBView();
+ content = new MeasurementOOBView(extendLocatorId("SuspectMetrics"));
} else if ("Recent Configuration Changes".equals(page)) {
- content = new ConfigurationHistoryView();
+ content = new ConfigurationHistoryView(extendLocatorId("RecentConfigChanges"));
} else if ("Recent Operations".equals(page)) {
- content = new OperationHistoryView();
+ content = new OperationHistoryView(extendLocatorId("RecentOps"));
} else if ("Recent Alerts".equals(page)) {
- content = new AlertsView();
+ content = new AlertsView(extendLocatorId("RecentAlerts"));
} else if ("Alert Definitions".equals(page)) {
//todo
} else if ("Platforms".equals(page)) {
- content = new PlatformPortletView();
+ content = new PlatformPortletView(extendLocatorId("Platforms"));
}
-
} else if ("Security".equals(section)) {
if ("Manage Users".equals(page)) {
- content = new UsersView();
+ content = new UsersView(extendLocatorId("Users"));
} else if ("Manage Roles".equals(page)) {
- content = new RolesView();
+ content = new RolesView(extendLocatorId("Roles"));
} else if ("Auto Discovery Queue".equals(page)) {
- content = new ResourceAutodiscoveryView();
+ content = new ResourceAutodiscoveryView(extendLocatorId("ADQ"));
} else if ("Remote Agent Install".equals(page)) {
content = new RemoteAgentInstallView();
}
@@ -312,7 +290,6 @@ public class ReportTopView extends HLayout implements BookmarkableView {
url = addQueryStringParam(url, "nomenu=true");
content = new FullHTMLPane(url);
-
} else if ("Cluster".equals(section)) {
String url = null;
if ("Servers".equals(page)) {
@@ -328,7 +305,6 @@ public class ReportTopView extends HLayout implements BookmarkableView {
content = new FullHTMLPane(url);
}
-
for (String name : treeGrids.keySet()) {
TreeGrid treeGrid = treeGrids.get(name);
@@ -342,19 +318,14 @@ public class ReportTopView extends HLayout implements BookmarkableView {
}
}
-
-
setContent(content);
-
if (content instanceof BookmarkableView) {
((BookmarkableView) content).renderView(viewPath.next().next());
}
-
}
-
public void renderView(ViewPath viewPath) {
if (!viewPath.isCurrent(currentSectionViewId) || !viewPath.isNext(currentPageViewId)) {
@@ -373,7 +344,6 @@ public class ReportTopView extends HLayout implements BookmarkableView {
}
-
}
private static String addQueryStringParam(String url, String param) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java
index 0b16677..2c614a0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java
@@ -25,7 +25,6 @@ package org.rhq.enterprise.gui.coregui.client.report.measurement;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
/**
@@ -33,29 +32,23 @@ import org.rhq.enterprise.gui.coregui.client.components.table.Table;
*/
public class MeasurementOOBView extends Table {
-
- public MeasurementOOBView() {
- super("Suspect Metrics");
-
+ public MeasurementOOBView(String locatorId) {
+ super(locatorId, "Suspect Metrics");
setDataSource(new MeasurementOOBDataSource());
getListGrid().setAlternateRecordStyles(false);
-
-
}
@Override
protected void onInit() {
super.onInit();
-
getListGrid().getField("resourceName").setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
return "<a href=\"#Resource/" + listGridRecord.getAttribute("resourceId") + "\">" + o + "</a>";
}
});
-
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TagCloudView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TagCloudView.java
index 0a78e50..654f4c4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TagCloudView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TagCloudView.java
@@ -27,7 +27,6 @@ import java.util.Comparator;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.criteria.TagCriteria;
import org.rhq.core.domain.tagging.compsite.TagReportComposite;
@@ -35,11 +34,12 @@ import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class TagCloudView extends VLayout {
+public class TagCloudView extends LocatableVLayout {
private PageList<TagReportComposite> tags;
@@ -47,10 +47,12 @@ public class TagCloudView extends VLayout {
private boolean simple = false;
- public TagCloudView() {
+ public TagCloudView(String locatorId) {
+ super(locatorId);
}
- public TagCloudView(boolean simple) {
+ public TagCloudView(String locatorId, boolean simple) {
+ this(locatorId);
this.simple = simple;
}
@@ -61,18 +63,17 @@ public class TagCloudView extends VLayout {
removeMembers(getMembers());
GWTServiceLookup.getTagService().findTagReportCompositesByCriteria(new TagCriteria(),
- new AsyncCallback<PageList<TagReportComposite>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load tags", caught);
- }
-
- public void onSuccess(PageList<TagReportComposite> result) {
- drawTags(result);
- }
- });
+ new AsyncCallback<PageList<TagReportComposite>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load tags", caught);
+ }
+
+ public void onSuccess(PageList<TagReportComposite> result) {
+ drawTags(result);
+ }
+ });
}
-
private void drawTags(PageList<TagReportComposite> tags) {
if (tags == null) {
@@ -109,12 +110,11 @@ public class TagCloudView extends VLayout {
int font = (int) ((((double) tag.getTotal()) / (double) max) * (maxFont - minFont)) + minFont;
- buf.append("<a href=\"#Reports/Inventory/Tag Cloud/" + tag.getTag().toString() + "\" style=\"font-size: " + font + "pt; margin: 8px;\"");
-
+ buf.append("<a href=\"#Reports/Inventory/Tag Cloud/" + tag.getTag().toString() + "\" style=\"font-size: "
+ + font + "pt; margin: 8px;\"");
buf.append(" title=\"Tag used " + tag.getTotal() + " times\"");
-
if (tag.getTag().toString().equals(selectedTag)) {
buf.append(" class=\"selectedTag\"");
}
@@ -127,7 +127,6 @@ public class TagCloudView extends VLayout {
addMember(flow);
}
-
public void setSelectedTag(String selectedTag) {
this.selectedTag = selectedTag;
removeMembers(getMembers());
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
index 3c4e3a6..c3ac4d6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
@@ -26,9 +26,6 @@ import java.util.ArrayList;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.SortSpecifier;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.tile.TileLayout;
import org.rhq.core.domain.tagging.Tag;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
@@ -39,22 +36,24 @@ import org.rhq.enterprise.gui.coregui.client.bundle.list.BundlesListView;
import org.rhq.enterprise.gui.coregui.client.bundle.version.BundleVersionListView;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTileLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* @author Greg Hinkle
*/
-public class TaggedView extends VLayout implements BookmarkableView {
+public class TaggedView extends LocatableVLayout implements BookmarkableView {
private TagCloudView tagCloudView;
private Criteria criteria;
-
private ArrayList<Table> tiles = new ArrayList<Table>();
- private TileLayout tileLayout;
+ private LocatableTileLayout tileLayout;
- public TaggedView() {
+ public TaggedView(String locatorId) {
+ super(locatorId);
setWidth100();
setHeight100();
}
@@ -63,7 +62,7 @@ public class TaggedView extends VLayout implements BookmarkableView {
protected void onInit() {
super.onInit();
- tagCloudView = new TagCloudView();
+ tagCloudView = new TagCloudView(getLocatorId());
tagCloudView.setAutoHeight();
addMember(tagCloudView);
}
@@ -84,29 +83,29 @@ public class TaggedView extends VLayout implements BookmarkableView {
criteria.addCriteria("tagSemantic", tag.getSemantic());
criteria.addCriteria("tagName", tag.getName());
-
if (tileLayout == null) {
- tileLayout = new TileLayout();
+ tileLayout = new LocatableTileLayout(getLocatorId());
tileLayout.setWidth100();
tileLayout.setTileHeight(220);
tileLayout.setTileWidth(getWidth() / 2 - 20);
addMember(tileLayout);
-
- ResourceSearchView resourceView = new ResourceSearchView(criteria, "Tagged Resources", new SortSpecifier[]{}, new String[]{"pluginName", "category", "currentAvailability"});
+ ResourceSearchView resourceView = new ResourceSearchView(getLocatorId(), criteria, "Tagged Resources",
+ new SortSpecifier[] {}, new String[] { "pluginName", "category", "currentAvailability" });
tiles.add(resourceView);
- BundlesListView bundlesView = new BundlesListView(criteria);
+ BundlesListView bundlesView = new BundlesListView(getLocatorId(), criteria);
tiles.add(bundlesView);
- BundleVersionListView bundleVersionListView = new BundleVersionListView(criteria);
+ BundleVersionListView bundleVersionListView = new BundleVersionListView(getLocatorId(), criteria);
tiles.add(bundleVersionListView);
- BundleDeploymentListView bundleDeploymentListView = new BundleDeploymentListView(criteria);
+ BundleDeploymentListView bundleDeploymentListView = new BundleDeploymentListView(getLocatorId(), criteria);
tiles.add(bundleDeploymentListView);
- BundleDestinationListView bundleDestinationListView = new BundleDestinationListView(criteria);
+ BundleDestinationListView bundleDestinationListView = new BundleDestinationListView(getLocatorId(),
+ criteria);
tiles.add(bundleDestinationListView);
for (Table t : tiles) {
@@ -120,7 +119,6 @@ public class TaggedView extends VLayout implements BookmarkableView {
}
}
-
public void renderView(ViewPath viewPath) {
if (!viewPath.isEnd()) {
String tagString = viewPath.getCurrent().getPath();
commit a834fcf4866ad7692eaf2f22541da39ac62a4604
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Aug 23 13:54:57 2010 -0400
Selenium Integration - More Locatable Wrapper work
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/Locatable.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/Locatable.java
new file mode 100644
index 0000000..bbb6888
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/Locatable.java
@@ -0,0 +1,26 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+public interface Locatable {
+
+ /**
+ * Returns the locatorId. This can be useful for constructing more granular locatorIds. For example, if
+ * the widget contains sub-widgets. Note, this is the raw locatorId for the widget, to get the fully
+ * formed ID, typically ofthe form "scClassname-locatorId" Call {@link getID()}.
+ *
+ * @return the locatorId
+ */
+ public String getLocatorId();
+
+ /**
+ * Extends this widget's original locatorId with an extension. This can be useful for constructing more
+ * granular locatorIds. For example, if the widget contains sub-widgets.
+ * <pre>
+ * ID Format: "getLocatorId()-extension"
+ * </pre>
+ *
+ * @param extension not null or empty.
+ *
+ * @return the new, extended locatorId
+ */
+ public String extendLocatorId(String extension);
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableButton.java
new file mode 100644
index 0000000..42fcba2
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableButton.java
@@ -0,0 +1,24 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.Button;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.Button that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableButton extends Button {
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ */
+ public LocatableButton(String locatorId, String title) {
+ super(title);
+ String unsafeId = this.getScClassName() + "-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableDialog.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableDialog.java
new file mode 100644
index 0000000..b5b841a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableDialog.java
@@ -0,0 +1,34 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.Dialog;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.Dialog that sets the ID for use with selenium scLocators.
+ *
+ * @author jay shaughnessy
+ */
+public class LocatableDialog extends Dialog implements Locatable {
+
+ private String locatorId;
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null.
+ */
+ public LocatableDialog(String locatorId) {
+ super();
+ this.locatorId = locatorId;
+ String unsafeId = this.getScClassName() + "-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
+ }
+
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ public String extendLocatorId(String extension) {
+ return this.locatorId + "-" + extension;
+ }
+}
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
index 6daedc2..c1c15af 100644
--- 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
@@ -7,18 +7,29 @@ import com.smartgwt.client.widgets.form.DynamicForm;
*
* @author Jay Shaughnessy
*/
-public class LocatableDynamicForm extends DynamicForm {
+public class LocatableDynamicForm extends DynamicForm implements Locatable {
+
+ private String locatorId;
/**
* <pre>
- * ID Format: "scClassname-id"
+ * ID Format: "scClassname-locatorId"
* </pre>
- * @param id not null or empty.
+ * @param locatorId not null or empty.
*/
- public LocatableDynamicForm(String id) {
+ public LocatableDynamicForm(String locatorId) {
super();
- String locatorId = this.getScClassName() + "-" + id;
- setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+ this.locatorId = locatorId;
+ String unsafeId = this.getScClassName() + "-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
+ }
+
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ public String extendLocatorId(String extension) {
+ return this.locatorId + "-" + extension;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.java
new file mode 100644
index 0000000..36a40c4
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.java
@@ -0,0 +1,35 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.layout.HLayout;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.layout.HLayout that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableHLayout extends HLayout implements Locatable {
+
+ private String locatorId;
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ */
+ public LocatableHLayout(String locatorId) {
+ super();
+ this.locatorId = locatorId;
+ String unsafeId = this.getScClassName() + "-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
+ }
+
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ public String extendLocatorId(String extension) {
+ return this.locatorId + "-" + extension;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHTMLPane.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHTMLPane.java
new file mode 100644
index 0000000..c86b4ec
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHTMLPane.java
@@ -0,0 +1,35 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.HTMLPane;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.HTMLPane that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableHTMLPane extends HTMLPane implements Locatable {
+
+ private String locatorId;
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ */
+ public LocatableHTMLPane(String locatorId) {
+ super();
+ this.locatorId = locatorId;
+ String unsafeId = this.getScClassName() + "-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
+ }
+
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ public String extendLocatorId(String extension) {
+ return this.locatorId + "-" + extension;
+ }
+
+}
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
index 74d01ae..021c98f 100644
--- 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
@@ -11,14 +11,14 @@ public class LocatableIButton extends IButton {
/**
* <pre>
- * ID Format: "scClassname-title"
+ * ID Format: "scClassname-locatorId"
* </pre>
- * @param id not null or empty.
+ * @param locatorId not null or empty.
*/
- public LocatableIButton(String title) {
+ public LocatableIButton(String locatorId, String title) {
super(title);
- String locatorId = this.getScClassName() + "-" + title;
- setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+ String unsafeId = this.getScClassName() + "-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableImg.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableImg.java
new file mode 100644
index 0000000..1d1ae6e
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableImg.java
@@ -0,0 +1,25 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.Img;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.Img that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableImg extends Img {
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null.
+ * @param img not null or empty.
+ */
+ public LocatableImg(String locatorId, String src, int width, int height) {
+ super(src, width, height);
+ String unsafeId = this.getScClassName() + "-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableLayout.java
new file mode 100644
index 0000000..5d1be5b
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableLayout.java
@@ -0,0 +1,35 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.layout.Layout;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.layout.HLayout that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableLayout extends Layout implements Locatable {
+
+ private String locatorId;
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ */
+ public LocatableLayout(String locatorId) {
+ super();
+ this.locatorId = locatorId;
+ String unsafeId = this.getScClassName() + "-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
+ }
+
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ public String extendLocatorId(String extension) {
+ return this.locatorId + "-" + extension;
+ }
+
+}
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
index 739aee5..6eba310 100644
--- 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
@@ -7,17 +7,28 @@ import com.smartgwt.client.widgets.grid.ListGrid;
*
* @author Jay Shaughnessy
*/
-public class LocatableListGrid extends ListGrid {
+public class LocatableListGrid extends ListGrid implements Locatable {
+
+ private String locatorId;
/**
* <pre>
* ID Format: "scClassname-id"
* </pre>
- * @param id not null or empty.
+ * @param locatorId not null or empty.
*/
- public LocatableListGrid(String id) {
+ public LocatableListGrid(String locatorId) {
super();
- String locatorId = this.getScClassName() + "-" + id;
- setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+ this.locatorId = locatorId;
+ String unsafeId = this.getScClassName() + "-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
+ }
+
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ public String extendLocatorId(String extension) {
+ return this.locatorId + "-" + extension;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableStretchImgButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableStretchImgButton.java
new file mode 100644
index 0000000..818f339
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableStretchImgButton.java
@@ -0,0 +1,25 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.StretchImgButton;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.StretchImgButton that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableStretchImgButton extends StretchImgButton {
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null.
+ * @param img not null or empty.
+ */
+ public LocatableStretchImgButton(String locatorId) {
+ super();
+ String unsafeId = this.getScClassName() + "-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTab.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTab.java
new file mode 100644
index 0000000..768ba40
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTab.java
@@ -0,0 +1,68 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.tab.Tab;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.tab.Tab that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableTab extends Tab implements Locatable {
+
+ private String locatorId;
+
+ /**
+ * <pre>
+ * ID Format: "Tab-locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ */
+ public LocatableTab(String locatorId, String title) {
+ super(title);
+ init(locatorId);
+ }
+
+ /**
+ * <pre>
+ * ID Format: "Tab-locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ */
+ public LocatableTab(String locatorId, String title, String icon) {
+ super(title, icon);
+ init(locatorId);
+ }
+
+ private void init(String locatorId) {
+ this.locatorId = locatorId;
+ String unsafeId = "Tab-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
+ }
+
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ public String extendLocatorId(String extension) {
+ return this.locatorId + "-" + extension;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTabSet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTabSet.java
new file mode 100644
index 0000000..3dd875a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTabSet.java
@@ -0,0 +1,71 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.tab.TabSet;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.tab.Tab that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableTabSet extends TabSet {
+
+ private String locatorId;
+
+ /**
+ * <pre>
+ * ID Format: "scClassName-locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ */
+ public LocatableTabSet(String locatorId) {
+ super();
+ this.locatorId = locatorId;
+ String unsafeId = this.getScClassName() + "-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
+ }
+
+ /**
+ * Returns the locatorId. This can be useful for constructing more granular locatorIds. For example, if
+ * the widget contains sub-widgets. Note, this is the raw locatorId for the widget, to get the fully
+ * formed ID, typically ofthe form "scClassname-locatorId" Call {@link getID()}.
+ *
+ * @return the locatorId
+ */
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ /**
+ * Extends this widget's original locatorId with an extension. This can be useful for constructing more
+ * granular locatorIds. For example, if the widget contains sub-widgets.
+ * <pre>
+ * ID Format: "getLocatorId()-extension"
+ * </pre>
+ *
+ * @param extension not null or empty.
+ *
+ * @return the new, extended locatorId
+ */
+ public String extendLocatorId(String extension) {
+ return this.locatorId + "-" + extension;
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTileLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTileLayout.java
new file mode 100644
index 0000000..1cb7dce
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTileLayout.java
@@ -0,0 +1,35 @@
+package org.rhq.enterprise.gui.coregui.client.util.selenium;
+
+import com.smartgwt.client.widgets.tile.TileLayout;
+
+/**
+ * Wrapper for com.smartgwt.client.widgets.layout.HLayout that sets the ID for use with selenium scLocators.
+ *
+ * @author Jay Shaughnessy
+ */
+public class LocatableTileLayout extends TileLayout implements Locatable {
+
+ private String locatorId;
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ */
+ public LocatableTileLayout(String locatorId) {
+ super();
+ this.locatorId = locatorId;
+ String unsafeId = this.getScClassName() + "-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
+ }
+
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ public String extendLocatorId(String extension) {
+ return this.locatorId + "-" + extension;
+ }
+
+}
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
index e254411..8058c93 100644
--- 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
@@ -11,14 +11,27 @@ public class LocatableTransferImgButton extends TransferImgButton {
/**
* <pre>
- * ID Format: "scClassname-img.toString()"
+ * ID Format: "scClassname-imgName"
* </pre>
- * @param id not null or empty.
+ * @param img not null.
*/
public LocatableTransferImgButton(TransferImg img) {
super(img);
- String locatorId = this.getScClassName() + "-" + getSuffix(img);
- setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+ String safeId = this.getScClassName() + "-" + getSuffix(img);
+ setID(safeId);
+ }
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null.
+ * @param img not null or empty.
+ */
+ public LocatableTransferImgButton(String locatorId, TransferImg img) {
+ super(img);
+ String unsafeId = this.getScClassName() + "-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
}
private String getSuffix(TransferImg img) {
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
index 317d795..a93e6bd 100644
--- 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
@@ -7,16 +7,28 @@ import com.smartgwt.client.widgets.tree.TreeGrid;
*
* @author jay shaughnessy
*/
-public class LocatableTreeGrid extends TreeGrid {
+public class LocatableTreeGrid extends TreeGrid implements Locatable {
+
+ private String locatorId;
/**
- * ID set explicitly
- * @param id not null or empty
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null.
*/
- public LocatableTreeGrid(String id) {
+ public LocatableTreeGrid(String locatorId) {
super();
- String locatorId = this.getScClassName() + "-" + id;
- setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+ this.locatorId = locatorId;
+ String unsafeId = this.getScClassName() + "-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
+ }
+
+ public String getLocatorId() {
+ return locatorId;
}
+ public String extendLocatorId(String extension) {
+ return this.locatorId + "-" + extension;
+ }
}
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
index aa2c7dd..8e8fb22 100644
--- 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
@@ -7,18 +7,49 @@ import com.smartgwt.client.widgets.layout.VLayout;
*
* @author Jay Shaughnessy
*/
-public class LocatableVLayout extends VLayout {
+public class LocatableVLayout extends VLayout implements Locatable {
+
+ private String locatorId;
+
+ /** Not Recommended */
+ public LocatableVLayout() {
+ this("DEFAULT_ID");
+ }
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-locatorId"
+ * </pre>
+ * @param locatorId not null or empty.
+ */
+ public LocatableVLayout(String locatorId) {
+ super();
+ init(locatorId);
+ }
/**
* <pre>
- * ID Format: "scClassname-id"
+ * ID Format: "scClassname-locatorId"
* </pre>
- * @param id not null or empty.
+ * @param locatorId not null or empty.
*/
- public LocatableVLayout(String id) {
+ public LocatableVLayout(String locatorId, int membersMargin) {
super();
- String locatorId = this.getScClassName() + "-" + id;
- setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+ init(locatorId);
+ }
+
+ private void init(String locatorId) {
+ this.locatorId = locatorId;
+ String unsafeId = this.getScClassName() + "-" + locatorId;
+ setID(SeleniumUtility.getSafeId(unsafeId));
+ }
+
+ public String getLocatorId() {
+ return locatorId;
+ }
+
+ public String extendLocatorId(String extension) {
+ return this.locatorId + "-" + extension;
}
}
13 years, 8 months
[rhq] modules/enterprise
by John Sanda
modules/enterprise/remoting/client-deps/pom.xml | 11 +----------
modules/enterprise/remoting/pom.xml | 1 +
2 files changed, 2 insertions(+), 10 deletions(-)
New commits:
commit f129f335aa655af8d6b2226fd8319cdaf664adbc
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Aug 25 08:37:28 2010 -0400
Changing packaging type back to pom and adding client-deps to paernt build
diff --git a/modules/enterprise/remoting/client-deps/pom.xml b/modules/enterprise/remoting/client-deps/pom.xml
index fcdd0d6..3dd52ab 100644
--- a/modules/enterprise/remoting/client-deps/pom.xml
+++ b/modules/enterprise/remoting/client-deps/pom.xml
@@ -7,16 +7,7 @@
<version>4.0.0-SNAPSHOT</version>
</parent>
<artifactId>remote-client-deps</artifactId>
- <!--
- The intent is to make the packaging type pom since this is
- just for grouping dependencies. A non-java based build tool
- that I am using to build a client uses the maven dependency
- handling APIs but currently lacks support for specifying the
- package type.
-
- - jsanda
- -->
- <!--<packaging>pom</packaging>-->
+ <packaging>pom</packaging>
<name>RHQ Remote Client Dependencies</name>
<dependencies>
diff --git a/modules/enterprise/remoting/pom.xml b/modules/enterprise/remoting/pom.xml
index 3879afd..d615902 100644
--- a/modules/enterprise/remoting/pom.xml
+++ b/modules/enterprise/remoting/pom.xml
@@ -16,6 +16,7 @@
<modules>
<module>client-api</module>
+ <module>client-deps</module>
</modules>
<profiles>
13 years, 8 months
[rhq] modules/enterprise
by John Sanda
modules/enterprise/remoting/client-deps/pom.xml | 72 ++++++++++++++++++++++++
1 file changed, 72 insertions(+)
New commits:
commit ab75f7d4e7e6d38eeefbb0e2e2e366832249f4a4
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Aug 24 22:30:27 2010 -0400
Initial commit for client-deps module
This module encapsulates the dependencies needed to build a remote client.
Assuming that you are using maven or maven dependency handling you only need to
declare a dependecy on this module and all of the required dependencies will get
pulled down as well.
diff --git a/modules/enterprise/remoting/client-deps/pom.xml b/modules/enterprise/remoting/client-deps/pom.xml
new file mode 100644
index 0000000..fcdd0d6
--- /dev/null
+++ b/modules/enterprise/remoting/client-deps/pom.xml
@@ -0,0 +1,72 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>remote-client-deps</artifactId>
+ <!--
+ The intent is to make the packaging type pom since this is
+ just for grouping dependencies. A non-java based build tool
+ that I am using to build a client uses the maven dependency
+ handling APIs but currently lacks support for specifying the
+ package type.
+
+ - jsanda
+ -->
+ <!--<packaging>pom</packaging>-->
+ <name>RHQ Remote Client Dependencies</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>${groupId}</groupId>
+ <artifactId>rhq-remoting-client-api</artifactId>
+ <version>${version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>hibernate-annotations</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.jcraft</groupId>
+ <artifactId>jsch</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>oswego-concurrent</groupId>
+ <artifactId>concurrent</artifactId>
+ <version>1.3.4-jboss-update1</version>
+ </dependency>
+ <dependency>
+ <groupId>i18nlog</groupId>
+ <artifactId>i18nlog</artifactId>
+ <version>1.0.10</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.0.jboss</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
+ </dependencies>
+
+</project>
13 years, 8 months
[rhq] modules/core
by Joseph Marques
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementData.java | 2 ++
1 file changed, 2 insertions(+)
New commits:
commit e2eb4ea3b28a3982285df4252a49d0d8ab0dc92d
Author: Joseph Marques <joseph(a)redhat.com>
Date: Tue Aug 24 19:37:06 2010 -0400
add serial version UID to MeasurementData
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementData.java b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementData.java
index 7c96309..2c99f85 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementData.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementData.java
@@ -45,6 +45,8 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public abstract class MeasurementData implements Serializable {
+ private static final long serialVersionUID = 1L;
+
@EmbeddedId
MeasurementDataPK id;
13 years, 8 months
[rhq] 5 commits - modules/enterprise
by Greg Hinkle
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 14 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java | 40 +++++++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java | 6 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java | 6 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableTransferImgButton.java | 2
7 files changed, 62 insertions(+), 10 deletions(-)
New commits:
commit 619f762d39898ef3f8e8f3e16f1fd79000a64206
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Aug 24 15:44:02 2010 -0400
Pass detail viewpath events down to the edit users details view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index 5779155..053c330 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -55,6 +55,7 @@ public class AdministrationView extends HLayout implements BookmarkableView {
private SectionStack sectionStack;
private Canvas contentCanvas;
+ private Canvas currentContent;
private LinkedHashMap<String, TreeGrid> treeGrids = new LinkedHashMap<String, TreeGrid>();
@Override
@@ -201,6 +202,7 @@ public class AdministrationView extends HLayout implements BookmarkableView {
contentCanvas.addChild(newContent);
contentCanvas.markForRedraw();
+ currentContent = newContent;
}
private void renderContentView(ViewPath viewPath) {
@@ -272,9 +274,6 @@ public class AdministrationView extends HLayout implements BookmarkableView {
setContent(content);
- if (content instanceof BookmarkableView) {
- ((BookmarkableView) content).renderView(viewPath.next().next());
- }
}
@@ -290,6 +289,15 @@ public class AdministrationView extends HLayout implements BookmarkableView {
}
}
+ // When looking at a detail view, always fire the event down
+ if (!viewPath.isEnd()) {
+
+ if (currentContent instanceof BookmarkableView) {
+ ((BookmarkableView) currentContent).renderView(viewPath.next().next());
+ }
+
+ }
+
}
private static String addQueryStringParam(String url, String param) {
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 6042b4f..f5af5a9 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
@@ -43,7 +43,12 @@ import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
+import org.rhq.core.domain.criteria.SubjectCriteria;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
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;
@@ -51,7 +56,7 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/**
* @author Greg Hinkle
*/
-public class UserEditView extends VLayout {
+public class UserEditView extends VLayout implements BookmarkableView {
private Label message = new Label("Select a user to edit...");
@@ -249,4 +254,37 @@ public class UserEditView extends VLayout {
}
+ private void editSubject(int subjectId, final ViewId current) {
+
+ SubjectCriteria criteria = new SubjectCriteria();
+ criteria.fetchRoles(true);
+ criteria.fetchConfiguration(true);
+
+ GWTServiceLookup.getSubjectService().findSubjectsByCriteria(criteria,
+ new AsyncCallback<PageList<Subject>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load subject for editing",caught);
+ }
+
+ @Override
+ public void onSuccess(PageList<Subject> result) {
+ Subject subject = result.get(0);
+ Record record = new UsersDataSource().copyValues(subject);
+ editRecord(record);
+
+ current.getBreadcrumbs().get(0).setDisplayName("Editing: " + subject.getName());
+ CoreGUI.refreshBreadCrumbTrail();
+ }
+ });
+ }
+
+ @Override
+ public void renderView(ViewPath viewPath) {
+ int userId = viewPath.getCurrentAsInt();
+
+
+
+ editSubject(userId, viewPath.getCurrent());
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index b194c1e..441fcd5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@ -23,11 +23,12 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
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.table.TableSection;
/**
* @author Greg Hinkle
*/
-public class UsersView extends Table {
+public class UsersView extends TableSection {
public UsersView() {
super("Users View");
commit 2dd748dd227a1d95ee097d43cc6986e3fe9e3d0a
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Aug 24 15:43:32 2010 -0400
Missed commenting id set in this one
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
index e254411..5578676 100644
--- 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
@@ -18,7 +18,7 @@ public class LocatableTransferImgButton extends TransferImgButton {
public LocatableTransferImgButton(TransferImg img) {
super(img);
String locatorId = this.getScClassName() + "-" + getSuffix(img);
- setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+// setID(SeleniumUtility.getSafeId(locatorId, locatorId));
}
private String getSuffix(TransferImg img) {
commit d26766966fbe0ab22af2bb8ad6b48f99547490cc
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Aug 24 14:57:14 2010 -0400
Forgot to fire breadcrumb redraw for detail view
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java
index 3a7715f..7206815 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java
@@ -83,6 +83,7 @@ public class OperationDetailsView extends VLayout implements BookmarkableView {
if (this.viewId != null) {
viewId.getBreadcrumbs().get(0).setDisplayName(operationHistory.getOperationDefinition().getDisplayName());
+ CoreGUI.refreshBreadCrumbTrail();
}
this.definition = operationHistory.getOperationDefinition();
commit e82481ac4520999dc005cc075d9204334e96538b
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Aug 24 14:56:57 2010 -0400
Refactored for new list grid system
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java
index 47bfa5f..c831c34 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java
@@ -24,6 +24,7 @@ import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.types.SortDirection;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
+
import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
@@ -49,9 +50,10 @@ public abstract class AbstractMeasurementDataTraitListView extends Table {
return (AbstractMeasurementDataTraitDataSource) super.getDataSource();
}
+
@Override
- protected void onInit() {
- super.onInit();
+ protected void configureTable() {
+ super.configureTable();
ListGrid listGrid = getListGrid();
listGrid.setSelectionType(SelectionStyle.SINGLE);
commit 276a5081829334fe01885cab112676cd14d9678f
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Aug 24 14:56:22 2010 -0400
Workaround exception thrown when trying to determine if component has been drawn (in debug mode)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index 9ecdc6c..a607496 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -76,7 +76,7 @@ public class SubTabLayout extends VLayout {
for (final String title : subtabs.keySet()) {
if (currentlySelected == null) {
- currentlyDisplayed = subtabs.get(title);
+// currentlyDisplayed = subtabs.get(title);
currentlySelected = title;
}
@@ -157,8 +157,10 @@ public class SubTabLayout extends VLayout {
}
private void draw(Canvas canvas) {
- if (currentlyDisplayed != null && currentlyDisplayed != canvas && currentlyDisplayed.isDrawn()) {
+ if (currentlyDisplayed != null && currentlyDisplayed != canvas) {
+ try {
currentlyDisplayed.hide();
+ } catch (Exception e) { } // ignore this
}
if (canvas != null) {
13 years, 8 months
[rhq] modules/enterprise
by Greg Hinkle
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
New commits:
commit 72d0a25331f8e51e7c5c5d83d9003a81cdf351c5
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Aug 24 14:25:53 2010 -0400
Fix hiding the old view when switching subtabs
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index d9429f4..9ecdc6c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -157,10 +157,9 @@ public class SubTabLayout extends VLayout {
}
private void draw(Canvas canvas) {
-// if (currentlyDisplayed != null && currentlyDisplayed != canvas && currentlyDisplayed.isDrawn()) {
-// currentlyDisplayed.hide();
-// // removeMember(currentlyDisplayed);
-// }
+ if (currentlyDisplayed != null && currentlyDisplayed != canvas && currentlyDisplayed.isDrawn()) {
+ currentlyDisplayed.hide();
+ }
if (canvas != null) {
if (hasMember(canvas)) {
13 years, 8 months
[rhq] 9 commits - modules/core modules/enterprise
by Greg Hinkle
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ClusterKeyFlyweight.java | 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java | 28 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java | 77 +---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java | 80 +---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java | 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java | 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java | 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java | 45 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 176 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java | 161 +++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java | 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupListView.java | 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java | 33 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java | 28 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 149 ++++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java | 54 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java | 82 ----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java | 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java | 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java | 106 ++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java | 86 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.java | 24 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableListGrid.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableVLayout.java | 2
31 files changed, 790 insertions(+), 496 deletions(-)
New commits:
commit 6221a8a57b21707f7cc06150c80c008655e0e512
Merge: 0e229ad... fdb272c...
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Aug 24 14:11:12 2010 -0400
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 0e229adec5b3c03daff47b162021303c8caafda6
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Aug 24 13:28:37 2010 -0400
Refactoring of core Table component to not build list grid on construction
Move to explicit table configuration lifecycle
Fix the rest of the list grids that were not extending Table
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
index 7c0f175..f2d47bd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
@@ -18,91 +18,51 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.roles;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
-
-import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
/**
* @author Greg Hinkle
*/
-public class RolesView extends VLayout implements BookmarkableView {
+public class RolesView extends TableSection implements BookmarkableView {
-
- @Override
- protected void onInit() {
- super.onInit();
-
- setWidth100();
- setHeight100();
-
+ public RolesView() {
+ super("Roles");
final RolesDataSource datasource = RolesDataSource.getInstance();
+ setDataSource(datasource);
+ }
-
- final Table table = new Table("Roles");
- table.setHeight("50%");
- table.setShowResizeBar(true);
- table.setResizeBarTarget("next");
- table.setDataSource(datasource);
-
- ListGridField idField = new ListGridField("id", "Id", 55);
- idField.setType(ListGridFieldType.INTEGER);
-
-
- ListGridField nameField = new ListGridField("name", "Name");
-
- table.getListGrid().setFields(idField, nameField);
-
+ @Override
+ protected void configureTable() {
+ super.configureTable();
- table.addTableAction("Remove",
+ addTableAction("Remove",
Table.SelectionEnablement.ANY,
"Are you sure you want to delete # roles?",
new TableAction() {
public void executeAction(ListGridRecord[] selection) {
- table.getListGrid().removeSelectedData();
+ getListGrid().removeSelectedData();
}
});
- table.addTableAction("Add Role",
+ addTableAction("Add Role",
new TableAction() {
public void executeAction(ListGridRecord[] selection) {
createRole();
}
});
-
- addMember(table);
-
-
- final RoleEditView roleEditor = new RoleEditView();
- roleEditor.setOverflow(Overflow.AUTO);
- addMember(roleEditor);
-
-
- table.getListGrid().addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (selectionEvent.getState()) {
- roleEditor.editRecord(selectionEvent.getRecord());
- } else {
- roleEditor.editNone();
- }
- }
- });
}
-
public void createRole() {
RoleEditView editView = new RoleEditView();
@@ -110,6 +70,13 @@ public class RolesView extends VLayout implements BookmarkableView {
editView.editNew();
}
+ @Override
+ public Canvas getDetailsView(int id) {
+ RoleEditView editor = new RoleEditView();
+
+ return editor;
+ }
+
public void renderView(ViewPath viewPath) {
System.out.println("Display role list");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index bc070bf..b194c1e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@ -18,99 +18,59 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.users;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
-import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.SectionStackSection;
-import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.toolbar.ToolStrip;
-
/**
* @author Greg Hinkle
*/
-public class UsersView extends VLayout {
+public class UsersView extends Table {
public UsersView() {
- super();
- setWidth100();
- setHeight100();
- }
-
- @Override
- protected void onInit() {
- super.onInit();
-
+ super("Users View");
final UsersDataSource datasource = UsersDataSource.getInstance();
- final Table table = new Table("Users");
- table.setHeight("50%");
- table.setShowResizeBar(true);
- table.setDataSource(datasource);
-
-
- ListGridField idField = new ListGridField("id", "Id", 55);
- idField.setType(ListGridFieldType.INTEGER);
-
- ListGridField nameField = new ListGridField("name", "User Name", 100);
+ setDataSource(datasource);
+ }
- ListGridField emailField = new ListGridField("emailAddress", "Email Address");
+ @Override
+ protected void configureTable() {
- table.getListGrid().setFields(idField, nameField, emailField);
- ToolStrip toolStrip = new ToolStrip();
- toolStrip.setWidth100();
- toolStrip.setMembersMargin(15);
+ getListGrid().getField("id").setWidth(55);
+ getListGrid().getField("name").setWidth(100);
- table.addTableAction("Remove",
+ addTableAction("Remove",
Table.SelectionEnablement.ANY,
"Are you sure you want to delete # users?",
new TableAction() {
public void executeAction(ListGridRecord[] selection) {
- table.getListGrid().removeSelectedData();
+ getListGrid().removeSelectedData();
}
});
- table.addTableAction("Add User",
+ addTableAction("Add User",
new TableAction() {
public void executeAction(ListGridRecord[] selection) {
createUser();
}
});
+ }
- final UserEditView userEditor = new UserEditView();
-
- final SectionStackSection detailsSection = new SectionStackSection("Details");
- detailsSection.setItems(new Label("Select a user to edit..."));
- detailsSection.setExpanded(false);
-
- table.getListGrid().addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (selectionEvent.getState()) {
- userEditor.editRecord(selectionEvent.getRecord());
- } else {
- userEditor.editNone();
- }
- }
- });
-
-
- addMember(table);
- addMember(userEditor);
+ public void createUser() {
+ UserEditView.editNew();
}
- public void createUser() {
+ public Canvas getDetailsView(int id) {
+ final UserEditView userEditor = new UserEditView();
- UserEditView.editNew();
+ return userEditor;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
index 83d3481..cd9c95c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@ -90,8 +90,7 @@ public class AlertsView extends Table {
@Override
- protected void onInit() {
- super.onInit();
+ protected void configureTable() {
// Add the list table as the top half of the view.
//Criteria criteria = new Criteria(AlertCriteria.);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
index 8cd574c..0d2e070 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
@@ -25,15 +25,11 @@ package org.rhq.enterprise.gui.coregui.client.bundle.deployment;
import java.util.HashMap;
import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.widgets.Canvas;
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.bundle.Bundle;
import org.rhq.core.domain.bundle.BundleDeploymentStatus;
-import org.rhq.core.domain.bundle.BundleVersion;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
/**
@@ -43,15 +39,14 @@ public class BundleDeploymentListView extends Table {
public BundleDeploymentListView(Criteria criteria) {
super("Bundle Deployments", criteria);
+ setDataSource(new BundleDeploymentDataSource());
+ setHeaderIcon("subsystems/bundle/BundleDeployment_24.png");
}
- @Override
- protected void onInit() {
- super.onInit();
- setHeaderIcon("subsystems/bundle/BundleDeployment_24.png");
- setDataSource(new BundleDeploymentDataSource());
+ @Override
+ protected void configureTable() {
getListGrid().getField("id").setWidth("60");
getListGrid().getField("name").setWidth("25%");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
index 0cd85a4..9883a72 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
@@ -47,14 +47,13 @@ public class BundleDestinationListView extends Table {
public BundleDestinationListView(Criteria criteria) {
super("Bundle Destinations", criteria);
setHeaderIcon("subsystems/bundle/BundleDestination_24.png");
+ setDataSource(new BundleDestinationDataSource());
}
- @Override
- protected void onInit() {
- super.onInit();
+ @Override
+ protected void configureTable() {
- setDataSource(new BundleDestinationDataSource());
getListGrid().getField("id").setWidth(45);
getListGrid().getField("name").setWidth("20%");
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 8b2726c..b102441 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
@@ -44,23 +44,21 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
public class BundlesListView extends Table {
public BundlesListView() {
- super("Bundles");
- setWidth100();
- setHeight100();
+ this(null);
}
public BundlesListView(Criteria criteria) {
super("Bundles", criteria);
- }
-
- @Override
- protected void onInit() {
- super.onInit();
setHeaderIcon("subsystems/bundle/Bundle_24.png");
setDataSource(new BundlesWithLatestVersionDataSource());
+ }
+
+ @Override
+ protected void configureTable() {
+
getListGrid().getField("id").setWidth("60");
getListGrid().getField("link").setWidth("25%");
getListGrid().getField("link").setType(ListGridFieldType.LINK);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java
index 4c83319..04aa55d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java
@@ -37,22 +37,17 @@ import org.rhq.enterprise.gui.coregui.client.components.table.Table;
public class BundleVersionListView extends Table {
- public BundleVersionListView() {
- }
-
public BundleVersionListView(Criteria criteria) {
super("Bundle Versions", criteria);
setHeaderIcon("subsystems/bundle/BundleVersion_24.png");
+ BundleVersionDataSource bundleVersionsDataSource = new BundleVersionDataSource();
+ setDataSource(bundleVersionsDataSource);
}
- @Override
- protected void onInit() {
- super.onInit();
- setHeight100();
+ @Override
+ protected void configureTable() {
- BundleVersionDataSource bundleVersionsDataSource = new BundleVersionDataSource();
- setDataSource(bundleVersionsDataSource);
getListGrid().getField("id").setWidth("60");
getListGrid().getField("name").setWidth("25%");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index 63319d4..d9429f4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -162,7 +162,6 @@ public class SubTabLayout extends VLayout {
// // removeMember(currentlyDisplayed);
// }
-
if (canvas != null) {
if (hasMember(canvas)) {
canvas.show();
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 48d218d..22e25f4 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
@@ -156,7 +156,6 @@ public class Table extends LocatableHLayout {
super.onInit();
// Grid
listGrid = new LocatableListGrid(tableTitle);
-
listGrid.setAutoFetchData(autoFetchData);
@@ -180,7 +179,7 @@ public class Table extends LocatableHLayout {
if (dataSource != null) {
listGrid.setDataSource(dataSource);
- }
+ }
contents = new VLayout();
contents.setWidth100();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
index 91fb92b..c1d484b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
@@ -49,9 +49,6 @@ public abstract class TableSection extends Table implements BookmarkableView {
private String basePath;
- protected TableSection() {
- }
-
protected TableSection(String tableTitle) {
super(tableTitle);
}
@@ -76,10 +73,25 @@ public abstract class TableSection extends Table implements BookmarkableView {
super(tableTitle, criteria, sortSpecifiers, excludedFieldNames, autoFetchData);
}
+
@Override
protected void onInit() {
super.onInit();
+ detailsHolder = new VLayout();
+ detailsHolder.setWidth100();
+ detailsHolder.setHeight100();
+ detailsHolder.hide();
+
+ addMember(detailsHolder);
+
+ }
+
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
getListGrid().addCellDoubleClickHandler(new CellDoubleClickHandler() {
@Override
public void onCellDoubleClick(CellDoubleClickEvent event) {
@@ -90,12 +102,6 @@ public abstract class TableSection extends Table implements BookmarkableView {
}
});
- detailsHolder = new VLayout();
- detailsHolder.setWidth100();
- detailsHolder.setHeight100();
- detailsHolder.hide();
-
- addMember(detailsHolder);
}
@@ -119,7 +125,7 @@ public abstract class TableSection extends Table implements BookmarkableView {
if (detailsView instanceof BookmarkableView) {
- ((BookmarkableView)detailsView).renderView(viewPath);
+ ((BookmarkableView) detailsView).renderView(viewPath);
}
@@ -129,25 +135,27 @@ public abstract class TableSection extends Table implements BookmarkableView {
detailsView.setWidth100();
detailsView.setHeight100();
- detailsHolder.addMember(new BackButton("Back to List",basePath));
+ detailsHolder.addMember(new BackButton("Back to List", basePath));
detailsHolder.addMember(detailsView);
detailsHolder.animateShow(AnimationEffect.FADE);
}
});
} else {
- contents.animateShow(AnimationEffect.FADE, new AnimationCallback() {
- @Override
- public void execute(boolean b) {
- if (detailsHolder.isVisible()) {
- detailsHolder.animateHide(AnimationEffect.FADE);
-
- for (Canvas child : detailsHolder.getMembers()) {
- detailsHolder.removeMember(child);
+ if (contents != null) {
+ contents.animateShow(AnimationEffect.FADE, new AnimationCallback() {
+ @Override
+ public void execute(boolean b) {
+ if (detailsHolder != null && detailsHolder.isVisible()) {
+ detailsHolder.animateHide(AnimationEffect.FADE);
+
+ for (Canvas child : detailsHolder.getMembers()) {
+ detailsHolder.removeMember(child);
+ }
}
}
- }
- });
+ });
+ }
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
index f92e7a2..2eb5b64 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/FavoriteResourcesPortlet.java
@@ -60,6 +60,13 @@ public class FavoriteResourcesPortlet extends ResourceSearchView implements Port
setShowFooter(false);
+
+ }
+
+ @Override
+ protected void configureTable() {
+ super.configureTable();
+
Set<Integer> favoriteIds = CoreGUI.getUserPreferences().getFavoriteResources();
Integer[] favArray = favoriteIds.toArray(new Integer[favoriteIds.size()]);
@@ -74,6 +81,7 @@ public class FavoriteResourcesPortlet extends ResourceSearchView implements Port
refresh(criteria);
+
getListGrid().addFieldStateChangedHandler(new FieldStateChangedHandler() {
public void onFieldStateChanged(FieldStateChangedEvent fieldStateChangedEvent) {
String state = getListGrid().getViewState();
@@ -82,6 +90,7 @@ public class FavoriteResourcesPortlet extends ResourceSearchView implements Port
portletWindow.save();
}
});
+
}
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
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 bcb0f00..7c737b6 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
@@ -52,9 +52,7 @@ public abstract class AbstractMeasurementScheduleListView extends Table {
return (AbstractMeasurementScheduleDataSource) super.getDataSource();
}
- @Override
- protected void onInit() {
- super.onInit();
+ protected void configureTable() {
ListGrid listGrid = getListGrid();
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 fe986b9..45d6b07 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
@@ -49,24 +49,21 @@ public class ResourceGroupListView extends Table {
public ResourceGroupListView(String title) {
super(title);
- setWidth100();
- setHeight100();
}
public ResourceGroupListView(Criteria criteria, String title) {
super(title, criteria);
- setWidth100();
- setHeight100();
+
+ final ResourceGroupsDataSource datasource = ResourceGroupsDataSource.getInstance();
+ setDataSource(datasource);
+
}
@Override
- protected void onInit() {
- super.onInit();
+ protected void configureTable() {
// setHeaderIcon("?_24.png");
- final ResourceGroupsDataSource datasource = ResourceGroupsDataSource.getInstance();
- setDataSource(datasource);
getListGrid().setSelectionType(SelectionStyle.SIMPLE);
//table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
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 8656997..5fb98f3 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
@@ -24,27 +24,29 @@ 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.enterprise.gui.coregui.client.components.table.Table;
/**
* @author Greg Hinkle
*/
-public class GroupDefinitionListView extends VLayout {
+public class GroupDefinitionListView extends Table {
public GroupDefinitionListView() {
-
- setWidth100();
- setHeight100();
+ super("Group Definitions");
final GroupDefinitionDataSource datasource = new GroupDefinitionDataSource();
+ setDataSource(datasource);
+
+
+ }
- Table table = new Table("Group Definitions");
- table.setDataSource(datasource);
+ @Override
+ protected void configureTable() {
+ super.configureTable();
- table.getListGrid().setSelectionType(SelectionStyle.SIMPLE);
- table.getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
+ getListGrid().setSelectionType(SelectionStyle.SIMPLE);
+ getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
ListGridField idField = new ListGridField("id", "Id", 55);
idField.setType(ListGridFieldType.INTEGER);
@@ -55,18 +57,5 @@ public class GroupDefinitionListView extends VLayout {
}
});
- //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);
-
}
-
}
\ No newline at end of file
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 728a50c..35b8d27 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
@@ -86,9 +86,6 @@ public class ResourceSearchView extends Table {
setHeaderIcon("types/Platform_up_24.png");
- setWidth100();
- setHeight100();
-
// DynamicForm searchPanel = new DynamicForm();
// final TextItem searchBox = new TextItem("query", "Search Resources");
// searchBox.setValue("");
@@ -99,8 +96,14 @@ public class ResourceSearchView extends Table {
// setTitleComponent(searchPanel);
setDataSource(datasource);
+
+ }
+
+
+ @Override
+ protected void configureTable() {
+
getListGrid().setSelectionType(SelectionStyle.SIMPLE);
- // getListGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
getListGrid().setResizeFieldsInRealTime(true);
ListGridField idField = new ListGridField("id", "Id", 55);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java
index 0b16677..59cc36f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/measurement/MeasurementOOBView.java
@@ -25,7 +25,6 @@ package org.rhq.enterprise.gui.coregui.client.report.measurement;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
/**
@@ -40,14 +39,14 @@ public class MeasurementOOBView extends Table {
setDataSource(new MeasurementOOBDataSource());
- getListGrid().setAlternateRecordStyles(false);
}
@Override
- protected void onInit() {
- super.onInit();
+ protected void configureTable() {
+
+ getListGrid().setAlternateRecordStyles(false);
getListGrid().getField("resourceName").setCellFormatter(new CellFormatter() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.java
index 0be952a..b1f216f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.java
@@ -18,7 +18,7 @@ public class LocatableHLayout extends VLayout {
public LocatableHLayout(String id) {
super();
String locatorId = this.getScClassName() + "-" + id;
- setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+// 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
index 74d01ae..4b65fa7 100644
--- 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
@@ -18,7 +18,7 @@ public class LocatableIButton extends IButton {
public LocatableIButton(String title) {
super(title);
String locatorId = this.getScClassName() + "-" + title;
- setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+// 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
index 739aee5..f6ab437 100644
--- 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
@@ -4,20 +4,21 @@ 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));
+// 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
index aa2c7dd..99df69a 100644
--- 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
@@ -18,7 +18,7 @@ public class LocatableVLayout extends VLayout {
public LocatableVLayout(String id) {
super();
String locatorId = this.getScClassName() + "-" + id;
- setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+// setID(SeleniumUtility.getSafeId(locatorId, locatorId));
}
}
commit f91ca0eb479e4e763c4504d63abd2caf47878793
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Aug 23 14:08:07 2010 -0400
fixing merge to new detail rendering strategy
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 b4f140b..15ee729 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
@@ -18,26 +18,14 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
-import java.util.EnumSet;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.HLayout;
-import org.rhq.core.domain.criteria.ResourceCriteria;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.composite.ResourceComposite;
-import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/**
* @author Greg Hinkle
@@ -46,14 +34,12 @@ public class ResourceTopView extends HLayout implements BookmarkableView {
private Canvas contentCanvas;
- private ResourceComposite currentResource;
- //private Resource resourcePlatform;
-
private ResourceTreeView treeView;
private ResourceDetailView detailView = new ResourceDetailView();
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
+
public ResourceTopView() {
}
@@ -71,72 +57,11 @@ public class ResourceTopView extends HLayout implements BookmarkableView {
contentCanvas = new Canvas();
addMember(contentCanvas);
- // created above
- // 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.goTo(InventoryView.VIEW_PATH);
- }
-
- public void onSuccess(PageList<ResourceComposite> result) {
- if (result.isEmpty()) {
- //noinspection ThrowableInstanceNeverThrown
- onFailure(new Exception("Resource with id [" + resourceId + "] does not exist."));
- } else {
- final ResourceComposite resourceComposite = result.get(0);
- loadResourceType(resourceComposite, view);
- }
- }
- });
- }
-
- private void loadResourceType(final ResourceComposite resourceComposite, final ViewPath view) {
- final Resource resource = resourceComposite.getResource();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- resource.getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.content, ResourceTypeRepository.MetadataType.operations,
- ResourceTypeRepository.MetadataType.events,
- ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- resource.setResourceType(type);
- completeSetSelectedResource(resourceComposite, view);
- }
- });
- }
- 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)
@@ -145,6 +70,7 @@ public class ResourceTopView extends HLayout implements BookmarkableView {
contentCanvas.markForRedraw();
}
+
public void renderView(ViewPath viewPath) {
if (viewPath.isEnd()) {
// default detail view
@@ -152,12 +78,8 @@ public class ResourceTopView extends HLayout implements BookmarkableView {
viewPath.getViewPath().add(new ViewId("Overview"));
}
- Integer resourceId = Integer.parseInt(viewPath.getCurrent().getPath());
- setSelectedResource(resourceId, viewPath);
-
this.treeView.renderView(viewPath);
- viewPath.next();
this.detailView.renderView(viewPath);
}
commit 9f87e338c14f8cd9a63acb537654e58deff4bde0
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Aug 23 13:40:27 2010 -0400
Fix graph popup label leaks on navigation
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
index c1dd21b..76e8e21 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
@@ -274,9 +274,9 @@ public class SmallGraphView extends VLayout {
hoverLabel.animateShow(AnimationEffect.FADE);
if (hoverLabel.getLeft() > 0 || hoverLabel.getTop() > 0) {
- hoverLabel.animateMove(item.getPageX() + 5, item.getPageY() + 5);
+ hoverLabel.animateMove(item.getPageX() + 10, item.getPageY() - 35);
} else {
- hoverLabel.moveTo(item.getPageX() + 5, item.getPageY() + 5);
+ hoverLabel.moveTo(item.getPageX() + 10, item.getPageY() - 35);
}
hoverLabel.redraw();
@@ -315,6 +315,18 @@ public class SmallGraphView extends VLayout {
}
+ @Override
+ public void destroy() {
+ super.destroy();
+ hoverLabel.destroy();
+ }
+
+ @Override
+ public void hide() {
+ super.hide();
+ hoverLabel.hide();
+ }
+
private String getHover(PlotItem item) {
if (definition != null) {
com.google.gwt.i18n.client.DateTimeFormat df = DateTimeFormat.getMediumDateTimeFormat();
commit 6f70a8fe1b1a4b47da1280df2f3d59b41d7056ca
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Tue Aug 24 13:48:49 2010 -0400
Fix some changes lost in rebase
Refactoring of core Table component to not build list grid on construction
Move to explicit table configuration lifecycle
Fix the rest of the list grids that were not extending Table
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
index e0b7991..445b0b7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
@@ -54,6 +54,10 @@ public class ViewPath {
return viewPath.get(index);
}
+ public int getCurrentAsInt() {
+ return Integer.parseInt(getCurrent().getPath());
+ }
+
public ViewId getCurrent() {
if (index >= viewPath.size()) {
return null;
@@ -62,6 +66,17 @@ public class ViewPath {
}
}
+ public String getPathToCurrent() {
+ String path = "";
+ for (int i = 0; i < index; i++) {
+ if (i > 0) {
+ path += "/";
+ }
+ path += viewPath.get(i).getPath();
+ }
+ return path;
+ }
+
public ViewId getNext() {
return viewPath.get(index + 1);
}
@@ -94,4 +109,17 @@ public class ViewPath {
public void setRefresh(boolean refresh) {
this.refresh = refresh;
}
+
+ @Override
+ public String toString() {
+ String path = "";
+ for (ViewId view : viewPath) {
+ if (path.length() > 0) {
+ path += "/";
+ }
+ path += view.getPath();
+ }
+ return path;
+ }
}
+
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index afec88d..63319d4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -21,7 +21,6 @@ package org.rhq.enterprise.gui.coregui.client.components.tab;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
-import java.util.Map;
import java.util.Set;
import com.google.gwt.event.shared.HandlerManager;
@@ -56,8 +55,8 @@ public class SubTabLayout extends VLayout {
}
@Override
- protected void onDraw() {
- super.onDraw();
+ protected void onInit() {
+ super.onInit();
setWidth100();
setHeight100();
@@ -109,7 +108,7 @@ public class SubTabLayout extends VLayout {
}
});
- subTabButtons.put(title,button);
+ subTabButtons.put(title, button);
buttonBar.addMember(button);
@@ -119,6 +118,13 @@ public class SubTabLayout extends VLayout {
selectTab(currentlySelected);
}
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+ selectTab(currentlySelected);
+ }
+
public void enableSubTab(String title) {
disabledSubTabs.remove(title);
if (subTabButtons.containsKey(title)) {
@@ -136,6 +142,13 @@ public class SubTabLayout extends VLayout {
}
public void updateSubTab(String title, Canvas canvas) {
+
+ // Destroy old views so they don't leak
+ Canvas oldCanvas = subtabs.get(title);
+ if (oldCanvas != null) {
+ oldCanvas.destroy();
+ }
+
subtabs.put(title, canvas);
if (isDrawn() && title.equals(currentlySelected)) {
draw(canvas);
@@ -144,10 +157,12 @@ public class SubTabLayout extends VLayout {
}
private void draw(Canvas canvas) {
- if (currentlyDisplayed != null) {
- currentlyDisplayed.hide();
- // removeMember(currentlyDisplayed);
- }
+// if (currentlyDisplayed != null && currentlyDisplayed != canvas && currentlyDisplayed.isDrawn()) {
+// currentlyDisplayed.hide();
+// // removeMember(currentlyDisplayed);
+// }
+
+
if (canvas != null) {
if (hasMember(canvas)) {
canvas.show();
@@ -212,4 +227,19 @@ public class SubTabLayout extends VLayout {
currentlyDisplayed);
hm.fireEvent(event);
}
+
+ public Canvas getCurrentCanvas() {
+ return currentlyDisplayed != null ? currentlyDisplayed : subtabs.get(currentlySelected);
+ }
+
+ /**
+ * Destroy all the currently held views so that they can be replaced with new versions
+ */
+ public void destroyViews() {
+ for (Canvas subtabCanvas : subtabs.values()) {
+ if (subtabCanvas != null) {
+ subtabCanvas.destroy();
+ }
+ }
+ }
}
\ No newline at end of file
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 8453a8b..48d218d 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
@@ -24,6 +24,7 @@ import java.util.List;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.Autofit;
+import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.util.BooleanCallback;
import com.smartgwt.client.util.SC;
@@ -48,7 +49,6 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
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
@@ -63,18 +63,25 @@ public class Table extends LocatableHLayout {
private HTMLFlow title;
+ private HLayout titleLayout;
private Canvas titleComponent;
private ListGrid listGrid;
private ToolStrip footer;
private Label tableInfo;
- private String[] excludedFieldNames;
private String headerIcon;
private boolean showHeader = true;
private boolean showFooter = true;
+ private String tableTitle;
+ private Criteria criteria;
+ private SortSpecifier[] sortSpecifiers;
+ private String[] excludedFieldNames;
+ private boolean autoFetchData;
+
+ private RPCDataSource dataSource;
/**
* Specifies how many rows must be selected in order for a {@link TableAction} button to be enabled.
@@ -107,9 +114,6 @@ public class Table extends LocatableHLayout {
private List<TableActionInfo> tableActions = new ArrayList<TableActionInfo>();
private List<Canvas> extraWidgets = new ArrayList<Canvas>();
- public Table() {
- this(null, null, null, null, true);
- }
public Table(String tableTitle) {
this(tableTitle, null, null, null, true);
@@ -132,22 +136,30 @@ public class Table extends LocatableHLayout {
}
public Table(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers, String[] excludedFieldNames,
- boolean autoFetchData) {
+ boolean autoFetchData) {
super(tableTitle);
setWidth100();
setHeight100();
+ setOverflow(Overflow.HIDDEN);
- contents = new VLayout();
- contents.setWidth100();
- contents.setHeight100();
+ this.tableTitle = tableTitle;
+ this.criteria = criteria;
+ this.sortSpecifiers = sortSpecifiers;
+ this.excludedFieldNames = excludedFieldNames;
+ this.autoFetchData = autoFetchData;
+ }
- // Title
- title = new HTMLFlow();
- setTableTitle(tableTitle);
- // Grid
+ @Override
+ protected void onInit() {
+ super.onInit();
+// Grid
listGrid = new LocatableListGrid(tableTitle);
+
+ listGrid.setAutoFetchData(autoFetchData);
+
+
if (criteria != null) {
listGrid.setInitialCriteria(criteria);
}
@@ -156,7 +168,6 @@ public class Table extends LocatableHLayout {
}
listGrid.setWidth100();
listGrid.setHeight100();
- listGrid.setAutoFetchData(autoFetchData);
listGrid.setAutoFitData(Autofit.HORIZONTAL);
listGrid.setAlternateRecordStyles(true);
listGrid.setResizeFieldsInRealTime(false);
@@ -167,20 +178,68 @@ public class Table extends LocatableHLayout {
//listGrid.setRecordCanSelectProperty("foobar");
listGrid.setRecordEditProperty("foobar");
+ if (dataSource != null) {
+ listGrid.setDataSource(dataSource);
+ }
+
+ contents = new VLayout();
+ contents.setWidth100();
+ contents.setHeight100();
+ addMember(contents);
+
+ contents.addMember(listGrid);
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+
+
+
+
+ for (Canvas child : contents.getMembers()) {
+ contents.removeChild(child);
+ }
+
+
+
+ // Title
+ title = new HTMLFlow();
+ setTableTitle(tableTitle);
+
+
+ if (showHeader) {
+ titleLayout = new HLayout();
+ titleLayout.setAutoHeight();
+ titleLayout.setAlign(VerticalAlignment.BOTTOM);
+
+ }
+
+
+
+
+ // Add components to the view
+ if (showHeader) {
+ contents.addMember(titleLayout,0);
+ }
+
+ contents.addMember(listGrid);
+
// Footer
footer = new ToolStrip();
footer.setPadding(5);
footer.setWidth100();
footer.setMembersMargin(15);
+ contents.addMember(footer);
- tableInfo = new Label("Total: " + listGrid.getTotalRows());
- this.excludedFieldNames = excludedFieldNames;
- }
+ // The ListGrid has been created and configured
+ // Now give extensions a chance to configure the table
+ configureTable();
+
+
+ tableInfo = new Label("Total: " + listGrid.getTotalRows());
- @Override
- 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
@@ -193,19 +252,9 @@ public class Table extends LocatableHLayout {
tableInfo.setWrap(false);
- }
-
- @Override
- protected void onDraw() {
- super.onDraw();
-
- contents.removeMembers(getMembers());
if (showHeader) {
- HLayout titleLayout = new HLayout();
- titleLayout.setAutoHeight();
- titleLayout.setAlign(VerticalAlignment.BOTTOM);
if (headerIcon != null) {
Img img = new Img(headerIcon, 24, 24);
@@ -220,10 +269,8 @@ public class Table extends LocatableHLayout {
titleLayout.addMember(titleComponent);
}
- contents.addMember(titleLayout);
}
- contents.addMember(listGrid);
if (showFooter) {
footer.removeMembers(footer.getMembers());
@@ -236,7 +283,7 @@ public class Table extends LocatableHLayout {
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) {
@@ -284,15 +331,20 @@ public class Table extends LocatableHLayout {
}
});
- contents.addMember(footer);
}
- addMember(contents);
}
- protected void setListGrid(ListGrid listGrid) {
- this.listGrid = listGrid;
+
+ /**
+ * Overriding components can use this as a chance to configure the list grid after it has been
+ * created but before it has been drawn to the DOM. This is also the proper place to add table
+ * actions so that they're rendered in the footer.
+ */
+ protected void configureTable() {
+
}
+
public boolean isShowHeader() {
return showHeader;
}
@@ -343,14 +395,12 @@ public class Table extends LocatableHLayout {
title.markForRedraw();
}
- @SuppressWarnings("unchecked")
- public void setDataSource(RPCDataSource dataSource) {
- listGrid.setDataSource(dataSource);
+ public RPCDataSource getDataSource() {
+ return dataSource;
}
- @SuppressWarnings("unchecked")
- public RPCDataSource getDataSource() {
- return (RPCDataSource) listGrid.getDataSource();
+ public void setDataSource(RPCDataSource dataSource) {
+ this.dataSource = dataSource;
}
public ListGrid getListGrid() {
@@ -366,7 +416,7 @@ public class Table extends LocatableHLayout {
}
public void addTableAction(String title, SelectionEnablement enablement, String confirmation,
- TableAction tableAction) {
+ TableAction tableAction) {
if (enablement == null) {
enablement = DEFAULT_SELECTION_ENABLEMENT;
}
@@ -393,23 +443,23 @@ public class Table extends LocatableHLayout {
for (TableActionInfo tableAction : tableActions) {
boolean enabled;
switch (tableAction.enablement) {
- case ALWAYS:
- enabled = true;
- break;
- case NEVER:
- enabled = false;
- 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 NEVER:
+ enabled = false;
+ 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/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index d6a7d8b..cd1c48b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -18,16 +18,23 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
+import java.util.EnumSet;
import java.util.Set;
import com.google.gwt.user.client.History;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Side;
+import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.tab.Tab;
+import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.ResourceTypeFacet;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.composite.ResourcePermission;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
@@ -37,27 +44,32 @@ import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedHandler;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSet;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ResourceConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.PluginConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.schedules.SchedulesView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits.TraitsView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.DashboardView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.OverviewView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/**
* Right panel of the Resource view.
*
* @author Greg Hinkle
*/
-public class ResourceDetailView extends VLayout implements BookmarkableView, ResourceSelectListener,
- TwoLevelTabSelectedHandler {
+public class ResourceDetailView extends VLayout implements BookmarkableView,
+ TwoLevelTabSelectedHandler {
private static final String DEFAULT_TAB_NAME = "Summary";
+ private int resourceId;
private ResourceComposite resourceComposite;
private TwoLevelTab summaryTab;
@@ -73,6 +85,8 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
private ResourceTitleBar titleBar;
+ private String tabName;
+ private String subTabName;
@Override
protected void onDraw() {
@@ -115,7 +129,7 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
contentTab.registerSubTabs("Deployed", "New", "Subscriptions", "History");
topTabSet.setTabs(summaryTab, monitoringTab, inventoryTab, operationsTab, alertsTab, configurationTab,
- eventsTab, contentTab);
+ eventsTab, contentTab);
topTabSet.addTwoLevelTabSelectedHandler(this);
@@ -127,17 +141,24 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
// CoreGUI.addBreadCrumb(getPlace());
}
- public void onResourceSelected(ResourceComposite resourceComposite) {
+ public void updateDetailViews(ResourceComposite resourceComposite) {
this.resourceComposite = resourceComposite;
final Resource resource = this.resourceComposite.getResource();
this.titleBar.setResource(resource);
+ for (Tab top : topTabSet.getTabs()) {
+
+ ((TwoLevelTab)top).getLayout().destroyViews();
+
+ }
+
+
summaryTab.updateSubTab("Overview", new OverviewView(this.resourceComposite));
summaryTab.updateSubTab("Dashboard", new DashboardView(this.resourceComposite));
summaryTab.updateSubTab("Timeline", new FullHTMLPane("/rhq/resource/summary/timeline-plain.xhtml?id="
- + resource.getId()));
+ + resource.getId()));
monitoringTab.updateSubTab("Graphs", new GraphListView(resource)); // new FullHTMLPane("/rhq/common/monitor/graphs.xhtml?id=" + resource.getId()));
monitoringTab.updateSubTab("Tables", new FullHTMLPane("/rhq/common/monitor/tables-plain.xhtml?id="
@@ -145,11 +166,11 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
monitoringTab.updateSubTab("Traits", new TraitsView(resource.getId()));
//new FullHTMLPane("/rhq/resource/monitor/traits-plain.xhtml?id=" + resource.getId()));
monitoringTab.updateSubTab("Availability", new FullHTMLPane(
- "/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId()));
+ "/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId()));
monitoringTab.updateSubTab("Schedules", new SchedulesView(resource.getId()));
- //new FullHTMLPane("/rhq/resource/monitor/schedules-plain.xhtml?id=" + resource.getId()));
+ //new FullHTMLPane("/rhq/resource/monitor/schedules-plain.xhtml?id=" + resource.getId()));
monitoringTab.updateSubTab("Call Time", new FullHTMLPane("/rhq/resource/monitor/response-plain.xhtml?id="
- + resource.getId()));
+ + resource.getId()));
inventoryTab.updateSubTab("Children", ResourceSearchView.getChildrenOf(resource.getId()));
inventoryTab.updateSubTab("Connection Settings", new PluginConfigurationEditView(resource)); // new ConfigurationEditor(resource.getId(), resource.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin));
@@ -159,12 +180,12 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
// 2) user can see both operation arguments and results in the history details pop-up
// 3) operation arguments/results become read-only configuration data in the history details pop-up
// 4) user can navigate to the group operation that spawned this resource operation history, if appropriate
- //operationsTab.updateSubTab("History", OperationHistoryView.getResourceHistoryView(resource));
+ operationsTab.updateSubTab("History", OperationHistoryView.getResourceHistoryView(resourceComposite));
// note: enabled operation execution/schedules from left-nav, if it doesn't already exist
- operationsTab.updateSubTab("History", new FullHTMLPane(
- "/rhq/resource/operation/resourceOperationHistory-plain.xhtml?id=" + resource.getId()));
+// operationsTab.updateSubTab("History", new FullHTMLPane(
+// "/rhq/resource/operation/resourceOperationHistory-plain.xhtml?id=" + resource.getId()));
operationsTab.updateSubTab("Scheduled", new FullHTMLPane(
- "/rhq/resource/operation/resourceOperationSchedules-plain.xhtml?id=" + resource.getId()));
+ "/rhq/resource/operation/resourceOperationSchedules-plain.xhtml?id=" + resource.getId()));
configurationTab.updateSubTab("Current", new ResourceConfigurationEditView(resource));
configurationTab.updateSubTab("History", ConfigurationHistoryView.getHistoryOf(resource.getId()));
@@ -176,26 +197,26 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
// 4) user can search alert history by: date alert was fired, alert priority, or alert definition
//alertsTab.updateSubTab("History", new ResourceAlertHistoryView(resource.getId()));
alertsTab.updateSubTab("History", new FullHTMLPane("/rhq/resource/alert/listAlertHistory-plain.xhtml?id="
- + resource.getId()));
+ + resource.getId()));
alertsTab.updateSubTab("Definitions", new ResourceAlertDefinitionsView(resource));
alertsTab.updateSubTab("DELETEME", new FullHTMLPane("/rhq/resource/alert/listAlertDefinitions-plain.xhtml?id="
- + resource.getId()));
+ + resource.getId()));
// comment out GWT-based view until...
// 1) user can search event history by: metric display range, event source, event details, event severity
// 2) user can delete events if they possess the appropriate permissions
//eventsTab.updateSubTab("History", EventHistoryView.createResourceHistoryView(resource.getId()));
eventsTab.updateSubTab("History", new FullHTMLPane("/rhq/resource/events/history-plain.xhtml?id="
- + resource.getId()));
+ + resource.getId()));
contentTab.updateSubTab("Deployed", new FullHTMLPane("/rhq/resource/content/view-plain.xhtml?id="
- + resource.getId()));
+ + resource.getId()));
contentTab.updateSubTab("New", new FullHTMLPane("/rhq/resource/content/deploy-plain.xhtml?id="
- + resource.getId()));
+ + resource.getId()));
contentTab.updateSubTab("Subscriptions", new FullHTMLPane("/rhq/resource/content/subscription-plain.xhtml?id="
- + resource.getId()));
+ + resource.getId()));
contentTab.updateSubTab("History", new FullHTMLPane("/rhq/resource/content/history-plain.xhtml?id="
- + resource.getId()));
+ + resource.getId()));
// topTabSet.setSelectedTab(selectedTab);
@@ -249,12 +270,14 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
if (this.resourceComposite == null) {
- History.fireCurrentHistoryState();
+// History.fireCurrentHistoryState();
} else {
// Switch tabs directly, rather than letting the history framework do it, to avoid redrawing the outer views.
- selectTab(tabSelectedEvent.getId(), tabSelectedEvent.getSubTabId());
+// selectTab(tabSelectedEvent.getId(), tabSelectedEvent.getSubTabId());
+
+
String tabPath = "/" + tabSelectedEvent.getId() + "/" + tabSelectedEvent.getSubTabId();
- String path = "Resource/" + this.resourceComposite.getResource().getId() + tabPath;
+ String path = "Resource/" + resourceId + tabPath;
// But still add an item to the history, specifying false to tell it not to fire an event.
History.newItem(path, true);
@@ -264,13 +287,79 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
public void renderView(ViewPath viewPath) {
// e.g. #Resource/10010/Inventory/Overview
- String tabName = (!viewPath.isEnd()) ? viewPath.getCurrent().getPath() : null; // e.g. "Inventory"
- String subTabName = (viewPath.viewsLeft() >= 1) ? viewPath.getNext().getPath() : null; // e.g. "Overview"
- selectTab(tabName, subTabName);
+ // ^ Current Path
+ int resourceId = Integer.parseInt(viewPath.getCurrent().getPath());
+
+
+ viewPath.next();
+
+
+ tabName = (!viewPath.isEnd()) ? viewPath.getCurrent().getPath() : null; // e.g. "Inventory"
+ subTabName = (viewPath.viewsLeft() >= 1) ? viewPath.getNext().getPath() : null; // e.g. "Overview"
+
+ viewPath.next();
+ viewPath.next();
+
+ if (this.resourceId != resourceId) {
+ // A different resource or first load, go get data
+ loadSelectedResource(resourceId, viewPath);
+ } else {
+ // same resource just switch tabs
+ selectTab(tabName, subTabName, viewPath);
+ }
+
+ }
+
+
+ public void loadSelectedResource(final int resourceId, final ViewPath viewPath) {
+ this.resourceId = resourceId;
+
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterId(resourceId);
+ criteria.fetchTags(true);
+ //criteria.fetchParentResource(true);
+ GWTServiceLookup.getResourceService().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.goTo(InventoryView.VIEW_PATH);
+ }
+
+ public void onSuccess(PageList<ResourceComposite> result) {
+ if (result.isEmpty()) {
+ //noinspection ThrowableInstanceNeverThrown
+ onFailure(new Exception("Resource with id [" + resourceId + "] does not exist."));
+ } else {
+ final ResourceComposite resourceComposite = result.get(0);
+ loadResourceType(resourceComposite, viewPath);
+ }
+ }
+ });
+ }
+
+
+ private void loadResourceType(final ResourceComposite resourceComposite, final ViewPath viewPath) {
+ final Resource resource = resourceComposite.getResource();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ resource.getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.content, ResourceTypeRepository.MetadataType.operations,
+ ResourceTypeRepository.MetadataType.events,
+ ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ resourceComposite.getResource().setResourceType(type);
+ ResourceDetailView.this.resourceComposite = resourceComposite;
+ updateDetailViews(resourceComposite);
+ selectTab(tabName, subTabName, viewPath);
+
+ }
+ });
}
- public void selectTab(String tabName, String subtabName) {
+ public void selectTab(String tabName, String subtabName, ViewPath viewPath) {
if (tabName == null) {
tabName = DEFAULT_TAB_NAME;
}
@@ -286,8 +375,12 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
CoreGUI.getErrorHandler().handleError("Invalid subtab name: " + subtabName);
// TODO: Should we fire a history event here to redirect to a valid bookmark?
return;
+ } else {
+ Canvas subView = tab.getLayout().getCurrentCanvas();
+ if (subView instanceof BookmarkableView) {
+ ((BookmarkableView) subView).renderView(viewPath);
+ }
}
- tab.getLayout().selectTab(subtabName);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
index 7d0c499..2d75b2b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
@@ -18,7 +18,17 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.criteria.ResourceCriteria;
@@ -32,17 +42,6 @@ import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallb
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.Img;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.layout.HLayout;
-
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
/**
* @author Greg Hinkle
* @author Ian Springer
@@ -120,7 +119,7 @@ public class ResourceTitleBar extends HLayout {
criteria.fetchTags(true);
GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Could not load resource tags",caught);
+ CoreGUI.getErrorHandler().handleError("Could not load resource tags", caught);
}
public void onSuccess(PageList<Resource> result) {
@@ -132,28 +131,29 @@ public class ResourceTitleBar extends HLayout {
}
-
public void setResource(Resource resource) {
- this.resource = resource;
- update();
+ if (this.resource == null || this.resource.getId() != resource.getId()) {
+ this.resource = resource;
+ update();
- this.title.setContents("<span class=\"SectionHeader\">" + resource.getName() + "</span> <span class=\"subtitle\">" + resource.getResourceType().getName() + "</span>");
+ this.title.setContents("<span class=\"SectionHeader\">" + resource.getName() + "</span> <span class=\"subtitle\">" + resource.getResourceType().getName() + "</span>");
- Set<Integer> favorites = CoreGUI.getUserPreferences().getFavoriteResources();
- this.favorite = favorites.contains(resource.getId());
- updateFavoriteButton();
+ Set<Integer> favorites = CoreGUI.getUserPreferences().getFavoriteResources();
+ this.favorite = favorites.contains(resource.getId());
+ updateFavoriteButton();
- this.availabilityImage.setSrc("resources/availability_" +
- (resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "green" : "red") +
- "_24.png");
+ this.availabilityImage.setSrc("resources/availability_" +
+ (resource.getCurrentAvailability().getAvailabilityType() == AvailabilityType.UP ? "green" : "red") +
+ "_24.png");
- String category = this.resource.getResourceType().getCategory().getDisplayName();
+ String category = this.resource.getResourceType().getCategory().getDisplayName();
- String avail = (resource.getCurrentAvailability() != null && resource.getCurrentAvailability().getAvailabilityType() != null)
- ? (resource.getCurrentAvailability().getAvailabilityType().name().toLowerCase()) : "down";
- badge.setSrc("types/" + category + "_" + avail + "_24.png");
+ String avail = (resource.getCurrentAvailability() != null && resource.getCurrentAvailability().getAvailabilityType() != null)
+ ? (resource.getCurrentAvailability().getAvailabilityType().name().toLowerCase()) : "down";
+ badge.setSrc("types/" + category + "_" + avail + "_24.png");
- markForRedraw();
+ markForRedraw();
+ }
}
private void updateFavoriteButton() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index f01e0e6..b4ae24c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -4,17 +4,21 @@
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
index b537f5d..b26407d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/OperationHistoryView.java
@@ -20,31 +20,25 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operatio
import java.util.EnumSet;
-import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.RecordDoubleClickEvent;
-import com.smartgwt.client.widgets.grid.events.RecordDoubleClickHandler;
-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.MenuItem;
import com.smartgwt.client.widgets.menu.events.ClickHandler;
import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
-import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.core.domain.operation.OperationRequestStatus;
import org.rhq.core.domain.operation.ResourceOperationHistory;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.create.OperationCreateWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.detail.OperationDetailsView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -52,45 +46,40 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTyp
/**
* @author Greg Hinkle
*/
-public class OperationHistoryView extends VLayout {
+public class OperationHistoryView extends TableSection {
- Table table;
- Resource resource;
- Criteria criteria;
-
- @Override
- protected void onInit() {
- super.onInit();
+ private ResourceComposite composite;
+ private Resource resource;
- }
-
public OperationHistoryView() {
+ super("Operation History");
setWidth100();
setHeight100();
+
+ setDataSource(new OperationHistoryDataSource());
+
}
- public OperationHistoryView(Resource resource) {
- this.resource = resource;
- this.criteria = new Criteria("resourceId", String.valueOf(resource.getId()));
+ public OperationHistoryView(ResourceComposite resourceComposite) {
+ super("Operation History", new Criteria("resourceId", String.valueOf(resourceComposite.getResource().getId())));
+ this.composite = resourceComposite;
+ this.resource = resourceComposite.getResource();
+
+ setDataSource(new OperationHistoryDataSource());
+
}
- @Override
- protected void onDraw() {
- super.onDraw();
- if (criteria == null) {
- table = new Table("Operation History");
- } else {
- table = new Table("Operation History", criteria);
- }
- table.setDataSource(new OperationHistoryDataSource());
+ @Override
+ protected void configureTable() {
+
- table.getListGrid().getField("id").setWidth(40);
- table.getListGrid().getField("operationName").setWidth("*");
- table.getListGrid().getField("status").setWidth(100);
- table.getListGrid().getField("status").setCellFormatter(new CellFormatter() {
+ getListGrid().getField("id").setWidth(40);
+ getListGrid().getField("operationName").setWidth("*");
+ getListGrid().getField("status").setWidth(100);
+ getListGrid().getField("status").setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
OperationRequestStatus status = OperationRequestStatus.valueOf((String) o);
String icon = "";
@@ -115,39 +104,33 @@ public class OperationHistoryView extends VLayout {
- table.getListGrid().getField("startedTime").setWidth(120);
+ getListGrid().getField("startedTime").setWidth(120);
if (this.resource == null) {
- table.getListGrid().getField("resource").setWidth(300);
- table.getListGrid().getField("resource").setCellFormatter(new CellFormatter() {
+ getListGrid().getField("resource").setWidth(300);
+ getListGrid().getField("resource").setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
Resource res = (Resource) o;
return "<a href=\"#Resource/" + res.getId() + "\">" + res.getName() + "</a>";
}
});
} else {
- table.getListGrid().hideField("resource");
+ getListGrid().hideField("resource");
}
- table.getListGrid().addRecordDoubleClickHandler(new RecordDoubleClickHandler() {
- public void onRecordDoubleClick(RecordDoubleClickEvent recordDoubleClickEvent) {
- ResourceOperationHistory history = (ResourceOperationHistory) recordDoubleClickEvent.getRecord().getAttributeAsObject("entity");
- showDetails(history);
- }
- });
- table.addTableAction("Details", Table.SelectionEnablement.SINGLE, null, new TableAction() {
+ addTableAction("Details", Table.SelectionEnablement.SINGLE, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
ResourceOperationHistory history = (ResourceOperationHistory) selection[0].getAttributeAsObject("entity");
- showDetails(history);
+ showDetails(history.getId());
}
});
- if (resource != null) {
+ if (resource != null && composite.getResourcePermission().isControl()) {
final Menu operationMenu = new Menu();
ResourceTypeRepository.Cache.getInstance().getResourceTypes(
resource.getResourceType().getId(),
@@ -168,39 +151,24 @@ public class OperationHistoryView extends VLayout {
IMenuButton operationsButton = new IMenuButton("Run Operation", operationMenu);
operationsButton.setShowMenuBelow(false);
- table.addExtraWidget(operationsButton);
+ addExtraWidget(operationsButton);
}
- addMember(table);
}
- private void showDetails(ResourceOperationHistory history) {
- ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
- criteria.addFilterId(history.getId());
-
- criteria.fetchOperationDefinition(true);
- criteria.fetchParameters(true);
- criteria.fetchResults(true);
-
- GWTServiceLookup.getOperationService().findResourceOperationHistoriesByCriteria(
- criteria, new AsyncCallback<PageList<ResourceOperationHistory>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failure loading operation history", caught);
- }
+ @Override
+ public Canvas getDetailsView(int id) {
+ OperationDetailsView detailsView = new OperationDetailsView();
- public void onSuccess(PageList<ResourceOperationHistory> result) {
- ResourceOperationHistory item = result.get(0);
- OperationDetailsView.displayDetailsDialog(item);
- }
- }
- );
+ return detailsView;
}
- public static OperationHistoryView getResourceHistoryView(Resource resource) {
+ public static OperationHistoryView getResourceHistoryView(ResourceComposite resource) {
return new OperationHistoryView(resource);
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java
index de1747b..3a7715f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/detail/OperationDetailsView.java
@@ -20,25 +20,40 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operatio
import java.util.Date;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.TitleOrientation;
+import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.AutoFitTextAreaItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.core.domain.operation.ResourceOperationHistory;
-import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
/**
* @author Greg Hinkle
*/
-public class OperationDetailsView extends VLayout {
+public class OperationDetailsView extends VLayout implements BookmarkableView {
- OperationDefinition definition;
- ResourceOperationHistory operationHistory;
+ private int historyId;
+ private OperationDefinition definition;
+ private ResourceOperationHistory operationHistory;
+
+ private ViewId viewId;
+
+ private DynamicForm form;
+ public OperationDetailsView() {
+ }
public OperationDetailsView(OperationDefinition definition, ResourceOperationHistory operationHistory) {
this.definition = definition;
@@ -49,10 +64,35 @@ public class OperationDetailsView extends VLayout {
protected void onDraw() {
super.onDraw();
+ for (Canvas child : getMembers()) {
+ child.destroy();
+ }
+
+
+ if (this.operationHistory != null) {
+ displayDetails(operationHistory);
+ }
+ }
+
+
+ private void displayDetails(ResourceOperationHistory operationHistory) {
+
+ for (Canvas child : getMembers()) {
+ removeChild(child);
+ }
+
+ if (this.viewId != null) {
+ viewId.getBreadcrumbs().get(0).setDisplayName(operationHistory.getOperationDefinition().getDisplayName());
+ }
+
+ this.definition = operationHistory.getOperationDefinition();
+ this.operationHistory = operationHistory;
// Information Form
- DynamicForm form = new DynamicForm();
+ form = new DynamicForm();
+ form.setWidth100();
+ form.setWrapItemTitles(false);
StaticTextItem operationItem = new StaticTextItem("operation", "Operation");
operationItem.setValue(definition.getName());
@@ -100,8 +140,33 @@ public class OperationDetailsView extends VLayout {
ConfigurationEditor resultsEditor = new ConfigurationEditor(definition.getResultsConfigurationDefinition(), operationHistory.getResults());
resultsEditor.setReadOnly(true);
addMember(resultsEditor);
-
}
+
+ }
+
+
+
+ private void lookupDetails(int historyId) {
+ ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
+
+ criteria.addFilterId(historyId);
+
+ criteria.fetchOperationDefinition(true);
+ criteria.fetchParameters(true);
+ criteria.fetchResults(true);
+
+ GWTServiceLookup.getOperationService().findResourceOperationHistoriesByCriteria(
+ criteria, new AsyncCallback<PageList<ResourceOperationHistory>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failure loading operation history", caught);
+ }
+
+ public void onSuccess(PageList<ResourceOperationHistory> result) {
+ ResourceOperationHistory item = result.get(0);
+ displayDetails(item);
+ }
+ }
+ );
}
@@ -124,4 +189,13 @@ public class OperationDetailsView extends VLayout {
}
+ @Override
+ public void renderView(ViewPath viewPath) {
+
+ historyId = viewPath.getCurrentAsInt();
+
+ viewId = viewPath.getCurrent();
+
+ lookupDetails(historyId);
+ }
}
commit ea622034c54bdb9f8e6e2cea7d46f0c5aa7aec8d
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Aug 23 13:37:24 2010 -0400
Linkmanager for resource quick nav
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 98e5ab9..728a50c 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,13 +18,6 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource;
-import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.AVAILABILITY;
-import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.CATEGORY;
-import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.DESCRIPTION;
-import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.NAME;
-import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.PLUGIN;
-import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.TYPE;
-
import java.util.ArrayList;
import java.util.List;
@@ -39,6 +32,7 @@ import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -46,6 +40,13 @@ import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
+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
*/
@@ -108,7 +109,7 @@ public class ResourceSearchView extends Table {
ListGridField nameField = new ListGridField(NAME.propertyName(), NAME.title(), 250);
nameField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- return "<a href=\"#Resource/" + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
+ return "<a href=\"" + LinkManager.getResourceLink(listGridRecord.getAttributeAsInt("id")) + "\">" + o + "</a>";
}
});
commit 48ee7c5ddf60a5f487c1eb351fbb5961aad6dcdb
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Aug 23 13:36:57 2010 -0400
Extension to table to support details views as well
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 43e45aa..8453a8b 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,9 +41,11 @@ 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.LocatableHLayout;
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;
@@ -52,10 +54,13 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
* @author Greg Hinkle
* @author Ian Springer
*/
-public class Table extends LocatableVLayout {
+public class Table extends LocatableHLayout {
private static final SelectionEnablement DEFAULT_SELECTION_ENABLEMENT = SelectionEnablement.ALWAYS;
+
+ protected VLayout contents;
+
private HTMLFlow title;
private Canvas titleComponent;
@@ -70,6 +75,7 @@ public class Table extends LocatableVLayout {
private boolean showHeader = true;
private boolean showFooter = true;
+
/**
* Specifies how many rows must be selected in order for a {@link TableAction} button to be enabled.
*/
@@ -132,6 +138,10 @@ public class Table extends LocatableVLayout {
setWidth100();
setHeight100();
+ contents = new VLayout();
+ contents.setWidth100();
+ contents.setHeight100();
+
// Title
title = new HTMLFlow();
setTableTitle(tableTitle);
@@ -189,7 +199,7 @@ public class Table extends LocatableVLayout {
protected void onDraw() {
super.onDraw();
- removeMembers(getMembers());
+ contents.removeMembers(getMembers());
if (showHeader) {
@@ -210,10 +220,10 @@ public class Table extends LocatableVLayout {
titleLayout.addMember(titleComponent);
}
- addMember(titleLayout);
+ contents.addMember(titleLayout);
}
- addMember(listGrid);
+ contents.addMember(listGrid);
if (showFooter) {
footer.removeMembers(footer.getMembers());
@@ -274,8 +284,9 @@ public class Table extends LocatableVLayout {
}
});
- addMember(footer);
+ contents.addMember(footer);
}
+ addMember(contents);
}
protected void setListGrid(ListGrid listGrid) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
new file mode 100644
index 0000000..91fb92b
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
@@ -0,0 +1,153 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.table;
+
+import com.google.gwt.user.client.History;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.SortSpecifier;
+import com.smartgwt.client.types.AnimationEffect;
+import com.smartgwt.client.widgets.AnimationCallback;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.events.CellDoubleClickEvent;
+import com.smartgwt.client.widgets.grid.events.CellDoubleClickHandler;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
+
+/**
+ * @author Greg Hinkle
+ */
+public abstract class TableSection extends Table implements BookmarkableView {
+
+ private int detailsId;
+
+ private VLayout detailsHolder;
+
+ private Canvas detailsView;
+
+ private String basePath;
+
+ protected TableSection() {
+ }
+
+ protected TableSection(String tableTitle) {
+ super(tableTitle);
+ }
+
+ protected TableSection(String tableTitle, Criteria criteria) {
+ super(tableTitle, criteria);
+ }
+
+ protected TableSection(String tableTitle, SortSpecifier[] sortSpecifiers) {
+ super(tableTitle, sortSpecifiers);
+ }
+
+ protected TableSection(String tableTitle, boolean autoFetchData) {
+ super(tableTitle, autoFetchData);
+ }
+
+ protected TableSection(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers, String[] excludedFieldNames) {
+ super(tableTitle, criteria, sortSpecifiers, excludedFieldNames);
+ }
+
+ protected TableSection(String tableTitle, Criteria criteria, SortSpecifier[] sortSpecifiers, String[] excludedFieldNames, boolean autoFetchData) {
+ super(tableTitle, criteria, sortSpecifiers, excludedFieldNames, autoFetchData);
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ getListGrid().addCellDoubleClickHandler(new CellDoubleClickHandler() {
+ @Override
+ public void onCellDoubleClick(CellDoubleClickEvent event) {
+
+ int id = event.getRecord().getAttributeAsInt("id");
+
+ showDetails(id);
+ }
+ });
+
+ detailsHolder = new VLayout();
+ detailsHolder.setWidth100();
+ detailsHolder.setHeight100();
+ detailsHolder.hide();
+
+ addMember(detailsHolder);
+
+ }
+
+ public void showDetails(int id) {
+ History.newItem(basePath + "/" + id);
+ }
+
+ public abstract Canvas getDetailsView(int id);
+
+
+ @Override
+ public void renderView(ViewPath viewPath) {
+
+ basePath = viewPath.getPathToCurrent();
+
+ if (!viewPath.isEnd()) {
+
+ int id = Integer.parseInt(viewPath.getCurrent().getPath());
+
+ detailsView = getDetailsView(id);
+
+ if (detailsView instanceof BookmarkableView) {
+
+ ((BookmarkableView)detailsView).renderView(viewPath);
+ }
+
+
+ contents.animateHide(AnimationEffect.FADE, new AnimationCallback() {
+ @Override
+ public void execute(boolean b) {
+ detailsView.setWidth100();
+ detailsView.setHeight100();
+
+ detailsHolder.addMember(new BackButton("Back to List",basePath));
+ detailsHolder.addMember(detailsView);
+ detailsHolder.animateShow(AnimationEffect.FADE);
+ }
+ });
+
+ } else {
+ contents.animateShow(AnimationEffect.FADE, new AnimationCallback() {
+ @Override
+ public void execute(boolean b) {
+ if (detailsHolder.isVisible()) {
+ detailsHolder.animateHide(AnimationEffect.FADE);
+
+ for (Canvas child : detailsHolder.getMembers()) {
+ detailsHolder.removeMember(child);
+ }
+ }
+ }
+ });
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.java
new file mode 100644
index 0000000..0be952a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableHLayout.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 LocatableHLayout extends VLayout {
+
+ /**
+ * <pre>
+ * ID Format: "scClassname-id"
+ * </pre>
+ * @param id not null or empty.
+ */
+ public LocatableHLayout(String id) {
+ super();
+ String locatorId = this.getScClassName() + "-" + id;
+ setID(SeleniumUtility.getSafeId(locatorId, locatorId));
+ }
+
+}
commit 0a35a6db14b13bd1a89084f79f17870e8c4a7436
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Aug 23 13:34:23 2010 -0400
missing accessors
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ClusterKeyFlyweight.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ClusterKeyFlyweight.java
index 6d3d488..e546614 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ClusterKeyFlyweight.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ClusterKeyFlyweight.java
@@ -59,4 +59,20 @@ public class ClusterKeyFlyweight implements Serializable {
result = 31 * result + (resourceKey != null ? resourceKey.hashCode() : 0);
return result;
}
+
+ public int getResourceTypeId() {
+ return resourceTypeId;
+ }
+
+ public String getResourceKey() {
+ return resourceKey;
+ }
+
+ @Override
+ public String toString() {
+ return "ClusterKeyFlyweight{" +
+ "resourceTypeId=" + resourceTypeId +
+ ", resourceKey='" + resourceKey + '\'' +
+ '}';
+ }
}
\ No newline at end of file
commit 6e63aec3e132ab8b02e6607ca953c83048a0634f
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Sun Aug 22 22:18:08 2010 -0400
Tag links updated for tag cloud under reports section
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
index ee73969..1dee039 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
@@ -284,4 +284,7 @@ public class LinkManager {
}
+ public static String getTagLink(String tag) {
+ return "Reports/Inventory/Tag%20Cloud/" + tag;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
index 6219504..08b9581 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
@@ -23,17 +23,12 @@
package org.rhq.enterprise.gui.coregui.client.components.tagging;
import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.types.TextMatchStyle;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Dialog;
@@ -41,18 +36,12 @@ import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.events.HoverEvent;
-import com.smartgwt.client.widgets.events.HoverHandler;
import com.smartgwt.client.widgets.events.MouseOutEvent;
import com.smartgwt.client.widgets.events.MouseOutHandler;
import com.smartgwt.client.widgets.events.MouseOverEvent;
import com.smartgwt.client.widgets.events.MouseOverHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
-import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
-import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
-import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
-import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
import com.smartgwt.client.widgets.layout.HLayout;
@@ -65,6 +54,7 @@ import org.rhq.core.domain.tagging.Tag;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
/**
@@ -136,7 +126,7 @@ public class TagEditorView extends Layout {
//tagLayout.set
HTMLFlow tagString = new HTMLFlow(
- "<a href=\"#Tag/" + tag.toString() + "\">" +
+ "<a href=\"" + LinkManager.getTagLink(tag.toString()) + "\">" +
tag.toString() + "</a>");
tagString.setAutoWidth();
13 years, 8 months
[rhq] modules/core
by mazz
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/content/version/PackageVersions.java | 43 ++++++----
1 file changed, 29 insertions(+), 14 deletions(-)
New commits:
commit fdb272c9ea2544b53a66bb37e99b7f6f9be38487
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Aug 24 13:56:07 2010 -0400
bz 534569 - fix the thread safety code. this class doesn't even seem to be used anymore, so - if you fix a bug in the woods, does anyone hear it?
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/content/version/PackageVersions.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/content/version/PackageVersions.java
index 418e1d7..f228f11 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/content/version/PackageVersions.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/content/version/PackageVersions.java
@@ -29,6 +29,8 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -94,15 +96,17 @@ public class PackageVersions {
* a static variable across all instances of this class.
*/
public void loadFromDisk() {
- dataLock.readLock().lock();
+ WriteLock lock = dataLock.writeLock();
+ lock.lock();
try {
ObjectInputStream ois = null;
try {
// All instances of this class will use the same store. If one loaded it already, there's nothing to do.
- if (data != null)
+ if (data != null) {
return;
+ }
log.debug("Loading package versions from storage for plugin [" + pluginName + "]");
File file = new File(dataDirectory, FILENAME);
@@ -142,7 +146,7 @@ public class PackageVersions {
}
}
} finally {
- dataLock.readLock().unlock();
+ lock.unlock();
}
}
@@ -152,12 +156,14 @@ public class PackageVersions {
* this call represents a best-effort to save the values.
*/
public void saveToDisk() {
- dataLock.writeLock().lock();
+ WriteLock lock = dataLock.writeLock();
+ lock.lock();
try {
- if (data == null)
+ if (data == null) {
throw new IllegalStateException("Data has not been loaded prior to saving for plugin [" + pluginName
+ "]");
+ }
ObjectOutputStream oos = null;
try {
@@ -180,7 +186,7 @@ public class PackageVersions {
}
} finally {
- dataLock.writeLock().unlock();
+ lock.unlock();
}
}
@@ -193,14 +199,19 @@ public class PackageVersions {
* @return version of the package if it is known; <code>null</code> otherwise
*/
public String getVersion(String packageKey) {
- if (packageKey == null)
+ if (packageKey == null) {
throw new IllegalArgumentException("packageKey cannot be null");
-
- checkLoaded();
+ }
String version;
- synchronized (data) {
+
+ ReadLock lock = dataLock.readLock();
+ lock.lock();
+ try {
+ checkLoaded();
version = data.getVersion(packageKey);
+ } finally {
+ lock.unlock();
}
return version;
@@ -223,13 +234,17 @@ public class PackageVersions {
* @param version version of the package
*/
public void putVersion(String packageKey, String version) {
- if (packageKey == null)
+ if (packageKey == null) {
throw new IllegalArgumentException("packageKey cannot be null");
+ }
- checkLoaded();
-
- synchronized (data) {
+ ReadLock lock = dataLock.readLock();
+ lock.lock();
+ try {
+ checkLoaded();
data.setVersion(packageKey, version);
+ } finally {
+ lock.unlock();
}
}
13 years, 8 months
[rhq] Branch 'code-smell' - 40 commits - etc/agentspawn modules/core modules/enterprise modules/helpers modules/plugins pom.xml
by lkrejci
etc/agentspawn/src/main/resources/template-configuration.xml | 2
etc/agentspawn/src/scripts/agentcopy-agent-configuration.xml | 2
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDataTraitCriteria.java | 127 ++++
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementData.java | 4
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfiguration.java | 16
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfigurationConstants.java | 7
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfigurationUpgrade.java | 13
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java | 3
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentSetupInstructions.java | 10
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/SetupPromptCommand.java | 8
modules/enterprise/agent/src/main/resources/agent-configuration.xml | 9
modules/enterprise/agent/src/test/resources/test-agent-configuration.xml | 2
modules/enterprise/agent/src/test/resources/test-agent1-cfg-mvn.xml | 2
modules/enterprise/agent/src/test/resources/test-agent2-cfg-mvn.xml | 2
modules/enterprise/agent/src/test/resources/test-agent2-configuration.xml | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java | 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java | 34 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitDataSource.java | 147 +++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java | 66 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementScheduleListView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsDataSource.java | 58 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsView.java | 48 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsDataSource.java | 58 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsView.java | 45 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java | 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/Message.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java | 5
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-add-map.xhtml | 32 +
modules/enterprise/gui/webdav-war/webdav-war.iml | 169 ------
modules/enterprise/server/jar/pom.xml | 7
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBean.java | 32 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerLocal.java | 15
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerRemote.java | 9
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java | 6
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java | 256 ++++++++++
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java | 101 +++
modules/enterprise/server/plugins/groovy-script/pom.xml | 229 ++++++++
modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ClasspathInitializer.groovy | 10
modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy | 65 ++
modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorException.groovy | 22
modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaSpec.groovy | 38 +
modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/FetchDelegate.groovy | 12
modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy | 45 +
modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptException.groovy | 22
modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy | 91 +++
modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/SortDelegate.groovy | 38 +
modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/SortField.groovy | 15
modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml | 74 ++
modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy | 67 ++
modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/test/TestEntity.groovy | 12
modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/test/TestEntityWithoutCriteria.groovy | 7
modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ClasspathInitializerTest.groovy | 33 +
modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy | 116 ++++
modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptTest.groovy | 57 ++
modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy | 126 ++++
modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/SortDelegateTest.groovy | 88 +++
modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/access_mgr.groovy | 4
modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/access_nonexistent_mgr.groovy | 3
modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/create_criteria.groovy | 17
modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/throw_exception.groovy | 3
modules/enterprise/server/plugins/pom.xml | 1
modules/enterprise/server/sars/agent-sar/src/main/resources/META-INF/embedded-agent-configuration.xml | 2
modules/helpers/perftest-data-gen/install_files.sh | 6
modules/helpers/perftest-data-gen/pom.xml | 1
modules/helpers/perftest-data-gen/src/main/java/org/rhq/etc/perftestDataGen/DataGen.java | 19
modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlDiscoveryComponent.java | 27 -
modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml | 1
modules/plugins/rhq-agent/src/test/resources/test-agent-configuration.xml | 2
pom.xml | 1
73 files changed, 2378 insertions(+), 225 deletions(-)
New commits:
commit 271474dd691b04cc01106d83baee292cfd6689a2
Merge: 4d5b070... 66234db...
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Aug 24 18:10:33 2010 +0200
Merge branch 'master' into code-smell
diff --cc modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlDiscoveryComponent.java
index ba0ea81,4f1045e..2ada67b
--- a/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlDiscoveryComponent.java
+++ b/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlDiscoveryComponent.java
@@@ -106,9 -115,7 +117,9 @@@ public class MySqlDiscoveryComponent im
version = conn.getMetaData().getDatabaseProductVersion();
} catch (SQLException e) {
// TODO GH: How to put this back to the server while inventorying this resource in an unconfigured state
- log.info("Exception detecting mysql instance version", e);
+ log.info("Exception detecting mysql instance version" + e.getMessage());
+ } finally {
+ JDBCUtil.safeClose(conn);
}
return version;
}
@@@ -126,4 -133,4 +137,4 @@@
return DriverManager.getConnection(url);
}
--}
++}
commit 66234dbf61b0ae04d40786a00185a3321bd43e93
Merge: 3023ab1... 9decb0a...
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Aug 23 00:42:39 2010 -0400
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 9decb0a2e1342a5e935d2c05330f9d23dbc95242
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Aug 24 00:06:08 2010 -0400
various minor fixes and tweaks
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index 3369352..90b795e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -20,13 +20,11 @@ package org.rhq.enterprise.gui.coregui.client.alert;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.core.DataClass;
@@ -60,8 +58,6 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
* @author Ian Springer
*/
public class AlertDataSource extends RPCDataSource<Alert> {
- private static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getMediumDateTimeFormat();
-
private AlertGWTServiceAsync alertService = GWTServiceLookup.getAlertService();
protected AlertDataSource() {
@@ -107,7 +103,7 @@ public class AlertDataSource extends RPCDataSource<Alert> {
DataSourceTextField priorityField = new DataSourceTextField(AlertCriteria.SORT_FIELD_PRIORITY, "Priority", 15);
fields.add(priorityField);
- DataSourceTextField ctimeField = new DataSourceTextField(AlertCriteria.SORT_FIELD_CTIME, "Creation Time");
+ DataSourceIntegerField ctimeField = new DataSourceIntegerField(AlertCriteria.SORT_FIELD_CTIME, "Creation Time");
fields.add(ctimeField);
DataSourceBooleanField boolField = new DataSourceBooleanField("ack", "Ack'd");
@@ -132,15 +128,12 @@ public class AlertDataSource extends RPCDataSource<Alert> {
public void onSuccess(Void blah) {
CoreGUI.getMessageCenter().notify(
new Message("Deleted [" + alertIds.length + "] alerts", Message.Severity.Info));
- System.out.println("Deleted Alerts with id's: " + Arrays.toString(alertIds) + ".");
alertsView.refresh();
}
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(
- "Failed to delete Alerts with id's: " + Arrays.toString(alertIds), caught);
- System.err.println("Failed to delete Alerts with id's " + Arrays.toString(alertIds) + " - cause: "
- + caught);
+ "Failed to delete alerts with id's: " + Arrays.toString(alertIds), caught);
}
});
}
@@ -159,7 +152,7 @@ public class AlertDataSource extends RPCDataSource<Alert> {
public void onSuccess(PageList<Alert> result) {
long fetchTime = System.currentTimeMillis() - start;
- System.out.println(result.size() + " Alerts fetched in: " + fetchTime + "ms");
+ System.out.println(result.size() + " alerts fetched in: " + fetchTime + "ms");
response.setData(buildRecords(result));
// For paging to work, we have to specify size of full result set.
@@ -206,7 +199,7 @@ public class AlertDataSource extends RPCDataSource<Alert> {
record.setAttribute("resourceName", from.getAlertDefinition().getResource().getName());
record.setAttribute("name", from.getAlertDefinition().getName());
record.setAttribute("priority", from.getAlertDefinition().getPriority().name());
- record.setAttribute("ctime", DATE_TIME_FORMAT.format(new Date(from.getCtime())));
+ record.setAttribute("ctime", from.getCtime());
if (from.getAcknowledgeTime() > 0) {
record.setAttribute("ack", "true");
}
@@ -264,7 +257,6 @@ public class AlertDataSource extends RPCDataSource<Alert> {
dc.setAttribute("message", log.getMessage());
notifications[i++] = dc;
-
}
record.setAttribute("notificationLogs", notifications);
return record;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
index 8983ffe..83d3481 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertsView.java
@@ -44,6 +44,7 @@ import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
/**
* A view that displays a paginated table of fired {@link org.rhq.core.domain.alert.Alert alert}s, along with the
@@ -101,7 +102,9 @@ public class AlertsView extends Table {
listGrid.getField("resourceName").setWidth("20%");
// listGrid.getField("recoveryInfo").setWidth("20%");
listGrid.getField("priority").setWidth("7%");
- listGrid.getField("ctime").setWidth("13%");
+ ListGridField ctimeField = listGrid.getField("ctime");
+ ctimeField.setWidth("13%");
+ ctimeField.setCellFormatter(new TimestampCellFormatter());
listGrid.getField("ack").setWidth("5%");
listGrid.getField("resourceName").setCellFormatter(new CellFormatter() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitDataSource.java
index 3b92ea4..d529087 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitDataSource.java
@@ -48,7 +48,6 @@ public abstract class AbstractMeasurementDataTraitDataSource extends RPCDataSour
protected AbstractMeasurementDataTraitDataSource() {
setCanMultiSort(true);
-
List<DataSourceField> fields = createFields();
addFields(fields);
}
@@ -56,6 +55,8 @@ public abstract class AbstractMeasurementDataTraitDataSource extends RPCDataSour
protected List<DataSourceField> createFields() {
List<DataSourceField> fields = new ArrayList<DataSourceField>();
+ // Note: The fields
+
DataSourceIntegerField idField = new DataSourceIntegerField(MeasurementDataTraitCriteria.SORT_FIELD_SCHEDULE_ID,
"Id");
idField.setHidden(true);
@@ -67,14 +68,14 @@ public abstract class AbstractMeasurementDataTraitDataSource extends RPCDataSour
// TODO: Include description from metric def?
- DataSourceIntegerField timestampField = new DataSourceIntegerField(MeasurementDataTraitCriteria.SORT_FIELD_TIMESTAMP,
- "Last Changed");
- fields.add(timestampField);
-
DataSourceTextField valueField = new DataSourceTextField(MeasurementDataTraitCriteria.SORT_FIELD_VALUE,
"Value");
fields.add(valueField);
+ DataSourceIntegerField timestampField = new DataSourceIntegerField(MeasurementDataTraitCriteria.SORT_FIELD_TIMESTAMP,
+ "Last Changed");
+ fields.add(timestampField);
+
return fields;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java
index fb30a06..47bfa5f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.gui.coregui.client.inventory.common;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.SortSpecifier;
+import com.smartgwt.client.types.SelectionStyle;
import com.smartgwt.client.types.SortDirection;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
@@ -53,6 +54,9 @@ public abstract class AbstractMeasurementDataTraitListView extends Table {
super.onInit();
ListGrid listGrid = getListGrid();
+ listGrid.setSelectionType(SelectionStyle.SINGLE);
+
+ // Set widths and cell formatters on the fields.
listGrid.getField(MeasurementDataTraitCriteria.SORT_FIELD_NAME).setWidth("20%");
listGrid.getField(MeasurementDataTraitCriteria.SORT_FIELD_VALUE).setWidth("60%");
ListGridField timestampField = listGrid.getField(MeasurementDataTraitCriteria.SORT_FIELD_TIMESTAMP);
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 55379d1..bcb0f00 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
@@ -57,6 +57,8 @@ public abstract class AbstractMeasurementScheduleListView extends Table {
super.onInit();
ListGrid listGrid = getListGrid();
+
+ // Set widths and cell formatters on the fields.
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%");
@@ -67,6 +69,7 @@ public abstract class AbstractMeasurementScheduleListView extends Table {
intervalField.setCellFormatter(new MillisecondsCellFormatter());
intervalField.setWidth("25%");
+ // Add action buttons and widgets.
addTableAction("Enable", Table.SelectionEnablement.ANY, null, new TableAction() {
public void executeAction(ListGridRecord[] selection) {
getDataSource().enableSchedules(AbstractMeasurementScheduleListView.this);
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 1b6f6cd..950d28c 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
@@ -19,6 +19,7 @@
package org.rhq.enterprise.gui.coregui.client.util;
import java.util.Collection;
+import java.util.List;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
@@ -36,6 +37,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
* Base GWT-RPC oriented DataSource class.
*
* @author Greg Hinkle
+ * @author Ian Springer
*/
public abstract class RPCDataSource<T> extends DataSource {
@@ -171,9 +173,16 @@ public abstract class RPCDataSource<T> extends DataSource {
return response;
}
- public void addFields(Collection<DataSourceField> fields) {
+ /**
+ * Add the specified fields to this data source. When the data source is associated with a
+ * {@link com.smartgwt.client.widgets.grid.ListGrid}, the fields will be displayed in the order they are specified
+ * here.
+ *
+ * @param fields the fields to be added
+ */
+ public void addFields(List<DataSourceField> fields) {
for (DataSourceField field : fields) {
- addField(field);
+ addField(field);
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/Message.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/Message.java
index 410853f..7e2eef4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/Message.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/message/Message.java
@@ -30,6 +30,7 @@ public class Message {
protected Date fired = new Date();
protected Severity severity;
+ // TODO: Add Debug severity?
public enum Severity { Info, Warning, Error };
public Message(String title, Severity severity) {
@@ -43,6 +44,4 @@ public class Message {
this.severity = severity;
}
-
-
}
commit 3023ab1440402effbdae2b366ac05f44a58ae5d1
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Aug 23 00:42:17 2010 -0400
Adding initial support for setting up user-defined classpath
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ClasspathInitializer.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ClasspathInitializer.groovy
new file mode 100644
index 0000000..584c364
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ClasspathInitializer.groovy
@@ -0,0 +1,10 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+import org.codehaus.groovy.control.CompilerConfiguration
+
+class ClasspathInitializer {
+
+ def initClasspath(String paths, String libDirs, scriptClassLoader) {
+ paths.eachLine { scriptClassLoader.addClasspath(it.trim()) }
+ }
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
index fc34aa0..6c9c44d 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
@@ -52,10 +52,13 @@ class ScriptRunner implements ServerPluginComponent, ControlFacet {
compilerConfig.scriptBaseClass = RHQScript.class.name
def scriptName = parameters.getSimpleValue("script", null)
+ def paths = parameters.getSimpleValue("classpath", '')
log.debug("Preparing to execute script, $scriptName")
def scriptClassLoader = new GroovyClassLoader(Thread.currentThread().contextClassLoader, compilerConfig)
+ new ClasspathInitializer().initClasspath(paths, null, scriptClassLoader)
+
def scriptRoots = new URL[1]
scriptRoots[0] = new File(scriptName).toURI().toURL()
def scriptEngine = new GroovyScriptEngine(scriptRoots, scriptClassLoader)
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
index 86a2e3a..fe6e665 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -27,9 +27,22 @@
<!--</c:simple-property>-->
<!--</c:map-property>-->
<!--</c:list-property>-->
+ <c:simple-property name="classpath"
+ type="longString"
+ required="false"
+ description="A list of classpath entries. Each entry must be placed on its own line.
+ This can refer to class directories, groovy source directories, and JAR
+ files."/>
+ <c:simple-property name="libDirs"
+ displayName="Library Directories"
+ type="longString"
+ required="false"
+ description="A list of JAR file directories. Each path must be placed on its own
+ line. Each JAR file found in a directory will be added to the
+ classspath."/>
</serverplugin:parameters>
<serverplugin:results>
- <c:simple-property name="results"/>
+ <c:simple-property name="results" type="longString"/>
</serverplugin:results>
</serverplugin:control>
</serverplugin:plugin-component>
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ClasspathInitializerTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ClasspathInitializerTest.groovy
new file mode 100644
index 0000000..028f72c
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ClasspathInitializerTest.groovy
@@ -0,0 +1,33 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+import org.testng.annotations.Test
+
+import static org.testng.Assert.*
+
+class ClasspathInitializerTest {
+
+ @Test
+ void addPathsToClasspathInSpecifiedOrder() {
+ def paths = """
+ /foo/scripts
+ /foo/classes
+ /foo/lib/dep1.jar
+ /foo/lib/dep2.jar
+ """.trim()
+
+ def expected = ['/foo/scripts', '/foo/classes', '/foo/lib/dep1.jar', '/foo/lib/dep2.jar']
+ def actual = []
+
+ def classLoader = [addClasspath: {String path -> actual << path }]
+
+ new ClasspathInitializer().initClasspath(paths, '', classLoader)
+
+ assertEquals(actual, expected, "Failed to add paths or add them in correct order to classpath")
+ }
+
+// @Test
+// void addJarsInEachLibDirToClasspath() {
+//
+// }
+
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
index 6900943..0b2b90c 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
@@ -99,6 +99,11 @@ class ScriptRunnerTest {
)
}
+ @Test
+ void addPathsToScriptClasspath() {
+
+ }
+
def executeScript(String script) {
def params = new Configuration()
params.put(new PropertySimple('script', getScriptPath(script)))
commit 3247f3ba5b2cc365e787f720505e695059074c42
Author: John Sanda <jsanda(a)redhat.com>
Date: Sun Aug 22 21:45:33 2010 -0400
Fixing compilation error
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index 6c2c7f1..96dcdd2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -30,6 +30,7 @@ import java.util.Map;
import java.util.Set;
import javax.ejb.Stateless;
+import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
@@ -76,6 +77,7 @@ import org.rhq.core.domain.criteria.Criteria;
import org.rhq.core.domain.criteria.EventCriteria;
import org.rhq.core.domain.criteria.GroupOperationHistoryCriteria;
import org.rhq.core.domain.criteria.InstalledPackageCriteria;
+import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
import org.rhq.core.domain.criteria.MeasurementDefinitionCriteria;
import org.rhq.core.domain.criteria.MeasurementScheduleCriteria;
import org.rhq.core.domain.criteria.OperationDefinitionCriteria;
@@ -575,6 +577,10 @@ public class WebservicesManagerBean implements WebservicesRemote {
return measurementDataManager.getAggregate(subject, scheduleId, startTime, endTime);
}
+ public PageList<MeasurementDataTrait> findTraitsByCriteria(Subject subject, MeasurementDataTraitCriteria criteria) {
+ return measurementDataManager.findTraitsByCriteria(subject, criteria);
+ }
+
//MEASUREMENTDATAMANAGER: END ----------------------------------
//MEASUREMENTDEFINITIONMANAGER: BEGIN ----------------------------------
commit 9354219518ccaf95c7cc5bee0e5c73c456d1b424
Author: John Sanda <jsanda(a)redhat.com>
Date: Sun Aug 22 21:37:06 2010 -0400
Adding logging
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
index 7dcc19b..b2cf489 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
@@ -14,6 +14,8 @@ class CriteriaGenerator {
def clazz
def criteria
+ log.debug("Preparing to generate $className")
+
try {
clazz = Class.forName(className)
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
index 033c149..534c050 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
@@ -1,9 +1,12 @@
package org.rhq.enterprise.server.plugins.groovy
import org.rhq.enterprise.server.util.LookupUtil
+import org.apache.commons.logging.LogFactory
class RHQScript extends Script {
+ static def log = LogFactory.getLog(RHQScript)
+
Map entityMap = [:]
Object run() {
@@ -17,6 +20,7 @@ class RHQScript extends Script {
return LookupUtil."$method"()
}
catch (MissingMethodException e) {
+ log.warn("Could not find a manager SLSB under the name $name", e)
throw new RHQScriptException("Unable to locate $name", e)
}
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
index 3937c51..fc34aa0 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
@@ -13,24 +13,31 @@ import org.rhq.enterprise.server.plugin.pc.ControlResults
import org.rhq.enterprise.server.plugin.pc.ScheduledJobInvocationContext
import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent
import org.rhq.enterprise.server.plugin.pc.ServerPluginContext
+import org.apache.commons.logging.LogFactory
class ScriptRunner implements ServerPluginComponent, ControlFacet {
+ static def log = LogFactory.getLog(ScriptRunner)
+
String entityPackagePrefix = "org.rhq.core.domain"
Map entityMap = [:]
void initialize(ServerPluginContext context) {
- def reflections = new Reflections(new ConfigurationBuilder()
- .setUrls(ClasspathHelper.getUrlsForPackagePrefix(entityPackagePrefix))
- .setScanners(new TypeAnnotationsScanner()));
+ log.debug("Initializing plugin")
+ log.debug("Preparing to scan classpath for entities and build entity map cache")
+
+ def reflections = new Reflections(new ConfigurationBuilder()
+ .setUrls(ClasspathHelper.getUrlsForPackagePrefix(entityPackagePrefix))
+ .setScanners(new TypeAnnotationsScanner()));
def classes = reflections.getTypesAnnotatedWith(Entity.class)
+ log.debug("Found ${classes.size()} entities")
+
classes.each { entityMap << [(it.simpleName.toString()): it] }
}
void start() {
-
}
void stop() {
@@ -38,7 +45,6 @@ class ScriptRunner implements ServerPluginComponent, ControlFacet {
}
void shutdown() {
-
}
ControlResults invoke(String name, Configuration parameters) {
@@ -47,6 +53,8 @@ class ScriptRunner implements ServerPluginComponent, ControlFacet {
def scriptName = parameters.getSimpleValue("script", null)
+ log.debug("Preparing to execute script, $scriptName")
+
def scriptClassLoader = new GroovyClassLoader(Thread.currentThread().contextClassLoader, compilerConfig)
def scriptRoots = new URL[1]
scriptRoots[0] = new File(scriptName).toURI().toURL()
@@ -63,9 +71,11 @@ class ScriptRunner implements ServerPluginComponent, ControlFacet {
try {
def scriptResult = script.run()
+ log.debug("Finished executing $scriptName")
results.complexResults.put(new PropertySimple("results", scriptResult))
}
catch (Throwable t) {
+ log.warn("An error occurred while executing $scriptName", t)
results.error = t
}
commit bd5c6b8622181643df09c1c775b2861f313efd1b
Merge: fdc507c... 2fee0bd...
Author: John Sanda <jsanda(a)redhat.com>
Date: Sun Aug 22 21:19:48 2010 -0400
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 2fee0bd59336c0ca99782ea2580c81bfe894d615
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Mon Aug 23 19:12:50 2010 -0400
implement Resource and group Monitoring>Traits subtabs
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDataTraitCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDataTraitCriteria.java
new file mode 100644
index 0000000..2fd4dcf
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDataTraitCriteria.java
@@ -0,0 +1,127 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.criteria;
+
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.core.domain.util.PageOrdering;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+
+/**
+ * RHQ {@link Criteria} object for filtered, sortable queries of {@link MeasurementDataTrait} data sets.
+ *
+ * @author Ian Springer
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@SuppressWarnings("unused")
+public class MeasurementDataTraitCriteria extends Criteria {
+ private static final long serialVersionUID = 1L;
+
+ // sort fields
+ public static final String SORT_FIELD_SCHEDULE_ID = "scheduleId";
+ public static final String SORT_FIELD_TIMESTAMP = "timestamp";
+ public static final String SORT_FIELD_NAME = "name";
+ public static final String SORT_FIELD_VALUE = "value";
+
+ // filter fields
+ public static final String FILTER_FIELD_SCHEDULE_ID = "scheduleId";
+ public static final String FILTER_FIELD_RESOURCE_ID = "resourceId";
+ public static final String FILTER_FIELD_GROUP_ID = "groupId";
+ public static final String FILTER_FIELD_MAX_TIMESTAMP = "maxTimestamp";
+
+ private Integer filterScheduleId; // requires overrides
+ private Integer filterResourceId; // requires overrides
+ private Integer filterGroupId; // requires overrides
+ private Boolean filterMaxTimestamp; // requires overrides
+
+ private boolean fetchSchedule;
+
+ private PageOrdering sortScheduleId; // requires overrides
+ private PageOrdering sortTimestamp; // requires overrides
+ private PageOrdering sortName; // requires overrides
+
+ public MeasurementDataTraitCriteria() {
+ filterOverrides.put(FILTER_FIELD_SCHEDULE_ID, "id.scheduleId = ?");
+ filterOverrides.put(FILTER_FIELD_RESOURCE_ID, "schedule.resource.id = ?");
+ filterOverrides.put(FILTER_FIELD_GROUP_ID, "schedule.resource.id IN " //
+ + "( SELECT res.id " //
+ + " FROM Resource res " //
+ + " JOIN res.implicitGroups ig " //
+ + " WHERE ig.id = ? )");
+ filterOverrides.put(FILTER_FIELD_MAX_TIMESTAMP, "id.timestamp = " //
+ + "( SELECT MAX(mdt.id.timestamp) "
+ + " FROM MeasurementDataTrait mdt "
+ + " WHERE mdt.id.scheduleId = id.scheduleId )");
+
+ sortOverrides.put(SORT_FIELD_SCHEDULE_ID, "id.scheduleId");
+ sortOverrides.put(SORT_FIELD_TIMESTAMP, "id.timestamp");
+ sortOverrides.put(SORT_FIELD_NAME, "schedule.definition.displayName");
+ }
+
+ @Override
+ public Class getPersistentClass() {
+ return MeasurementDataTrait.class;
+ }
+
+ public void addFilterScheduleId(Integer filterScheduleId) {
+ this.filterScheduleId = filterScheduleId;
+ }
+
+ public void addFilterResourceId(Integer filterResourceId) {
+ if (this.filterGroupId != null) {
+ throw new IllegalArgumentException("This criteria cannot be filtered by both a Resource id and a group id.");
+ }
+ this.filterResourceId = filterResourceId;
+ }
+
+ public void addFilterGroupId(Integer filterGroupId) {
+ if (this.filterResourceId != null) {
+ throw new IllegalArgumentException("This criteria cannot be filtered by both a Resource id and a group id.");
+ }
+ this.filterGroupId = filterGroupId;
+ }
+
+ public void addFilterMaxTimestamp(Boolean filterMaxTimestamp) {
+ this.filterMaxTimestamp = filterMaxTimestamp;
+ }
+
+ public void fetchSchedule(boolean fetchSchedule) {
+ this.fetchSchedule = fetchSchedule;
+ }
+
+ public void addSortScheduleId(PageOrdering sortScheduleId) {
+ addSortField(SORT_FIELD_SCHEDULE_ID);
+ this.sortScheduleId = sortScheduleId;
+ }
+
+ public void addSortTimestamp(PageOrdering sortTimestamp) {
+ addSortField(SORT_FIELD_TIMESTAMP);
+ this.sortTimestamp = sortTimestamp;
+ }
+
+ public void addSortName(PageOrdering sortName) {
+ addSortField(SORT_FIELD_NAME);
+ this.sortName = sortName;
+ }
+}
\ No newline at end of file
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementData.java b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementData.java
index 7fefa3e..7c96309 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementData.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementData.java
@@ -96,6 +96,10 @@ public abstract class MeasurementData implements Serializable {
this.name = name;
}
+ public MeasurementSchedule getSchedule() {
+ return schedule;
+ }
+
public abstract Object getValue();
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java
new file mode 100644
index 0000000..9d0952b
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TimestampCellFormatter.java
@@ -0,0 +1,34 @@
+package org.rhq.enterprise.gui.coregui.client.components.table;
+
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+import java.util.Date;
+
+/**
+ * Formats a timestamp (i.e. milliseconds since Epoch).
+ *
+ * @author Ian Springer
+ */
+public class TimestampCellFormatter implements CellFormatter {
+ private static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getMediumDateTimeFormat();
+
+ public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
+ if (value == null) {
+ return "";
+ }
+ long longValue;
+ if (value instanceof Long) {
+ longValue = (Long)value;
+ } else if (value instanceof Integer) {
+ longValue = (Integer)value;
+ } else if (value instanceof String) {
+ longValue = Long.parseLong((String)value);
+ } else {
+ throw new IllegalArgumentException("value parameter is not a Long, an Integer, or a String.");
+ }
+ Date date = new Date(longValue);
+ return DATE_TIME_FORMAT.format(date);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java
index cf1a9a2..9297d96 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/MeasurementDataGWTService.java
@@ -24,6 +24,7 @@ import java.util.Set;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
+import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
import org.rhq.core.domain.criteria.MeasurementDefinitionCriteria;
import org.rhq.core.domain.criteria.MeasurementScheduleCriteria;
import org.rhq.core.domain.measurement.DisplayType;
@@ -74,4 +75,6 @@ public interface MeasurementDataGWTService extends RemoteService {
void updateSchedulesForCompatibleGroup(int resourceGroupId, int[] measurementDefinitionIds, long collectionInterval);
+ PageList<MeasurementDataTrait> findTraitsByCriteria(MeasurementDataTraitCriteria criteria);
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitDataSource.java
new file mode 100644
index 0000000..3b92ea4
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitDataSource.java
@@ -0,0 +1,146 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.common;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.fields.*;
+import com.smartgwt.client.rpc.RPCResponse;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.MeasurementDataGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A server-side SmartGWT DataSource for reading {@link MeasurementDataTrait trait data}.
+ *
+ * @author Ian Springer
+ */
+public abstract class AbstractMeasurementDataTraitDataSource extends RPCDataSource<MeasurementDataTrait> {
+ private MeasurementDataGWTServiceAsync measurementService = GWTServiceLookup.getMeasurementDataService();
+
+ protected AbstractMeasurementDataTraitDataSource() {
+ setCanMultiSort(true);
+
+ List<DataSourceField> fields = createFields();
+ addFields(fields);
+ }
+
+ protected List<DataSourceField> createFields() {
+ List<DataSourceField> fields = new ArrayList<DataSourceField>();
+
+ DataSourceIntegerField idField = new DataSourceIntegerField(MeasurementDataTraitCriteria.SORT_FIELD_SCHEDULE_ID,
+ "Id");
+ idField.setHidden(true);
+ fields.add(idField);
+
+ DataSourceTextField nameField = new DataSourceTextField(MeasurementDataTraitCriteria.SORT_FIELD_NAME,
+ "Trait");
+ fields.add(nameField);
+
+ // TODO: Include description from metric def?
+
+ DataSourceIntegerField timestampField = new DataSourceIntegerField(MeasurementDataTraitCriteria.SORT_FIELD_TIMESTAMP,
+ "Last Changed");
+ fields.add(timestampField);
+
+ DataSourceTextField valueField = new DataSourceTextField(MeasurementDataTraitCriteria.SORT_FIELD_VALUE,
+ "Value");
+ fields.add(valueField);
+
+ return fields;
+ }
+
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ final long startTime = System.currentTimeMillis();
+
+ final MeasurementDataTraitCriteria criteria = getCriteria(request);
+
+ this.measurementService.findTraitsByCriteria(criteria, new AsyncCallback<PageList<MeasurementDataTrait>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to fetch traits for criteria " + criteria,
+ caught);
+ response.setStatus(RPCResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<MeasurementDataTrait> result) {
+ long fetchDuration = System.currentTimeMillis() - startTime;
+ System.out.println(result.size() + " traits fetched in: " + fetchDuration + "ms");
+
+ response.setData(buildRecords(result));
+ // For paging to work, we have to specify size of full result set.
+ response.setTotalRows(result.getTotalSize());
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ protected MeasurementDataTraitCriteria getCriteria(DSRequest request) {
+ MeasurementDataTraitCriteria criteria = new MeasurementDataTraitCriteria();
+
+ Criteria requestCriteria = request.getCriteria();
+ if (requestCriteria != null) {
+ Map values = requestCriteria.getValues();
+ for (Object key : values.keySet()) {
+ String fieldName = (String) key;
+ if (fieldName.equals(MeasurementDataTraitCriteria.FILTER_FIELD_RESOURCE_ID)) {
+ Integer resourceId = (Integer) values.get(fieldName);
+ criteria.addFilterResourceId(resourceId);
+ } else if (fieldName.equals(MeasurementDataTraitCriteria.FILTER_FIELD_GROUP_ID)) {
+ Integer groupId = (Integer) values.get(fieldName);
+ criteria.addFilterGroupId(groupId);
+ }
+ }
+ }
+
+ criteria.setPageControl(getPageControl(request));
+ return criteria;
+ }
+
+ @Override
+ public MeasurementDataTrait copyValues(ListGridRecord from) {
+ return null;
+ }
+
+ @Override
+ public ListGridRecord copyValues(MeasurementDataTrait from) {
+ ListGridRecord record = new ListGridRecord();
+
+ record.setAttribute(MeasurementDataTraitCriteria.SORT_FIELD_SCHEDULE_ID, from.getScheduleId());
+ record.setAttribute(MeasurementDataTraitCriteria.SORT_FIELD_TIMESTAMP, from.getTimestamp());
+ record.setAttribute(MeasurementDataTraitCriteria.SORT_FIELD_NAME, from.getSchedule().getDefinition().getDisplayName());
+ record.setAttribute(MeasurementDataTraitCriteria.SORT_FIELD_VALUE, from.getValue());
+
+ // TODO: resourceId and resourceGroupId (in subclasses)
+
+ return record;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java
new file mode 100644
index 0000000..fb30a06
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMeasurementDataTraitListView.java
@@ -0,0 +1,62 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.common;
+
+import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.SortSpecifier;
+import com.smartgwt.client.types.SortDirection;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
+import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
+
+/**
+ * A view that displays a non-paginated table of {@link org.rhq.core.domain.measurement.MeasurementDataTrait trait}s,
+ * along with the ability to sort those traits.
+ *
+ * @author Ian Springer
+ */
+public abstract class AbstractMeasurementDataTraitListView extends Table {
+ private static final SortSpecifier[] SORT_SPECIFIERS = new SortSpecifier[] { new SortSpecifier(
+ MeasurementDataTraitCriteria.SORT_FIELD_NAME, SortDirection.ASCENDING) };
+
+ public AbstractMeasurementDataTraitListView(String title, AbstractMeasurementDataTraitDataSource dataSource,
+ Criteria criteria, String[] excludedFieldNames) {
+ super(title, criteria, SORT_SPECIFIERS, excludedFieldNames);
+ setDataSource(dataSource);
+ }
+
+ @Override
+ public AbstractMeasurementDataTraitDataSource getDataSource() {
+ return (AbstractMeasurementDataTraitDataSource) super.getDataSource();
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ ListGrid listGrid = getListGrid();
+ listGrid.getField(MeasurementDataTraitCriteria.SORT_FIELD_NAME).setWidth("20%");
+ listGrid.getField(MeasurementDataTraitCriteria.SORT_FIELD_VALUE).setWidth("60%");
+ ListGridField timestampField = listGrid.getField(MeasurementDataTraitCriteria.SORT_FIELD_TIMESTAMP);
+ timestampField.setWidth("20%");
+ timestampField.setCellFormatter(new TimestampCellFormatter());
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index a9a6989..5f05bef 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -43,6 +43,7 @@ import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedH
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSet;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.schedules.SchedulesView;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.traits.TraitsView;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary.OverviewView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -91,7 +92,7 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
summaryTab.registerSubTabs("Overview", "Timeline");
monitoringTab = new TwoLevelTab("Monitoring", "/images/icons/Monitor_grey_16.png");
- monitoringTab.registerSubTabs("Graphs", "Tables", "Schedules", "Call Time");
+ monitoringTab.registerSubTabs("Graphs", "Tables", "Traits", "Schedules", "Call Time");
inventoryTab = new TwoLevelTab("Inventory", "/images/icons/Inventory_grey_16.png");
inventoryTab.registerSubTabs("Members", "Connection Settings");
@@ -138,6 +139,7 @@ public class ResourceGroupDetailView extends VLayout implements BookmarkableView
+ groupId));
monitoringTab.updateSubTab("Tables", new FullHTMLPane("/rhq/group/monitor/tables-plain.xhtml?groupId="
+ groupId));
+ monitoringTab.updateSubTab("Traits", new TraitsView(groupId));
monitoringTab.updateSubTab("Schedules", new SchedulesView(groupId));
//new FullHTMLPane("/rhq/group/monitor/schedules-plain.xhtml?groupId=" + groupId));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsDataSource.java
new file mode 100644
index 0000000..a9abcaf
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsDataSource.java
@@ -0,0 +1,58 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.traits;
+
+import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractMeasurementDataTraitDataSource;
+
+import java.util.List;
+
+/**
+ * A DataSource for reading traits for the current group.
+ *
+ * @author Ian Springer
+ */
+public class TraitsDataSource extends AbstractMeasurementDataTraitDataSource {
+ private int groupId;
+
+ public TraitsDataSource(int groupId) {
+ this.groupId = groupId;
+ }
+
+ @Override
+ protected List<DataSourceField> createFields() {
+ List<DataSourceField> fields = super.createFields();
+ DataSourceField groupIdField = new DataSourceIntegerField(MeasurementDataTraitCriteria.FILTER_FIELD_GROUP_ID,
+ "Group Id");
+ groupIdField.setHidden(true);
+ fields.add(groupIdField);
+ return fields;
+ }
+
+ @Override
+ public ListGridRecord copyValues(MeasurementDataTrait from) {
+ ListGridRecord record = super.copyValues(from);
+ record.setAttribute(MeasurementDataTraitCriteria.FILTER_FIELD_GROUP_ID, this.groupId);
+ return record;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsView.java
new file mode 100644
index 0000000..e071fe8
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsView.java
@@ -0,0 +1,48 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.monitoring.traits;
+
+import com.smartgwt.client.data.Criteria;
+import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractMeasurementDataTraitListView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits.TraitsDataSource;
+
+/**
+ * The group Monitoring>Traits subtab.
+ *
+ * @author Ian Springer
+ */
+public class TraitsView extends AbstractMeasurementDataTraitListView {
+
+ private static final String TITLE = "Traits";
+
+ private static final String[] EXCLUDED_FIELD_NAMES = new String[] { MeasurementDataTraitCriteria.FILTER_FIELD_GROUP_ID };
+
+ public TraitsView(int groupId) {
+ super(TITLE, new TraitsDataSource(groupId), createCriteria(groupId), EXCLUDED_FIELD_NAMES);
+ // TODO (ips): add column for Resource name
+ // TODO (ips): group rows by trait
+ }
+
+ private static Criteria createCriteria(int groupId) {
+ Criteria criteria = new Criteria();
+ criteria.addCriteria(MeasurementDataTraitCriteria.FILTER_FIELD_GROUP_ID, groupId);
+ return criteria;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 5c0671c..d6a7d8b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -44,6 +44,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configura
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.PluginConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.schedules.SchedulesView;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits.TraitsView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.DashboardView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.summary.OverviewView;
@@ -141,8 +142,8 @@ public class ResourceDetailView extends VLayout implements BookmarkableView, Res
monitoringTab.updateSubTab("Graphs", new GraphListView(resource)); // new FullHTMLPane("/rhq/common/monitor/graphs.xhtml?id=" + resource.getId()));
monitoringTab.updateSubTab("Tables", new FullHTMLPane("/rhq/common/monitor/tables-plain.xhtml?id="
+ resource.getId()));
- monitoringTab.updateSubTab("Traits", new FullHTMLPane("/rhq/resource/monitor/traits-plain.xhtml?id="
- + resource.getId()));
+ monitoringTab.updateSubTab("Traits", new TraitsView(resource.getId()));
+ //new FullHTMLPane("/rhq/resource/monitor/traits-plain.xhtml?id=" + resource.getId()));
monitoringTab.updateSubTab("Availability", new FullHTMLPane(
"/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId()));
monitoringTab.updateSubTab("Schedules", new SchedulesView(resource.getId()));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsDataSource.java
new file mode 100644
index 0000000..77cb4bb
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsDataSource.java
@@ -0,0 +1,58 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits;
+
+import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.fields.DataSourceIntegerField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractMeasurementDataTraitDataSource;
+
+import java.util.List;
+
+/**
+ * A DataSource for reading traits for the current Resource.
+ *
+ * @author Ian Springer
+ */
+public class TraitsDataSource extends AbstractMeasurementDataTraitDataSource {
+ private int resourceId;
+
+ public TraitsDataSource(int resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ @Override
+ protected List<DataSourceField> createFields() {
+ List<DataSourceField> fields = super.createFields();
+ DataSourceField resourceIdField = new DataSourceIntegerField(MeasurementDataTraitCriteria.FILTER_FIELD_RESOURCE_ID,
+ "Resource Id");
+ resourceIdField.setHidden(true);
+ fields.add(resourceIdField);
+ return fields;
+ }
+
+ @Override
+ public ListGridRecord copyValues(MeasurementDataTrait from) {
+ ListGridRecord record = super.copyValues(from);
+ record.setAttribute(MeasurementDataTraitCriteria.FILTER_FIELD_RESOURCE_ID, this.resourceId);
+ return record;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsView.java
new file mode 100644
index 0000000..8ae344c
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/traits/TraitsView.java
@@ -0,0 +1,45 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits;
+
+import com.smartgwt.client.data.Criteria;
+import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
+import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractMeasurementDataTraitListView;
+
+/**
+ * The Resource Monitoring>Traits subtab.
+ *
+ * @author Ian Springer
+ */
+public class TraitsView extends AbstractMeasurementDataTraitListView {
+
+ private static final String TITLE = "Traits";
+
+ private static final String[] EXCLUDED_FIELD_NAMES = new String[] { MeasurementDataTraitCriteria.FILTER_FIELD_RESOURCE_ID };
+
+ public TraitsView(int resourceId) {
+ super(TITLE, new TraitsDataSource(resourceId), createCriteria(resourceId), EXCLUDED_FIELD_NAMES);
+ }
+
+ private static Criteria createCriteria(int resourceId) {
+ Criteria criteria = new Criteria();
+ criteria.addCriteria(MeasurementDataTraitCriteria.FILTER_FIELD_RESOURCE_ID, resourceId);
+ return criteria;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java
index 52b5619..78232b6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/MeasurementDataGWTServiceImpl.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.gui.coregui.server.gwt;
import java.util.List;
import java.util.Set;
+import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
import org.rhq.core.domain.criteria.MeasurementDefinitionCriteria;
import org.rhq.core.domain.criteria.MeasurementScheduleCriteria;
import org.rhq.core.domain.measurement.DisplayType;
@@ -136,6 +137,10 @@ public class MeasurementDataGWTServiceImpl extends AbstractGWTServiceImpl implem
collectionInterval);
}
+ public PageList<MeasurementDataTrait> findTraitsByCriteria(MeasurementDataTraitCriteria criteria) {
+ return SerialUtility.prepare(dataManager.findTraitsByCriteria(getSessionSubject(), criteria),
+ "MeasurementDataService.findTraitsByCriteria");
+ }
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBean.java
index b3b4eff..3fece05 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBean.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2010 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -55,6 +55,7 @@ import org.rhq.core.db.DatabaseType;
import org.rhq.core.db.DatabaseTypeFactory;
import org.rhq.core.db.Postgresql83DatabaseType;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.DisplayType;
import org.rhq.core.domain.measurement.MeasurementData;
@@ -69,6 +70,7 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.OrderingField;
+import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.core.server.PersistenceUtility;
import org.rhq.core.util.collection.ArrayUtils;
@@ -88,6 +90,8 @@ import org.rhq.enterprise.server.measurement.instrumentation.MeasurementMonitor;
import org.rhq.enterprise.server.measurement.uibean.MetricDisplaySummary;
import org.rhq.enterprise.server.measurement.util.MeasurementDataManagerUtility;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
+import org.rhq.enterprise.server.util.CriteriaQueryRunner;
/**
* A manager for {@link MeasurementData}s.
@@ -823,6 +827,32 @@ public class MeasurementDataManagerBean implements MeasurementDataManagerLocal,
return result;
}
+ public PageList<MeasurementDataTrait> findTraitsByCriteria(Subject subject, MeasurementDataTraitCriteria criteria) {
+ CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
+
+ Map<String, Object> filterFields = generator.getFilterFields(criteria);
+ if (!this.authorizationManager.isInventoryManager(subject)) {
+ if (filterFields.get(MeasurementDataTraitCriteria.FILTER_FIELD_GROUP_ID) != null) {
+ generator.setAuthorizationResourceFragment(CriteriaQueryGenerator.AuthorizationTokenType.GROUP,
+ subject.getId());
+ } else {
+ generator.setAuthorizationResourceFragment(CriteriaQueryGenerator.AuthorizationTokenType.RESOURCE,
+ subject.getId());
+ }
+ }
+
+ CriteriaQueryRunner<MeasurementDataTrait> queryRunner = new CriteriaQueryRunner(criteria, generator,
+ this.entityManager);
+ PageList<MeasurementDataTrait> results = queryRunner.execute();
+
+ // Fetch the definitions, so the results include the trait names.
+ for (MeasurementDataTrait result : results) {
+ result.getSchedule().getDefinition();
+ }
+
+ return results;
+ }
+
private MeasurementDataManagerUtility getConnectedUtilityInstance() {
return MeasurementDataManagerUtility.getInstance(rhqDs);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerLocal.java
index de557d0..7e4d87c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerLocal.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2010 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -26,6 +26,8 @@ import java.util.Set;
import javax.ejb.Local;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
+import org.rhq.core.domain.criteria.MeasurementScheduleCriteria;
import org.rhq.core.domain.measurement.DisplayType;
import org.rhq.core.domain.measurement.MeasurementData;
import org.rhq.core.domain.measurement.MeasurementDataNumeric;
@@ -37,6 +39,7 @@ import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowCo
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.common.EntityContext;
import org.rhq.enterprise.server.measurement.uibean.MetricDisplaySummary;
@@ -150,6 +153,16 @@ public interface MeasurementDataManagerLocal {
List<MeasurementDataTrait> findCurrentTraitsForResource(Subject subject, int resourceId, DisplayType displayType);
/**
+ * Finds traits that match the specified {@link MeasurementDataTraitCriteria criteria}.
+ *
+ * @param subject the user that is requesting the traits
+ * @param criteria the criteria by which to filter the traits
+ *
+ * @return the traits that match the specified {@link MeasurementDataTraitCriteria criteria}; never null
+ */
+ PageList<MeasurementDataTrait> findTraitsByCriteria(Subject subject, MeasurementDataTraitCriteria criteria);
+
+ /**
* Get live metrics for a given MeasurementSchedule
*
* @param sched MeasurementSchedule to obtain the data for
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerRemote.java
index 6549d2c..032f8f9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerRemote.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2010 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -29,10 +29,12 @@ import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.criteria.MeasurementDataTraitCriteria;
import org.rhq.core.domain.measurement.DisplayType;
import org.rhq.core.domain.measurement.MeasurementData;
import org.rhq.core.domain.measurement.MeasurementDataTrait;
import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.jaxb.adapter.MeasurementDataNumericHighLowCompositeAdapter;
import org.rhq.enterprise.server.system.ServerVersion;
@@ -60,6 +62,11 @@ public interface MeasurementDataManagerRemote {
@WebParam(name = "displayType") DisplayType displayType);
@WebMethod
+ PageList<MeasurementDataTrait> findTraitsByCriteria( //
+ @WebParam(name = "subject") Subject subject, //
+ @WebParam(name = "criteria") MeasurementDataTraitCriteria criteria);
+
+ @WebMethod
Set<MeasurementData> findLiveData(//
@WebParam(name = "subject") Subject subject, //
@WebParam(name = "resourceId") int resourceId, //
commit 593d4cf0d05238b64584c14d9955f403e01f4f40
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Aug 23 13:05:15 2010 -0400
bz 626497 - add rhq.agent.server.alias to be able to change the name of the server alias to look up (default is "rhqserver").
if you don't define it (e.g. comment it out of the config xml), the DNS lookup is never performed thus forcing the user to configure the server bind address explicitly
diff --git a/etc/agentspawn/src/main/resources/template-configuration.xml b/etc/agentspawn/src/main/resources/template-configuration.xml
index 3a0d65a..4992b96 100644
--- a/etc/agentspawn/src/main/resources/template-configuration.xml
+++ b/etc/agentspawn/src/main/resources/template-configuration.xml
@@ -15,7 +15,7 @@ RHQ Agent Configuration - Default Template For Agent Spawn Utility
<map />
<node name="spawn"> <!-- TO BE OVERRIDDEN -->
<map>
- <entry key="rhq.agent.configuration-schema-version" value="5" />
+ <entry key="rhq.agent.configuration-schema-version" value="6" />
<entry key="rhq.agent.configuration-setup-flag" value="true" />
<entry key="rhq.agent.name" value="127.0.0.1"/> <!-- TO BE OVERRIDDEN -->
diff --git a/etc/agentspawn/src/scripts/agentcopy-agent-configuration.xml b/etc/agentspawn/src/scripts/agentcopy-agent-configuration.xml
index 7d8110e..69b74f3 100644
--- a/etc/agentspawn/src/scripts/agentcopy-agent-configuration.xml
+++ b/etc/agentspawn/src/scripts/agentcopy-agent-configuration.xml
@@ -9,7 +9,7 @@
<map />
<node name="@@@AGENT_NODE@@@">
<map>
- <entry key="rhq.agent.configuration-schema-version" value="5" />
+ <entry key="rhq.agent.configuration-schema-version" value="6" />
<entry key="rhq.agent.configuration-setup-flag" value="true" />
<entry key="rhq.agent.name" value="agentcopy-@@@AGENT_NODE@@@"/>
<entry key="rhq.agent.server.transport" value="@@@rhq.agent.server.transport@(a)@" />
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfiguration.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfiguration.java
index ae41e6f..11a2981 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfiguration.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfiguration.java
@@ -200,9 +200,17 @@ public class AgentConfiguration {
public String getServerBindAddress() {
String address = m_preferences.get(AgentConfigurationConstants.SERVER_BIND_ADDRESS, null);
if (address == null) {
- try {
- address = InetAddress.getByName("rhqserver").getCanonicalHostName();
- } catch (Exception e1) {
+ String alias = m_preferences.get(AgentConfigurationConstants.SERVER_ALIAS, null);
+ if (alias != null) {
+ try {
+ address = InetAddress.getByName(alias).getCanonicalHostName();
+ } catch (Exception e1) {
+ LOG.debug(AgentI18NResourceKeys.SERVER_ALIAS_UNKNOWN, alias, e1);
+ address = null;
+ }
+ }
+
+ if (address == null) {
try {
address = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e2) {
@@ -1413,7 +1421,7 @@ public class AgentConfiguration {
try {
m_preferences.flush();
} catch (Exception e) {
- LOG.warn(LOG.getMsgString(AgentI18NResourceKeys.CANNOT_STORE_PREFERENCES), changedPreference, e);
+ LOG.warn(AgentI18NResourceKeys.CANNOT_STORE_PREFERENCES, changedPreference, e);
}
}
}
\ No newline at end of file
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfigurationConstants.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfigurationConstants.java
index c32d04b..6f21139 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfigurationConstants.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfigurationConstants.java
@@ -58,7 +58,7 @@ public interface AgentConfigurationConstants {
/**
* This is the current schema version that our agent configuration knows about.
*/
- int CURRENT_CONFIG_SCHEMA_VERSION = 5;
+ int CURRENT_CONFIG_SCHEMA_VERSION = 6;
/**
* Flag to indicate if the agent's configuration has been setup.
@@ -112,6 +112,11 @@ public interface AgentConfigurationConstants {
String DEFAULT_SERVER_TRANSPORT_PARAMS = "/jboss-remoting-servlet-invoker/ServerInvokerServlet";
/**
+ * The DNS alias for the RHQ Server - used when the server IP address is not explicitly set.
+ */
+ String SERVER_ALIAS = PROPERTY_NAME_PREFIX + "server.alias";
+
+ /**
* The flag that, if <code>true</code>, will tell the agent to attempt to auto-detect the JON Server coming online
* and going offline.
*/
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfigurationUpgrade.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfigurationUpgrade.java
index 562a487..6c0a2ce 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfigurationUpgrade.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfigurationUpgrade.java
@@ -58,6 +58,7 @@ public class AgentConfigurationUpgrade extends PreferencesUpgrade {
list.add(new Step2to3()); // goes from v2 to v3
list.add(new Step3to4()); // goes from v3 to v4
list.add(new Step4to5()); // goes from v4 to v5
+ list.add(new Step5to6());
return list;
}
@@ -126,4 +127,16 @@ public class AgentConfigurationUpgrade extends PreferencesUpgrade {
}
}
}
+
+ static class Step5to6 extends PreferencesUpgradeStep {
+ public int getSupportedConfigurationSchemaVersion() {
+ return 6;
+ }
+
+ public void upgrade(Preferences preferences) {
+ // This new schema version added rhq.server.alias - to support backwards compatibility, we want
+ // to set this to "rhqserver" which will cause the same behavior that was exhibited in previous versions
+ preferences.put(AgentConfigurationConstants.SERVER_ALIAS, "rhqserver");
+ }
+ }
}
\ No newline at end of file
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java
index eadb493..7920df0 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java
@@ -28,6 +28,9 @@ import mazz.i18n.annotation.I18NResourceBundle;
*/
@I18NResourceBundle(baseName = "agent-messages", defaultLocale = "en")
public interface AgentI18NResourceKeys {
+ @I18NMessage("The configured server alias [{0}] cannot be resolved - will use localhost address. Cause: {1}")
+ String SERVER_ALIAS_UNKNOWN = "AgentConfiguration.server-alias-unknown";
+
@I18NMessage("Specified bad console type [{0}]")
String AGENT_INPUT_READER_FACTORY_BAD_TYPE = "AgentMain.input-reader-factory-bad-type";
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentSetupInstructions.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentSetupInstructions.java
index 985c764..faf3692 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentSetupInstructions.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentSetupInstructions.java
@@ -78,6 +78,16 @@ public interface AgentSetupInstructions {
+ "and all the different values allowed for the specific transport being used.") })
String SETUP_INSTRUCTION_SERVERTRANSPORTPARAMS_HELP = "PromptCommand.setup.instruction.serveruri.transportparams.help";
+ // SERVER ALIAS
+ String SETUP_INSTRUCTION_SERVERALIAS_PREF = AgentConfigurationConstants.SERVER_ALIAS;
+ String SETUP_INSTRUCTION_SERVERALIAS_DEFAULT = null;
+ @I18NMessages( { @I18NMessage("RHQ Server Alias") })
+ String SETUP_INSTRUCTION_SERVERALIAS_PROMPT = "PromptCommand.setup.instruction.serveralias.prompt";
+ @I18NMessages( { @I18NMessage("If the RHQ Server hostname or IP address was not set,\\n\\\n"
+ + "this DNS alias name will be looked up and used as the RHQ Server host.\\n\\\n"
+ + "Not setting this preference will disable this DNS alias lookup feature") })
+ String SETUP_INSTRUCTION_SERVERALIAS_HELP = "PromptCommand.setup.instruction.serveralias.help";
+
// SERVER AUTO-DETECTION
String SETUP_INSTRUCTION_SERVERAUTODETECT_PREF = AgentConfigurationConstants.SERVER_AUTO_DETECTION;
String SETUP_INSTRUCTION_SERVERAUTODETECT_DEFAULT = Boolean
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/SetupPromptCommand.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/SetupPromptCommand.java
index 4c9226a..7c8152a 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/SetupPromptCommand.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/SetupPromptCommand.java
@@ -81,7 +81,8 @@ public class SetupPromptCommand implements AgentPromptCommand {
if (args.length == 1) {
performBasicSetup(agent.getConfiguration().getPreferences(), new AgentPromptInfo(agent), agent.getOut());
} else if ((args.length == 2) && args[1].equals(MSG.getMsg(AgentI18NResourceKeys.SETUP_ADVANCED))) {
- performAdvancedSetup(agent.getConfiguration().getPreferences(), new AgentPromptInfo(agent), agent.getOut());
+ performAdvancedSetup(agent.getConfiguration().getPreferences(), new AgentPromptInfo(agent), agent
+ .getOut());
} else if ((args.length == 2) && args[1].equals(MSG.getMsg(AgentI18NResourceKeys.SETUP_ALL))) {
performAllSetup(agent.getConfiguration().getPreferences(), new AgentPromptInfo(agent), agent.getOut());
} else {
@@ -248,6 +249,11 @@ public class SetupPromptCommand implements AgentPromptCommand {
.getMsg(AgentSetupInstructions.SETUP_INSTRUCTION_SERVERTRANSPORTPARAMS_PROMPT), SETUPMSG
.getMsg(AgentSetupInstructions.SETUP_INSTRUCTION_SERVERTRANSPORTPARAMS_HELP)));
+ instr.add(new DefaultSetupInstruction(AgentSetupInstructions.SETUP_INSTRUCTION_SERVERALIAS_PREF,
+ AgentSetupInstructions.SETUP_INSTRUCTION_SERVERALIAS_DEFAULT, null, SETUPMSG
+ .getMsg(AgentSetupInstructions.SETUP_INSTRUCTION_SERVERALIAS_PROMPT), SETUPMSG
+ .getMsg(AgentSetupInstructions.SETUP_INSTRUCTION_SERVERALIAS_HELP)));
+
instr.add(new SecurityEnabledSetupInstruction(ServiceContainerConfigurationConstants.CONNECTOR_TRANSPORT,
AgentSetupInstructions.SETUP_INSTRUCTION_SERVERCLIENTAUTHMODE_PREF,
AgentSetupInstructions.SETUP_INSTRUCTION_SERVERCLIENTAUTHMODE_DEFAULT,
diff --git a/modules/enterprise/agent/src/main/resources/agent-configuration.xml b/modules/enterprise/agent/src/main/resources/agent-configuration.xml
index f36b459..66e1d59 100644
--- a/modules/enterprise/agent/src/main/resources/agent-configuration.xml
+++ b/modules/enterprise/agent/src/main/resources/agent-configuration.xml
@@ -59,7 +59,7 @@ commands named "config", "setconfig" and "setup" and the command line options
file conforms to. This is the schema for the rhq.agent
preferences.
-->
- <entry key="rhq.agent.configuration-schema-version" value="5" />
+ <entry key="rhq.agent.configuration-schema-version" value="6" />
<!--
_______________________________________________________________
@@ -106,6 +106,7 @@ commands named "config", "setconfig" and "setup" and the command line options
rhq.agent.server.bind-address
rhq.agent.server.bind-port
rhq.agent.server.transport-params
+ rhq.agent.server.alias
The RHQ Server endpoint configuration.
@@ -114,8 +115,9 @@ commands named "config", "setconfig" and "setup" and the command line options
to separate the transport parameters.
Note that the server address is left undefined - the agent
- will default to the DNS alias of "rhqserver" and if that is not
- defined, it will default to the localhost or 127.0.0.1.
+ will default to the DNS alias (see rhq.agent.server.alias)
+ and if that is not defined, it will default to the localhost
+ or 127.0.0.1.
-->
<entry key="rhq.agent.server.transport" value="servlet" />
<entry key="rhq.agent.server.bind-port" value="7080" />
@@ -123,6 +125,7 @@ commands named "config", "setconfig" and "setup" and the command line options
<entry key="rhq.agent.server.bind-address" value="127.0.0.1" />
-->
<entry key="rhq.agent.server.transport-params" value="/jboss-remoting-servlet-invoker/ServerInvokerServlet" />
+ <entry key="rhq.agent.server.alias" value="rhqserver" />
<!--
_______________________________________________________________
diff --git a/modules/enterprise/agent/src/test/resources/test-agent-configuration.xml b/modules/enterprise/agent/src/test/resources/test-agent-configuration.xml
index e832f13..a3da93e 100644
--- a/modules/enterprise/agent/src/test/resources/test-agent-configuration.xml
+++ b/modules/enterprise/agent/src/test/resources/test-agent-configuration.xml
@@ -29,7 +29,7 @@
<!-- the "real" settings -->
<entry key="rhq.agent.name" value="jboss-on" />
- <entry key="rhq.agent.configuration-schema-version" value="5" />
+ <entry key="rhq.agent.configuration-schema-version" value="6" />
<entry key="rhq.agent.configuration-setup-flag" value="true" />
<entry key="rhq.agent.server.transport" value="socket" />
<entry key="rhq.agent.server.bind-address" value="127.0.0.1" />
diff --git a/modules/enterprise/agent/src/test/resources/test-agent1-cfg-mvn.xml b/modules/enterprise/agent/src/test/resources/test-agent1-cfg-mvn.xml
index 84187f9..2d8c91f 100644
--- a/modules/enterprise/agent/src/test/resources/test-agent1-cfg-mvn.xml
+++ b/modules/enterprise/agent/src/test/resources/test-agent1-cfg-mvn.xml
@@ -29,7 +29,7 @@
<!-- the "real" settings -->
<entry key="rhq.agent.name" value="jboss-on" />
- <entry key="rhq.agent.configuration-schema-version" value="5" />
+ <entry key="rhq.agent.configuration-schema-version" value="6" />
<entry key="rhq.agent.configuration-setup-flag" value="true" />
<entry key="rhq.agent.server.transport" value="socket" />
<entry key="rhq.agent.server.bind-address" value="127.0.0.1" />
diff --git a/modules/enterprise/agent/src/test/resources/test-agent2-cfg-mvn.xml b/modules/enterprise/agent/src/test/resources/test-agent2-cfg-mvn.xml
index 2dd7334..7321e5b 100644
--- a/modules/enterprise/agent/src/test/resources/test-agent2-cfg-mvn.xml
+++ b/modules/enterprise/agent/src/test/resources/test-agent2-cfg-mvn.xml
@@ -48,7 +48,7 @@
<!-- the "real" settings -->
<entry key="rhq.agent.name" value="jboss-on" />
- <entry key="rhq.agent.configuration-schema-version" value="5" />
+ <entry key="rhq.agent.configuration-schema-version" value="6" />
<entry key="rhq.agent.configuration-setup-flag" value="true" />
<entry key="rhq.agent.server.transport" value="socket" />
<entry key="rhq.agent.server.bind-address" value="127.0.0.1" />
diff --git a/modules/enterprise/agent/src/test/resources/test-agent2-configuration.xml b/modules/enterprise/agent/src/test/resources/test-agent2-configuration.xml
index 6a7aaff..d5b4738 100644
--- a/modules/enterprise/agent/src/test/resources/test-agent2-configuration.xml
+++ b/modules/enterprise/agent/src/test/resources/test-agent2-configuration.xml
@@ -18,7 +18,7 @@
<!-- the "real" settings -->
<entry key="rhq.agent.name" value="jboss-on2" />
- <entry key="rhq.agent.configuration-schema-version" value="5" />
+ <entry key="rhq.agent.configuration-schema-version" value="6" />
<entry key="rhq.agent.configuration-setup-flag" value="true" />
<entry key="rhq.agent.server.transport" value="socket" />
<entry key="rhq.agent.server.bind-address" value="127.0.0.1" />
diff --git a/modules/enterprise/server/sars/agent-sar/src/main/resources/META-INF/embedded-agent-configuration.xml b/modules/enterprise/server/sars/agent-sar/src/main/resources/META-INF/embedded-agent-configuration.xml
index b2702cd..68e8719 100644
--- a/modules/enterprise/server/sars/agent-sar/src/main/resources/META-INF/embedded-agent-configuration.xml
+++ b/modules/enterprise/server/sars/agent-sar/src/main/resources/META-INF/embedded-agent-configuration.xml
@@ -23,7 +23,7 @@ Embedded RHQ Agent Configuration
file conforms to. This is the schema for the rhq.agent
preferences.
-->
- <entry key="rhq.agent.configuration-schema-version" value="5" />
+ <entry key="rhq.agent.configuration-schema-version" value="6" />
<!--
_______________________________________________________________
diff --git a/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml
index dbfdfe2..df799fe 100644
--- a/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml
@@ -379,6 +379,7 @@
</c:constraint>
</c:simple-property>
<c:simple-property name="rhq.agent.server.transport-params" type="string" activationPolicy="restart" required="false" default="/jboss-remoting-servlet-invoker/ServerInvokerServlet" displayName="RHQ Server Transport Parameters" description="Custom set of transport parameters used when sending commands to the RHQ Server. Please see the documentation for more information on transport params." />
+ <c:simple-property name="rhq.agent.server.alias" type="string" activationPolicy="restart" required="false" default="rhqserver" displayName="RHQ Server Alias" description="If the RHQ Server IP address is not defined, this is the DNS alias name that will be looked up to determine the RHQ Server IP address." />
<c:simple-property name="rhq.communications.connector.transport" type="string" activationPolicy="restart" required="true" default="socket" displayName="Agent Transport Protocol" description="The transport protocol used to receive commands from the RHQ Server. e.g. socket, sslsocket. If you want secure communications, you must use an SSL-enabled transport">
<c:property-options>
<c:option name="socket" value="socket" default="true" />
diff --git a/modules/plugins/rhq-agent/src/test/resources/test-agent-configuration.xml b/modules/plugins/rhq-agent/src/test/resources/test-agent-configuration.xml
index 7dc685c..a5209a8 100644
--- a/modules/plugins/rhq-agent/src/test/resources/test-agent-configuration.xml
+++ b/modules/plugins/rhq-agent/src/test/resources/test-agent-configuration.xml
@@ -18,7 +18,7 @@
<!-- the "real" settings -->
<entry key="rhq.agent.name" value="jboss-on" />
- <entry key="rhq.agent.configuration-schema-version" value="5" />
+ <entry key="rhq.agent.configuration-schema-version" value="6" />
<entry key="rhq.agent.configuration-setup-flag" value="true" />
<entry key="rhq.agent.server.transport" value="socket" />
<entry key="rhq.agent.server.bind-address" value="127.0.0.1" />
commit fdc507c69f1ac14bf1c457b03098931f094385fd
Author: John Sanda <jsanda(a)redhat.com>
Date: Sun Aug 22 06:28:23 2010 -0400
Adding logic to handle script exceptions
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
index 28f2056..3937c51 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
@@ -58,10 +58,16 @@ class ScriptRunner implements ServerPluginComponent, ControlFacet {
// Calling setEntityMap() worked though.
//script.entityMap = entityMap
script.setEntityMap(entityMap)
- def scriptResult = script.run()
- ControlResults results = new ControlResults()
- results.complexResults.put(new PropertySimple("results", scriptResult))
+ def results = new ControlResults()
+
+ try {
+ def scriptResult = script.run()
+ results.complexResults.put(new PropertySimple("results", scriptResult))
+ }
+ catch (Throwable t) {
+ results.error = t
+ }
return results;
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
index 0924ab7..6900943 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
@@ -16,6 +16,7 @@ import org.testng.annotations.BeforeMethod
import org.testng.annotations.Test
import static org.testng.Assert.assertEquals
import static org.testng.Assert.assertTrue
+import static org.testng.Assert.assertNotNull
import org.rhq.core.domain.test.TestEntity
class ScriptRunnerTest {
@@ -54,9 +55,13 @@ class ScriptRunnerTest {
}
}
- @Test(expectedExceptions = [RHQScriptException])
void throwExceptionWhenManagerAccessedDoesNotExist() {
- executeScript('access_nonexistent_mgr.groovy')
+ def result = executeScript('access_nonexistent_mgr.groovy')
+ assertEquals(
+ result.error,
+ "$RHQScriptException.name: Unable to locate NonexistentManager",
+ "Expected error to be set when script tries to access nonexistent manager"
+ )
}
@Test
@@ -83,6 +88,17 @@ class ScriptRunnerTest {
}
}
+ @Test
+ void handleScriptExceptions() {
+ def result = executeScript('throw_exception.groovy')
+
+ assertEquals(
+ "$result.error",
+ "$RuntimeException.name: script failed!",
+ "error property should be set when script throws an exception"
+ )
+ }
+
def executeScript(String script) {
def params = new Configuration()
params.put(new PropertySimple('script', getScriptPath(script)))
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/throw_exception.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/throw_exception.groovy
new file mode 100644
index 0000000..728e2ed
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/throw_exception.groovy
@@ -0,0 +1,3 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+throw new RuntimeException("script failed!")
commit c88a6b75de474c9d123523260a12aa176712ad01
Author: John Sanda <jsanda(a)redhat.com>
Date: Sat Aug 21 09:36:35 2010 -0400
Adding opencsv test dependency that was missing from server/jar
diff --git a/modules/enterprise/gui/webdav-war/webdav-war.iml b/modules/enterprise/gui/webdav-war/webdav-war.iml
deleted file mode 100644
index 2147216..0000000
--- a/modules/enterprise/gui/webdav-war/webdav-war.iml
+++ /dev/null
@@ -1,169 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module relativePaths="true" MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
- <component name="FacetManager">
- <facet type="web" name="Web">
- <configuration>
- <descriptors>
- <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml" optional="false" version="2.5" />
- </descriptors>
- <webroots>
- <root url="file://$MODULE_DIR$/src/main/webapp" relative="/" />
- <root url="file://$MODULE_DIR$//home/ghinkle/projects/jbosson/rhq/modules/enterprise/gui/webdav-war/src/main/webapp" relative="/" />
- <root url="file://$MODULE_DIR$//home/ghinkle/projects/jbosson/rhq/modules/enterprise/gui/webdav-war/src/main/webapp-filtered" relative="/" />
- </webroots>
- <building>
- <setting name="EXPLODED_URL" value="file://$MODULE_DIR$/../../../../../out/exploded/webdav-warWeb" />
- <setting name="EXPLODED_ENABLED" value="true" />
- <setting name="JAR_URL" value="file://" />
- <setting name="JAR_ENABLED" value="false" />
- <setting name="EXCLUDE_EXPLODED_DIRECTORY" value="true" />
- </building>
- <packaging>
- <containerElement type="library" name="Maven: i18nlog:i18nlog:1.0.9" level="project">
- <attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/lib/" />
- </containerElement>
- <containerElement type="module" name="rhq-core-gui">
- <attribute name="method" value="5" />
- <attribute name="URI" value="/WEB-INF/lib/rhq-core-gui-1.2.0-SNAPSHOT.jar" />
- </containerElement>
- <containerElement type="library" name="Maven: org.richfaces.framework:richfaces-api:3.3.0.GA" level="project">
- <attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/lib/" />
- </containerElement>
- <containerElement type="library" name="Maven: commons-collections:commons-collections:3.2" level="project">
- <attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/lib/" />
- </containerElement>
- <containerElement type="library" name="Maven: commons-beanutils:commons-beanutils:1.6.1" level="project">
- <attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/lib/" />
- </containerElement>
- <containerElement type="library" name="Maven: org.richfaces.framework:richfaces-impl:3.3.0.GA" level="project">
- <attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/lib/" />
- </containerElement>
- <containerElement type="library" name="Maven: commons-digester:commons-digester:1.8" level="project">
- <attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/lib/" />
- </containerElement>
- <containerElement type="library" name="Maven: org.richfaces.ui:richfaces-ui:3.3.0.GA" level="project">
- <attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/lib/" />
- </containerElement>
- <containerElement type="library" name="Maven: ettrema:milton-api:1.2" level="project">
- <attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/lib/" />
- </containerElement>
- <containerElement type="library" name="Maven: ettrema:milton-servlet:1.2" level="project">
- <attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/lib/" />
- </containerElement>
- <containerElement type="library" name="Maven: org.slf4j:slf4j-jdk14:1.5.6" level="project">
- <attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/lib/" />
- </containerElement>
- <containerElement type="library" name="Maven: org.slf4j:slf4j-api:1.5.6" level="project">
- <attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/lib/" />
- </containerElement>
- <containerElement type="library" name="Maven: javax.servlet:jstl:1.1.2" level="project">
- <attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/lib/" />
- </containerElement>
- <containerElement type="module" name="webdav-war">
- <attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/classes" />
- </containerElement>
- </packaging>
- </configuration>
- </facet>
- </component>
- <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/target/classes" />
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
- <content url="file://$MODULE_DIR$">
- <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
- <excludeFolder url="file://$MODULE_DIR$/target" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$APPLICATION_HOME_DIR$/lib/javaee.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.0.jboss" level="project" />
- <orderEntry type="library" exported="" name="Maven: i18nlog:i18nlog:1.0.9" level="project" />
- <orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.1" level="project" />
- <orderEntry type="library" name="Maven: javax.xml.stream:stax-api:1.0-2" level="project" />
- <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
- <orderEntry type="library" name="Maven: log4j:log4j:1.2.14" level="project" />
- <orderEntry type="library" name="Maven: org.testng:testng:jdk15:5.7" level="project" />
- <orderEntry type="library" name="Maven: junit:junit:3.8.1" level="project" />
- <orderEntry type="library" name="Maven: org.jetbrains:annotations:7.0.2" level="project" />
- <orderEntry type="module" module-name="rhq-core-domain" />
- <orderEntry type="module" module-name="rhq-core-util" />
- <orderEntry type="library" name="Maven: jdom:jdom:1.0" level="project" />
- <orderEntry type="module" module-name="rhq-core-gui" exported="" />
- <orderEntry type="library" exported="" name="Maven: org.richfaces.framework:richfaces-api:3.3.0.GA" level="project" />
- <orderEntry type="library" exported="" name="Maven: commons-collections:commons-collections:3.2" level="project" />
- <orderEntry type="library" exported="" name="Maven: commons-beanutils:commons-beanutils:1.6.1" level="project" />
- <orderEntry type="library" exported="" name="Maven: org.richfaces.framework:richfaces-impl:3.3.0.GA" level="project" />
- <orderEntry type="library" exported="" name="Maven: commons-digester:commons-digester:1.8" level="project" />
- <orderEntry type="library" exported="" name="Maven: org.richfaces.ui:richfaces-ui:3.3.0.GA" level="project" />
- <orderEntry type="module" module-name="rhq-enterprise-server" />
- <orderEntry type="module" module-name="rhq-enterprise-comm" />
- <orderEntry type="module" module-name="rhq-core-comm-api" />
- <orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1-jboss" level="project" />
- <orderEntry type="library" name="Maven: gnu-getopt:getopt:1.0.13" level="project" />
- <orderEntry type="library" name="Maven: jboss:jboss-common:1.2.0.GA" level="project" />
- <orderEntry type="library" name="Maven: jboss:jboss-jmx:4.2.1.GA" level="project" />
- <orderEntry type="library" name="Maven: jboss:jboss-remoting:2.2.1.GA" level="project" />
- <orderEntry type="library" name="Maven: jboss:jboss-serialization:1.0.3.GA" level="project" />
- <orderEntry type="library" name="Maven: oswego-concurrent:concurrent:1.3.4-jboss" level="project" />
- <orderEntry type="module" module-name="rhq-core-client-api" />
- <orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.1.6" level="project" />
- <orderEntry type="module" module-name="rhq-core-dbutils" />
- <orderEntry type="library" name="Maven: ant:ant:1.6.5" level="project" />
- <orderEntry type="library" name="Maven: commons-httpclient:commons-httpclient:3.0.1" level="project" />
- <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.2" level="project" />
- <orderEntry type="library" name="Maven: commons-validator:commons-validator:1.1.4" level="project" />
- <orderEntry type="library" name="Maven: jboss:jboss-cache:1.4.1.SP3" level="project" />
- <orderEntry type="library" name="Maven: jboss:jbpm:3.1.1" level="project" />
- <orderEntry type="library" name="Maven: org.snmp4j:snmp4j:1.8.2" level="project" />
- <orderEntry type="library" name="Maven: postgresql:postgresql:8.3-604.jdbc3" level="project" />
- <orderEntry type="library" name="Maven: rss4j:rss4j:0.92-on.2" level="project" />
- <orderEntry type="library" exported="" name="Maven: org.slf4j:slf4j-jdk14:1.5.6" level="project" />
- <orderEntry type="library" exported="" name="Maven: org.slf4j:slf4j-api:1.5.6" level="project" />
- <orderEntry type="library" name="Maven: hibernate:hibernate3:3.2.r14201-2" level="project" />
- <orderEntry type="library" name="Maven: hibernate-annotations:hibernate-annotations:3.2.1.GA" level="project" />
- <orderEntry type="library" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
- <orderEntry type="library" exported="" name="Maven: javax.servlet:jstl:1.1.2" level="project" />
- <orderEntry type="library" name="Maven: jboss:jboss-ejb-api:4.2.1.GA" level="project" />
- <orderEntry type="library" name="Maven: jboss:jboss-j2ee:4.2.1.GA" level="project" />
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$M2_REPO$/com/ettrema/milton-api/1.4.1/milton-api-1.4.1.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$M2_REPO$/com/ettrema/milton-servlet/1.4.1/milton-servlet-1.4.1.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- </component>
-</module>
-
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index b0b3484..04d3557 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -393,6 +393,13 @@
<version>${version}</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>net.sf.opencsv</groupId>
+ <artifactId>opencsv</artifactId>
+ <version>1.8</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
commit aa341e76cdb545e6651c332094e29446204942bc
Author: John Sanda <jsanda(a)redhat.com>
Date: Sat Aug 21 08:59:16 2010 -0400
Adding groovy script plugin to build
diff --git a/modules/enterprise/server/plugins/pom.xml b/modules/enterprise/server/plugins/pom.xml
index 07be817..5ff09b2 100644
--- a/modules/enterprise/server/plugins/pom.xml
+++ b/modules/enterprise/server/plugins/pom.xml
@@ -83,6 +83,7 @@
<module>filetemplate-bundle</module>
<module>ant-bundle</module>
<module>validate-all-serverplugins</module>
+ <module>groovy-script</module>
</modules>
</project>
commit 876398c1751c450495a23d3d6e88810cf6553f37
Merge: 81667f2... 51dd587...
Author: John Sanda <jsanda(a)redhat.com>
Date: Sat Aug 21 08:34:42 2010 -0400
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 81667f27c16d39d1b1b49c8350b8413b049b5186
Author: John Sanda <jsanda(a)redhat.com>
Date: Sat Aug 21 00:38:35 2010 -0400
Re-enabling test
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
index 877f5b0..0924ab7 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
@@ -16,6 +16,7 @@ import org.testng.annotations.BeforeMethod
import org.testng.annotations.Test
import static org.testng.Assert.assertEquals
import static org.testng.Assert.assertTrue
+import org.rhq.core.domain.test.TestEntity
class ScriptRunnerTest {
@@ -58,8 +59,14 @@ class ScriptRunnerTest {
executeScript('access_nonexistent_mgr.groovy')
}
- @Test(enabled = false)
+ @Test
void createCriteriaAccordingToSpec() {
+ scriptRunner.entityMap << [TestEntity: TestEntity.class]
+
+ def testMgr = {}
+ def lookupUtil = new MockFor(LookupUtil)
+ lookupUtil.demand.getTestEntityManager { testMgr }
+
def expectedCriteria = new TestEntityCriteria()
expectedCriteria.id = 1
expectedCriteria.name = 'Test'
@@ -69,9 +76,11 @@ class ScriptRunnerTest {
expectedCriteria.addSortId(PageOrdering.DESC)
expectedCriteria.addSortName(PageOrdering.DESC)
- def result = executeScript('create_criteria.groovy')
+ lookupUtil.use {
+ def result = executeScript('create_criteria.groovy')
- assertScriptResultEquals(result, expectedCriteria.toString(), 'Failed to generate criteria correctly')
+ assertScriptResultEquals(result, expectedCriteria.toString(), 'Failed to generate criteria correctly')
+ }
}
def executeScript(String script) {
commit 29f040e5b56ff2dee9533816fc755707c71c2b11
Author: John Sanda <jsanda(a)redhat.com>
Date: Sat Aug 21 00:33:53 2010 -0400
Adding test to verify that the entity map cache is populated
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
index 922facf..28f2056 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
@@ -16,11 +16,13 @@ import org.rhq.enterprise.server.plugin.pc.ServerPluginContext
class ScriptRunner implements ServerPluginComponent, ControlFacet {
+ String entityPackagePrefix = "org.rhq.core.domain"
+
Map entityMap = [:]
void initialize(ServerPluginContext context) {
def reflections = new Reflections(new ConfigurationBuilder()
- .setUrls(ClasspathHelper.getUrlsForPackagePrefix("org.rhq.core.domain"))
+ .setUrls(ClasspathHelper.getUrlsForPackagePrefix(entityPackagePrefix))
.setScanners(new TypeAnnotationsScanner()));
def classes = reflections.getTypesAnnotatedWith(Entity.class)
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/test/TestEntity.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/test/TestEntity.groovy
index 04b21b4..7f02ba7 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/test/TestEntity.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/test/TestEntity.groovy
@@ -1,5 +1,8 @@
package org.rhq.core.domain.test
+import javax.persistence.Entity
+
+@Entity
class TestEntity {
Integer id
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/test/TestEntityWithoutCriteria.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/test/TestEntityWithoutCriteria.groovy
index 312ea47..79703ee 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/test/TestEntityWithoutCriteria.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/test/TestEntityWithoutCriteria.groovy
@@ -1,4 +1,7 @@
package org.rhq.core.domain.test
+import javax.persistence.Entity
+
+@Entity
class TestEntityWithoutCriteria {
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
index 24170ed..877f5b0 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
@@ -1,25 +1,21 @@
package org.rhq.enterprise.server.plugins.groovy
-import org.testng.annotations.Test
import groovy.mock.interceptor.MockFor
-import org.rhq.enterprise.server.util.LookupUtil
+import javax.persistence.Entity
+import org.reflections.Reflections
+import org.reflections.scanners.TypeAnnotationsScanner
+import org.reflections.util.ClasspathHelper
+import org.reflections.util.ConfigurationBuilder
import org.rhq.core.domain.configuration.Configuration
import org.rhq.core.domain.configuration.PropertySimple
-
-import static org.testng.Assert.*
-import org.rhq.enterprise.server.plugin.pc.ControlResults
import org.rhq.core.domain.criteria.TestEntityCriteria
-import org.testng.annotations.BeforeClass
-import org.rhq.core.domain.test.TestEntity
import org.rhq.core.domain.util.PageOrdering
+import org.rhq.enterprise.server.plugin.pc.ControlResults
+import org.rhq.enterprise.server.util.LookupUtil
import org.testng.annotations.BeforeMethod
-import org.reflections.Reflections
-import javax.persistence.Entity
-import org.reflections.scanners.SubTypesScanner
-import org.reflections.scanners.TypeAnnotationsScanner
-import org.reflections.scanners.ResourcesScanner
-import org.reflections.util.ClasspathHelper
-import org.reflections.util.ConfigurationBuilder
+import org.testng.annotations.Test
+import static org.testng.Assert.assertEquals
+import static org.testng.Assert.assertTrue
class ScriptRunnerTest {
@@ -28,7 +24,17 @@ class ScriptRunnerTest {
@BeforeMethod
void setup() {
scriptRunner = new ScriptRunner()
- scriptRunner.entityMap << [TestEntity: TestEntity.class]
+ }
+
+ @Test
+ void populateEntityMap() {
+ scriptRunner.entityPackagePrefix = 'org.rhq.core.domain.test'
+ scriptRunner.initialize(null)
+
+ assertEquals(scriptRunner.entityMap.size(), 2, "Expected to entityMap to contain two entries")
+ assertTrue(scriptRunner.entityMap.containsKey('TestEntity'), "Expected to find <TestEntity> in entity map")
+ assertTrue(scriptRunner.entityMap.containsKey('TestEntityWithoutCriteria'),
+ "Expected to find <TestEntityWithoutCriteria> in entity map")
}
@Test
@@ -68,17 +74,6 @@ class ScriptRunnerTest {
assertScriptResultEquals(result, expectedCriteria.toString(), 'Failed to generate criteria correctly')
}
- @Test
- void scanClasspath() {
- Reflections reflections = new Reflections(new ConfigurationBuilder()
- .setUrls(ClasspathHelper.getUrlsForPackagePrefix("org.rhq.core.domain"))
- .setScanners(new TypeAnnotationsScanner()));
- def classes = reflections.getTypesAnnotatedWith(Entity.class)
-
- println "Found ${classes.size()} entities"
- assertTrue(classes.size() > 5, "Found ${classes.size()} entities")
- }
-
def executeScript(String script) {
def params = new Configuration()
params.put(new PropertySimple('script', getScriptPath(script)))
commit 47ade1fdd82c7d11b64a48db422d8ba9055f188a
Author: John Sanda <jsanda(a)redhat.com>
Date: Sat Aug 21 00:07:11 2010 -0400
Adding logic to dynamically generate entity map
diff --git a/modules/enterprise/server/plugins/groovy-script/pom.xml b/modules/enterprise/server/plugins/groovy-script/pom.xml
index 22b86e0..1abb9b3 100644
--- a/modules/enterprise/server/plugins/groovy-script/pom.xml
+++ b/modules/enterprise/server/plugins/groovy-script/pom.xml
@@ -54,6 +54,11 @@
<version>4.2.3.GA</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.reflections</groupId>
+ <artifactId>reflections</artifactId>
+ <version>0.9.5-RC2</version>
+ </dependency>
</dependencies>
<build>
@@ -74,8 +79,32 @@
<artifactItem>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
- <version>1.7.1</version>
+ <version>1.7.3</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.reflections</groupId>
+ <artifactId>reflections</artifactId>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.5.6</version>
</artifactItem>
+ <artifactItem>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.5.6</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
+ <version>1.0</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.8.0.GA</version>
+ </artifactItem>
</artifactItems>
<outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
</configuration>
@@ -189,4 +218,12 @@
</profile>
</profiles>
+
+ <repositories>
+ <repository>
+ <id>reflections-repo</id>
+ <name>Reflections Maven2 Repository</name>
+ <url>http://reflections.googlecode.com/svn/repo</url>
+ </repository>
+ </repositories>
</project>
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
index 5245756..922facf 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
@@ -1,25 +1,30 @@
package org.rhq.enterprise.server.plugins.groovy
+import javax.persistence.Entity
import org.codehaus.groovy.control.CompilerConfiguration
+import org.reflections.Reflections
+import org.reflections.scanners.TypeAnnotationsScanner
+import org.reflections.util.ClasspathHelper
+import org.reflections.util.ConfigurationBuilder
import org.rhq.core.domain.configuration.Configuration
import org.rhq.core.domain.configuration.PropertySimple
import org.rhq.enterprise.server.plugin.pc.ControlFacet
import org.rhq.enterprise.server.plugin.pc.ControlResults
+import org.rhq.enterprise.server.plugin.pc.ScheduledJobInvocationContext
import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent
import org.rhq.enterprise.server.plugin.pc.ServerPluginContext
-import org.rhq.core.domain.resource.Resource
-import org.rhq.core.domain.resource.ResourceType
-import org.rhq.enterprise.server.plugin.pc.ScheduledJobInvocationContext
class ScriptRunner implements ServerPluginComponent, ControlFacet {
- Map entityMap = [
- Resource: Resource.class,
- ResourceType: ResourceType.class
- ]
+ Map entityMap = [:]
void initialize(ServerPluginContext context) {
+ def reflections = new Reflections(new ConfigurationBuilder()
+ .setUrls(ClasspathHelper.getUrlsForPackagePrefix("org.rhq.core.domain"))
+ .setScanners(new TypeAnnotationsScanner()));
+ def classes = reflections.getTypesAnnotatedWith(Entity.class)
+ classes.each { entityMap << [(it.simpleName.toString()): it] }
}
void start() {
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
index c8a00d6..24170ed 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
@@ -13,6 +13,13 @@ import org.testng.annotations.BeforeClass
import org.rhq.core.domain.test.TestEntity
import org.rhq.core.domain.util.PageOrdering
import org.testng.annotations.BeforeMethod
+import org.reflections.Reflections
+import javax.persistence.Entity
+import org.reflections.scanners.SubTypesScanner
+import org.reflections.scanners.TypeAnnotationsScanner
+import org.reflections.scanners.ResourcesScanner
+import org.reflections.util.ClasspathHelper
+import org.reflections.util.ConfigurationBuilder
class ScriptRunnerTest {
@@ -61,6 +68,17 @@ class ScriptRunnerTest {
assertScriptResultEquals(result, expectedCriteria.toString(), 'Failed to generate criteria correctly')
}
+ @Test
+ void scanClasspath() {
+ Reflections reflections = new Reflections(new ConfigurationBuilder()
+ .setUrls(ClasspathHelper.getUrlsForPackagePrefix("org.rhq.core.domain"))
+ .setScanners(new TypeAnnotationsScanner()));
+ def classes = reflections.getTypesAnnotatedWith(Entity.class)
+
+ println "Found ${classes.size()} entities"
+ assertTrue(classes.size() > 5, "Found ${classes.size()} entities")
+ }
+
def executeScript(String script) {
def params = new Configuration()
params.put(new PropertySimple('script', getScriptPath(script)))
commit 51dd587b1ea111526c7ab426f0198cf3b71a04dc
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Aug 20 15:10:09 2010 +0200
Implement linking of resource types to parents (at least a start).
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
index 58603ea..a289960 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
@@ -57,6 +57,7 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
private Map<Integer,Integer> pluginsTranslationTable = new HashMap<Integer,Integer>();
private Map<Integer,Integer> resourceTypeTranslationTable = new HashMap<Integer,Integer>();
+ private Map<Integer,Integer> childParentTypeMap = new HashMap<Integer, Integer>();
public void testOne() throws Exception {
setup();
@@ -166,9 +167,9 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
}
private void setupResourceTypes() {
- // TODO first pull in the parentResourceTypes.csv file to get a mapping for them.
- String descriptorFile = "perftest/resourceTypes.csv";
+ // first pull in the parentResourceTypes.csv file to get a mapping for them.
+ String descriptorFile = "perftest/parentResourceTypes.csv";
URL descriptorUrl = this.getClass().getClassLoader().getResource(descriptorFile);
FileReader fr = null;
try {
@@ -180,6 +181,39 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
}
try {
CSVReader reader = new CSVReader(fr,',','"',1);
+ List<String[]> lines = reader.readAll();
+ System.out.println("# of lines: " + lines.size());
+ for (String[] line: lines) {
+ Integer typeId = Integer.parseInt(line[0]);
+ Integer parentTypeId = Integer.parseInt(line[1]);
+ childParentTypeMap.put(typeId,parentTypeId);
+ }
+ }
+ catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ finally {
+ try {
+ fr.close();
+ } catch (IOException e) {
+ e.printStackTrace(); // TODO: Customise this generated block
+ }
+ }
+
+ // now the ResourceTypes themselves
+
+ descriptorFile = "perftest/resourceTypes.csv";
+ descriptorUrl = this.getClass().getClassLoader().getResource(descriptorFile);
+ fr = null;
+ try {
+ String fileName = descriptorUrl.getFile();
+ fr = new FileReader(fileName);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace(); // TODO: Customise this generated block
+ return;
+ }
+ try {
+ CSVReader reader = new CSVReader(fr,',','"',1);
List<String[]> lines = reader.readAll();
System.out.println("# of lines: " + lines.size());
@@ -188,7 +222,7 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
continue; // comment
int originalId = Integer.parseInt(line[0]);
- ResourceType parentType = null; // TODO get from parent-child table
+ ResourceType parentType = findResourceType(originalId);
ResourceCategory category = ResourceCategory.valueOf(line[2]);
ResourceType rt = new ResourceType(line[1],line[3],category,parentType);
getEntityManager().persist(rt);
@@ -209,4 +243,14 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
}
}
+
+ private ResourceType findResourceType(int originalId) {
+
+ if (childParentTypeMap.containsKey(originalId)) {
+ int id = childParentTypeMap.get(originalId);
+ int translatedId = resourceTypeTranslationTable.get(id);
+ ResourceType parentType = getEntityManager().find(ResourceType.class,translatedId);
+ }
+ return null;
+ }
}
commit 6a4c52d2c965cb68fbcb40b9ccfe5256cccd2c01
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Aug 20 14:38:25 2010 +0200
Prototypical work for the PerfTests
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
new file mode 100644
index 0000000..58603ea
--- /dev/null
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
@@ -0,0 +1,212 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.server.performance.test;
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import au.com.bytecode.opencsv.CSVReader;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.plugin.Plugin;
+import org.rhq.core.domain.resource.Agent;
+import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.server.test.AbstractEJB3PerformanceTest;
+
+import org.testng.annotations.Test;
+
+/**
+ * Performance test the availabilities subsystem
+ *
+ * @author Heiko W. Rupp
+ */
+@Test(groups = "PERF")
+public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
+
+ private final Log log = LogFactory.getLog(AvailabilityInsertPurgeTest.class);
+
+ /*
+ * we need to replace the ids in the csv files with the ids that we get back from the
+ * databse in relations. So store them as pair <csv-id,new entity-id>
+ */
+ private Map<Integer,Integer> agentsTranslationTable = new HashMap<Integer,Integer>();
+ private Map<Integer,Integer> pluginsTranslationTable = new HashMap<Integer,Integer>();
+ private Map<Integer,Integer> resourceTypeTranslationTable = new HashMap<Integer,Integer>();
+
+
+ public void testOne() throws Exception {
+ setup();
+ startTiming();
+
+ Thread.sleep(1234);
+
+ endTiming();
+
+ commitTimings();
+
+ }
+
+ private void setup() {
+ setupAgents();
+ setupPlugins();
+ setupResourceTypes();
+ // TODO set up resources
+
+ }
+
+ private void setupAgents() {
+ String descriptorFile = "perftest/agents.csv";
+ URL descriptorUrl = this.getClass().getClassLoader().getResource(descriptorFile);
+ FileReader fr = null;
+ try {
+ String fileName = descriptorUrl.getFile();
+ fr = new FileReader(fileName);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace(); // TODO: Customise this generated block
+ return;
+ }
+ try {
+ CSVReader reader = new CSVReader(fr,',','"',1); // Skip 1st line, use " as quote char and , as separator
+
+ List<String[]> lines = reader.readAll();
+ System.out.println("# of lines: " + lines.size());
+ for (String[] line : lines) {
+ if (line[0].startsWith("#"))
+ continue; // comment
+
+ int originalId = Integer.parseInt(line[0]);
+ Agent agent = new Agent(line[1],line[2],Integer.parseInt(line[3]),line[5],line[4]);// TODO more information?
+ getEntityManager().persist(agent);
+ int id = agent.getId();
+
+ agentsTranslationTable.put(originalId,id);
+
+
+ }
+ }
+ catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ finally {
+ try {
+ fr.close();
+ } catch (IOException e) {
+ e.printStackTrace(); // TODO: Customise this generated block
+ }
+ }
+
+ }
+
+ private void setupPlugins() {
+ String descriptorFile = "perftest/plugins.csv";
+ URL descriptorUrl = this.getClass().getClassLoader().getResource(descriptorFile);
+ FileReader fr = null;
+ try {
+ String fileName = descriptorUrl.getFile();
+ fr = new FileReader(fileName);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace(); // TODO: Customise this generated block
+ return;
+ }
+ try {
+ CSVReader reader = new CSVReader(fr,',','"',1);
+
+ List<String[]> lines = reader.readAll();
+ System.out.println("# of lines: " + lines.size());
+ for (String[] line : lines) {
+ if (line[0].startsWith("#"))
+ continue; // comment
+
+ int originalId = Integer.parseInt(line[0]);
+ Plugin plugin = new Plugin(line[1],line[5],line[6]);
+ plugin.setDisplayName(line[2]);
+ plugin.setVersion(line[3]);
+ plugin.setAmpsVersion(line[4]);
+ getEntityManager().persist(plugin);
+
+ int id = plugin.getId();
+ pluginsTranslationTable.put(originalId,id);
+ }
+ }
+ catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ finally {
+ try {
+ fr.close();
+ } catch (IOException e) {
+ e.printStackTrace(); // TODO: Customise this generated block
+ }
+ }
+
+ }
+ private void setupResourceTypes() {
+
+ // TODO first pull in the parentResourceTypes.csv file to get a mapping for them.
+
+ String descriptorFile = "perftest/resourceTypes.csv";
+ URL descriptorUrl = this.getClass().getClassLoader().getResource(descriptorFile);
+ FileReader fr = null;
+ try {
+ String fileName = descriptorUrl.getFile();
+ fr = new FileReader(fileName);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace(); // TODO: Customise this generated block
+ return;
+ }
+ try {
+ CSVReader reader = new CSVReader(fr,',','"',1);
+
+ List<String[]> lines = reader.readAll();
+ System.out.println("# of lines: " + lines.size());
+ for (String[] line : lines) {
+ if (line[0].startsWith("#"))
+ continue; // comment
+
+ int originalId = Integer.parseInt(line[0]);
+ ResourceType parentType = null; // TODO get from parent-child table
+ ResourceCategory category = ResourceCategory.valueOf(line[2]);
+ ResourceType rt = new ResourceType(line[1],line[3],category,parentType);
+ getEntityManager().persist(rt);
+
+ int id = rt.getId();
+ resourceTypeTranslationTable.put(originalId,id);
+ }
+ }
+ catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ finally {
+ try {
+ fr.close();
+ } catch (IOException e) {
+ e.printStackTrace(); // TODO: Customise this generated block
+ }
+ }
+
+ }
+}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java
new file mode 100644
index 0000000..05b3495
--- /dev/null
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java
@@ -0,0 +1,101 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.server.test;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Helper that introduces timing functionality on top of the Abstract EJB tests.
+ *
+ * @author Heiko W. Rupp
+ */
+public class AbstractEJB3PerformanceTest extends AbstractEJB3Test {
+
+ private static final Log log = LogFactory.getLog("TIMING_INFO");
+
+
+ private static final String DEFAULT = "-default-";
+ private Map<String,Long> timings = new HashMap<String, Long>();
+ private Map<String,Long> startTime = new HashMap<String, Long>();
+
+
+ protected void startTiming(String name) {
+ long now = System.currentTimeMillis();
+ startTime.put(name,now);
+
+ }
+
+ protected void endTiming(String name) {
+
+ boolean found = startTime.containsKey(name);
+ assert found : "No start time information for name [" + name + "] found - did you call startTiming()?";
+
+
+ long now = System.currentTimeMillis();
+ long start = startTime.get(name);
+ long duration = (now - start);
+ if (timings.containsKey(name)) {
+ long timing = timings.get(name);
+ timing+=duration;
+ timings.put(name,timing);
+ }
+ else {
+ timings.put(name,duration);
+ }
+ }
+
+ protected void startTiming() {
+ startTiming(DEFAULT);
+ }
+
+ protected void endTiming() {
+ endTiming(DEFAULT);
+ }
+
+
+ protected void commitTimings() {
+
+ Set<Map.Entry<String,Long>> data = timings.entrySet();
+ for (Map.Entry<String,Long> item : data) {
+ log.info(":| " + item.getKey() + " => " + item.getValue());
+ }
+ timings.clear();
+ startTime.clear();
+ }
+
+ protected void assertTiming(String name, long maxDuration) {
+
+ boolean found = timings.containsKey(name);
+ assert found : "No timing information for name [" + name + "] found";
+
+ long duration = timings.get(name);
+
+ assert duration < maxDuration : "Execution took longer than given max ( " + duration + " > " + maxDuration + ")";
+
+ }
+
+ protected void assertTiming(long maxDuration) {
+ assertTiming(DEFAULT,maxDuration);
+ }
+}
commit 74d0107cf4038dc3e307a384f25efd54bea22b93
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Aug 20 14:37:57 2010 +0200
Create dir if not there.
diff --git a/modules/helpers/perftest-data-gen/install_files.sh b/modules/helpers/perftest-data-gen/install_files.sh
index 0a33154..3513612 100644
--- a/modules/helpers/perftest-data-gen/install_files.sh
+++ b/modules/helpers/perftest-data-gen/install_files.sh
@@ -4,4 +4,8 @@ set -x
pwd
-cp target/*.csv ../../enterprise/server/jar/src/test/resources/perftest/
\ No newline at end of file
+if [ ! -d ../../enterprise/server/jar/src/test/resources/perftest/ ]
+then
+ mkdir -p ../../enterprise/server/jar/src/test/resources/perftest/
+fi
+cp target/*.csv ../../enterprise/server/jar/src/test/resources/perftest/
commit 5ecc0338f2129d34de47c80f670ac1478efe92f5
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Aug 20 14:23:41 2010 +0200
Add table and OrderBy column
diff --git a/modules/helpers/perftest-data-gen/pom.xml b/modules/helpers/perftest-data-gen/pom.xml
index dceeb22..b9dafce 100644
--- a/modules/helpers/perftest-data-gen/pom.xml
+++ b/modules/helpers/perftest-data-gen/pom.xml
@@ -40,5 +40,4 @@
</dependency>
</dependencies>
-
</project>
\ No newline at end of file
diff --git a/modules/helpers/perftest-data-gen/src/main/java/org/rhq/etc/perftestDataGen/DataGen.java b/modules/helpers/perftest-data-gen/src/main/java/org/rhq/etc/perftestDataGen/DataGen.java
index 4e0857e..f51973f 100644
--- a/modules/helpers/perftest-data-gen/src/main/java/org/rhq/etc/perftestDataGen/DataGen.java
+++ b/modules/helpers/perftest-data-gen/src/main/java/org/rhq/etc/perftestDataGen/DataGen.java
@@ -42,11 +42,13 @@ public class DataGen {
private static final String DOTCSV = ".csv";
private static final String[][] props = {//
- {"agents","RHQ_Agent","id,name,address,port,agenttoken,remote_endpoint"},
- {"plugins","RHQ_Plugin","id,name,display_name,version,amps_version"},
- {"resourceTypes","RHQ_resource_type","id,name,category,plugin"}, // TODO parent / child types?
- {"resources","RHQ_resource","id,uuid,resource_key,name,resource_type_id,parent_resource_id"} // TODO child resources?
- };
+ // filename , table , columns , oderby column
+ {"agents","RHQ_Agent","id,name,address,port,agenttoken,remote_endpoint","id"},
+ {"plugins","RHQ_Plugin","id,name,display_name,version,amps_version,path,md5","id"},
+ {"resourceTypes","RHQ_resource_type","id,name,category,plugin","id"},
+ {"parentResourceTypes","RHQ_RESOURCE_TYPE_PARENTS","resource_type_id,parent_resource_type_id",null},
+ {"resources","RHQ_resource","id,uuid,resource_key,name,resource_type_id,parent_resource_id","id"} // TODO child resources?
+ };
public static void main(String[] args) {
@@ -83,12 +85,17 @@ public class DataGen {
String fileName = prop[0];
String tableName = prop[1];
String columns = prop[2];
+ String orderBy = prop[3];
+
File agents = new File(TARGET + fileName + DOTCSV);
System.out.println("Writing file: " + agents.getAbsolutePath());
CSVWriter writer = new CSVWriter(new FileWriter(agents));
Statement stm = conn.createStatement();
- String query = "SELECT " + columns + " FROM " + tableName;
+ String query = "SELECT " + columns + " FROM " + tableName ;
+ if (orderBy!=null) {
+ query += " ORDER BY " + orderBy + " ASC";
+ }
System.out.println(" using query: [" + query + "]");
System.out.flush();
ResultSet rs = stm.executeQuery(query);
commit fce93b5bcb146d746b35f786bebc0b35ab9bc7a2
Merge: 660a61e... 462e15f...
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Aug 20 12:58:23 2010 +0200
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 660a61e8f9e2796b69e39922406353bf227bd448
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Aug 20 12:57:56 2010 +0200
Be less loud on exceptions when talking to MySQL.
diff --git a/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlDiscoveryComponent.java b/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlDiscoveryComponent.java
index f50fbc0..4f1045e 100644
--- a/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlDiscoveryComponent.java
+++ b/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlDiscoveryComponent.java
@@ -62,7 +62,10 @@ public class MySqlDiscoveryComponent implements ResourceDiscoveryComponent, Manu
ProcessInfo procInfo = result.getProcessInfo();
- servers.add(createResourceDetails(context,context.getDefaultPluginConfiguration(),procInfo));
+ DiscoveredResourceDetails resourceDetails = createResourceDetails(context, context.getDefaultPluginConfiguration(), procInfo);
+ if (resourceDetails!=null) {
+ servers.add(resourceDetails);
+ }
}
return servers;
@@ -78,14 +81,22 @@ public class MySqlDiscoveryComponent implements ResourceDiscoveryComponent, Manu
}
protected static DiscoveredResourceDetails createResourceDetails(ResourceDiscoveryContext discoveryContext,
- Configuration pluginConfiguration,
- ProcessInfo processInfo) {
+ Configuration pluginConfiguration, ProcessInfo processInfo) {
+
String key = buildUrl(pluginConfiguration);
String db = pluginConfiguration.getSimple(DB_CONFIGURATION_PROPERTY).getStringValue();
String name = "MySql [" + db + "]";
- String version = getVersion(pluginConfiguration);
- return new DiscoveredResourceDetails(discoveryContext.getResourceType(), key, name, version,
- DEFAULT_RESOURCE_DESCRIPTION, pluginConfiguration, processInfo);
+ try {
+ String version = getVersion(pluginConfiguration);
+ return new DiscoveredResourceDetails(discoveryContext.getResourceType(), key, name, version,
+ DEFAULT_RESOURCE_DESCRIPTION, pluginConfiguration, processInfo);
+ } catch (Exception e) {
+ log.warn("Getting details failed: " + e.getMessage());
+ if (e.getCause()!=null) {
+ log.warn(" caused by: " + e.getCause().getMessage());
+ }
+ }
+ return null;
}
protected static String buildUrl(Configuration config) {
@@ -104,7 +115,7 @@ public class MySqlDiscoveryComponent implements ResourceDiscoveryComponent, Manu
version = conn.getMetaData().getDatabaseProductVersion();
} catch (SQLException e) {
// TODO GH: How to put this back to the server while inventorying this resource in an unconfigured state
- log.info("Exception detecting mysql instance version", e);
+ log.info("Exception detecting mysql instance version" + e.getMessage());
}
return version;
}
commit 3f7dceb114149a0cbfb45229032f99b5cb402dbb
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Aug 19 16:53:14 2010 -0400
Adding an exec method to generated criteria to fetch query results and iterate over them
An exec method is dynamically added to the generated criteria. It invokes the corresponding
manager SLSB and iterates over the results passing each returned entity into the closure that
is passed to exec. Here is an example to illustrate:
criteria(Resource) {
filter = [resourceType: 'JBossAS Server']
fetch {
resourceType
pluginConfigurationUpdates
}
sort { currentAvailability.desc }
}.exec(subject) { resource ->
// do stuff with each resource object returned
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
index 56da79c..7dcc19b 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
@@ -2,6 +2,8 @@ package org.rhq.enterprise.server.plugins.groovy
import org.apache.commons.logging.Log
import org.apache.commons.logging.LogFactory
+import org.rhq.core.domain.auth.Subject
+import org.rhq.enterprise.server.util.LookupUtil
class CriteriaGenerator {
@@ -39,6 +41,15 @@ class CriteriaGenerator {
criteria.caseSensitive = spec.caseSensitive
criteria.strict = spec.strict
+ def mgr = LookupUtil."get${spec.criteriaType.simpleName}Manager"()
+
+ criteria.metaClass {
+ exec { Subject subject, Closure closure ->
+ def results = mgr."find${spec.criteriaType.simpleName}sByCriteria"(subject, criteria)
+ results.each { closure(it) }
+ }
+ }
+
return criteria
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
index 67b8527..5245756 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
@@ -9,6 +9,7 @@ import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent
import org.rhq.enterprise.server.plugin.pc.ServerPluginContext
import org.rhq.core.domain.resource.Resource
import org.rhq.core.domain.resource.ResourceType
+import org.rhq.enterprise.server.plugin.pc.ScheduledJobInvocationContext
class ScriptRunner implements ServerPluginComponent, ControlFacet {
@@ -58,5 +59,7 @@ class ScriptRunner implements ServerPluginComponent, ControlFacet {
return results;
}
+ void executeScript(ScheduledJobInvocationContext context) {
+ }
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
index 31d21a5..86a2e3a 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -31,6 +31,31 @@
<serverplugin:results>
<c:simple-property name="results"/>
</serverplugin:results>
- </serverplugin:control>
+ </serverplugin:control>
</serverplugin:plugin-component>
+
+ <!--<serverplugin:scheduled-jobs>-->
+ <!--<c:list-property name="jobs">-->
+ <!--<c:map-property name="executeScript">-->
+ <!--<c:simple-property name="enabled" type="boolean" required="true" default="false" summary="true"/>-->
+ <!--<c:simple-property name="scheduleType" type="string" required="true" default="cron" summary="true">-->
+ <!--<c:property-options>-->
+ <!--<c:option value="periodic"/>-->
+ <!--<c:option value="cron" default="true"/>-->
+ <!--</c:property-options>-->
+ <!--</c:simple-property>-->
+ <!--<c:simple-property name="scheduleTrigger" type="string" required="true" default="0 0/30 * * * ?" summary="true"/>-->
+ <!--<c:simple-property name="concurrent" type="boolean" required="true" default="false" summary="false" readOnly="true"/>-->
+ <!--<c:simple-property name="clustered" type="boolean" required="true" default="false" summary="false" readOnly="true"/>-->
+ <!--</c:map-property>-->
+ <!--</c:list-property>-->
+ <!--</serverplugin:scheduled-jobs>-->
+
+ <serverplugin:plugin-configuration>
+ <c:group name="cobblerServerConnection">
+ <c:simple-property name="url" type="string" required="true" default="http://127.0.0.1:80" description="The URL where the Cobbler server is found" />
+ <c:simple-property name="username" type="string" required="true" default="testing" description="The username that this plugin will use when logging into the Cobbler server" />
+ <c:simple-property name="password" type="password" required="true" default="testing" description="The password that this plugin will use when logging into the Cobbler server" />
+ </c:group>
+ </serverplugin:plugin-configuration>
</generic-plugin>
\ No newline at end of file
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
index 54243a4..08b5c7b 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
@@ -7,15 +7,30 @@ import static org.testng.Assert.*
import org.rhq.core.domain.criteria.TestEntityCriteria
import org.rhq.core.domain.test.TestEntityWithoutCriteria
import org.rhq.core.domain.test.TestEntity
+import org.testng.annotations.BeforeMethod
+import groovy.mock.interceptor.MockFor
+import org.rhq.enterprise.server.util.LookupUtil
class CriteriaGeneratorTest {
+ def mockLookupUtil
+
+ @BeforeMethod
+ void setup() {
+ def fakeMgr = {}
+
+ mockLookupUtil = new MockFor(LookupUtil)
+ mockLookupUtil.demand.getTestEntityManager(0..1) { fakeMgr }
+ }
+
@Test
void theCriteriaTypeShouldMatchTheSpecifiedEntity() {
- def spec = new CriteriaSpec(TestEntity)
- def criteria = new CriteriaGenerator().execute(spec)
+ mockLookupUtil.use {
+ def spec = new CriteriaSpec(TestEntity)
+ def criteria = new CriteriaGenerator().execute(spec)
- assertTrue(criteria instanceof TestEntityCriteria, "Expected an instance of ${TestEntityCriteria.name}")
+ assertTrue(criteria instanceof TestEntityCriteria, "Expected an instance of ${TestEntityCriteria.name}")
+ }
}
@Test(expectedExceptions = [CriteriaGeneratorException])
@@ -35,10 +50,12 @@ class CriteriaGeneratorTest {
name: expectedName
]
- def criteria = new CriteriaGenerator().execute(spec)
+ mockLookupUtil.use {
+ def criteria = new CriteriaGenerator().execute(spec)
- assertEquals(criteria.id, expectedId, 'The <id> filter is wrong')
- assertEquals(criteria.name, expectedName, 'The <name> filter is wrong')
+ assertEquals(criteria.id, expectedId, 'The <id> filter is wrong')
+ assertEquals(criteria.name, expectedName, 'The <name> filter is wrong')
+ }
}
@Test
@@ -49,10 +66,12 @@ class CriteriaGeneratorTest {
resourceTypes
}
- def criteria = new CriteriaGenerator().execute(spec)
+ mockLookupUtil.use {
+ def criteria = new CriteriaGenerator().execute(spec)
- assertTrue(criteria.fetchResources, 'Expected fetchResources to be <true>')
- assertTrue(criteria.fetchResourceTypes, 'Expected fetchResourceTypes to be <false>')
+ assertTrue(criteria.fetchResources, 'Expected fetchResources to be <true>')
+ assertTrue(criteria.fetchResourceTypes, 'Expected fetchResourceTypes to be <false>')
+ }
}
@Test
@@ -63,9 +82,11 @@ class CriteriaGeneratorTest {
id.asc
}
- def criteria = new CriteriaGenerator().execute(spec)
+ mockLookupUtil.use {
+ def criteria = new CriteriaGenerator().execute(spec)
- assertEquals(criteria.orderingFieldNames, ['sortName', 'sortId'])
+ assertEquals(criteria.orderingFieldNames, ['sortName', 'sortId'])
+ }
}
@Test
@@ -73,9 +94,11 @@ class CriteriaGeneratorTest {
def spec = new CriteriaSpec(TestEntity)
spec.caseSensitive = true
- def criteria = new CriteriaGenerator().execute(spec)
+ mockLookupUtil.use {
+ def criteria = new CriteriaGenerator().execute(spec)
- assertTrue(criteria.caseSensitive, "Expected the <caseSensitive> property to be set to true")
+ assertTrue(criteria.caseSensitive, "Expected the <caseSensitive> property to be set to true")
+ }
}
@Test
@@ -83,9 +106,11 @@ class CriteriaGeneratorTest {
def spec = new CriteriaSpec(TestEntity)
spec.strict = true
- def criteria = new CriteriaGenerator().execute(spec)
+ mockLookupUtil.use {
+ def criteria = new CriteriaGenerator().execute(spec)
- assertTrue(criteria.strict, "Expected the <strict> property to be set to true")
+ assertTrue(criteria.strict, "Expected the <strict> property to be set to true")
+ }
}
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptTest.groovy
index 5c03608..a08d833 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptTest.groovy
@@ -4,19 +4,54 @@ import org.testng.annotations.Test
import static org.testng.Assert.assertEquals
import static org.testng.Assert.assertTrue
import org.rhq.core.domain.test.TestEntity
+import org.rhq.enterprise.server.util.LookupUtil
+import groovy.mock.interceptor.MockFor
+import org.rhq.enterprise.server.resource.ResourceManagerLocal
+import org.rhq.core.domain.auth.Subject
+import org.rhq.core.domain.criteria.ResourceCriteria
+import org.rhq.core.domain.resource.Resource
class RHQScriptTest {
@Test
void buildCriteriaThatMatchesSpec() {
- def script = new RHQScript()
- def criteria = script.criteria(TestEntity) {
- filters = [id: 1]
- fetch = { resourceTypes }
+ def fakeMgr = {}
+ def lookupUtil = new MockFor(LookupUtil)
+ lookupUtil.demand.getTestEntityManager(1..1) { fakeMgr }
+
+ lookupUtil.use {
+ def script = new RHQScript()
+ def criteria = script.criteria(TestEntity) {
+ filters = [id: 1]
+ fetch { resourceTypes }
+ }
+
+ assertEquals(criteria.id, 1, "The criteria's id property is wrong")
+ assertTrue(criteria.fetchResourceTypes)
}
+ }
+
+ @Test(enabled = false)
+ void addExecMethodToCriteria() {
+ def resourceMgr = new MockFor(ResourceManagerLocal)
+ def mockLookupUtil = new MockFor(LookupUtil)
+
+ mockLookupUtil.demand.getResourceManager(1..1) { resourceMgr }
+ resourceMgr.demand.findResourcesByCriteria { subject, resourceCriteria -> [] }
- assertEquals(criteria.id, 1, "The criteria's id property is wrong")
- assertTrue(criteria.fetchResourceTypes)
+ def criteria
+
+ mockLookupUtil.use {
+ def script = new RHQScript()
+ criteria = script.criteria(Resource) {
+ filters = [id: 1]
+ fetch { resourceType }
+ }
+ }
+
+ resourceMgr.use {
+ criteria.exec(new Subject()) { }
+ }
}
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
index deac8ed..c8a00d6 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
@@ -45,7 +45,7 @@ class ScriptRunnerTest {
executeScript('access_nonexistent_mgr.groovy')
}
- @Test
+ @Test(enabled = false)
void createCriteriaAccordingToSpec() {
def expectedCriteria = new TestEntityCriteria()
expectedCriteria.id = 1
commit 19c1364252e04afde403a0413e0259a9f68d990e
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Aug 19 15:14:49 2010 +0200
Add John Sanda's blog.
diff --git a/pom.xml b/pom.xml
index 6271e7e..6f27b89 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1206,6 +1206,7 @@
</developer>
<developer>
<name>John Sanda</name>
+ <url>http://johnsanda.blogspot.com</url>
<timezone>-5</timezone>
</developer>
<developer>
commit 3c481d48a1ac583cd5b3cfef57e69e0a26b2c054
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Aug 18 21:49:46 2010 -0400
Turning fetch property in criteria dsl into a method that takes literal property names
There is no need now to delimit property names in string. The syntax now looks like,
criteria {
filters = [
resourceType: 'JBossAS',
currentAvailabilityType: DOWN
]
fetch {
alertDefinitions
pluginConfigurationUpdates
}
sort {
resourceCategory.asc
resourceTypeName.desc
}
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaSpec.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaSpec.groovy
index 1485236..2553bbe 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaSpec.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaSpec.groovy
@@ -28,4 +28,11 @@ class CriteriaSpec {
sortFields.addAll(sortSpec.delegate.sortFields)
}
+ def fetch(Closure fetchSpec) {
+ fetchSpec.resolveStrategy = Closure.DELEGATE_ONLY
+ fetchSpec.delegate = new FetchDelegate()
+ fetchSpec()
+ fetch.addAll(fetchSpec.delegate.propertiesToFetch)
+ }
+
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/FetchDelegate.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/FetchDelegate.groovy
new file mode 100644
index 0000000..050eea8
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/FetchDelegate.groovy
@@ -0,0 +1,12 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+class FetchDelegate {
+
+ List propertiesToFetch = []
+
+ def propertyMissing(String name) {
+ propertiesToFetch << name
+ return this
+ }
+
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
index b1cfa66..033c149 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
@@ -1,7 +1,5 @@
package org.rhq.enterprise.server.plugins.groovy
-import org.rhq.core.domain.resource.Resource
-import org.rhq.core.domain.resource.ResourceType
import org.rhq.enterprise.server.util.LookupUtil
class RHQScript extends Script {
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
index 3c9a6e6..54243a4 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
@@ -44,7 +44,10 @@ class CriteriaGeneratorTest {
@Test
void setTheFetchFields() {
def spec = new CriteriaSpec(TestEntity)
- spec.fetch = ['resources', 'resourceTypes']
+ spec.fetch {
+ resources
+ resourceTypes
+ }
def criteria = new CriteriaGenerator().execute(spec)
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptTest.groovy
index 14c4548..5c03608 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptTest.groovy
@@ -12,7 +12,7 @@ class RHQScriptTest {
def script = new RHQScript()
def criteria = script.criteria(TestEntity) {
filters = [id: 1]
- fetch = ['resourceTypes']
+ fetch = { resourceTypes }
}
assertEquals(criteria.id, 1, "The criteria's id property is wrong")
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/create_criteria.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/create_criteria.groovy
index 1583c78..f8ef330 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/create_criteria.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/create_criteria.groovy
@@ -5,7 +5,7 @@ testCriteria = criteria(TestEntity) {
id: 1,
name: 'Test'
]
- fetch = ['resources']
+ fetch { resources }
sort {
id.desc
name.desc
commit 1d42419fa7bb6d73bb38c2d954ec625c808e14e4
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Aug 18 21:34:45 2010 -0400
Updating ScriptRunnerTest to verify latest criteria functionality
Also refactoring RHQScript so that the entityMap is injected into rather than creating it
directly. This has a couple benefits. First, it helps with unit tests since we can inject
fake, test entities during a test run. Secondly, we can create a single, non-static
entityMap in ScriptRunner (the plugin component) and initialize it at plugin initialization
time.
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
index a90701f..b1cfa66 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
@@ -6,10 +6,7 @@ import org.rhq.enterprise.server.util.LookupUtil
class RHQScript extends Script {
- static def entityMap = [
- Resource: Resource.class,
- ResourceType: ResourceType.class
- ]
+ Map entityMap = [:]
Object run() {
super.run()
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
index 19c0576..67b8527 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
@@ -7,9 +7,16 @@ import org.rhq.enterprise.server.plugin.pc.ControlFacet
import org.rhq.enterprise.server.plugin.pc.ControlResults
import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent
import org.rhq.enterprise.server.plugin.pc.ServerPluginContext
+import org.rhq.core.domain.resource.Resource
+import org.rhq.core.domain.resource.ResourceType
class ScriptRunner implements ServerPluginComponent, ControlFacet {
+ Map entityMap = [
+ Resource: Resource.class,
+ ResourceType: ResourceType.class
+ ]
+
void initialize(ServerPluginContext context) {
}
@@ -38,7 +45,12 @@ class ScriptRunner implements ServerPluginComponent, ControlFacet {
def scriptEngine = new GroovyScriptEngine(scriptRoots, scriptClassLoader)
scriptEngine.config = compilerConfig
- def scriptResult = scriptEngine.run(scriptName, new Binding())
+ def script = (RHQScript) scriptEngine.createScript(scriptName, new Binding())
+ // Not sure why but assigning a value to the entityMap property was failing in unit tests.
+ // Calling setEntityMap() worked though.
+ //script.entityMap = entityMap
+ script.setEntityMap(entityMap)
+ def scriptResult = script.run()
ControlResults results = new ControlResults()
results.complexResults.put(new PropertySimple("results", scriptResult))
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy
index 46947a3..b6b2bcb 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy
@@ -54,7 +54,13 @@ class TestEntityCriteria extends Criteria {
}
def String toString() {
- "TestEntityCriteria[id: $id, name: $name, fetchResources: $fetchResources, fetchResourceTypes: $fetchResourceTypes]"
+ "TestEntityCriteria[id: $id, " +
+ "name: $name, ".toString() +
+ "fetchResources: $fetchResources, " +
+ "fetchResourceTypes: $fetchResourceTypes, " +
+ "caseSensitive: $caseSensitive, " +
+ "strict: $strict, " +
+ "sortFields: $orderingFieldNames]"
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
index 1b7ba47..deac8ed 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
@@ -11,12 +11,17 @@ import org.rhq.enterprise.server.plugin.pc.ControlResults
import org.rhq.core.domain.criteria.TestEntityCriteria
import org.testng.annotations.BeforeClass
import org.rhq.core.domain.test.TestEntity
+import org.rhq.core.domain.util.PageOrdering
+import org.testng.annotations.BeforeMethod
class ScriptRunnerTest {
- @BeforeClass
- void setupClass() {
- RHQScript.entityMap << [TestEntity: TestEntity.class]
+ ScriptRunner scriptRunner
+
+ @BeforeMethod
+ void setup() {
+ scriptRunner = new ScriptRunner()
+ scriptRunner.entityMap << [TestEntity: TestEntity.class]
}
@Test
@@ -45,39 +50,22 @@ class ScriptRunnerTest {
def expectedCriteria = new TestEntityCriteria()
expectedCriteria.id = 1
expectedCriteria.name = 'Test'
+ expectedCriteria.strict = true
+ expectedCriteria.caseSensitive = true
expectedCriteria.fetchResources = true
+ expectedCriteria.addSortId(PageOrdering.DESC)
+ expectedCriteria.addSortName(PageOrdering.DESC)
def result = executeScript('create_criteria.groovy')
-// assertEquals(
-// actualCriteria.id,
-// expectedCriteria.id,
-// 'The filter on the id property was not set correctly'
-// )
-// assertEquals(
-// actualCriteria.name,
-// expectedCriteria.name,
-// 'The filter on the name property was not set correctly'
-// )
-// assertEquals(
-// actualCriteria.fetchResources,
-// expectedCriteria.fetchResources,
-// 'The fetch flag for the resources property was not set correctly'
-// )
-// assertEquals(
-// actualCriteria.fetchResourceTypes,
-// expectedCriteria.fetchResourceTypes,
-// 'The fetch flag for the resourceTypes property was not set correctly'
-// )
assertScriptResultEquals(result, expectedCriteria.toString(), 'Failed to generate criteria correctly')
}
def executeScript(String script) {
- def runner = new ScriptRunner()
def params = new Configuration()
params.put(new PropertySimple('script', getScriptPath(script)))
- return runner.invoke('execute', params)
+ return scriptRunner.invoke('execute', params)
}
String getScriptPath(String scriptName) {
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/create_criteria.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/create_criteria.groovy
index 595a7d6..1583c78 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/create_criteria.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/create_criteria.groovy
@@ -6,6 +6,12 @@ testCriteria = criteria(TestEntity) {
name: 'Test'
]
fetch = ['resources']
+ sort {
+ id.desc
+ name.desc
+ }
+ caseSensitive = true
+ strict = true
}
return testCriteria.toString()
\ No newline at end of file
commit 95c1cc1064d30d7689d1577011a53678bb29e7f9
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Aug 18 16:44:58 2010 -0400
Adding support for strict and caseSensitive flags
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
index 8e07760..56da79c 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
@@ -35,6 +35,9 @@ class CriteriaGenerator {
}
spec.fetch.each { criteria."fetch${capitalize(it)}"(true) }
+ spec.sortFields.each { criteria."addSort${capitalize(it.name)}"(it.order) }
+ criteria.caseSensitive = spec.caseSensitive
+ criteria.strict = spec.strict
return criteria
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaSpec.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaSpec.groovy
index 008a090..1485236 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaSpec.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaSpec.groovy
@@ -1,5 +1,8 @@
package org.rhq.enterprise.server.plugins.groovy
+import static org.rhq.core.domain.util.PageOrdering.ASC
+import static org.rhq.core.domain.util.PageOrdering.ASC
+
class CriteriaSpec {
Class criteriaType
@@ -8,10 +11,21 @@ class CriteriaSpec {
List fetch = []
+ List sortFields = []
+
+ Boolean caseSensitive = false
+
+ Boolean strict = false
+
CriteriaSpec(Class criteriaType) {
this.criteriaType = criteriaType
}
- //def propertyMissing
+ def sort(Closure sortSpec) {
+ sortSpec.resolveStrategy = Closure.DELEGATE_ONLY
+ sortSpec.delegate = new SortDelegate()
+ sortSpec()
+ sortFields.addAll(sortSpec.delegate.sortFields)
+ }
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
index 9b27562..19c0576 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
@@ -1,12 +1,12 @@
package org.rhq.enterprise.server.plugins.groovy
-import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent
-import org.rhq.enterprise.server.plugin.pc.ServerPluginContext
-import org.rhq.enterprise.server.plugin.pc.ControlFacet
-import org.rhq.enterprise.server.plugin.pc.ControlResults
+import org.codehaus.groovy.control.CompilerConfiguration
import org.rhq.core.domain.configuration.Configuration
import org.rhq.core.domain.configuration.PropertySimple
-import org.codehaus.groovy.control.CompilerConfiguration
+import org.rhq.enterprise.server.plugin.pc.ControlFacet
+import org.rhq.enterprise.server.plugin.pc.ControlResults
+import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent
+import org.rhq.enterprise.server.plugin.pc.ServerPluginContext
class ScriptRunner implements ServerPluginComponent, ControlFacet {
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/SortDelegate.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/SortDelegate.groovy
index e42ffa4..6e4b9c3 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/SortDelegate.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/SortDelegate.groovy
@@ -1,11 +1,38 @@
package org.rhq.enterprise.server.plugins.groovy
-/**
- * Created by IntelliJ IDEA.
- * User: jsanda
- * Date: Aug 18, 2010
- * Time: 12:18:36 PM
- * To change this template use File | Settings | File Templates.
- */
+import static org.rhq.core.domain.util.PageOrdering.ASC
+import static org.rhq.core.domain.util.PageOrdering.DESC
+import org.rhq.core.domain.util.PageOrdering
+
class SortDelegate {
+
+ String currentField
+
+ def sortFields = []
+
+ def propertyMissing(String name) {
+ if (sortFields.size() > 0 && (name == 'asc' || name == 'desc')) {
+ def sortField = sortFields[sortFields.size() - 1]
+ sortField.order = getOrder(name)
+ currentField = null
+ }
+ else {
+ currentField = name
+ sortFields << new SortField(name: currentField, order: ASC)
+ }
+ return this
+ }
+
+ PageOrdering getOrder(String order) {
+ if (order == 'asc') {
+ return ASC
+ }
+ else if (order == 'desc') {
+ return DESC
+ }
+ else {
+ throw new RHQScriptException("Unrecognized value for sort order: $order - possible values are <asc> and <desc>")
+ }
+ }
+
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy
index f077ced..46947a3 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy
@@ -1,5 +1,7 @@
package org.rhq.core.domain.criteria
+import org.rhq.core.domain.util.PageOrdering
+
class TestEntityCriteria extends Criteria {
Integer id
@@ -10,10 +12,21 @@ class TestEntityCriteria extends Criteria {
boolean fetchResourceTypes
+ PageOrdering sortId
+
+ PageOrdering sortName
+
+ TestEntityCriteria() {
+ sortOverrides.put('sortId', 'id')
+ sortOverrides.put('sortName', 'name')
+ }
+
Class<?> getPersistentClass() {
TestEntityCriteria
}
+
+
void addFilterId(Integer id) {
this.id = id
}
@@ -30,6 +43,16 @@ class TestEntityCriteria extends Criteria {
fetchResourceTypes = fetch
}
+ void addSortId(PageOrdering order) {
+ addSortField('id')
+ sortId = order
+ }
+
+ void addSortName(PageOrdering order) {
+ addSortField('name')
+ sortName = order
+ }
+
def String toString() {
"TestEntityCriteria[id: $id, name: $name, fetchResources: $fetchResources, fetchResourceTypes: $fetchResourceTypes]"
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
index b5439a6..3c9a6e6 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
@@ -52,4 +52,37 @@ class CriteriaGeneratorTest {
assertTrue(criteria.fetchResourceTypes, 'Expected fetchResourceTypes to be <false>')
}
+ @Test
+ void setTheSortFields() {
+ def spec = new CriteriaSpec(TestEntity)
+ spec.sort {
+ name.desc
+ id.asc
+ }
+
+ def criteria = new CriteriaGenerator().execute(spec)
+
+ assertEquals(criteria.orderingFieldNames, ['sortName', 'sortId'])
+ }
+
+ @Test
+ void setCaseSensitiveFlag() {
+ def spec = new CriteriaSpec(TestEntity)
+ spec.caseSensitive = true
+
+ def criteria = new CriteriaGenerator().execute(spec)
+
+ assertTrue(criteria.caseSensitive, "Expected the <caseSensitive> property to be set to true")
+ }
+
+ @Test
+ void setStrictFlag() {
+ def spec = new CriteriaSpec(TestEntity)
+ spec.strict = true
+
+ def criteria = new CriteriaGenerator().execute(spec)
+
+ assertTrue(criteria.strict, "Expected the <strict> property to be set to true")
+ }
+
}
commit b101eace8447eabe19f7b5363245e9f4f787c19a
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Aug 18 14:48:36 2010 -0400
Refactoring logic SortDelegate.propertyMissing and adding more tests
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/SortField.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/SortField.groovy
index 61447b6..e38b421 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/SortField.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/SortField.groovy
@@ -1,11 +1,15 @@
package org.rhq.enterprise.server.plugins.groovy
-/**
- * Created by IntelliJ IDEA.
- * User: jsanda
- * Date: Aug 18, 2010
- * Time: 1:36:44 PM
- * To change this template use File | Settings | File Templates.
- */
+import org.rhq.core.domain.util.PageOrdering
+
class SortField {
+
+ String name
+
+ PageOrdering order
+
+ String toString() {
+ "SortField[name: $name, order: $order]"
+ }
+
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/SortDelegateTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/SortDelegateTest.groovy
index b7d2a08..70abb12 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/SortDelegateTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/SortDelegateTest.groovy
@@ -1,11 +1,88 @@
package org.rhq.enterprise.server.plugins.groovy
-/**
- * Created by IntelliJ IDEA.
- * User: jsanda
- * Date: Aug 18, 2010
- * Time: 12:47:35 PM
- * To change this template use File | Settings | File Templates.
- */
+import org.testng.annotations.Test
+
+import static org.rhq.core.domain.util.PageOrdering.ASC
+import static org.rhq.core.domain.util.PageOrdering.DESC
+import static org.testng.Assert.*
+import org.testng.annotations.BeforeMethod
+
class SortDelegateTest {
+
+ SortDelegate sort
+
+ @BeforeMethod
+ void setup() {
+ sort = new SortDelegate()
+ }
+
+ @Test
+ void addPropertyWithDefaultOrder() {
+ sort.username
+
+ assertSortFieldsEquals(
+ sort.sortFields,
+ [new SortField(name: 'username', order: ASC)],
+ "Expected sortFields to contain <username> with default order of $ASC"
+ )
+ }
+
+ @Test
+ void addPropertyWithOrderSpecified() {
+ sort.username.desc
+
+ assertSortFieldsEquals(
+ sort.sortFields,
+ [new SortField(name: 'username', order: DESC)],
+ "Expected sortFields to contain <username> with sort order of $DESC"
+ )
+ }
+
+ @Test
+ void addMultipleProperties() {
+ sort.username
+ sort.id
+
+ assertSortFieldsEquals(
+ sort.sortFields,
+ [new SortField(name: 'username', order: ASC), new SortField(name: 'id', order: ASC)],
+ "Failed to specify multiple sort fields with implied ordering"
+ )
+ }
+
+ @Test
+ void addMultiplePropertiesWithOrderSpecified() {
+ sort.username.desc
+ sort.id.asc
+
+ assertSortFieldsEquals(
+ sort.sortFields,
+ [new SortField(name: 'username', order: DESC), new SortField(name: 'id', order: ASC)],
+ "Failed to specify multiple sort fields with order specified for each field"
+ )
+ }
+
+ @Test
+ void addMultiplePropertiesWithOrderSpecifiedForSome() {
+ sort.username.desc
+ sort.id
+
+ assertSortFieldsEquals(
+ sort.sortFields,
+ [new SortField(name: 'username', order: DESC), new SortField(name: 'id', order: ASC)],
+ "Failed to specify multiple sort fields with order specified for some of them"
+ )
+ }
+
+ def assertSortFieldsEquals(List actual, List expected, String msg) {
+ assertEquals(actual.size(), expected.size(), "$msg -- Lists do not have the same number of elements")
+
+ def index = 0
+ expected.each { expectedSortField ->
+ def actualSortField = actual[index++]
+ assertEquals(actualSortField.name, expectedSortField.name, "$msg -- sort fields differ, actual: $actual, expected: $expected")
+ assertEquals(actualSortField.order, expectedSortField.order, "$msg -- sort fields differ, actual: $actual, expected: $expected")
+ }
+ }
+
}
commit c334492346f6938e2877444a7dae1d11b5e0f2a3
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Aug 18 14:26:45 2010 -0400
Initial commit for sort-related classes
The sort delegate allows for a syntax like,
sort {
username.asc
password.desc
}
where the order of sort fields is determined by the order in which the
property names are listed. An order can optionally be specified with
'asc' or 'desc' using the dot operator as illustrated above.
diff --git a/modules/enterprise/server/plugins/groovy-script/pom.xml b/modules/enterprise/server/plugins/groovy-script/pom.xml
index 4691ce7..22b86e0 100644
--- a/modules/enterprise/server/plugins/groovy-script/pom.xml
+++ b/modules/enterprise/server/plugins/groovy-script/pom.xml
@@ -24,7 +24,7 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
- <version>1.7.1</version>
+ <version>1.7.3</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/SortDelegate.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/SortDelegate.groovy
new file mode 100644
index 0000000..e42ffa4
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/SortDelegate.groovy
@@ -0,0 +1,11 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: jsanda
+ * Date: Aug 18, 2010
+ * Time: 12:18:36 PM
+ * To change this template use File | Settings | File Templates.
+ */
+class SortDelegate {
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/SortField.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/SortField.groovy
new file mode 100644
index 0000000..61447b6
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/SortField.groovy
@@ -0,0 +1,11 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: jsanda
+ * Date: Aug 18, 2010
+ * Time: 1:36:44 PM
+ * To change this template use File | Settings | File Templates.
+ */
+class SortField {
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/SortDelegateTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/SortDelegateTest.groovy
new file mode 100644
index 0000000..b7d2a08
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/SortDelegateTest.groovy
@@ -0,0 +1,11 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: jsanda
+ * Date: Aug 18, 2010
+ * Time: 12:47:35 PM
+ * To change this template use File | Settings | File Templates.
+ */
+class SortDelegateTest {
+}
commit deb3350d933143dbf5e5c6f76fb330f046a8aec5
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Aug 17 23:58:38 2010 -0400
Adding test in ScriptRunnerTest to verify criteria dsl
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
index 3d47f1e..a90701f 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
@@ -1,12 +1,12 @@
package org.rhq.enterprise.server.plugins.groovy
-import org.rhq.enterprise.server.util.LookupUtil
import org.rhq.core.domain.resource.Resource
import org.rhq.core.domain.resource.ResourceType
+import org.rhq.enterprise.server.util.LookupUtil
class RHQScript extends Script {
- def entityMap = [
+ static def entityMap = [
Resource: Resource.class,
ResourceType: ResourceType.class
]
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy
index 9c83185..f077ced 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy
@@ -30,4 +30,9 @@ class TestEntityCriteria extends Criteria {
fetchResourceTypes = fetch
}
+ def String toString() {
+ "TestEntityCriteria[id: $id, name: $name, fetchResources: $fetchResources, fetchResourceTypes: $fetchResourceTypes]"
+ }
+
+
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/test/TestEntity.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/test/TestEntity.groovy
new file mode 100644
index 0000000..04b21b4
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/test/TestEntity.groovy
@@ -0,0 +1,9 @@
+package org.rhq.core.domain.test
+
+class TestEntity {
+
+ Integer id
+
+ String name
+
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/test/TestEntityWithoutCriteria.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/test/TestEntityWithoutCriteria.groovy
new file mode 100644
index 0000000..312ea47
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/test/TestEntityWithoutCriteria.groovy
@@ -0,0 +1,4 @@
+package org.rhq.core.domain.test
+
+class TestEntityWithoutCriteria {
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
index 07d450d..b5439a6 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
@@ -5,8 +5,8 @@ import org.testng.annotations.Test
import static org.testng.Assert.*
import org.rhq.core.domain.criteria.TestEntityCriteria
-import org.rhq.org.rhq.core.domain.test.TestEntity
-import org.rhq.org.rhq.core.domain.test.TestEntityWithoutCriteria
+import org.rhq.core.domain.test.TestEntityWithoutCriteria
+import org.rhq.core.domain.test.TestEntity
class CriteriaGeneratorTest {
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptTest.groovy
index 84c7806..14c4548 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptTest.groovy
@@ -1,9 +1,9 @@
package org.rhq.enterprise.server.plugins.groovy
import org.testng.annotations.Test
-import org.rhq.org.rhq.core.domain.test.TestEntity
-
-import static org.testng.Assert.*
+import static org.testng.Assert.assertEquals
+import static org.testng.Assert.assertTrue
+import org.rhq.core.domain.test.TestEntity
class RHQScriptTest {
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
index 1991b25..1b7ba47 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
@@ -8,9 +8,17 @@ import org.rhq.core.domain.configuration.PropertySimple
import static org.testng.Assert.*
import org.rhq.enterprise.server.plugin.pc.ControlResults
+import org.rhq.core.domain.criteria.TestEntityCriteria
+import org.testng.annotations.BeforeClass
+import org.rhq.core.domain.test.TestEntity
class ScriptRunnerTest {
+ @BeforeClass
+ void setupClass() {
+ RHQScript.entityMap << [TestEntity: TestEntity.class]
+ }
+
@Test
void lookupManagerWhenADynamicManagerPropertyIsAccessed() {
def fakeMgr = {}
@@ -32,6 +40,38 @@ class ScriptRunnerTest {
executeScript('access_nonexistent_mgr.groovy')
}
+ @Test
+ void createCriteriaAccordingToSpec() {
+ def expectedCriteria = new TestEntityCriteria()
+ expectedCriteria.id = 1
+ expectedCriteria.name = 'Test'
+ expectedCriteria.fetchResources = true
+
+ def result = executeScript('create_criteria.groovy')
+
+// assertEquals(
+// actualCriteria.id,
+// expectedCriteria.id,
+// 'The filter on the id property was not set correctly'
+// )
+// assertEquals(
+// actualCriteria.name,
+// expectedCriteria.name,
+// 'The filter on the name property was not set correctly'
+// )
+// assertEquals(
+// actualCriteria.fetchResources,
+// expectedCriteria.fetchResources,
+// 'The fetch flag for the resources property was not set correctly'
+// )
+// assertEquals(
+// actualCriteria.fetchResourceTypes,
+// expectedCriteria.fetchResourceTypes,
+// 'The fetch flag for the resourceTypes property was not set correctly'
+// )
+ assertScriptResultEquals(result, expectedCriteria.toString(), 'Failed to generate criteria correctly')
+ }
+
def executeScript(String script) {
def runner = new ScriptRunner()
def params = new Configuration()
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/org/rhq/core/domain/test/TestEntity.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/org/rhq/core/domain/test/TestEntity.groovy
deleted file mode 100644
index 12ee6df..0000000
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/org/rhq/core/domain/test/TestEntity.groovy
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.rhq.org.rhq.core.domain.test
-
-class TestEntity {
-
- Integer id
-
- String name
-
-}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/org/rhq/core/domain/test/TestEntityWithoutCriteria.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/org/rhq/core/domain/test/TestEntityWithoutCriteria.groovy
deleted file mode 100644
index 1ddcea2..0000000
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/org/rhq/core/domain/test/TestEntityWithoutCriteria.groovy
+++ /dev/null
@@ -1,4 +0,0 @@
-package org.rhq.org.rhq.core.domain.test
-
-class TestEntityWithoutCriteria {
-}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/create_criteria.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/create_criteria.groovy
new file mode 100644
index 0000000..595a7d6
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/create_criteria.groovy
@@ -0,0 +1,11 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+testCriteria = criteria(TestEntity) {
+ filters = [
+ id: 1,
+ name: 'Test'
+ ]
+ fetch = ['resources']
+}
+
+return testCriteria.toString()
\ No newline at end of file
commit 25735a3547c396ebc7fae2a8b9db7a58bf9fe9d7
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Aug 17 00:26:22 2010 -0400
Adding logic to throw exception if script accesses nonexistent manager SLSB
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
index a1f131d..3d47f1e 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
@@ -18,7 +18,12 @@ class RHQScript extends Script {
def propertyMissing(String name) {
if (name.endsWith("Manager")) {
def method = "get$name"
- return LookupUtil."$method"()
+ try {
+ return LookupUtil."$method"()
+ }
+ catch (MissingMethodException e) {
+ throw new RHQScriptException("Unable to locate $name", e)
+ }
}
if (entityMap.containsKey(name)) {
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptException.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptException.groovy
new file mode 100644
index 0000000..930a358
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptException.groovy
@@ -0,0 +1,22 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+class RHQScriptException extends Exception {
+
+ def RHQScriptException() {
+ super();
+ }
+
+ def RHQScriptException(String message) {
+ super(message);
+ }
+
+ def RHQScriptException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ def RHQScriptException(Throwable cause) {
+ super(cause);
+ }
+
+
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
index e45656f..1991b25 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
@@ -17,12 +17,8 @@ class ScriptRunnerTest {
def lookupMock = new MockFor(LookupUtil)
lookupMock.demand.getSubjectManager { fakeMgr }
- def runner = new ScriptRunner()
- def params = new Configuration()
- params.put(new PropertySimple('script', getScriptPath('access_mgr.groovy')))
-
lookupMock.use {
- def result = runner.invoke('execute', params)
+ def result = executeScript('access_mgr.groovy')
assertScriptResultEquals(
result,
fakeMgr.class.name,
@@ -31,6 +27,19 @@ class ScriptRunnerTest {
}
}
+ @Test(expectedExceptions = [RHQScriptException])
+ void throwExceptionWhenManagerAccessedDoesNotExist() {
+ executeScript('access_nonexistent_mgr.groovy')
+ }
+
+ def executeScript(String script) {
+ def runner = new ScriptRunner()
+ def params = new Configuration()
+ params.put(new PropertySimple('script', getScriptPath(script)))
+
+ return runner.invoke('execute', params)
+ }
+
String getScriptPath(String scriptName) {
this.class.getResource(scriptName).toURI().path
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/access_nonexistent_mgr.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/access_nonexistent_mgr.groovy
new file mode 100644
index 0000000..75fc7ca
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/access_nonexistent_mgr.groovy
@@ -0,0 +1,3 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+return NonexistentManager.class.name
commit dd07dc1e3cf123a4d034a54a8cc4fdc93cf11cdc
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Aug 17 00:03:50 2010 -0400
Renaming GroovyScriptPluginComponent to ScriptRunner and adding unit test for it
diff --git a/modules/enterprise/server/plugins/groovy-script/pom.xml b/modules/enterprise/server/plugins/groovy-script/pom.xml
index a8a98b2..4691ce7 100644
--- a/modules/enterprise/server/plugins/groovy-script/pom.xml
+++ b/modules/enterprise/server/plugins/groovy-script/pom.xml
@@ -26,12 +26,34 @@
<artifactId>groovy-all</artifactId>
<version>1.7.1</version>
</dependency>
-
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.7.1</version>
</dependency>
+ <dependency>
+ <groupId>quartz</groupId>
+ <artifactId>quartz</artifactId>
+ <version>1.5.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-jms-api</artifactId>
+ <version>1.1.0.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-system</artifactId>
+ <version>4.2.3.GA</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
index 4e73145..8e07760 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
@@ -16,7 +16,7 @@ class CriteriaGenerator {
clazz = Class.forName(className)
}
catch (Exception e) {
- def msg = "Failed to load criteria class $classname"
+ def msg = "Failed to load criteria class $className"
log.warn msg, e
throw new CriteriaGeneratorException(msg, e)
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaSpec.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaSpec.groovy
index c46892d..008a090 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaSpec.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaSpec.groovy
@@ -12,6 +12,6 @@ class CriteriaSpec {
this.criteriaType = criteriaType
}
- def propertyMissing
+ //def propertyMissing
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/GroovyScriptPluginComponent.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/GroovyScriptPluginComponent.groovy
deleted file mode 100644
index de0184c..0000000
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/GroovyScriptPluginComponent.groovy
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.rhq.enterprise.server.plugins.groovy
-
-import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent
-import org.rhq.enterprise.server.plugin.pc.ServerPluginContext
-import org.rhq.enterprise.server.plugin.pc.ControlFacet
-import org.rhq.enterprise.server.plugin.pc.ControlResults
-import org.rhq.core.domain.configuration.Configuration
-import org.rhq.core.domain.configuration.PropertySimple
-import org.codehaus.groovy.control.CompilerConfiguration
-
-class GroovyScriptPluginComponent implements ServerPluginComponent, ControlFacet {
-
- void initialize(ServerPluginContext context) {
-
- }
-
- void start() {
-
- }
-
- void stop() {
-
- }
-
- void shutdown() {
-
- }
-
- ControlResults invoke(String name, Configuration parameters) {
- def compilerConfig = new CompilerConfiguration()
- compilerConfig.scriptBaseClass = RHQScript.class.name
-
- def scriptName = parameters.getSimpleValue("script", null)
-
- def scriptClassLoader = new GroovyClassLoader(Thread.currentThread().contextClassLoader, compilerConfig)
- def scriptRoots = new URL[1]
- scriptRoots[0] = new File(scriptName).toURI().toURL()
- def scriptEngine = new GroovyScriptEngine(scriptRoots, scriptClassLoader)
- scriptEngine.config = compilerConfig
-
- def scriptResult = scriptEngine.run(scriptName, new Binding())
-
- ControlResults results = new ControlResults()
- results.complexResults.put(new PropertySimple("results", scriptResult))
-
- return results;
- }
-
-
-}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
index b87e863..a1f131d 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
@@ -30,10 +30,11 @@ class RHQScript extends Script {
def criteria(Class entityClass, Closure specifyCriteria) {
def criteriaSpec = new CriteriaSpec(entityClass)
+ specifyCriteria.resolveStrategy = Closure.DELEGATE_FIRST
specifyCriteria.delegate = criteriaSpec
specifyCriteria()
- return new CriteriaGenerator().execute(criteriaSpec)
+ return new CriteriaGenerator().execute(specifyCriteria.delegate)
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
new file mode 100644
index 0000000..9b27562
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunner.groovy
@@ -0,0 +1,50 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent
+import org.rhq.enterprise.server.plugin.pc.ServerPluginContext
+import org.rhq.enterprise.server.plugin.pc.ControlFacet
+import org.rhq.enterprise.server.plugin.pc.ControlResults
+import org.rhq.core.domain.configuration.Configuration
+import org.rhq.core.domain.configuration.PropertySimple
+import org.codehaus.groovy.control.CompilerConfiguration
+
+class ScriptRunner implements ServerPluginComponent, ControlFacet {
+
+ void initialize(ServerPluginContext context) {
+
+ }
+
+ void start() {
+
+ }
+
+ void stop() {
+
+ }
+
+ void shutdown() {
+
+ }
+
+ ControlResults invoke(String name, Configuration parameters) {
+ def compilerConfig = new CompilerConfiguration()
+ compilerConfig.scriptBaseClass = RHQScript.class.name
+
+ def scriptName = parameters.getSimpleValue("script", null)
+
+ def scriptClassLoader = new GroovyClassLoader(Thread.currentThread().contextClassLoader, compilerConfig)
+ def scriptRoots = new URL[1]
+ scriptRoots[0] = new File(scriptName).toURI().toURL()
+ def scriptEngine = new GroovyScriptEngine(scriptRoots, scriptClassLoader)
+ scriptEngine.config = compilerConfig
+
+ def scriptResult = scriptEngine.run(scriptName, new Binding())
+
+ ControlResults results = new ControlResults()
+ results.complexResults.put(new PropertySimple("results", scriptResult))
+
+ return results;
+ }
+
+
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
index c4c6678..31d21a5 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -7,7 +7,7 @@
xmlns="urn:xmlns:rhq-serverplugin.generic"
xmlns:serverplugin="urn:xmlns:rhq-serverplugin"
xmlns:c="urn:xmlns:rhq-configuration">
- <serverplugin:plugin-component class="GroovyScriptPluginComponent">
+ <serverplugin:plugin-component class="ScriptRunner">
<serverplugin:control name="execute" description="Executes a Groovy script">
<serverplugin:parameters>
<c:simple-property name="script"
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
new file mode 100644
index 0000000..e45656f
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/ScriptRunnerTest.groovy
@@ -0,0 +1,46 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+import org.testng.annotations.Test
+import groovy.mock.interceptor.MockFor
+import org.rhq.enterprise.server.util.LookupUtil
+import org.rhq.core.domain.configuration.Configuration
+import org.rhq.core.domain.configuration.PropertySimple
+
+import static org.testng.Assert.*
+import org.rhq.enterprise.server.plugin.pc.ControlResults
+
+class ScriptRunnerTest {
+
+ @Test
+ void lookupManagerWhenADynamicManagerPropertyIsAccessed() {
+ def fakeMgr = {}
+ def lookupMock = new MockFor(LookupUtil)
+ lookupMock.demand.getSubjectManager { fakeMgr }
+
+ def runner = new ScriptRunner()
+ def params = new Configuration()
+ params.put(new PropertySimple('script', getScriptPath('access_mgr.groovy')))
+
+ lookupMock.use {
+ def result = runner.invoke('execute', params)
+ assertScriptResultEquals(
+ result,
+ fakeMgr.class.name,
+ "Expected the script to return the object it received from accessing a dynamic manager property"
+ )
+ }
+ }
+
+ String getScriptPath(String scriptName) {
+ this.class.getResource(scriptName).toURI().path
+ }
+
+ def assertScriptResultEquals(controlResults, expected, msg) {
+ assertEquals(getScriptResult(controlResults), expected, msg)
+ }
+
+ def getScriptResult(ControlResults results) {
+ results.complexResults.getSimpleValue("results", null)
+ }
+
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/access_mgr.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/access_mgr.groovy
new file mode 100644
index 0000000..1f060f5
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/resources/org/rhq/enterprise/server/plugins/groovy/access_mgr.groovy
@@ -0,0 +1,4 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+return SubjectManager.class.name
+
commit 225c0357d027d6e46269eec7ab723a692cf46813
Merge: 986a88c... 7677e9f...
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Aug 16 17:03:52 2010 -0400
Merge branch 'master' into groovy-server-plugin
commit 986a88c1e229f182ae1aa78de4f15fb3ecb9985c
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Aug 16 16:41:34 2010 -0400
Adding error handling logic in CriteriaGenerator
Initial commit for RHQScriptTest.groovy which includes a test for the
criteria dsl.
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
index 3595114..4e73145 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
@@ -1,10 +1,33 @@
package org.rhq.enterprise.server.plugins.groovy
+import org.apache.commons.logging.Log
+import org.apache.commons.logging.LogFactory
+
class CriteriaGenerator {
+ static Log log = LogFactory.getLog(CriteriaGenerator)
+
def execute(CriteriaSpec spec) {
- def clazz = Class.forName("org.rhq.core.domain.criteria.${spec.criteriaType.simpleName}Criteria")
- def criteria = clazz.newInstance()
+ def className = "org.rhq.core.domain.criteria.${spec.criteriaType.simpleName}Criteria"
+ def clazz
+ def criteria
+
+ try {
+ clazz = Class.forName(className)
+ }
+ catch (Exception e) {
+ def msg = "Failed to load criteria class $classname"
+ log.warn msg, e
+ throw new CriteriaGeneratorException(msg, e)
+ }
+ try {
+ criteria = clazz.newInstance()
+ }
+ catch (Exception e) {
+ def msg = "Failed to create instance of criteria class $className"
+ log.warn msg, e
+ throw new CriteriaGeneratorException(msg, e)
+ }
spec.filters.each { key, value ->
def filterName = "addFilter${capitalize(key)}"
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorException.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorException.groovy
new file mode 100644
index 0000000..9040a51
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorException.groovy
@@ -0,0 +1,22 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+class CriteriaGeneratorException extends Exception {
+
+ def CriteriaGeneratorException() {
+ super();
+ }
+
+ def CriteriaGeneratorException(String message) {
+ super(message);
+ }
+
+ def CriteriaGeneratorException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ def CriteriaGeneratorException(Throwable cause) {
+ super(cause);
+ }
+
+
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
index caed55c..07d450d 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
@@ -6,6 +6,7 @@ import static org.testng.Assert.*
import org.rhq.core.domain.criteria.TestEntityCriteria
import org.rhq.org.rhq.core.domain.test.TestEntity
+import org.rhq.org.rhq.core.domain.test.TestEntityWithoutCriteria
class CriteriaGeneratorTest {
@@ -17,10 +18,11 @@ class CriteriaGeneratorTest {
assertTrue(criteria instanceof TestEntityCriteria, "Expected an instance of ${TestEntityCriteria.name}")
}
-// @Test
-// void throwExceptionWhenEntityTypeDoesNotExist() {
-// def spec = new CriteriaSpec()
-// }
+ @Test(expectedExceptions = [CriteriaGeneratorException])
+ void throwExceptionWhenCriteriaTypeDoesNotExist() {
+ def spec = new CriteriaSpec(TestEntityWithoutCriteria)
+ def criteria = new CriteriaGenerator().execute(spec)
+ }
@Test
void setTheFilterFields() {
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptTest.groovy
new file mode 100644
index 0000000..84c7806
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScriptTest.groovy
@@ -0,0 +1,22 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+import org.testng.annotations.Test
+import org.rhq.org.rhq.core.domain.test.TestEntity
+
+import static org.testng.Assert.*
+
+class RHQScriptTest {
+
+ @Test
+ void buildCriteriaThatMatchesSpec() {
+ def script = new RHQScript()
+ def criteria = script.criteria(TestEntity) {
+ filters = [id: 1]
+ fetch = ['resourceTypes']
+ }
+
+ assertEquals(criteria.id, 1, "The criteria's id property is wrong")
+ assertTrue(criteria.fetchResourceTypes)
+ }
+
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/org/rhq/core/domain/test/TestEntityWithoutCriteria.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/org/rhq/core/domain/test/TestEntityWithoutCriteria.groovy
new file mode 100644
index 0000000..1ddcea2
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/org/rhq/core/domain/test/TestEntityWithoutCriteria.groovy
@@ -0,0 +1,4 @@
+package org.rhq.org.rhq.core.domain.test
+
+class TestEntityWithoutCriteria {
+}
commit d7f2b2f0aad74e96b29c256c654bacd4262b8286
Merge: 0d54848... 02a6eaf...
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Aug 16 07:38:27 2010 -0400
Merge branch 'master' into groovy-server-plugin
commit 0d5484847d4e9f995ec7e83bc851d4e5d721110f
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Aug 16 07:31:18 2010 -0400
Adding support for fetch fields in criteria dsl, adding criteria() method in RHQScript
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaDelegate.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaDelegate.groovy
deleted file mode 100644
index 742dded..0000000
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaDelegate.groovy
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.rhq.enterprise.server.plugins.groovy
-
-class CriteriaDelegate {
-
- Map filters = [:]
-
- Class criteriaType
-
- CriteriaDelegate(Class criteriaType) {
- this.criteriaType = criteriaType
- }
-
-}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
index c966dee..3595114 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
@@ -2,15 +2,17 @@ package org.rhq.enterprise.server.plugins.groovy
class CriteriaGenerator {
- def execute(CriteriaDelegate details) {
- def clazz = Class.forName("org.rhq.core.domain.criteria.${details.criteriaType.simpleName}Criteria")
+ def execute(CriteriaSpec spec) {
+ def clazz = Class.forName("org.rhq.core.domain.criteria.${spec.criteriaType.simpleName}Criteria")
def criteria = clazz.newInstance()
- details.filters.each { key, value ->
+ spec.filters.each { key, value ->
def filterName = "addFilter${capitalize(key)}"
criteria."$filterName"(value)
}
+ spec.fetch.each { criteria."fetch${capitalize(it)}"(true) }
+
return criteria
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaSpec.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaSpec.groovy
new file mode 100644
index 0000000..c46892d
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaSpec.groovy
@@ -0,0 +1,17 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+class CriteriaSpec {
+
+ Class criteriaType
+
+ Map filters = [:]
+
+ List fetch = []
+
+ CriteriaSpec(Class criteriaType) {
+ this.criteriaType = criteriaType
+ }
+
+ def propertyMissing
+
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
index 6259473..b87e863 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
@@ -28,4 +28,13 @@ class RHQScript extends Script {
return null // TODO Should we instead some sort of property not found exception
}
+ def criteria(Class entityClass, Closure specifyCriteria) {
+ def criteriaSpec = new CriteriaSpec(entityClass)
+ specifyCriteria.delegate = criteriaSpec
+ specifyCriteria()
+
+ return new CriteriaGenerator().execute(criteriaSpec)
+
+ }
+
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy
index fe1395a..9c83185 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy
@@ -6,6 +6,10 @@ class TestEntityCriteria extends Criteria {
String name
+ boolean fetchResources
+
+ boolean fetchResourceTypes
+
Class<?> getPersistentClass() {
TestEntityCriteria
}
@@ -18,4 +22,12 @@ class TestEntityCriteria extends Criteria {
this.name = name
}
+ void fetchResources(boolean fetch) {
+ fetchResources = fetch
+ }
+
+ void fetchResourceTypes(boolean fetch) {
+ fetchResourceTypes = fetch
+ }
+
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
index 9ec9fbf..caed55c 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
@@ -11,28 +11,43 @@ class CriteriaGeneratorTest {
@Test
void theCriteriaTypeShouldMatchTheSpecifiedEntity() {
-// def details = new CriteriaDelegate(Resource.class)
- def details = new CriteriaDelegate(TestEntity)
- def criteria = new CriteriaGenerator().execute(details)
+ def spec = new CriteriaSpec(TestEntity)
+ def criteria = new CriteriaGenerator().execute(spec)
assertTrue(criteria instanceof TestEntityCriteria, "Expected an instance of ${TestEntityCriteria.name}")
}
+// @Test
+// void throwExceptionWhenEntityTypeDoesNotExist() {
+// def spec = new CriteriaSpec()
+// }
+
@Test
- void setTheCriteriaFilters() {
+ void setTheFilterFields() {
def expectedId = 1
def expectedName = 'Test Entity'
- def details = new CriteriaDelegate(TestEntity)
- details.filters = [
+ def spec = new CriteriaSpec(TestEntity)
+ spec.filters = [
id: expectedId,
name: expectedName
]
- def criteria = new CriteriaGenerator().execute(details)
+ def criteria = new CriteriaGenerator().execute(spec)
assertEquals(criteria.id, expectedId, 'The <id> filter is wrong')
assertEquals(criteria.name, expectedName, 'The <name> filter is wrong')
}
+ @Test
+ void setTheFetchFields() {
+ def spec = new CriteriaSpec(TestEntity)
+ spec.fetch = ['resources', 'resourceTypes']
+
+ def criteria = new CriteriaGenerator().execute(spec)
+
+ assertTrue(criteria.fetchResources, 'Expected fetchResources to be <true>')
+ assertTrue(criteria.fetchResourceTypes, 'Expected fetchResourceTypes to be <false>')
+ }
+
}
commit 4200f06280fbe7b900e76ee03883f0fe3e7ab585
Author: John Sanda <jsanda(a)redhat.com>
Date: Sun Aug 15 15:26:48 2010 -0400
Starting to implement criteria dsl.
The purpose of the dsl is to provide a more concise, yet readable syntax
for creating and executing criteria queries that are commonly used in the
remote apis and in the CLI. The syntax will look something like,
criteria(Resource) {
filters = [
id: 1
name: 'My Resource'
availability: UP
]
sort = [
name: ASC,
pluginName: DESC
]
}
This will create a ResourceCriteria object with the id, name, and
availability filters set. And it will sort by the name and pluginName
properties.
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaDelegate.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaDelegate.groovy
new file mode 100644
index 0000000..742dded
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaDelegate.groovy
@@ -0,0 +1,13 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+class CriteriaDelegate {
+
+ Map filters = [:]
+
+ Class criteriaType
+
+ CriteriaDelegate(Class criteriaType) {
+ this.criteriaType = criteriaType
+ }
+
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
new file mode 100644
index 0000000..c966dee
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGenerator.groovy
@@ -0,0 +1,24 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+class CriteriaGenerator {
+
+ def execute(CriteriaDelegate details) {
+ def clazz = Class.forName("org.rhq.core.domain.criteria.${details.criteriaType.simpleName}Criteria")
+ def criteria = clazz.newInstance()
+
+ details.filters.each { key, value ->
+ def filterName = "addFilter${capitalize(key)}"
+ criteria."$filterName"(value)
+ }
+
+ return criteria
+ }
+
+ String capitalize(String string) {
+ if (string.length() == 1) {
+ return string.toUpperCase()
+ }
+ return string[0].toUpperCase() + string[1..string.length() - 1]
+ }
+
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
index 38bcad7..6259473 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
@@ -1,9 +1,16 @@
package org.rhq.enterprise.server.plugins.groovy
import org.rhq.enterprise.server.util.LookupUtil
+import org.rhq.core.domain.resource.Resource
+import org.rhq.core.domain.resource.ResourceType
class RHQScript extends Script {
+ def entityMap = [
+ Resource: Resource.class,
+ ResourceType: ResourceType.class
+ ]
+
Object run() {
super.run()
}
@@ -13,6 +20,11 @@ class RHQScript extends Script {
def method = "get$name"
return LookupUtil."$method"()
}
+
+ if (entityMap.containsKey(name)) {
+ return entityMap[name]
+ }
+
return null // TODO Should we instead some sort of property not found exception
}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy
new file mode 100644
index 0000000..fe1395a
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/core/domain/criteria/TestEntityCriteria.groovy
@@ -0,0 +1,21 @@
+package org.rhq.core.domain.criteria
+
+class TestEntityCriteria extends Criteria {
+
+ Integer id
+
+ String name
+
+ Class<?> getPersistentClass() {
+ TestEntityCriteria
+ }
+
+ void addFilterId(Integer id) {
+ this.id = id
+ }
+
+ void addFilterName(String name) {
+ this.name = name
+ }
+
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
new file mode 100644
index 0000000..9ec9fbf
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/enterprise/server/plugins/groovy/CriteriaGeneratorTest.groovy
@@ -0,0 +1,38 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+import org.testng.annotations.Test
+
+import static org.testng.Assert.*
+
+import org.rhq.core.domain.criteria.TestEntityCriteria
+import org.rhq.org.rhq.core.domain.test.TestEntity
+
+class CriteriaGeneratorTest {
+
+ @Test
+ void theCriteriaTypeShouldMatchTheSpecifiedEntity() {
+// def details = new CriteriaDelegate(Resource.class)
+ def details = new CriteriaDelegate(TestEntity)
+ def criteria = new CriteriaGenerator().execute(details)
+
+ assertTrue(criteria instanceof TestEntityCriteria, "Expected an instance of ${TestEntityCriteria.name}")
+ }
+
+ @Test
+ void setTheCriteriaFilters() {
+ def expectedId = 1
+ def expectedName = 'Test Entity'
+
+ def details = new CriteriaDelegate(TestEntity)
+ details.filters = [
+ id: expectedId,
+ name: expectedName
+ ]
+
+ def criteria = new CriteriaGenerator().execute(details)
+
+ assertEquals(criteria.id, expectedId, 'The <id> filter is wrong')
+ assertEquals(criteria.name, expectedName, 'The <name> filter is wrong')
+ }
+
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/org/rhq/core/domain/test/TestEntity.groovy b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/org/rhq/core/domain/test/TestEntity.groovy
new file mode 100644
index 0000000..12ee6df
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/test/groovy/org/rhq/org/rhq/core/domain/test/TestEntity.groovy
@@ -0,0 +1,9 @@
+package org.rhq.org.rhq.core.domain.test
+
+class TestEntity {
+
+ Integer id
+
+ String name
+
+}
commit 0331a532c08ed27468b827f277ae80b2179c8eb4
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Aug 9 23:09:49 2010 -0400
Initial commit for RHQScript.groovy which is the base class for scripts run by the plugin
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/GroovyScriptPluginComponent.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/GroovyScriptPluginComponent.groovy
index 1f12a36..de0184c 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/GroovyScriptPluginComponent.groovy
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/GroovyScriptPluginComponent.groovy
@@ -6,6 +6,7 @@ import org.rhq.enterprise.server.plugin.pc.ControlFacet
import org.rhq.enterprise.server.plugin.pc.ControlResults
import org.rhq.core.domain.configuration.Configuration
import org.rhq.core.domain.configuration.PropertySimple
+import org.codehaus.groovy.control.CompilerConfiguration
class GroovyScriptPluginComponent implements ServerPluginComponent, ControlFacet {
@@ -26,13 +27,17 @@ class GroovyScriptPluginComponent implements ServerPluginComponent, ControlFacet
}
ControlResults invoke(String name, Configuration parameters) {
+ def compilerConfig = new CompilerConfiguration()
+ compilerConfig.scriptBaseClass = RHQScript.class.name
+
def scriptName = parameters.getSimpleValue("script", null)
- def scriptClassLoader = new GroovyClassLoader(Thread.currentThread().contextClassLoader)
+ def scriptClassLoader = new GroovyClassLoader(Thread.currentThread().contextClassLoader, compilerConfig)
def scriptRoots = new URL[1]
scriptRoots[0] = new File(scriptName).toURI().toURL()
def scriptEngine = new GroovyScriptEngine(scriptRoots, scriptClassLoader)
-
+ scriptEngine.config = compilerConfig
+
def scriptResult = scriptEngine.run(scriptName, new Binding())
ControlResults results = new ControlResults()
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
new file mode 100644
index 0000000..38bcad7
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/RHQScript.groovy
@@ -0,0 +1,19 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+import org.rhq.enterprise.server.util.LookupUtil
+
+class RHQScript extends Script {
+
+ Object run() {
+ super.run()
+ }
+
+ def propertyMissing(String name) {
+ if (name.endsWith("Manager")) {
+ def method = "get$name"
+ return LookupUtil."$method"()
+ }
+ return null // TODO Should we instead some sort of property not found exception
+ }
+
+}
commit fe85bc399b56ef1e904280bede87baac4927133a
Author: John Sanda <jsanda(a)localhost.localdomain>
Date: Mon Aug 9 22:08:15 2010 -0400
Commenting out classpath parameter for now due to BZ 622996
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-add-map.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-add-map.xhtml
new file mode 100644
index 0000000..ea074f8
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-add-map.xhtml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component">
+
+<ui:composition template="/rhq/admin/plugin/plugin-details-map.xhtml">
+ <ui:param name="actionVerb" value="Add to" />
+ <ui:param name="editBreadCrumb" value="true" />
+
+ <ui:define name="mapConfig">
+ <onc:config configurationDefinition="#{editPluginConfigurationUIBean.currentConfigurationDefinition}"
+ configuration="#{editPluginConfigurationUIBean.currentConfiguration}"
+ listName="#{param.listName}" />
+
+ <h:panelGrid columns="2" styleClass="buttons-table" columnClasses="button-cell">
+ <h:commandButton value="OK" type="submit" action="#{editPluginConfigurationUIBean.finishMap}"
+ alt="Click to Add Map" styleClass="buttonmed"/>
+ <h:commandButton value="RESET" type="reset" immediate="true"
+ alt="Click to Reset Fields" styleClass="buttonmed"/>
+ </h:panelGrid>
+ </ui:define>
+</ui:composition>
+
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-edit-map.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-edit-map.xhtml
new file mode 100644
index 0000000..e69de29
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
index c952fa7..c4c6678 100644
--- a/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -13,19 +13,20 @@
<c:simple-property name="script"
required="true"
description="The pat of the script to execute. Can be relative or absolute." />
- <c:list-property name="classpathList" displayName="classpath" required="false">
- <c:map-property name="classpathMap">
- <c:simple-property name="path"
- description="A file system path that can refer to a classes directory, a
- single JAR file, or a directory containing multiple JAR files."/>
- <c:simple-property name="libDir" displayName="JAR Directory" default="no">
- <c:property-options>
- <c:option value="yes" name="Yes"/>
- <c:option value="no" name="No"/>
- </c:property-options>
- </c:simple-property>
- </c:map-property>
- </c:list-property>
+ <!--<c:list-property name="classpathList" displayName="classpath" required="false">-->
+ <!--<c:map-property name="classpathMap">-->
+ <!--<c:simple-property name="path"-->
+ <!--required="true"-->
+ <!--description="A file system path that can refer to a classes directory, a-->
+ <!--single JAR file, or a directory containing multiple JAR files."/>-->
+ <!--<c:simple-property name="libDir" displayName="JAR Directory" default="no" required="false">-->
+ <!--<c:property-options>-->
+ <!--<c:option value="yes" name="Yes"/>-->
+ <!--<c:option value="no" name="No"/>-->
+ <!--</c:property-options>-->
+ <!--</c:simple-property>-->
+ <!--</c:map-property>-->
+ <!--</c:list-property>-->
</serverplugin:parameters>
<serverplugin:results>
<c:simple-property name="results"/>
commit 0efa7953b22a7877ab594bba2f4ebc2382875ef0
Author: John Sanda <jsanda(a)localhost.localdomain>
Date: Sun Aug 8 22:23:01 2010 -0400
Initial commit for groovy-script server plugin
With this commit there is initial support for running a specified
script. The plugin descriptor has meta data in place for specifying
a classpath, but support for an additional classpath has not been
implemented yet.
diff --git a/modules/enterprise/server/plugins/groovy-script/pom.xml b/modules/enterprise/server/plugins/groovy-script/pom.xml
new file mode 100644
index 0000000..a8a98b2
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/pom.xml
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-enterprise-server-plugins-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.rhq</groupId>
+ <artifactId>groovy-script-server-plugin</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+
+ <name>RHQ Enterprise Server Groovy Script Plugin</name>
+
+ <scm>
+ <connection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/enterprise/server/...</connection>
+ <developerConnection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/enterprise/server/...</developerConnection>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.7.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.7.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.0</version>
+ <executions>
+ <execution>
+ <id>copy-libs</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.7.1</version>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludedGroups>${rhq.testng.excludedGroups}</excludedGroups>
+ <!--
+ <argLine>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</argLine>
+ -->
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <profiles>
+
+ <profile>
+ <id>dev</id>
+
+ <properties>
+ <rhq.rootDir>../../../../..</rhq.rootDir>
+ <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
+ <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir>
+ </properties>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+
+ <execution>
+ <id>deploy</id>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="${rhq.deploymentDir}" />
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating ${deployment.file}...</echo>
+ <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>undeploy</id>
+ <phase>clean</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Deleting ${deployment.file}...</echo>
+ <delete file="${deployment.file}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>deploy-jar-meta-inf</id>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating META-INF dir in ${deployment.file}...</echo>
+ <unjar src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.outputDirectory}">
+ <patternset>
+ <include name="META-INF/**" />
+ </patternset>
+ </unjar>
+ <jar destfile="${deployment.file}" manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF" update="true">
+ </jar>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+</project>
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/GroovyScriptPluginComponent.groovy b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/GroovyScriptPluginComponent.groovy
new file mode 100644
index 0000000..1f12a36
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/groovy/org/rhq/enterprise/server/plugins/groovy/GroovyScriptPluginComponent.groovy
@@ -0,0 +1,45 @@
+package org.rhq.enterprise.server.plugins.groovy
+
+import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent
+import org.rhq.enterprise.server.plugin.pc.ServerPluginContext
+import org.rhq.enterprise.server.plugin.pc.ControlFacet
+import org.rhq.enterprise.server.plugin.pc.ControlResults
+import org.rhq.core.domain.configuration.Configuration
+import org.rhq.core.domain.configuration.PropertySimple
+
+class GroovyScriptPluginComponent implements ServerPluginComponent, ControlFacet {
+
+ void initialize(ServerPluginContext context) {
+
+ }
+
+ void start() {
+
+ }
+
+ void stop() {
+
+ }
+
+ void shutdown() {
+
+ }
+
+ ControlResults invoke(String name, Configuration parameters) {
+ def scriptName = parameters.getSimpleValue("script", null)
+
+ def scriptClassLoader = new GroovyClassLoader(Thread.currentThread().contextClassLoader)
+ def scriptRoots = new URL[1]
+ scriptRoots[0] = new File(scriptName).toURI().toURL()
+ def scriptEngine = new GroovyScriptEngine(scriptRoots, scriptClassLoader)
+
+ def scriptResult = scriptEngine.run(scriptName, new Binding())
+
+ ControlResults results = new ControlResults()
+ results.complexResults.put(new PropertySimple("results", scriptResult))
+
+ return results;
+ }
+
+
+}
diff --git a/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
new file mode 100644
index 0000000..c952fa7
--- /dev/null
+++ b/modules/enterprise/server/plugins/groovy-script/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -0,0 +1,35 @@
+<generic-plugin name="GroovyScriptServerPlugin"
+ displayName="Groovy Script Server Plugin"
+ description="A plugin that executes Groovy scripts on the RHQ server"
+ package="org.rhq.enterprise.server.plugins.groovy"
+ disabledOnDiscovery="true"
+ version="2.0"
+ xmlns="urn:xmlns:rhq-serverplugin.generic"
+ xmlns:serverplugin="urn:xmlns:rhq-serverplugin"
+ xmlns:c="urn:xmlns:rhq-configuration">
+ <serverplugin:plugin-component class="GroovyScriptPluginComponent">
+ <serverplugin:control name="execute" description="Executes a Groovy script">
+ <serverplugin:parameters>
+ <c:simple-property name="script"
+ required="true"
+ description="The pat of the script to execute. Can be relative or absolute." />
+ <c:list-property name="classpathList" displayName="classpath" required="false">
+ <c:map-property name="classpathMap">
+ <c:simple-property name="path"
+ description="A file system path that can refer to a classes directory, a
+ single JAR file, or a directory containing multiple JAR files."/>
+ <c:simple-property name="libDir" displayName="JAR Directory" default="no">
+ <c:property-options>
+ <c:option value="yes" name="Yes"/>
+ <c:option value="no" name="No"/>
+ </c:property-options>
+ </c:simple-property>
+ </c:map-property>
+ </c:list-property>
+ </serverplugin:parameters>
+ <serverplugin:results>
+ <c:simple-property name="results"/>
+ </serverplugin:results>
+ </serverplugin:control>
+ </serverplugin:plugin-component>
+</generic-plugin>
\ No newline at end of file
13 years, 8 months