modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertFormatUtility.java
| 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentListView.java
| 73 ++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleDeploymentView.java
| 25 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/destination/BundleDestinationListView.java
| 77 ++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundlesListView.java
| 23 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/version/BundleVersionListView.java
| 39 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
| 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/Link.java
| 101 ++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ViewLink.java
| 62 ---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/CanvasField.java
| 89 +++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/EnhancedListGrid.java
| 85 +++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/EscapedHtmlCellFormatter.java
| 19 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
| 64 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/ViewLinkField.java
| 54 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tagging/TagEditorView.java
| 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
| 20 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResourcesPortlet.java
| 24 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
| 17 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
| 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDetailsView.java
| 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
| 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/AlertDefinitionReportView.java
| 166 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java
| 39 +-
25 files changed, 694 insertions(+), 336 deletions(-)
New commits:
commit 471497cc81108613590d680db5e5b012b2934d3e
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Apr 27 18:23:46 2011 -0400
more work on converting raw HTML links to ViewLink widgets
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertFormatUtility.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertFormatUtility.java
index 26a2477..e81d57e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertFormatUtility.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertFormatUtility.java
@@ -210,6 +210,7 @@ public class AlertFormatUtility {
AlertDefinition recoveryAlertDefinition = alert.getRecoveryAlertDefinition();
if (recoveryAlertDefinition != null && recoveryAlertDefinition.getId() !=
0) {
int resourceId = alert.getAlertDefinition().getResource().getId();
+ // TODO (ips, 04/27/11): Can the below URL be converted over to a coregui
URL?
String otherAlertDef = "<a
href=\"/alerts/Config.do?mode=viewRoles&id=" + resourceId +
"&ad="
+ recoveryAlertDefinition.getId() + "\">" +
recoveryAlertDefinition.getName() + "</a>";
recoveryInfo =
MSG.view_alert_common_tab_conditions_recovery_enabled(otherAlertDef);
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 b2763d9..d9d2d3d 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
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -28,7 +28,6 @@ import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.events.DoubleClickEvent;
import com.smartgwt.client.widgets.events.DoubleClickHandler;
-import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -39,10 +38,11 @@ import org.rhq.core.domain.bundle.BundleDeploymentStatus;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ErrorMessageWindow;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
-import org.rhq.enterprise.gui.coregui.client.bundle.list.BundleVersionDataSource;
+import org.rhq.enterprise.gui.coregui.client.components.ViewLink;
import org.rhq.enterprise.gui.coregui.client.components.table.EscapedHtmlCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
+import org.rhq.enterprise.gui.coregui.client.components.table.ViewLinkField;
import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
/**
@@ -62,12 +62,33 @@ public class BundleDeploymentListView extends
Table<BundleDeploymentDataSource>
@Override
protected void configureTable() {
ListGridField idField = new ListGridField(BundleDeploymentDataSource.FIELD_ID,
MSG.common_title_id());
- ListGridField nameField = new
ListGridField(BundleDeploymentDataSource.FIELD_NAME, MSG
+ ListGridField nameField;
+ // only users that are authorized can see deployments
+ if (canManageBundles) {
+ nameField = new ViewLinkField(BundleDeploymentDataSource.FIELD_NAME,
MSG.view_bundle_deploy_name()) {
+ protected ViewLink getViewLink(ListGrid grid, ListGridRecord record) {
+ String linkText =
StringUtility.escapeHtml(record.getAttribute(BundleDeploymentDataSource.FIELD_NAME));
+ String viewPath = getBundleDeploymentLink(record);
+ return new ViewLink(extendLocatorId("ViewLink"), linkText,
viewPath);
+ }
+ };
+ } else {
+ nameField = new ListGridField(BundleDeploymentDataSource.FIELD_NAME, MSG
.view_bundle_deploy_name());
+ nameField.setCellFormatter(new EscapedHtmlCellFormatter());
+ }
ListGridField descriptionField = new
ListGridField(BundleDeploymentDataSource.FIELD_DESCRIPTION, MSG
.common_title_description());
- ListGridField bundleVersionField = new
ListGridField(BundleDeploymentDataSource.FIELD_BUNDLE_VERSION_VERSION,
- MSG.view_bundle_bundleVersion());
+ ViewLinkField bundleVersionField = new
ViewLinkField(BundleDeploymentDataSource.FIELD_BUNDLE_VERSION_VERSION,
+ MSG.view_bundle_bundleVersion()) {
+ protected ViewLink getViewLink(ListGrid grid, ListGridRecord record) {
+ String linkText =
record.getAttribute(BundleDeploymentDataSource.FIELD_BUNDLE_VERSION_VERSION);
+ String viewPath = LinkManager.getBundleVersionLink(record
+ .getAttributeAsInt(BundleDeploymentDataSource.FIELD_BUNDLE_ID),
record
+
.getAttributeAsInt(BundleDeploymentDataSource.FIELD_BUNDLE_VERSION_ID));
+ return new ViewLink(extendLocatorId("ViewLink"), linkText,
viewPath);
+ }
+ };
ListGridField statusField = new
ListGridField(BundleDeploymentDataSource.FIELD_STATUS, MSG
.common_title_status());
ListGridField deployTimeField = new
ListGridField(BundleDeploymentDataSource.FIELD_DEPLOY_TIME, MSG
@@ -75,34 +96,8 @@ public class BundleDeploymentListView extends
Table<BundleDeploymentDataSource>
TimestampCellFormatter.prepareDateField(deployTimeField);
deployTimeField.setType(ListGridFieldType.DATE);
- // only users that are authorized can see deployments
- if (canManageBundles) {
- nameField.setCellFormatter(new CellFormatter() {
- public String format(Object value, ListGridRecord record, int i, int i1)
{
- return "<a href=\""
- + LinkManager.getBundleDeploymentLink(record
-
.getAttributeAsInt(BundleDeploymentDataSource.FIELD_BUNDLE_ID), record
- .getAttributeAsInt(BundleDeploymentDataSource.FIELD_ID)) +
"\">"
- + StringUtility.escapeHtml(String.valueOf(value))
- + "</a>";
- }
- });
- } else {
- nameField.setCellFormatter(new EscapedHtmlCellFormatter());
- }
-
descriptionField.setCellFormatter(new EscapedHtmlCellFormatter());
- bundleVersionField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord record, int i, int i1) {
- return "<a href=\""
- + LinkManager.getBundleVersionLink(record
- .getAttributeAsInt(BundleDeploymentDataSource.FIELD_BUNDLE_ID),
record
-
.getAttributeAsInt(BundleDeploymentDataSource.FIELD_BUNDLE_VERSION_ID)) +
"\">"
- + String.valueOf(o) + "</a>";
- }
- });
-
HashMap<String, String> statusIcons = new HashMap<String, String>();
statusIcons.put(BundleDeploymentStatus.PENDING.name(),
"subsystems/bundle/install-loader.gif");
statusIcons.put(BundleDeploymentStatus.IN_PROGRESS.name(),
"subsystems/bundle/install-loader.gif");
@@ -140,13 +135,19 @@ public class BundleDeploymentListView extends
Table<BundleDeploymentDataSource>
ListGrid listGrid = (ListGrid) event.getSource();
ListGridRecord[] selectedRows = listGrid.getSelection();
if (selectedRows != null && selectedRows.length == 1) {
- String selectedId =
selectedRows[0].getAttribute(BundleVersionDataSource.FIELD_BUNDLE_ID);
- String selectedVersionId =
selectedRows[0].getAttribute(BundleVersionDataSource.FIELD_ID);
-
CoreGUI.goToView(LinkManager.getBundleDeploymentLink(Integer.valueOf(selectedId), Integer
- .valueOf(selectedVersionId)));
+ ListGridRecord selectedRecord = selectedRows[0];
+ String viewPath = getBundleDeploymentLink(selectedRecord);
+ CoreGUI.goToView(viewPath);
}
}
});
}
}
+
+ private static String getBundleDeploymentLink(ListGridRecord record) {
+ return LinkManager.getBundleDeploymentLink(record
+ .getAttributeAsInt(BundleDeploymentDataSource.FIELD_BUNDLE_ID), record
+ .getAttributeAsInt(BundleDeploymentDataSource.FIELD_ID));
+ }
+
}
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 e220cfc..58b5664 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
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -41,7 +41,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.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -67,13 +66,14 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ErrorMessageWindow;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
-import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.bundle.revert.BundleRevertWizard;
import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
+import org.rhq.enterprise.gui.coregui.client.components.ViewLink;
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.TimestampCellFormatter;
+import org.rhq.enterprise.gui.coregui.client.components.table.ViewLinkField;
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;
@@ -112,7 +112,7 @@ public class BundleDeploymentView extends LocatableVLayout implements
Bookmarkab
statusIcons.put(BundleDeploymentStatus.SUCCESS.name(),
"subsystems/bundle/Ok_11.png");
}
- private void viewBundleDeployment(BundleDeployment bundleDeployment, ViewId current)
{
+ private void viewBundleDeployment(BundleDeployment bundleDeployment) {
// Whenever a new view request comes in, make sure to clean house to avoid ID
conflicts for sub-widgets
this.destroyMembers();
@@ -344,16 +344,15 @@ public class BundleDeploymentView extends LocatableVLayout
implements Bookmarkab
resourceIcon.setWidth(40);
// resource field
- ListGridField resource = new ListGridField("resource",
MSG.common_title_platform());
+ ViewLinkField resource = new ViewLinkField("resource",
MSG.common_title_platform()) {
+ protected ViewLink getViewLink(ListGrid grid, ListGridRecord record) {
+ String resourceUrl =
LinkManager.getResourceLink(record.getAttributeAsInt("resourceId"));
+ String linkText =
StringUtility.escapeHtml(record.getAttribute("resource"));
+ return new ViewLink(extendLocatorId("ViewLink"), linkText,
resourceUrl);
+ }
+ };
resource.setAutoFitWidth(true);
resource.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);
- resource.setCellFormatter(new CellFormatter() {
- public String format(Object value, ListGridRecord listGridRecord, int i, int
i1) {
- return "<a href=\"" +
LinkManager.getResourceLink(listGridRecord.getAttributeAsInt("resourceId"))
- + "\">" +
StringUtility.escapeHtml(String.valueOf(value)) + "</a>";
-
- }
- });
// resource version field
ListGridField resourceVersion = new ListGridField("resourceVersion",
MSG.view_bundle_deploy_operatingSystem());
@@ -456,7 +455,7 @@ public class BundleDeploymentView extends LocatableVLayout implements
Bookmarkab
public void
onSuccess(PageList<BundleResourceDeployment> result) {
deployment.setResourceDeployments(result);
- viewBundleDeployment(deployment,
viewPath.getCurrent());
+ viewBundleDeployment(deployment);
}
});
}
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 bbd20f6..2e94600 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
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -28,7 +28,6 @@ import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.events.DoubleClickEvent;
import com.smartgwt.client.widgets.events.DoubleClickHandler;
-import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -36,8 +35,10 @@ import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.bundle.BundleDeploymentStatus;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.ViewLink;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
+import org.rhq.enterprise.gui.coregui.client.components.table.ViewLinkField;
import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
/**
@@ -58,13 +59,36 @@ public class BundleDestinationListView extends
Table<BundleDestinationDataSource
@Override
protected void configureTable() {
ListGridField idField = new ListGridField(BundleDestinationDataSource.FIELD_ID,
MSG.common_title_id());
- ListGridField nameField = new
ListGridField(BundleDestinationDataSource.FIELD_NAME, MSG.common_title_name());
+ ViewLinkField nameField = new
ViewLinkField(BundleDestinationDataSource.FIELD_NAME, MSG.common_title_name()) {
+ protected ViewLink getViewLink(ListGrid grid, ListGridRecord record) {
+ String bundleName =
record.getAttribute(BundleDestinationDataSource.FIELD_NAME);
+ String linkText = StringUtility.escapeHtml(bundleName);
+ String viewPath = getBundleDestinationLink(record);
+ return new ViewLink(extendLocatorId("ViewLink"), linkText,
viewPath);
+ }
+ };
ListGridField descriptionField = new
ListGridField(BundleDestinationDataSource.FIELD_DESCRIPTION, MSG
.common_title_description());
- ListGridField bundleNameField = new
ListGridField(BundleDestinationDataSource.FIELD_BUNDLE_NAME, MSG
- .view_bundle_bundle());
- ListGridField groupNameField = new
ListGridField(BundleDestinationDataSource.FIELD_GROUP_NAME, MSG
- .view_bundle_dest_group());
+ ViewLinkField bundleNameField = new
ViewLinkField(BundleDestinationDataSource.FIELD_BUNDLE_NAME, MSG
+ .view_bundle_bundle()) {
+ protected ViewLink getViewLink(ListGrid grid, ListGridRecord record) {
+ String bundleName =
record.getAttribute(BundleDestinationDataSource.FIELD_BUNDLE_NAME);
+ String linkText = StringUtility.escapeHtml(bundleName);
+ Integer bundleId =
record.getAttributeAsInt(BundleDestinationDataSource.FIELD_BUNDLE_ID);
+ String viewPath = LinkManager.getBundleLink(bundleId);
+ return new ViewLink(extendLocatorId("ViewLink"), linkText,
viewPath);
+ }
+ };
+ ViewLinkField groupNameField = new
ViewLinkField(BundleDestinationDataSource.FIELD_GROUP_NAME, MSG
+ .view_bundle_dest_group()) {
+ protected ViewLink getViewLink(ListGrid grid, ListGridRecord record) {
+ String groupName =
record.getAttribute(BundleDestinationDataSource.FIELD_GROUP_NAME);
+ String linkText = StringUtility.escapeHtml(groupName);
+ Integer groupId =
record.getAttributeAsInt(BundleDestinationDataSource.FIELD_GROUP_ID);
+ String viewPath = LinkManager.getResourceGroupLink(groupId);
+ return new ViewLink(extendLocatorId("ViewLink"), linkText,
viewPath);
+ }
+ };
ListGridField deployDirField = new
ListGridField(BundleDestinationDataSource.FIELD_DEPLOY_DIR, MSG
.view_bundle_dest_deployDir());
ListGridField latestDeploymentVersionField = new ListGridField(
@@ -77,31 +101,6 @@ public class BundleDestinationListView extends
Table<BundleDestinationDataSource
latestDeploymentDateField.setType(ListGridFieldType.DATE);
TimestampCellFormatter.prepareDateField(latestDeploymentDateField);
- nameField.setCellFormatter(new CellFormatter() {
- public String format(Object value, ListGridRecord listGridRecord, int i, int
i1) {
- Integer bundleId =
listGridRecord.getAttributeAsInt(BundleDestinationDataSource.FIELD_BUNDLE_ID);
- Integer bundleDestId =
listGridRecord.getAttributeAsInt(BundleDestinationDataSource.FIELD_ID);
- return "<a href=\"" +
LinkManager.getBundleDestinationLink(bundleId, bundleDestId) + "\">"
- + StringUtility.escapeHtml(value.toString()) +
"</a>";
- }
- });
-
- groupNameField.setCellFormatter(new CellFormatter() {
- public String format(Object value, ListGridRecord listGridRecord, int i, int
i1) {
- Integer groupId =
listGridRecord.getAttributeAsInt(BundleDestinationDataSource.FIELD_GROUP_ID);
- return "<a href=\"" +
LinkManager.getResourceGroupLink(groupId) + "\">"
- + StringUtility.escapeHtml(value.toString()) +
"</a>";
- }
- });
-
- bundleNameField.setCellFormatter(new CellFormatter() {
- public String format(Object value, ListGridRecord listGridRecord, int i, int
i1) {
- Integer bid =
listGridRecord.getAttributeAsInt(BundleDestinationDataSource.FIELD_BUNDLE_ID);
- return "<a href=\"" + LinkManager.getBundleLink(bid) +
"\">"
- + StringUtility.escapeHtml(value.toString()) +
"</a>";
- }
- });
-
HashMap<String, String> statusIcons = new HashMap<String, String>();
statusIcons.put(BundleDeploymentStatus.PENDING.name(),
"subsystems/bundle/install-loader.gif");
statusIcons.put(BundleDeploymentStatus.IN_PROGRESS.name(),
"subsystems/bundle/install-loader.gif");
@@ -133,12 +132,18 @@ public class BundleDestinationListView extends
Table<BundleDestinationDataSource
ListGrid listGrid = (ListGrid) event.getSource();
ListGridRecord[] selectedRows = listGrid.getSelection();
if (selectedRows != null && selectedRows.length == 1) {
- String selectedId =
selectedRows[0].getAttribute(BundleDestinationDataSource.FIELD_BUNDLE_ID);
- String selectedDestId =
selectedRows[0].getAttribute(BundleDestinationDataSource.FIELD_ID);
-
CoreGUI.goToView(LinkManager.getBundleDestinationLink(Integer.valueOf(selectedId),
Integer
- .valueOf(selectedDestId)));
+ ListGridRecord selectedRecord = selectedRows[0];
+ String viewPath = getBundleDestinationLink(selectedRecord);
+ CoreGUI.goToView(viewPath);
}
}
});
}
+
+ private static String getBundleDestinationLink(ListGridRecord record) {
+ Integer bundleId =
record.getAttributeAsInt(BundleDestinationDataSource.FIELD_BUNDLE_ID);
+ Integer bundleDestId =
record.getAttributeAsInt(BundleDestinationDataSource.FIELD_ID);
+ return LinkManager.getBundleDestinationLink(bundleId, bundleDestId);
+ }
+
}
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 bf9db3e..b0313bc 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
@@ -25,6 +25,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.events.DoubleClickEvent;
import com.smartgwt.client.widgets.events.DoubleClickHandler;
import com.smartgwt.client.widgets.grid.CellFormatter;
@@ -32,6 +33,7 @@ import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.composite.BundleWithLatestVersionComposite;
@@ -41,7 +43,9 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.bundle.create.BundleCreateWizard;
import org.rhq.enterprise.gui.coregui.client.bundle.deploy.BundleDeployWizard;
+import org.rhq.enterprise.gui.coregui.client.components.ViewLink;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
+import org.rhq.enterprise.gui.coregui.client.components.table.CanvasField;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
import org.rhq.enterprise.gui.coregui.client.gwt.BundleGWTServiceAsync;
@@ -85,15 +89,18 @@ public class BundlesListView extends
Table<BundlesWithLatestVersionDataSource> {
idField.setType(ListGridFieldType.INTEGER);
idField.setWidth("50");
- ListGridField nameField = new
ListGridField(BundlesWithLatestVersionDataSource.FIELD_NAME, MSG
- .common_title_name());
- nameField.setWidth("33%");
- nameField.setCellFormatter(new CellFormatter() {
- public String format(Object value, ListGridRecord record, int i, int i1) {
- return "<a href=\"" +
record.getAttribute(BundlesWithLatestVersionDataSource.FIELD_NAMELINK) +
"\">"
- + StringUtility.escapeHtml(String.valueOf(value)) +
"</a>";
+ CanvasField nameField = new
CanvasField(BundlesWithLatestVersionDataSource.FIELD_NAME, MSG
+ .common_title_name()) {
+ protected Canvas createCanvas(ListGrid grid, ListGridRecord record) {
+ HLayout hLayout = createHLayout(grid);
+ String name =
record.getAttribute(BundlesWithLatestVersionDataSource.FIELD_NAME);
+ String nameLink =
record.getAttribute(BundlesWithLatestVersionDataSource.FIELD_NAMELINK);
+ ViewLink viewLink = new ViewLink(extendLocatorId("ViewLink"),
StringUtility.escapeHtml(name), nameLink);
+ hLayout.addMember(viewLink);
+ return hLayout;
}
- });
+ };
+ nameField.setWidth("33%");
ListGridField descField = new
ListGridField(BundlesWithLatestVersionDataSource.FIELD_DESCRIPTION, MSG
.common_title_description());
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 10e1e43..29c9744 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
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -24,16 +24,19 @@ package org.rhq.enterprise.gui.coregui.client.bundle.version;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.SelectionStyle;
+import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.events.DoubleClickEvent;
import com.smartgwt.client.widgets.events.DoubleClickHandler;
-import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.bundle.list.BundleVersionDataSource;
+import org.rhq.enterprise.gui.coregui.client.components.ViewLink;
+import org.rhq.enterprise.gui.coregui.client.components.table.CanvasField;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
/**
@@ -60,15 +63,17 @@ public class BundleVersionListView extends
Table<BundleVersionDataSource> {
protected void configureTable() {
ListGridField idField = new ListGridField(FIELD_ID, MSG.common_title_id());
- ListGridField versionField = new
ListGridField(BundleVersionDataSource.FIELD_VERSION, MSG
- .common_title_version());
- versionField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1)
{
- Integer _bundleId =
listGridRecord.getAttributeAsInt("bundleId");
- Integer _bvId = listGridRecord.getAttributeAsInt("id");
- return "<a href=\"" +
LinkManager.getBundleVersionLink(_bundleId, _bvId) + "\">" + o +
"</a>";
+ CanvasField versionField = new CanvasField(BundleVersionDataSource.FIELD_VERSION,
MSG
+ .common_title_version()) {
+ protected Canvas createCanvas(ListGrid grid, ListGridRecord record) {
+ HLayout hLayout = createHLayout(grid);
+ String viewPath = getBundleVersionViewPath(record);
+ ViewLink viewLink = new ViewLink(extendLocatorId("ViewLink"),
+ record.getAttribute(BundleVersionDataSource.FIELD_VERSION),
viewPath);
+ hLayout.addMember(viewLink);
+ return hLayout;
}
- });
+ };
ListGridField nameField = new ListGridField(BundleVersionDataSource.FIELD_NAME,
MSG.common_title_name());
@@ -92,12 +97,18 @@ public class BundleVersionListView extends
Table<BundleVersionDataSource> {
ListGrid listGrid = (ListGrid) event.getSource();
ListGridRecord[] selectedRows = listGrid.getSelection();
if (selectedRows != null && selectedRows.length == 1) {
- String selectedId =
selectedRows[0].getAttribute(BundleVersionDataSource.FIELD_BUNDLE_ID);
- String selectedVersionId =
selectedRows[0].getAttribute(BundleVersionDataSource.FIELD_ID);
-
CoreGUI.goToView(LinkManager.getBundleVersionLink(Integer.valueOf(selectedId), Integer
- .valueOf(selectedVersionId)));
+ ListGridRecord selectedRecord = selectedRows[0];
+ String viewPath = getBundleVersionViewPath(selectedRecord);
+ CoreGUI.goToView(viewPath);
}
}
});
}
+
+ private static String getBundleVersionViewPath(ListGridRecord record) {
+ Integer bundleId =
record.getAttributeAsInt(BundleVersionDataSource.FIELD_BUNDLE_ID);
+ Integer bundleVersionId =
record.getAttributeAsInt(BundleVersionDataSource.FIELD_ID);
+ return LinkManager.getBundleVersionLink(bundleId, bundleVersionId);
+ }
+
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
index 5687c75..ef723db 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
@@ -102,6 +102,7 @@ public class AboutModalWindow extends LocatableWindow {
contentPane.setPadding(15);
contentPane.setMembersMargin(25);
+ // TODO: Replace the below raw HTML w/ GWT widgets.
HTMLFlow htmlFlow = new HTMLFlow();
String html = "<span class=\"DisplaySubhead\">\n" +
" <a href=\"" + PRODUCT_INFO.getUrl() + "\"
title=\""
+ PRODUCT_INFO.getFullName() + " " + MSG.view_aboutBox_homepage() +
"\" target=\"_blank\">"
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/Link.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/Link.java
new file mode 100644
index 0000000..240779a
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/Link.java
@@ -0,0 +1,101 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.components;
+
+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.events.MouseOverEvent;
+import com.smartgwt.client.widgets.events.MouseOverHandler;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLFlow;
+
+/**
+ * A link.
+ *
+ * @author Ian Springer
+ */
+public class Link extends LocatableHTMLFlow {
+
+ private static final String DEFAULT_MOUSE_OUT_STYLE_NAME = "viewLink";
+ private static final String DEFAULT_MOUSE_OVER_STYLE_NAME =
"viewLinkHover";
+
+ private String mouseOverStyleName;
+ private String mouseOutStyleName;
+
+ public Link(String locatorId, String linkText, ClickHandler clickHandler) {
+ super(locatorId);
+
+ this.mouseOutStyleName = DEFAULT_MOUSE_OUT_STYLE_NAME;
+ this.mouseOverStyleName = DEFAULT_MOUSE_OVER_STYLE_NAME;
+
+ setWidth100();
+ setHeight(25);
+ setContents(linkText);
+
+ addClickHandler(clickHandler);
+
+ addMouseOverHandler(new MouseOverHandler() {
+ public void onMouseOver(MouseOverEvent event) {
+ if (mouseOutStyleName != null && mouseOverStyleName != null) {
+ setStyleName(mouseOverStyleName);
+ markForRedraw();
+ }
+ }
+ });
+
+ addMouseOutHandler(new MouseOutHandler() {
+ public void onMouseOut(MouseOutEvent event) {
+ if (mouseOutStyleName != null && mouseOverStyleName != null) {
+ setStyleName(mouseOutStyleName);
+ markForRedraw();
+ }
+ }
+ });
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ setStyleName(getMouseOutStyleName());
+ }
+
+ public String getMouseOverStyleName() {
+ return this.mouseOverStyleName;
+ }
+
+ public void setMouseOverStyleName(String mouseOverStyleName) {
+ this.mouseOverStyleName = mouseOverStyleName;
+ }
+
+ public String getMouseOutStyleName() {
+ return this.mouseOutStyleName;
+ }
+
+ public void setMouseOutStyleName(String mouseOutStyleName) {
+ this.mouseOutStyleName = mouseOutStyleName;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + "[" + getContents() + " -> ?]";
+ }
+
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ViewLink.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ViewLink.java
index 459c4d9..5446a8c 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ViewLink.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/ViewLink.java
@@ -34,77 +34,23 @@ import
org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLFlow;
*
* @author Ian Springer
*/
-public class ViewLink extends LocatableHTMLFlow {
-
- private static final String DEFAULT_MOUSE_OUT_STYLE_NAME = "viewLink";
- private static final String DEFAULT_MOUSE_OVER_STYLE_NAME =
"viewLinkHover";
+public class ViewLink extends Link {
private String viewPath;
- private String mouseOverStyleName;
- private String mouseOutStyleName;
public ViewLink(String locatorId, String linkText, final String viewPath) {
- super(locatorId);
-
- this.viewPath = viewPath;
- this.mouseOutStyleName = DEFAULT_MOUSE_OUT_STYLE_NAME;
- this.mouseOverStyleName = DEFAULT_MOUSE_OVER_STYLE_NAME;
-
- setWidth100();
- setHeight(25);
- setContents(linkText);
-
- addClickHandler(new ClickHandler() {
+ super(locatorId, linkText, new ClickHandler() {
public void onClick(ClickEvent event) {
CoreGUI.goToView(viewPath);
}
});
- addMouseOverHandler(new MouseOverHandler() {
- public void onMouseOver(MouseOverEvent event) {
- if (mouseOutStyleName != null && mouseOverStyleName != null) {
- setStyleName(mouseOverStyleName);
- markForRedraw();
- }
- }
- });
-
- addMouseOutHandler(new MouseOutHandler() {
- public void onMouseOut(MouseOutEvent event) {
- if (mouseOutStyleName != null && mouseOverStyleName != null) {
- setStyleName(mouseOutStyleName);
- markForRedraw();
- }
- }
- });
- }
-
- @Override
- protected void onInit() {
- super.onInit();
-
- setStyleName(getMouseOutStyleName());
- }
-
- public String getMouseOverStyleName() {
- return this.mouseOverStyleName;
- }
-
- public void setMouseOverStyleName(String mouseOverStyleName) {
- this.mouseOverStyleName = mouseOverStyleName;
- }
-
- public String getMouseOutStyleName() {
- return this.mouseOutStyleName;
- }
-
- public void setMouseOutStyleName(String mouseOutStyleName) {
- this.mouseOutStyleName = mouseOutStyleName;
+ this.viewPath = viewPath;
}
@Override
public String toString() {
- return super.toString() + "[" + getContents() + " -> " +
this.viewPath + "]";
+ return getClass().getName() + "[" + getContents() + " -> "
+ this.viewPath + "]";
}
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/CanvasField.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/CanvasField.java
new file mode 100644
index 0000000..b28e51f
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/CanvasField.java
@@ -0,0 +1,89 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.table;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.Canvas;
+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;
+
+/**
+ * Formats a cell value as a SmartGWT canvas.
+ */
+public abstract class CanvasField extends ListGridField {
+
+ protected CanvasField() {
+ }
+
+ protected CanvasField(JavaScriptObject jsObj) {
+ super(jsObj);
+ }
+
+ protected CanvasField(String name) {
+ super(name);
+ }
+
+ protected CanvasField(String name, int width) {
+ super(name, width);
+ }
+
+ protected CanvasField(String name, String title) {
+ super(name, title);
+ }
+
+ protected CanvasField(String name, String title, int width) {
+ super(name, title, width);
+ }
+
+ protected CanvasField(ListGridField field) {
+ super(field.getName(), field.getTitle());
+
+ setWidth(field.getWidth());
+ // TODO: clone other commonly used fields
+ }
+
+ /**
+ * TODO
+ *
+ * @param grid
+ * @param record
+ * @return
+ */
+ protected abstract Canvas createCanvas(ListGrid grid, ListGridRecord record);
+
+ protected HLayout createHLayout(ListGrid grid) {
+ HLayout component = new HLayout();
+ component.setWidth100();
+ // TODO: is this the best way to deal w/ height?
+ component.setHeight(25);
+ component.setMargin(grid.getCellPadding());
+ component.setOverflow(Overflow.HIDDEN);
+ return component;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getName() + "[name=" + getName() + ",
title=" + getTitle() + "]";
+ }
+
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/EnhancedListGrid.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/EnhancedListGrid.java
new file mode 100644
index 0000000..b383443
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/EnhancedListGrid.java
@@ -0,0 +1,85 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.table;
+
+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 org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A subclass of ListGrid that provides generic enhancements.
+ *
+ * @author Ian Springer
+ */
+public class EnhancedListGrid extends LocatableListGrid {
+
+ private Map<String, ListGridField> originalFields;
+
+ public EnhancedListGrid(String locatorId) {
+ super(locatorId);
+ }
+
+ @Override
+ public void setFields(ListGridField... fields) {
+ super.setFields(fields);
+
+ this.originalFields = new HashMap<String, ListGridField>();
+ if (fields != null) {
+ for (ListGridField field : fields) {
+ this.originalFields.put(field.getName(), field);
+ if (field instanceof CanvasField) {
+ setShowRecordComponents(true);
+ setShowRecordComponentsByCell(true);
+ // This is a workaround for a SmartGWT bug.
+ field.setCellFormatter(new CellFormatter() {
+ public String format(Object value, ListGridRecord record, int
rowNum, int colNum) {
+ return "";
+ }
+ });
+ }
+ }
+ }
+ }
+
+ /**
+ * @see CanvasField
+ */
+ @Override
+ protected Canvas createRecordComponent(ListGridRecord record, Integer colNum) {
+ if (getShowRecordComponents() != null && !getShowRecordComponents()) {
+ return null;
+ }
+
+ ListGridField field = getField(colNum);
+ ListGridField originalField = this.originalFields.get(field.getName());
+ if (originalField instanceof CanvasField) {
+ CanvasField canvasField = (CanvasField)originalField;
+ return canvasField.createCanvas(this, record);
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/EscapedHtmlCellFormatter.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/EscapedHtmlCellFormatter.java
index c60236c..a441a50 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/EscapedHtmlCellFormatter.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/EscapedHtmlCellFormatter.java
@@ -1,3 +1,22 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
package org.rhq.enterprise.gui.coregui.client.components.table;
import com.smartgwt.client.widgets.grid.CellFormatter;
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 c15cb4f..dbc318c 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
@@ -106,7 +106,7 @@ public class Table<DS extends RPCDataSource> extends
LocatableHLayout implements
private Canvas titleComponent;
private TableFilter filterForm;
- private ListGrid listGrid;
+ private EnhancedListGrid listGrid;
private Label tableInfo;
private List<String> headerIcons = new ArrayList<String>();
@@ -273,8 +273,8 @@ public class Table<DS extends RPCDataSource> extends
LocatableHLayout implements
contents.addMember(listGrid);
}
- protected LocatableListGrid createListGrid(String locatorId) {
- return new LocatableListGrid(locatorId);
+ protected EnhancedListGrid createListGrid(String locatorId) {
+ return new EnhancedListGrid(locatorId);
}
protected SelectionStyle getDefaultSelectionStyle() {
@@ -671,7 +671,7 @@ public class Table<DS extends RPCDataSource> extends
LocatableHLayout implements
this.dataSource = dataSource;
}
- public ListGrid getListGrid() {
+ public EnhancedListGrid getListGrid() {
return listGrid;
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
index 49ca4b8..4b49302 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
@@ -37,6 +37,7 @@ import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.Layout;
import com.smartgwt.client.widgets.layout.VLayout;
@@ -48,8 +49,6 @@ import org.rhq.enterprise.gui.coregui.client.components.ViewLink;
import org.rhq.enterprise.gui.coregui.client.components.buttons.BackButton;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
@@ -142,11 +141,25 @@ public abstract class TableSection<DS extends RPCDataSource>
extends Table<DS> i
ListGridField field = (grid != null) ?
grid.getField(getDetailsLinkColumnName()) : null;
if (field != null) {
//field.setCellFormatter(getDetailsLinkColumnCellFormatter());
- field.setCellFormatter(new CellFormatter() {
- public String format(Object value, ListGridRecord record, int rowNum,
int colNum) {
- return "";
+
+ CanvasField canvasField = new CanvasField(field) {
+ protected Canvas createCanvas(ListGrid grid, ListGridRecord record)
{
+ HLayout hLayout = createHLayout(grid);
+ Integer recordId = getId(record);
+ String detailsViewPath = getBasePath() + "/" +
recordId;
+ String recordValue =
record.getAttribute(getDetailsLinkColumnName());
+ String formattedValue = (escapeHtmlInDetailsLinkColumn) ?
StringUtility.escapeHtml(recordValue.toString())
+ : recordValue.toString();
+ ViewLink viewLink = new
ViewLink(extendLocatorId("ViewLink"), formattedValue, detailsViewPath);
+ hLayout.addMember(viewLink);
+ return hLayout;
}
- });
+ };
+
+ int fieldIndex = grid.getFieldNum(field.getName());
+ ListGridField[] fields = grid.getFields();
+ fields[fieldIndex] = canvasField;
+ grid.setFields(fields);
}
setListGridDoubleClickHandler(new DoubleClickHandler() {
@@ -397,43 +410,4 @@ public abstract class TableSection<DS extends RPCDataSource>
extends Table<DS> i
}
}
- @Override
- protected LocatableListGrid createListGrid(String locatorId) {
- return new TableSectionListGrid(locatorId);
- }
-
- class TableSectionListGrid extends LocatableListGrid {
- public TableSectionListGrid(String locatorId) {
- super(locatorId);
-
- if (isDetailsEnabled() && getDetailsLinkColumnName() != null) {
- setShowRecordComponents(true);
- setShowRecordComponentsByCell(true);
- }
- }
-
- @Override
- protected Canvas createRecordComponent(ListGridRecord record, Integer colNum) {
- Layout component;
- String fieldName = this.getFieldName(colNum);
- if (fieldName.equals(getDetailsLinkColumnName())) {
- component = new LocatableHLayout(extendLocatorId(fieldName +
getRecordIndex(record)));
- component.setWidth100();
- component.setHeight(25);
- component.setMargin(getCellPadding());
- component.setOverflow(Overflow.HIDDEN);
- Integer recordId = getId(record);
- String detailsViewPath = getBasePath() + "/" + recordId;
- String recordValue = record.getAttribute(getDetailsLinkColumnName());
- String formattedValue = (escapeHtmlInDetailsLinkColumn) ?
StringUtility.escapeHtml(recordValue.toString())
- : recordValue.toString();
- ViewLink viewLink = new ViewLink(extendLocatorId("ViewLink"),
formattedValue, detailsViewPath);
- component.addMember(viewLink);
- } else {
- component = null;
- }
- return component;
- }
- }
-
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/ViewLinkField.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/ViewLinkField.java
new file mode 100644
index 0000000..b91d48c
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/ViewLinkField.java
@@ -0,0 +1,54 @@
+package org.rhq.enterprise.gui.coregui.client.components.table;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.layout.HLayout;
+import org.rhq.enterprise.gui.coregui.client.components.ViewLink;
+
+/**
+ * @author Ian Springer
+ */
+public abstract class ViewLinkField extends CanvasField {
+
+ protected ViewLinkField() {
+ super();
+ }
+
+ protected ViewLinkField(JavaScriptObject jsObj) {
+ super(jsObj);
+ }
+
+ protected ViewLinkField(String name) {
+ super(name);
+ }
+
+ protected ViewLinkField(String name, int width) {
+ super(name, width);
+ }
+
+ protected ViewLinkField(String name, String title) {
+ super(name, title);
+ }
+
+ protected ViewLinkField(String name, String title, int width) {
+ super(name, title, width);
+ }
+
+ @Override
+ protected Canvas createCanvas(ListGrid grid, ListGridRecord record) {
+ HLayout hLayout = createHLayout(grid);
+ ViewLink viewLink = getViewLink(grid, record);
+ hLayout.addMember(viewLink);
+ return hLayout;
+ }
+
+ protected abstract ViewLink getViewLink(ListGrid grid, ListGridRecord record);
+
+ protected ViewLinkField(ListGridField field) {
+ super(field);
+ }
+
+}
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 ac289a2..2f31612 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
@@ -51,7 +51,9 @@ 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.components.ViewLink;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
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;
@@ -165,10 +167,9 @@ public class TagEditorView extends LocatableLayout {
tagLayout.setHeight(18);
tagLayout.setHeight(16);
- HTMLFlow tagString = new HTMLFlow("<a href=\"" +
LinkManager.getTagLink(tag.toString()) + "\">"
- + tag.toString() + "</a>");
- tagString.setAutoWidth();
- tagLayout.addMember(tagString);
+ ViewLink viewLink = new
ViewLink(tagLayout.extendLocatorId("ViewLink"),
+ StringUtility.escapeHtml(tag.toString()),
LinkManager.getTagLink(tag.toString()));
+ tagLayout.addMember(viewLink);
if (!readOnly) {
final LayoutSpacer spacer = new LayoutSpacer();
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
index 6f38d63..831993c 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/platform/PlatformSummaryPortlet.java
@@ -29,7 +29,7 @@ import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Img;
-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;
@@ -46,6 +46,8 @@ import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.ViewLink;
+import org.rhq.enterprise.gui.coregui.client.components.table.ViewLinkField;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
@@ -55,6 +57,7 @@ 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.MeasurementConverterClient;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
/**
@@ -119,15 +122,14 @@ public class PlatformSummaryPortlet extends LocatableListGrid
implements Portlet
}
private void buildUI() {
-
- ListGridField nameField = new
ListGridField(ResourceDataSourceField.NAME.propertyName(), MSG
- .common_title_name());
- nameField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1)
{
- return "<a href=\"" +
LinkManager.getResourceLink(listGridRecord.getAttributeAsInt("id")) +
"\">" + o
- + "</a>";
+ ViewLinkField nameField = new
ViewLinkField(ResourceDataSourceField.NAME.propertyName(), MSG
+ .common_title_name()) {
+ protected ViewLink getViewLink(ListGrid grid, ListGridRecord record) {
+ String resourceUrl =
LinkManager.getResourceLink(record.getAttributeAsInt("id"));
+ String linkText =
StringUtility.escapeHtml(record.getAttribute(ResourceDataSourceField.NAME.propertyName()));
+ return new ViewLink(extendLocatorId("ViewLink"), linkText,
resourceUrl);
}
- });
+ };
nameField.setWidth("20%");
setFields(nameField);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResourcesPortlet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResourcesPortlet.java
index d6b61d2..91289ba 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResourcesPortlet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/imported/RecentlyAddedResourcesPortlet.java
@@ -30,14 +30,18 @@ import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.events.SubmitValuesEvent;
import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
import com.smartgwt.client.widgets.form.fields.SelectItem;
-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;
import com.smartgwt.client.widgets.tree.TreeGrid;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.HeaderLabel;
+import org.rhq.enterprise.gui.coregui.client.components.ViewLink;
+import org.rhq.enterprise.gui.coregui.client.components.table.CanvasField;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.AutoRefreshPortletUtil;
@@ -45,6 +49,7 @@ 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.enterprise.gui.coregui.client.dashboard.PortletWindow;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
public class RecentlyAddedResourcesPortlet extends LocatableVLayout implements
CustomSettingsPortlet,
@@ -87,13 +92,18 @@ public class RecentlyAddedResourcesPortlet extends LocatableVLayout
implements C
treeGrid.setResizeFieldsInRealTime(true);
treeGrid.setTreeFieldTitle("Resource Name");
- ListGridField resourceNameField = new ListGridField("name",
MSG.common_title_resource_name());
-
- resourceNameField.setCellFormatter(new CellFormatter() {
- public String format(Object o, ListGridRecord listGridRecord, int i, int i1)
{
- return "<a href=\"#Resource/" +
listGridRecord.getAttribute("id") + "\">" + String.valueOf(o)
+ "</a>";
+ CanvasField resourceNameField = new CanvasField("name",
MSG.common_title_resource_name()) {
+ protected Canvas createCanvas(ListGrid grid, ListGridRecord record) {
+ HLayout hLayout = createHLayout(grid);
+ int resourceId = record.getAttributeAsInt("id");
+ String resourceName = record.getAttribute("name");
+ String resourceViewPath = LinkManager.getResourceLink(resourceId);
+ ViewLink viewLink = new ViewLink(extendLocatorId("ViewLink"),
StringUtility.escapeHtml(resourceName),
+ resourceViewPath);
+ hLayout.addMember(viewLink);
+ return hLayout;
}
- });
+ };
ListGridField timestampField = new ListGridField("timestamp",
MSG.common_title_timestamp());
TimestampCellFormatter.prepareDateField(timestampField);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
index 10daf03..3d2c15d 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
@@ -54,7 +54,6 @@ 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.FormItemClickHandler;
import com.smartgwt.client.widgets.form.fields.events.FormItemIconClickEvent;
-import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.HoverCustomizer;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
@@ -73,8 +72,10 @@ import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.PermissionsLoadedListener;
import org.rhq.enterprise.gui.coregui.client.PermissionsLoader;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.components.ViewLink;
import org.rhq.enterprise.gui.coregui.client.components.table.EscapedHtmlCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
+import org.rhq.enterprise.gui.coregui.client.components.table.ViewLinkField;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource;
import
org.rhq.enterprise.gui.coregui.client.inventory.groups.definitions.GroupDefinitionExpressionBuilder.AddExpressionHandler;
@@ -249,16 +250,14 @@ public class SingleGroupDefinitionView extends LocatableVLayout
implements Bookm
idField.setType(ListGridFieldType.INTEGER);
idField.setWidth("50");
- ListGridField nameField = new ListGridField(NAME.propertyName(),
NAME.title());
- nameField.setWidth("*");
- nameField.setCellFormatter(new CellFormatter() {
- @Override
- public String format(Object value, ListGridRecord record, int rowNum, int
colNum) {
- String linkName = record.getAttributeAsString(NAME.propertyName());
+ ViewLinkField nameField = new ViewLinkField(NAME.propertyName(),
NAME.title()) {
+ protected ViewLink getViewLink(ListGrid grid, ListGridRecord record) {
+ String linkName =
StringUtility.escapeHtml(record.getAttributeAsString(NAME.propertyName()));
String linkUrl =
LinkManager.getResourceGroupLink(record.getAttributeAsInt("id"));
- return "<a href=\"" + linkUrl +
"\">" + StringUtility.escapeHtml(linkName) + "</a>";
+ return new ViewLink(extendLocatorId("ViewLink"), linkName,
linkUrl);
}
- });
+ };
+ nameField.setWidth("*");
ListGridField descriptionField = new
ListGridField(DESCRIPTION.propertyName(), DESCRIPTION.title());
descriptionField.setWidth("300");
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
index 045c1ef..fc7486a 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/GeneralProperties.java
@@ -24,6 +24,7 @@ import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.HLayout;
@@ -34,6 +35,7 @@ import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.ViewLink;
import org.rhq.enterprise.gui.coregui.client.components.form.CheckboxEditableFormItem;
import org.rhq.enterprise.gui.coregui.client.components.form.EditableFormItem;
import org.rhq.enterprise.gui.coregui.client.components.form.EnhancedDynamicForm;
@@ -237,12 +239,13 @@ public class GeneralProperties extends LocatableVLayout {
formItems.add(lastModifiedByItem);
if (isDynaGroup) {
- StaticTextItem groupDefinitionItem = new
StaticTextItem("groupDefinition", MSG
+ CanvasItem groupDefinitionItem = new CanvasItem("groupDefinition",
MSG
.view_group_summary_groupDefinition());
GroupDefinition groupDefinition = group.getGroupDefinition();
String groupDefinitionUrl =
LinkManager.getGroupDefinitionLink(groupDefinition.getId());
String groupDefinitionName =
StringUtility.escapeHtml(groupDefinition.getName());
- groupDefinitionItem.setValue("<a href=\"" +
groupDefinitionUrl + "\">" + groupDefinitionName +
"</a>");
+ ViewLink viewLink = new ViewLink(extendLocatorId("ViewLink"),
groupDefinitionName, groupDefinitionUrl);
+ groupDefinitionItem.setCanvas(viewLink);
formItems.add(groupDefinitionItem);
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
index 50fe917..b451c0e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/AncestryUtil.java
@@ -58,12 +58,12 @@ public abstract class AncestryUtil {
private static final String TITLE_PLATFORM =
CoreGUI.getMessages().common_title_platform() + ": ";
/**
- * Convienence method that creates a standard ancestry ListGridField.
+ * Convenience method that creates a standard ancestry ListGridField.
+ *
* @return ancestry field
*/
public static ListGridField setupAncestryListGridField() {
- ListGridField ancestryField;
- ancestryField = new ListGridField(AncestryUtil.RESOURCE_ANCESTRY,
CoreGUI.getMessages().common_title_ancestry());
+ ListGridField ancestryField = new ListGridField(AncestryUtil.RESOURCE_ANCESTRY,
CoreGUI.getMessages().common_title_ancestry());
ancestryField.setAlign(Alignment.LEFT);
ancestryField.setCellAlign(Alignment.LEFT);
setupAncestryListGridFieldCellFormatter(ancestryField);
@@ -72,7 +72,7 @@ public abstract class AncestryUtil {
}
/**
- * Convienence method that creates a standard ancestry ListGridField where the field
already exists
+ * Convenience method that creates a standard ancestry ListGridField where the field
already exists
* in the given list grid.
*
* @return ancestry field
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDetailsView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDetailsView.java
index 6c21b83..b94f59b 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDetailsView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDetailsView.java
@@ -23,10 +23,13 @@ import java.util.List;
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.Label;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria;
import org.rhq.core.domain.operation.GroupOperationHistory;
@@ -38,6 +41,7 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.components.ViewLink;
import
org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import
org.rhq.enterprise.gui.coregui.client.inventory.common.detail.operation.history.AbstractOperationHistoryDetailsView;
@@ -81,13 +85,17 @@ public class ResourceOperationHistoryDetailsView extends
AbstractOperationHistor
GroupOperationHistory groupOperationHistory =
operationHistory.getGroupOperationHistory();
if (groupOperationHistory != null) {
- StaticTextItem groupOperationHistoryItem = new StaticTextItem(
+ CanvasItem groupOperationHistoryItem = new CanvasItem(
ResourceOperationHistoryDataSource.Field.GROUP_OPERATION_HISTORY,
"Parent Group Execution");
+ HLayout hLayout = new HLayout();
String groupOperationHistoryUrl =
LinkManager.getGroupOperationHistoryLink(groupOperationHistory.getGroup()
.getId(), groupOperationHistory.getId());
- String value = "<a href=\"" + groupOperationHistoryUrl +
"\">" + groupOperationHistory.getId()
- + "</a> (on group '" +
groupOperationHistory.getGroup().getName() + "')";
- groupOperationHistoryItem.setValue(value);
+ ViewLink viewLink = new ViewLink(extendLocatorId("ViewLink"),
String.valueOf(groupOperationHistory.getId()),
+ groupOperationHistoryUrl);
+ hLayout.addMember(viewLink);
+ HTMLFlow html = new HTMLFlow("(on group '" +
groupOperationHistory.getGroup().getName() + "')");
+ hLayout.addMember(html);
+ groupOperationHistoryItem.setCanvas(hLayout);
items.add(groupOperationHistoryItem);
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index 6ec69f5..70fdc4c 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@ -29,8 +29,6 @@ import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.layout.Layout;
-import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
@@ -43,7 +41,6 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.DashboardsView;
import org.rhq.enterprise.gui.coregui.client.help.HelpView;
import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView;
import org.rhq.enterprise.gui.coregui.client.report.ReportTopView;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHStack;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/AlertDefinitionReportView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/AlertDefinitionReportView.java
index cb5f03f..23c6546 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/AlertDefinitionReportView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/AlertDefinitionReportView.java
@@ -11,16 +11,18 @@ import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSourceField;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.events.DoubleClickEvent;
import com.smartgwt.client.widgets.events.DoubleClickHandler;
-import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.HoverCustomizer;
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.RecordClickEvent;
-import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
import org.rhq.core.domain.criteria.ResourceCriteria;
@@ -31,6 +33,9 @@ import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
import
org.rhq.enterprise.gui.coregui.client.alert.definitions.AbstractAlertDefinitionsDataSource;
+import org.rhq.enterprise.gui.coregui.client.components.Link;
+import org.rhq.enterprise.gui.coregui.client.components.ViewLink;
+import org.rhq.enterprise.gui.coregui.client.components.table.CanvasField;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -38,7 +43,6 @@ import
org.rhq.enterprise.gui.coregui.client.inventory.resource.AncestryUtil;
import
org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import
org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository.TypesLoadedCallback;
import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
* A tabular report that shows alert definitions on all resources in inventory.
@@ -117,30 +121,103 @@ public class AlertDefinitionReportView extends
Table<AlertDefinitionReportView.D
// hide the created/modified fields, we don't need to show them by
default
// add cell formatter on the name field so we can make it a link
- for (ListGridField field : fields) {
+ for (int i = 0, fieldsSize = fields.size(); i < fieldsSize; i++) {
+ ListGridField field = fields.get(i);
String fieldName = field.getName();
if (fieldName.equals(FIELD_CTIME) || fieldName.equals(FIELD_MTIME)) {
field.setHidden(true);
} else if (fieldName.equals(FIELD_NAME)) {
- field.setCellFormatter(new CellFormatter() {
- @Override
- public String format(Object value, ListGridRecord record, int
rowNum, int colNum) {
+ CanvasField canvasField = new CanvasField(field) {
+ protected Canvas createCanvas(ListGrid grid, ListGridRecord
record) {
+ HLayout hLayout = createHLayout(grid);
AlertDefinition alertDef = copyValues(record);
int resourceId = alertDef.getResource().getId();
int alertDefId = alertDef.getId();
String link =
LinkManager.getSubsystemAlertDefinitionLink(resourceId, alertDefId);
- return "<a href=\"" + link +
"\">" + StringUtility.escapeHtml(alertDef.getName()) +
"</a>";
+ ViewLink viewLink = new
ViewLink(extendLocatorId("ViewLink"),
+ StringUtility.escapeHtml(alertDef.getName()), link);
+ hLayout.addMember(viewLink);
+ return hLayout;
}
- });
+ };
+ fields.set(i, canvasField);
}
}
// add more columns
- ListGridField parentField = new ListGridField(FIELD_PARENT,
MSG.view_alerts_field_parent());
- parentField.setWidth(100);
+ CanvasField parentField = new CanvasField(FIELD_PARENT,
MSG.view_alerts_field_parent(), 100) {
+ protected Canvas createCanvas(ListGrid grid, final ListGridRecord record)
{
+ HLayout hLayout = createHLayout(grid);
+
+ final AlertDefinition alertDef = copyValues(record);
+ boolean hasParent;
+ String linkText;
+ if (alertDef.getParentId() != null && alertDef.getParentId()
> 0) {
+ // has a parent template alertdef
+ hasParent = true;
+ linkText = "Template Alert";
+ } else if (alertDef.getGroupAlertDefinition() != null) {
+ // has a parent group alertdef
+ hasParent = true;
+ linkText = "Group Alert";
+ } else {
+ hasParent = false;
+ linkText = null;
+ }
+ if (hasParent) {
+ // we only display a link if we really have a parent.
+ // if we have a template parent, we have to get the
resource's type and go to the template page for that type
+ // if we have a group parent, we can directly go to the
group's alert def page
+ Link link = new Link("Link", linkText, new
ClickHandler() {
+ public void onClick(ClickEvent event) {
+ if (alertDef.getParentId() != null &&
alertDef.getParentId() > 0) {
+ // has a parent template alertdef
+ final Integer templateId = alertDef.getParentId();
+ final Integer resourceId =
alertDef.getResource().getId();
+
+ ResourceCriteria resCriteria = new
ResourceCriteria();
+ resCriteria.addFilterId(resourceId);
+ resCriteria.fetchResourceType(true);
+
+
GWTServiceLookup.getResourceService().findResourcesByCriteria(resCriteria,
+ new
AsyncCallback<PageList<Resource>>() {
+ @Override
+ public void
onSuccess(PageList<Resource> result) {
+ if (result == null || result.size() != 1)
{
+
CoreGUI.getErrorHandler().handleError(
+
MSG.view_reports_alertDefinitions_resTypeLoadError());
+ } else {
+ int typeId =
result.get(0).getResourceType().getId();
+
CoreGUI.goToView(LinkManager.getAdminTemplatesLink() + "/Alert/" + typeId +
"/"
+ + templateId);
+ }
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+
MSG.view_reports_alertDefinitions_resTypeLoadError(), caught);
+ }
+ });
+
+ } else if (alertDef.getGroupAlertDefinition() != null) {
+ // has a parent group alertdef
+ AlertDefinition groupAlertDef =
alertDef.getGroupAlertDefinition();
+
CoreGUI.goToView(LinkManager.getResourceGroupLink(groupAlertDef.getResourceGroup().getId())
+ + "/Alerts/Definitions/" +
groupAlertDef.getId());
+ }
+ }
+ });
+ hLayout.addMember(link);
+ } else {
+ hLayout.addMember(new HTMLFlow(MSG.common_val_na()));
+ }
+
+ return hLayout;
+ }
+ };
parentField.setShowHover(true);
parentField.setHoverCustomizer(new HoverCustomizer() {
- @Override
public String hoverHTML(Object value, ListGridRecord record, int rowNum,
int colNum) {
if (record.getAttribute(FIELD_PARENT) != null) {
return MSG.view_reports_alertDefinitions_parentHover();
@@ -148,59 +225,20 @@ public class AlertDefinitionReportView extends
Table<AlertDefinitionReportView.D
return MSG.common_val_na();
}
});
- parentField.addRecordClickHandler(new RecordClickHandler() {
- @Override
- public void onRecordClick(RecordClickEvent event) {
- // we only do something if we really have a parent.
- // if we have a template parent, we have to get the resource's
type and go to the template page for that type
- // if we have a group parent, we can directly go to the group's
alert def page
- Record record = event.getRecord();
- AlertDefinition alertDef = copyValues(record);
- if (alertDef.getParentId() != null &&
alertDef.getParentId().intValue() > 0) {
- final Integer templateId = alertDef.getParentId().intValue();
- final Integer resourceId = alertDef.getResource().getId();
-
- ResourceCriteria resCriteria = new ResourceCriteria();
- resCriteria.addFilterId(resourceId);
- resCriteria.fetchResourceType(true);
-
-
GWTServiceLookup.getResourceService().findResourcesByCriteria(resCriteria,
- new AsyncCallback<PageList<Resource>>() {
- @Override
- public void onSuccess(PageList<Resource> result) {
- if (result == null || result.size() != 1) {
- CoreGUI.getErrorHandler().handleError(
-
MSG.view_reports_alertDefinitions_resTypeLoadError());
- } else {
- int typeId =
result.get(0).getResourceType().getId();
-
CoreGUI.goToView(LinkManager.getAdminTemplatesLink() + "/Alert/" + typeId +
"/"
- + templateId);
- }
- }
-
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
-
MSG.view_reports_alertDefinitions_resTypeLoadError(), caught);
- }
- });
- } else if (alertDef.getGroupAlertDefinition() != null) {
- AlertDefinition groupAlertDef =
alertDef.getGroupAlertDefinition();
-
CoreGUI.goToView(LinkManager.getResourceGroupLink(groupAlertDef.getResourceGroup().getId())
- + "/Alerts/Definitions/" + groupAlertDef.getId());
- }
- }
- });
fields.add(parentField);
- ListGridField resourceField = new ListGridField(FIELD_RESOURCE,
MSG.common_title_resource());
- resourceField.setCellFormatter(new CellFormatter() {
- public String format(Object value, ListGridRecord listGridRecord, int i,
int i1) {
- String url = LinkManager
-
.getResourceLink(listGridRecord.getAttributeAsInt(AncestryUtil.RESOURCE_ID));
- return SeleniumUtility.getLocatableHref(url,
StringUtility.escapeHtml(value.toString()), null);
+ CanvasField resourceField = new CanvasField(FIELD_RESOURCE,
MSG.common_title_resource()) {
+ protected Canvas createCanvas(ListGrid grid, ListGridRecord record) {
+ HLayout hLayout = createHLayout(grid);
+ Integer resourceId =
record.getAttributeAsInt(AncestryUtil.RESOURCE_ID);
+ String url = LinkManager.getResourceLink(resourceId);
+ String resourceName = record.getAttribute(FIELD_RESOURCE);
+ ViewLink viewLink = new
ViewLink(extendLocatorId("ViewLink"),
+ StringUtility.escapeHtml(resourceName), url);
+ hLayout.addMember(viewLink);
+ return hLayout;
}
- });
+ };
resourceField.setShowHover(true);
resourceField.setHoverCustomizer(new HoverCustomizer() {
public String hoverHTML(Object value, ListGridRecord listGridRecord, int
rowNum, int colNum) {
@@ -258,7 +296,7 @@ public class AlertDefinitionReportView extends
Table<AlertDefinitionReportView.D
DataSourceField resourceField = new DataSourceTextField(FIELD_RESOURCE);
fields.add(resourceField);
- DataSourceField parentField = new DataSourceTextField(FIELD_RESOURCE);
+ DataSourceField parentField = new DataSourceTextField(FIELD_PARENT);
fields.add(parentField);
return fields;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java
index f1fa548..caf8e8d 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ResourceInstallReport.java
@@ -9,20 +9,24 @@ import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.events.DoubleClickEvent;
import com.smartgwt.client.widgets.events.DoubleClickHandler;
-import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.HoverCustomizer;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.composite.ResourceInstallCount;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
+import org.rhq.enterprise.gui.coregui.client.components.ViewLink;
+import org.rhq.enterprise.gui.coregui.client.components.table.CanvasField;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -30,6 +34,7 @@ import
org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import org.rhq.enterprise.gui.coregui.client.util.StringUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
@@ -113,7 +118,21 @@ public class ResourceInstallReport extends LocatableVLayout
implements Bookmarka
@Override
protected void configureTable() {
- ListGridField fieldTypeName = new ListGridField(DataSource.Field.TYPENAME,
MSG.common_title_resource_type());
+ CanvasField fieldTypeName = new CanvasField(DataSource.Field.TYPENAME,
MSG.common_title_resource_type()) {
+ protected Canvas createCanvas(ListGrid grid, ListGridRecord record) {
+ HLayout hLayout = createHLayout(grid);
+ String typeName = record.getAttribute(DataSource.Field.TYPENAME);
+ String url = getResourceTypeTableUrl(record);
+ if (url != null) {
+ ViewLink viewLink = new
ViewLink(extendLocatorId("ViewLink"), typeName, url);
+ hLayout.addMember(viewLink);
+ } else {
+ HTMLFlow html = new HTMLFlow(typeName);
+ hLayout.addMember(html);
+ }
+ return hLayout;
+ }
+ };
ListGridField fieldPlugin = new ListGridField(DataSource.Field.TYPEPLUGIN,
MSG.common_title_plugin());
ListGridField fieldCategory = new ListGridField(DataSource.Field.CATEGORY,
MSG.common_title_category());
ListGridField fieldVersion = new ListGridField(DataSource.Field.VERSION,
MSG.common_title_version());
@@ -125,18 +144,6 @@ public class ResourceInstallReport extends LocatableVLayout
implements Bookmarka
fieldVersion.setWidth("*");
fieldCount.setWidth("10%");
- fieldTypeName.setCellFormatter(new CellFormatter() {
- @Override
- public String format(Object value, ListGridRecord record, int rowNum, int
colNum) {
- String url = getResourceTypeTableUrl(record);
- if (url == null) {
- return value.toString();
- }
-
- return "<a href=\"" + url + "\">"
+ value + "</a>";
- }
- });
-
fieldCategory.setType(ListGridFieldType.ICON);
fieldCategory.setShowValueIconOnly(true);
HashMap<String, String> categoryIcons = new HashMap<String,
String>(3);
@@ -165,8 +172,8 @@ public class ResourceInstallReport extends LocatableVLayout implements
Bookmarka
@Override
public void onDoubleClick(DoubleClickEvent event) {
ListGrid lg = (ListGrid) event.getSource();
- ListGridRecord selected = lg.getSelectedRecord();
- String url = getResourceTypeTableUrl(selected);
+ ListGridRecord selectedRecord = lg.getSelectedRecord();
+ String url = getResourceTypeTableUrl(selectedRecord);
if (url != null) {
CoreGUI.goToView(url);
}