headerWidth, height - 1);
dataRenderer.paint(rendererGraphics);
rendererGraphics.dispose();
// Draw the sort image
Image sortImage = null;
String columnName = column.getName();
SortDirection sortDirection = tableView.getSort().get(columnName);
if (sortDirection != null) {
switch (sortDirection) {
case ASCENDING: {
sortImage = sortAscendingImage;
break;
}
case DESCENDING: {
sortImage = sortDescendingImage;
break;
}
}
}
if (sortImage != null) {
int sortImageMargin = sortImage.getWidth() + SORT_INDICATOR_PADDING * 2;
if (headerWidth >= dataRenderer.getPreferredWidth(-1) + sortImageMargin) {
Graphics2D sortImageGraphics = (Graphics2D)graphics.create();
sortImageGraphics.translate(headerX + headerWidth - sortImageMargin,
(height - sortImage.getHeight()) / 2);
sortImage.paint(sortImageGraphics);
sortImageGraphics.dispose();
}
}
// Draw the divider