modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleResourceDeploymentHistoryListView.java
| 122 ++++++----
1 file changed, 84 insertions(+), 38 deletions(-)
New commits:
commit f65d0fc2c63453daf2af4eb21d7afdcc171b464a
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Dec 17 14:08:52 2010 -0500
fix up the deployment details list, add more data like user and timestamp
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleResourceDeploymentHistoryListView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleResourceDeploymentHistoryListView.java
index 9073dc9..6093083 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleResourceDeploymentHistoryListView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deployment/BundleResourceDeploymentHistoryListView.java
@@ -23,17 +23,24 @@
package org.rhq.enterprise.gui.coregui.client.bundle.deployment;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.AutoFitWidthApproach;
+import com.smartgwt.client.types.DateDisplayFormat;
import com.smartgwt.client.types.ExpansionMode;
-import com.smartgwt.client.types.TitleOrientation;
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.types.SelectionStyle;
+import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
+import com.smartgwt.client.widgets.events.CloseClientEvent;
+import com.smartgwt.client.widgets.events.DoubleClickEvent;
+import com.smartgwt.client.widgets.events.DoubleClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.AutoFitTextAreaItem;
-import com.smartgwt.client.widgets.form.fields.ButtonItem;
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;
@@ -44,8 +51,10 @@ import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
import org.rhq.core.domain.bundle.BundleDeploymentStatus;
import org.rhq.core.domain.bundle.BundleResourceDeployment;
import org.rhq.core.domain.bundle.BundleResourceDeploymentHistory;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
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.LocatableWindow;
/**
* @author Greg Hinkle
@@ -53,44 +62,60 @@ import
org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
public class BundleResourceDeploymentHistoryListView extends LocatableVLayout {
private BundleResourceDeployment resourceDeployment;
+ private HashMap<String, String> statusIcons;
public BundleResourceDeploymentHistoryListView(String locatorId,
BundleResourceDeployment resourceDeployment) {
super(locatorId);
-
setWidth100();
setHeight100();
this.resourceDeployment = resourceDeployment;
+ statusIcons = new HashMap<String, String>();
+ statusIcons.put(BundleDeploymentStatus.IN_PROGRESS.name(),
"subsystems/bundle/install-loader.gif");
+ statusIcons.put(BundleDeploymentStatus.FAILURE.name(),
"subsystems/bundle/Error_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");
}
@Override
protected void onInit() {
super.onInit();
- ListGrid grid = new LocatableListGrid(this.getLocatorId());
+ final ListGrid grid = new LocatableListGrid(this.getLocatorId());
grid.setWidth100();
grid.setHeight100();
+ grid.setSelectionType(SelectionStyle.SINGLE);
+ grid.setCanExpandRecords(true);
+ grid.setExpansionMode(ExpansionMode.DETAIL_FIELD);
+ grid.setDetailField("message");
ListGridField action = new ListGridField("action",
MSG.view_bundle_deploy_action());
+ action.setAutoFitWidth(true);
+ action.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);
+
ListGridField message = new ListGridField("info",
MSG.common_title_info());
- ListGridField status = new ListGridField("status",
MSG.common_title_status());
+ message.setWidth("60%");
- HashMap<String, String> icons = new HashMap<String, String>();
- icons.put(BundleDeploymentStatus.IN_PROGRESS.name(),
"subsystems/bundle/install-loader.gif");
- icons.put(BundleDeploymentStatus.FAILURE.name(),
"subsystems/bundle/Warning_11.png");
- icons.put(BundleDeploymentStatus.MIXED.name(),
"subsystems/bundle/Warning_11.png");
- icons.put(BundleDeploymentStatus.WARN.name(),
"subsystems/bundle/Warning_11.png");
- icons.put(BundleDeploymentStatus.SUCCESS.name(),
"subsystems/bundle/Ok_11.png");
- status.setValueIcons(icons);
- status.setValueIconHeight(11);
- status.setWidth(80);
+ ListGridField user = new ListGridField("user",
MSG.common_title_user());
+ user.setHidden(true);
- grid.setCanExpandRecords(true);
- grid.setExpansionMode(ExpansionMode.DETAIL_FIELD);
- grid.setDetailField("message");
+ ListGridField timestamp = new ListGridField("timestamp",
MSG.common_title_timestamp());
+ timestamp.setWidth("40%");
+
+ ListGridField status = new ListGridField("status",
MSG.common_title_status());
+ status.setValueIcons(statusIcons);
+ status.setValueIconHeight(11);
+ status.setValueIconWidth(11);
+ status.setAutoFitWidth(true);
+ status.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);
ListGridField details = new ListGridField("attachment",
MSG.common_title_details());
details.setWidth(50);
+ details.setAlign(Alignment.CENTER);
+ details.setType(ListGridFieldType.ICON);
+ details.setIconHeight(11);
+ details.setIconWidth(11);
details.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1)
{
return "<img
src=\"images/subsystems/bundle/Details_11.png\"/>";
@@ -102,47 +127,67 @@ public class BundleResourceDeploymentHistoryListView extends
LocatableVLayout {
}
});
- grid.setFields(action, message, status, details);
+ grid.setFields(action, message, timestamp, status, user, details);
grid.setData(buildRecords());
- addMember(grid);
+ grid.addDoubleClickHandler(new DoubleClickHandler() {
+ @Override
+ public void onDoubleClick(DoubleClickEvent event) {
+ showDetails(grid.getSelectedRecord());
+ }
+ });
+
+ addMember(grid);
}
private void showDetails(ListGridRecord record) {
+ DynamicForm form = new
LocatableDynamicForm(extendLocatorId("detailsForm"));
+ form.setHeight100();
+ form.setWidth100();
+ form.setPadding(20);
+
+ StaticTextItem status = new StaticTextItem("status",
MSG.common_title_status());
+ status.setValueIcons(statusIcons);
+ status.setValueIconHeight(11);
+ status.setValueIconWidth(11);
+ status.setShowValueIconOnly(true);
+
+ StaticTextItem user = new StaticTextItem("user",
MSG.common_title_user());
- DynamicForm form = new DynamicForm();
+ StaticTextItem timestamp = new StaticTextItem("timestamp",
MSG.common_title_timestamp());
+ timestamp.setDateFormatter(DateDisplayFormat.TOLOCALESTRING);
StaticTextItem action = new StaticTextItem("action",
MSG.view_bundle_deploy_action());
StaticTextItem info = new StaticTextItem("info",
MSG.common_title_info());
StaticTextItem category = new StaticTextItem("category",
MSG.common_title_category());
- StaticTextItem message = new StaticTextItem("message",
MSG.common_title_message());
-
- AutoFitTextAreaItem detail = new AutoFitTextAreaItem("attachement",
MSG.common_title_details());
- detail.setTitleOrientation(TitleOrientation.TOP);
- detail.setColSpan(2);
- ButtonItem close = new ButtonItem("close", MSG.common_button_close());
+ StaticTextItem message = new StaticTextItem("message",
MSG.common_title_message());
+ message.setTitleVAlign(VerticalAlignment.TOP);
- form.setItems(action, info, category, message, detail, close);
+ AutoFitTextAreaItem detail = new AutoFitTextAreaItem("attachment",
MSG.common_title_details());
+ detail.setTitleVAlign(VerticalAlignment.TOP);
+ form.setItems(timestamp, action, category, user, status, info, message, detail);
form.editRecord(record);
- final Window window = new Window();
+ final Window window = new
LocatableWindow(extendLocatorId("detailsWin"));
window.setTitle(MSG.view_bundle_deploy_installDetails());
- window.setWidth(800);
- window.setHeight(600);
+ window.setAutoSize(true);
+ window.setWidth(500);
+ window.setAutoCenter(true);
window.setIsModal(true);
window.setShowModalMask(true);
window.setCanDragResize(true);
- window.centerInPage();
window.addItem(form);
- window.show();
-
- close.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
+ window.setShowMinimizeButton(false);
+ window.setShowMaximizeButton(true);
+ window.addCloseClickHandler(new CloseClickHandler() {
+ @Override
+ public void onCloseClick(CloseClientEvent event) {
window.destroy();
}
});
+ window.show();
}
public ListGridRecord[] buildRecords() {
@@ -161,10 +206,11 @@ public class BundleResourceDeploymentHistoryListView extends
LocatableVLayout {
record.setAttribute("message", step.getMessage());
record.setAttribute("attachment", step.getAttachment());
record.setAttribute("status", step.getStatus().name());
+ record.setAttribute("timestamp", new Date(step.getAuditTime()));
+ record.setAttribute("user", step.getSubjectName());
records.add(record);
}
return records.toArray(new ListGridRecord[records.size()]);
-
}
}