int index, // cell index
boolean isSelected, // is the cell selected
boolean cellHasFocus) // the list and the cell have the focus
{
// TF:27/03/2009:Removed lots of extra casting which is unnecessary and adds runtime overhead
DisplayNode node = (DisplayNode)value;
// TF:28/04/2009:The list vell renderer should always refer to the first column in the list, not the DVNodeText
// The DVNodeText is initialised in the constructor, so there's no case where this would be null (unless explicitly
// set later) so this code stops a valid value being displayed.
/*
if (node.getDVNodeText()!= null){
String text = this.getNodeText(node);
this._LabelText.setText(text);
}
// this is a unique feature of Forte ListView, if the DVNodeText is null than the 1st column is used as the node text
// So, for example, if the node is mapped to a DisplayNode subclass which has "Name" as it's first column, then the
// Name will appear in the text next to the icon
else*/
this.labelText.setText(getNodeText(node));
UIutils.labelWidth(this.labelText);
// Set float over text as the label is often truncated. ISIS-349881.
this.setToolTipText(this.labelText.getText());
ImageIcon image = null;
if (isSelected) {
if (list.hasFocus()) {
this.labelText.setBackground(list.getSelectionBackground());
this.labelText.setForeground(list.getSelectionForeground());
}
else {
this.labelText.setBackground(java.awt.Color.lightGray);
this.labelText.setForeground(java.awt.Color.black);
}
// TF:15/8/07:Moved the selection of the icon here, because it doesn't matter
// if we have focus or not for which icon we display
// TF:27/03/2009:Changed this to use the inbuilt method "asIconImage" and removed obsolete logic
if (node.getDVSelectedIcon() != null) {
image = node.getDVSelectedIcon().asIconImage();
}
else if (node.getDVLargeIcon() != null) {
image = node.getDVLargeIcon().asIconImage();
}
else if (node.getDVSmallIcon() != null) {
image = node.getDVSmallIcon().asIconImage();
}
}
else {
this.labelText.setBackground(list.getBackground());
this.labelText.setForeground(list.getForeground());
if (node.getDVLargeIcon() != null) {
image = node.getDVLargeIcon().asIconImage();
}
else if (node.getDVSmallIcon() != null) {
image = node.getDVSmallIcon().asIconImage();
}
}
if (image != null){
image = new ImageIcon(image.getImage().getScaledInstance(this.imageSize, this.imageSize, Image.SCALE_DEFAULT));
this.labelIcon.setIcon(image);