Package org.pushingpixels.substance.internal.utils

Examples of org.pushingpixels.substance.internal.utils.HashMapKey


                : ComponentState.DISABLED_UNSELECTED);
    SubstanceColorScheme mainBorderScheme = SubstanceColorSchemeUtilities
        .getColorScheme(scrollBar, ColorSchemeAssociationKind.BORDER,
            scrollBar.isEnabled() ? ComponentState.ENABLED
                : ComponentState.DISABLED_UNSELECTED);
    HashMapKey key = SubstanceCoreUtilities.getHashKey(mainScheme
        .getDisplayName(), mainBorderScheme.getDisplayName(), width,
        height, shaper.getDisplayName());
    float radius = height / 2;
    if (shaper instanceof ClassicButtonShaper)
      radius = SubstanceSizeUtils
View Full Code Here


                : ComponentState.DISABLED_UNSELECTED);
    SubstanceColorScheme mainBorderScheme = SubstanceColorSchemeUtilities
        .getColorScheme(scrollBar, ColorSchemeAssociationKind.BORDER,
            scrollBar.isEnabled() ? ComponentState.ENABLED
                : ComponentState.DISABLED_UNSELECTED);
    HashMapKey key = SubstanceCoreUtilities.getHashKey(mainScheme
        .getDisplayName(), mainBorderScheme.getDisplayName(), width,
        height, shaper.getDisplayName());
    BufferedImage result = SubstanceScrollBarUI.trackVerticalMap.get(key);
    if (result == null) {
      float radius = width / 2;
View Full Code Here

        .getFillPainter(scrollBar);
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(scrollBar);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(scrollBar);
    HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
        scheme.getDisplayName(), borderScheme.getDisplayName(), painter
            .getDisplayName(), shaper.getDisplayName(),
        borderPainter.getDisplayName());
    BufferedImage result = SubstanceScrollBarUI.thumbVerticalMap.get(key);
    if (result == null) {
View Full Code Here

        .getFillPainter(scrollBar);
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(scrollBar);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(scrollBar);
    HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
        scheme.getDisplayName(), borderScheme.getDisplayName(), painter
            .getDisplayName(), shaper.getDisplayName(),
        borderPainter.getDisplayName());

    float radius = height / 2;
View Full Code Here

        .getColorScheme(combo, currState);
    SubstanceColorScheme baseBorderScheme = SubstanceColorSchemeUtilities
        .getColorScheme(combo, ColorSchemeAssociationKind.BORDER,
            currState);

    HashMapKey keyBase = SubstanceCoreUtilities.getHashKey(width, height,
        baseFillScheme.getDisplayName(), baseBorderScheme
            .getDisplayName(), fillPainter.getDisplayName(),
        borderPainter.getDisplayName(), combo.getClass().getName(),
        radius, comboFontSize);
    BufferedImage layerBase = regularBackgrounds.get(keyBase);
    if (layerBase == null) {
      layerBase = createBackgroundImage(combo, shaper, fillPainter,
          borderPainter, width, height, baseFillScheme,
          baseBorderScheme, radius);
      regularBackgrounds.put(keyBase, layerBase);
    }
    if (currState.isDisabled() || (activeStates.size() == 1)) {
      return layerBase;
    }

    BufferedImage result = SubstanceCoreUtilities.getBlankImage(width,
        height);
    Graphics2D g2d = result.createGraphics();
    // draw the base layer
    g2d.drawImage(layerBase, 0, 0, null);
    // System.out.println("\nPainting base state " + currState);

    // draw the 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 fillScheme = SubstanceColorSchemeUtilities
            .getColorScheme(combo, activeState);
        SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities
            .getColorScheme(combo,
                ColorSchemeAssociationKind.BORDER, activeState);
        HashMapKey key = SubstanceCoreUtilities.getHashKey(width,
            height, fillScheme.getDisplayName(), borderScheme
                .getDisplayName(),
            fillPainter.getDisplayName(), borderPainter
                .getDisplayName(), combo.getClass().getName(),
            radius, comboFontSize);
View Full Code Here

        .getColorScheme(this.menuItem,
            ColorSchemeAssociationKind.BORDER, currState);
    float visibility = stateTransitionTracker
        .getFacetStrength(ComponentStateFacet.SELECTION);

    HashMapKey keyBase = SubstanceCoreUtilities.getHashKey(fontSize,
        checkMarkSize, fillPainter.getDisplayName(), borderPainter
            .getDisplayName(),
        baseFillColorScheme.getDisplayName(), baseMarkColorScheme
            .getDisplayName(), baseBorderColorScheme
            .getDisplayName(), visibility);
    Icon iconBase = iconMap.get(keyBase);
    if (iconBase == null) {
      iconBase = new ImageIcon(SubstanceImageCreator.getRadioButton(
          this.menuItem, fillPainter, borderPainter, checkMarkSize,
          currState, 0, baseFillColorScheme, baseMarkColorScheme,
          baseBorderColorScheme, visibility));
      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);
