private SubstanceColorScheme getColorSchemeForState(JList list, int index,
SubstanceListUI listUI, ComponentState state) {
boolean toUseHighlightKindForCurrState = (index >= 0)
&& (state.isFacetActive(ComponentStateFacet.ROLLOVER) || state
.isFacetActive(ComponentStateFacet.SELECTION));
UpdateOptimizationInfo updateOptimizationInfo = listUI
.getUpdateOptimizationInfo();
if (toUseHighlightKindForCurrState) {
if (updateOptimizationInfo == null) {
return SubstanceColorSchemeUtilities.getColorScheme(list,
ColorSchemeAssociationKind.HIGHLIGHT, state);
} else {
return updateOptimizationInfo.getHighlightColorScheme(state);
}
} else {
if (updateOptimizationInfo == null) {
return SubstanceColorSchemeUtilities
.getColorScheme(list, state);
} else {
return updateOptimizationInfo.getDefaultScheme();
}
}
}