/**
* Returns the object used to render the specified cell.
*/
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
CellLabel currentLabel;
// Icon label foreground.
if(column == 0) {
currentLabel = icon;
if(row == FOLDER)
currentLabel.setIcon(IconManager.getIcon(IconManager.FILE_ICON_SET, CustomFileIconProvider.FOLDER_ICON_NAME));
else if(row == ARCHIVE)
currentLabel.setIcon(IconManager.getIcon(IconManager.FILE_ICON_SET, CustomFileIconProvider.ARCHIVE_ICON_NAME));
else if(row == SYMLINK)
currentLabel.setIcon(symlinkIcon);
else
currentLabel.setIcon(IconManager.getIcon(IconManager.FILE_ICON_SET, CustomFileIconProvider.FILE_ICON_NAME));
}
// Text label foreground.
else {
currentLabel = label;
currentLabel.setFont(data.getFont(ThemeData.FILE_TABLE_FONT));
currentLabel.setText((String)value);
currentLabel.setForeground(getForegroundColor(row, isSelected));
}
// Foreground.
if(isSelected)
currentLabel.setOutline(isActive ? data.getColor(ThemeData.FILE_TABLE_SELECTED_OUTLINE_COLOR) :
data.getColor(ThemeData.FILE_TABLE_INACTIVE_SELECTED_OUTLINE_COLOR));
else
currentLabel.setOutline(null);
// Background.
if(FilePreviewPanel.this.isActive) {
if(isSelected)
currentLabel.setBackground(FilePreviewPanel.this.data.getColor(ThemeData.FILE_TABLE_SELECTED_BACKGROUND_COLOR));
else
currentLabel.setBackground(FilePreviewPanel.this.data.getColor((row % 2 == 0) ? ThemeData.FILE_TABLE_BACKGROUND_COLOR :
ThemeData.FILE_TABLE_ALTERNATE_BACKGROUND_COLOR));
}
else {
if(isSelected)
currentLabel.setBackground(FilePreviewPanel.this.data.getColor(ThemeData.FILE_TABLE_INACTIVE_SELECTED_BACKGROUND_COLOR));
else
currentLabel.setBackground(FilePreviewPanel.this.data.getColor((row % 2 == 0) ? ThemeData.FILE_TABLE_INACTIVE_BACKGROUND_COLOR :
ThemeData.FILE_TABLE_INACTIVE_ALTERNATE_BACKGROUND_COLOR));
}
return currentLabel;
}