// first frame uses full opacity, and the next frame starts the
// fade sequence. So, we use the UI delegate to compute the
// focus indication.
hasFocus = ui.isFocusedCell(row, column);
TableCellId cellId = new TableCellId(row, column);
Comparable<?> compId = ui.getId(row, column);
ComponentState state = ui.getCellState(cellId);
ComponentState prevState = ui.getPrevCellState(cellId);
SubstanceColorScheme scheme = (state == ComponentState.DEFAULT) ? ui
.getDefaultColorScheme() : ui.getHighlightColorScheme(state);
if (scheme == null) {
scheme = (state == ComponentState.DEFAULT) ? SubstanceColorSchemeUtilities
.getColorScheme(table, state)
: SubstanceColorSchemeUtilities.getColorScheme(table,
ColorSchemeAssociationKind.HIGHLIGHT, state);
}
SubstanceColorScheme prevScheme = scheme;
if (prevState != state) {
prevScheme = (prevState == ComponentState.DEFAULT) ? ui
.getDefaultColorScheme() : ui
.getHighlightColorScheme(prevState);
if (prevScheme == null) {
prevScheme = (prevState == ComponentState.DEFAULT) ? SubstanceColorSchemeUtilities
.getColorScheme(table, prevState)
: SubstanceColorSchemeUtilities
.getColorScheme(table,
ColorSchemeAssociationKind.HIGHLIGHT,
prevState);
}
}
// SubstanceColorScheme scheme = (state == ComponentState.DEFAULT) ?
// ui
// .getDefaultColorScheme() : SubstanceColorSchemeUtilities
// .getColorScheme(table, state);
if (scheme == null)
scheme = SubstanceColorSchemeUtilities.getColorScheme(table, state);
if (ui.hasRolloverAnimations() || ui.hasSelectionAnimations()) {
super.setForeground(new ColorUIResource(SubstanceColorUtilities
.getInterpolatedForegroundColor(table, compId, scheme,
state, prevScheme, prevState, FadeKind.SELECTION,
FadeKind.ROLLOVER)));
} else {
super
.setForeground(new ColorUIResource(scheme
.getForegroundColor()));
}
SubstanceStripingUtils.applyStripedBackground(table, row, this);
this.setFont(table.getFont());
TableCellId cellFocusId = new TableCellId(row, column);
// set indication to make exact comparison (since
// focus can be only on one cell).
cellFocusId.setExactComparison(true);
FadeState focusState = SubstanceFadeUtilities.getFadeState(table,
cellFocusId, FadeKind.FOCUS);
Insets regInsets = ui.getCellRendererInsets();
if (hasFocus || (focusState != null)) {