severityField.setShowHover(true);
severityField.setHoverCustomizer(new HoverCustomizer() {
@Override
public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
try {
Severity severity = ((Message) record.getAttributeAsObject(FIELD_OBJECT)).getSeverity();
switch (severity) {
case Info:
return MSG.common_severity_info();
case Warning:
return MSG.common_severity_warn();
case Error:
return MSG.common_severity_error();
case Fatal:
return MSG.common_severity_fatal();
}
} catch (Throwable e) {
Log.error("Cannot get severity hover", e);
}
return null;
}
});
severityField.setSortNormalizer(new SortNormalizer() {
@Override
public Object normalize(ListGridRecord record, String fieldName) {
try {
Severity severity = ((Message) record.getAttributeAsObject(FIELD_OBJECT)).getSeverity();
return Integer.valueOf(severity.ordinal());
} catch (Throwable e) {
Log.error("Cannot get sort nomalizer", e);
}
return Integer.valueOf(0);
}