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;
}
}