}
protected List<ListGridField> createFields() {
List<ListGridField> fields = new ArrayList<ListGridField>();
IconField iconField = new IconField();
iconField.setShowHover(true);
iconField.setHoverCustomizer(new HoverCustomizer() {
public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
String resCat = record.getAttribute(CATEGORY.propertyName());
switch (ResourceCategory.valueOf(resCat)) {
case PLATFORM:
return MSG.common_title_platform();
case SERVER:
return MSG.common_title_server();
case SERVICE:
return MSG.common_title_service();
}
return null;
}
});
fields.add(iconField);
ListGridField nameField = new ListGridField(NAME.propertyName(), NAME.title(), 250);
nameField.setCellFormatter(new CellFormatter() {
public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
String invStatus = record.getAttribute(INVENTORY_STATUS.propertyName());
if (InventoryStatus.COMMITTED == InventoryStatus.valueOf(invStatus)) {
String url = LinkManager.getResourceLink(record.getAttributeAsInt("id"));
String name = StringUtility.escapeHtml(value.toString());
return LinkManager.getHref(url, name);
} else {
return value.toString();
}
}
});
nameField.setShowHover(true);
nameField.setHoverCustomizer(new HoverCustomizer() {
public String hoverHTML(Object value, ListGridRecord listGridRecord, int rowNum, int colNum) {
return AncestryUtil.getResourceHoverHTML(listGridRecord, 0);
}
});
fields.add(nameField);
ListGridField keyField = new ListGridField(KEY.propertyName(), KEY.title(), 170);
keyField.setCellFormatter(new EscapedHtmlCellFormatter());
fields.add(keyField);
ListGridField ancestryField = AncestryUtil.setupAncestryListGridField();
fields.add(ancestryField);
ListGridField descriptionField = new ListGridField(DESCRIPTION.propertyName(), DESCRIPTION.title());
descriptionField.setCellFormatter(new EscapedHtmlCellFormatter());
fields.add(descriptionField);
ListGridField locationField = new ListGridField(LOCATION.propertyName(), LOCATION.title(), 180);
locationField.setCellFormatter(new EscapedHtmlCellFormatter());
fields.add(locationField);
ListGridField typeNameField = new ListGridField(TYPE.propertyName(), TYPE.title(), 130);
fields.add(typeNameField);
ListGridField pluginNameField = new ListGridField(PLUGIN.propertyName(), PLUGIN.title(), 100);
fields.add(pluginNameField);
ListGridField versionField = new ListGridField(VERSION.propertyName(), VERSION.title(), 60);
fields.add(versionField);
ListGridField categoryField = new ListGridField(CATEGORY.propertyName(), CATEGORY.title(), 60);
categoryField.setCellFormatter(new ResourceCategoryCellFormatter());
fields.add(categoryField);
IconField availabilityField = new IconField(AVAILABILITY.propertyName(), AVAILABILITY.title(), 70);
fields.add(availabilityField);
ListGridField ctimeField = new ListGridField(CTIME.propertyName(), CTIME.title(), 120);
ctimeField.setCellFormatter(new TimestampCellFormatter());
fields.add(ctimeField);