DatasetEditorModel model = (DatasetEditorModel) table.getModel();
sortingLabel.setText(null);
int width = 0;
String columnName = value.toString();
SortingState sortingState = (SortingState) model.getSortingState();
SortingInstruction sortingInstruction = sortingState.getSortingInstruction(columnName);
if (sortingInstruction != null) {
Icon icon = sortingInstruction.getDirection() == SortDirection.ASCENDING ?
Icons.DATA_EDITOR_SORT_ASC :
Icons.DATA_EDITOR_SORT_DESC;
sortingLabel.setIcon(icon);
width += icon.getIconWidth();
if (sortingState.size() > 1) {
sortingLabel.setText(Integer.toString(sortingInstruction.getIndex()));
}
} else {
sortingLabel.setIcon(null);
}