尝试将CellStyle用于工具提示更新:
@Override
public CellStyle getCellStyleAt(int row, int column) {
Object property = super.getPropertyAt(row);
String description = property instanceof Property ? ((Property) property).getDescription() : null;
if (!StringUtils.isBlank(description)) {
if (description.length() > splitLength) { // Automatically split long descriptions, store results in cache map.
String splitString = descriptionToSplit.get(description);
if (null == splitString) {
splitString = StringUtils.splitToRows(description, splitLength);
descriptionToSplit.put(description, splitString);
}
cellStyle.setToolTipText(splitString);
} else { // Optimization for short descriptions.
cellStyle.setToolTipText(description);
}
} else { // If description is empty, use display name instead.
String name = property instanceof Property ? ((Property) property).getDisplayName() : null;
cellStyle.setToolTipText(name);
}
return cellStyle;
}
@Override
public boolean isCellStyleOn() {
return true;
}
private static final CellStyle cellStyle = new CellStyle();