@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
// use the name of the snapshot as its display value
Metadata snap = (Metadata) value;
Component result = super.getListCellRendererComponent(list,
snap.getName(), index, isSelected, cellHasFocus);
// place a checkmark icon next to the active snapshot
if (snap.getId().equals(activeSnapshotId))
setIcon(DashboardIconFactory.getCheckIcon());
else
setIcon(null);
// display snapshot comments as a tooltip
String comment = snap.getComment();
String tooltip = null;
if (StringUtils.hasValue(comment))
tooltip = "<html><div style='width:200px'>"
+ HTMLUtils.escapeEntities(comment) + "</div></html>";
setToolTipText(tooltip);