}
@Override
protected void configureTable() {
DataClass[] input = record.getAttributeAsRecordArray("notificationLogs");
ListGrid grid = getListGrid();
grid.setData((Record[]) input);
ListGridField sender = new ListGridField("sender", MSG.view_alert_common_tab_notifications_sender());
sender.setWidth("33%");
ListGridField status = new ListGridField("status", MSG.view_alert_common_tab_notifications_status());
status.setWidth("50");
status.setAlign(Alignment.CENTER);
status.setType(ListGridFieldType.IMAGE);
status.setCellFormatter(new CellFormatter() {
public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
String statusStr = record.getAttribute("status");
ResultState statusEnum = (statusStr == null) ? ResultState.UNKNOWN : ResultState.valueOf(statusStr);
return imgHTML(ImageManager.getAlertNotificationResultIcon(statusEnum));
}
});
status.setShowHover(true);
status.setHoverCustomizer(new HoverCustomizer() {
public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
String statusStr = record.getAttribute("status");
ResultState statusEnum = (statusStr == null) ? ResultState.UNKNOWN : ResultState.valueOf(statusStr);
switch (statusEnum) {
case SUCCESS:
return MSG.common_status_success();
case FAILURE:
return MSG.common_status_failed();
case PARTIAL:
return MSG.common_status_partial();
case DEFERRED:
return MSG.common_status_deferred();
case UNKNOWN:
default:
return MSG.common_status_unknown();
}
}
});
ListGridField message = new ListGridField("message", MSG.view_alert_common_tab_notifications_message());
message.setWidth("*");
grid.setFields(sender, status, message);
}