Map<ComponentState, StateTransitionTracker.StateContributionInfo> activeStates = modelStateInfo
.getStateContributionMap();
SubstanceFillPainter fillPainter = SubstanceCoreUtilities
.getFillPainter(this.menuItem);
SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
.getBorderPainter(this.menuItem);
ComponentState currState = modelStateInfo.getCurrModelState();
SubstanceColorScheme baseFillColorScheme = SubstanceColorSchemeUtilities
.getColorScheme(this.menuItem, ColorSchemeAssociationKind.FILL,
currState);
SubstanceColorScheme baseMarkColorScheme = SubstanceColorSchemeUtilities
.getColorScheme(this.menuItem, ColorSchemeAssociationKind.MARK,
currState);
SubstanceColorScheme baseBorderColorScheme = SubstanceColorSchemeUtilities
.getColorScheme(this.menuItem,
ColorSchemeAssociationKind.BORDER, currState);
float visibility = stateTransitionTracker
.getFacetStrength(ComponentStateFacet.SELECTION);
boolean isCheckMarkFadingOut = !currState
.isFacetActive(ComponentStateFacet.SELECTION);
int fontSize = SubstanceSizeUtils.getComponentFontSize(this.menuItem);
int checkMarkSize = this.size + 3;
HashMapKey keyBase = SubstanceCoreUtilities.getHashKey(fontSize,
checkMarkSize, fillPainter.getDisplayName(), borderPainter
.getDisplayName(),
baseFillColorScheme.getDisplayName(), baseMarkColorScheme
.getDisplayName(), baseBorderColorScheme
.getDisplayName(), visibility, isCheckMarkFadingOut);
Icon iconBase = iconMap.get(keyBase);
if (iconBase == null) {
iconBase = new ImageIcon(SubstanceImageCreator.getCheckBox(
this.menuItem, fillPainter, borderPainter, checkMarkSize,
currState, baseFillColorScheme, baseMarkColorScheme,
baseBorderColorScheme, visibility, isCheckMarkFadingOut));
iconMap.put(keyBase, iconBase);
}
if (currState.isDisabled() || (activeStates.size() == 1)) {
return iconBase;
}
BufferedImage result = SubstanceCoreUtilities.getBlankImage(iconBase
.getIconWidth(), iconBase.getIconHeight());
Graphics2D g2d = result.createGraphics();
// draw the base layer
iconBase.paintIcon(this.menuItem, g2d, 0, 0);
// draw other active layers
for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
.entrySet()) {
ComponentState activeState = activeEntry.getKey();
// System.out.println("Painting state " + activeState + "[curr is "
// + currState + "] with " + activeEntry.getValue());
if (activeState == currState)
continue;
float stateContribution = activeEntry.getValue().getContribution();
if (stateContribution > 0.0f) {
g2d.setComposite(AlphaComposite.SrcOver
.derive(stateContribution));
SubstanceColorScheme fillColorScheme = SubstanceColorSchemeUtilities
.getColorScheme(this.menuItem,
ColorSchemeAssociationKind.FILL, activeState);
SubstanceColorScheme markColorScheme = SubstanceColorSchemeUtilities
.getColorScheme(this.menuItem,
ColorSchemeAssociationKind.MARK, activeState);
SubstanceColorScheme borderColorScheme = SubstanceColorSchemeUtilities
.getColorScheme(this.menuItem,
ColorSchemeAssociationKind.BORDER, activeState);
HashMapKey keyLayer = SubstanceCoreUtilities.getHashKey(
fontSize, checkMarkSize, fillPainter.getDisplayName(),
borderPainter.getDisplayName(), fillColorScheme
.getDisplayName(), markColorScheme
.getDisplayName(), borderColorScheme
.getDisplayName(), visibility);
Icon iconLayer = iconMap.get(keyLayer);
if (iconLayer == null) {