View Full Code Here

    SubstanceColorScheme baseScheme = SubstanceColorSchemeUtilities
        .getColorScheme(this.component, baseAssociationKind, currState);
    float baseAlpha = SubstanceColorSchemeUtilities.getAlpha(
        this.component, currState);

    HashMapKey keyBase = SubstanceCoreUtilities.getHashKey(this.component
        .getClass().getName(), this.orientation, SubstanceSizeUtils
        .getComponentFontSize(this.component), baseScheme
        .getDisplayName(), baseAlpha);
    Icon layerBase = iconMap.get(keyBase);
    if (layerBase == null) {
      Icon baseFullOpacity = this.delegate.getColorSchemeIcon(baseScheme);
      if (baseAlpha == 1.0f) {
        layerBase = baseFullOpacity;
        iconMap.put(keyBase, layerBase);
      } else {
        BufferedImage baseImage = SubstanceCoreUtilities.getBlankImage(
            baseFullOpacity.getIconWidth(), baseFullOpacity
                .getIconHeight());
        Graphics2D g2base = baseImage.createGraphics();
        g2base.setComposite(AlphaComposite.SrcOver.derive(baseAlpha));
        baseFullOpacity.paintIcon(this.component, g2base, 0, 0);
        g2base.dispose();
        layerBase = new ImageIcon(baseImage);
        iconMap.put(keyBase, layerBase);
      }
    }
    // System.out.println("Contribution map in painting");
    // for (Map.Entry<ComponentState,
    // StateTransitionTracker.StateContributionInfo> existing : activeStates
    // .entrySet()) {
    // System.out.println("\t" + existing.getKey() + " in ["
    // + existing.getValue().start + ":" + existing.getValue().end
    // + "] : " + existing.getValue().curr);
    // }

    if (currState.isDisabled() || (activeStates.size() == 1)) {
      return layerBase;
    }

    BufferedImage result = SubstanceCoreUtilities.getBlankImage(layerBase
        .getIconWidth(), layerBase.getIconHeight());
    Graphics2D g2d = result.createGraphics();
    // draw the base layer
    // System.out.println("Painting currState " + currState + ":" +
    // baseAlpha);
    layerBase.paintIcon(this.component, g2d, 0, 0);

    // draw the 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();
      // System.out.println("Painting activeState "
      // + activeState
      // + ":"
      // + stateContribution
      // + "*"
      // + SubstanceColorSchemeUtilities.getAlpha(this.component,
      // activeState));
      if (stateContribution > 0.0f) {
        g2d.setComposite(AlphaComposite.SrcOver
            .derive(stateContribution));

        ColorSchemeAssociationKind associationKind = isMenu
            && activeState
                .isFacetActive(ComponentStateFacet.ROLLOVER) ? ColorSchemeAssociationKind.HIGHLIGHT
            : ColorSchemeAssociationKind.MARK;
        SubstanceColorScheme scheme = SubstanceColorSchemeUtilities
            .getColorScheme(this.component, associationKind,
                activeState);
        float alpha = SubstanceColorSchemeUtilities.getAlpha(
            this.component, activeState);

        HashMapKey key = SubstanceCoreUtilities
            .getHashKey(this.component.getClass().getName(),
                this.orientation, SubstanceSizeUtils
                    .getComponentFontSize(this.component),
                scheme.getDisplayName(), alpha);
        Icon layer = iconMap.get(key);
View Full Code Here

              .getComponentFontSize(button));
      if (radius < 0.0f)
        radius = 0.0f;
    }

    HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
        straightSides, radius, insets);

    GeneralPath result = contours.get(key);
    if (result != null) {
      return result;
View Full Code Here

   * @param isMirrorred
   *            Indication whether the icon should be mirrored.
   * @return Icon for horizontal slider in {@link SubstanceSliderUI}.
   */
  public static Icon getSliderHorizontalIcon(int size, boolean isMirrorred) {
    HashMapKey key = SubstanceCoreUtilities.getHashKey(size, isMirrorred);
    if (SubstanceIconFactory.sliderHorizontalIcons.get(key) == null) {
      Icon icon = new SliderHorizontalIcon(size, isMirrorred);
      SubstanceIconFactory.sliderHorizontalIcons.put(key, icon);
    }
    return SubstanceIconFactory.sliderHorizontalIcons.get(key);
View Full Code Here

   * @param size
   *            The size of the icon to retrieve.
   * @return Round icon for slider in {@link SubstanceSliderUI}.
   */
  public static Icon getSliderRoundIcon(int size) {
    HashMapKey key = SubstanceCoreUtilities.getHashKey(size);
    if (SubstanceIconFactory.sliderRoundIcons.get(key) == null) {
      Icon icon = new SliderRoundIcon(size);
      SubstanceIconFactory.sliderRoundIcons.put(key, icon);
    }
    return SubstanceIconFactory.sliderRoundIcons.get(key);
View Full Code Here

TOP

Related Classes of org.pushingpixels.substance.internal.utils.HashMapKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.