Examples of SubstanceColorScheme


Examples of org.pushingpixels.substance.api.SubstanceColorScheme

      ComponentState state) {
    if (this.highlightBorderSchemeMap == null) {
      this.highlightBorderSchemeMap = new HashMap<ComponentState, SubstanceColorScheme>();
          //ComponentState.class);
    }
    SubstanceColorScheme result = this.highlightBorderSchemeMap.get(state);
    if (result == null) {
      result = SubstanceColorSchemeUtilities.getColorScheme(
          this.component,
          ColorSchemeAssociationKind.HIGHLIGHT_BORDER, state);
      this.highlightBorderSchemeMap.put(state, result);
View Full Code Here

Examples of org.pushingpixels.substance.api.SubstanceColorScheme

   */
  private static BufferedImage getTrackHorizontal(JScrollBar scrollBar,
      int width, int height) {
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(scrollBar);
    SubstanceColorScheme mainScheme = SubstanceColorSchemeUtilities
        .getColorScheme(scrollBar,
            scrollBar.isEnabled() ? ComponentState.ENABLED
                : 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
          .getClassicButtonCornerRadius(SubstanceSizeUtils
View Full Code Here

Examples of org.pushingpixels.substance.api.SubstanceColorScheme

   */
  private static BufferedImage getTrackVertical(JScrollBar scrollBar,
      int width, int height) {
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(scrollBar);
    SubstanceColorScheme mainScheme = SubstanceColorSchemeUtilities
        .getColorScheme(scrollBar,
            scrollBar.isEnabled() ? ComponentState.ENABLED
                : 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;
      if (shaper instanceof ClassicButtonShaper)
View Full Code Here

Examples of org.pushingpixels.substance.api.SubstanceColorScheme

    StateTransitionTracker.ModelStateInfo modelStateInfo = this.compositeStateTransitionTracker
        .getModelStateInfo();
    ComponentState currState = modelStateInfo.getCurrModelState();

    // enabled scroll bar is always painted as active
    SubstanceColorScheme baseFillScheme = (currState != ComponentState.ENABLED) ? SubstanceColorSchemeUtilities
        .getColorScheme(this.scrollbar, currState)
        : SubstanceColorSchemeUtilities.getActiveColorScheme(
            this.scrollbar, currState);
    SubstanceColorScheme baseBorderScheme = SubstanceColorSchemeUtilities
        .getColorScheme(this.scrollbar,
            ColorSchemeAssociationKind.BORDER, currState);
    BufferedImage baseLayer = getThumbVertical(this.scrollbar, width,
        height, baseFillScheme, baseBorderScheme);

    Map<ComponentState, StateTransitionTracker.StateContributionInfo> activeStates = modelStateInfo
        .getStateContributionMap();
    if (currState.isDisabled() || (activeStates.size() == 1)) {
      return baseLayer;
    }

    BufferedImage result = SubstanceCoreUtilities.getBlankImage(baseLayer
        .getWidth(), baseLayer.getHeight());
    Graphics2D g2d = result.createGraphics();
    g2d.drawImage(baseLayer, 0, 0, null);

    for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
        .entrySet()) {
      ComponentState activeState = activeEntry.getKey();
      if (activeState == modelStateInfo.getCurrModelState())
        continue;

      float contribution = activeEntry.getValue().getContribution();
      if (contribution == 0.0f)
        continue;

      g2d.setComposite(AlphaComposite.SrcOver.derive(contribution));

      SubstanceColorScheme fillScheme = (activeState != ComponentState.ENABLED) ? SubstanceColorSchemeUtilities
          .getColorScheme(this.scrollbar, activeState)
          : SubstanceColorSchemeUtilities.getActiveColorScheme(
              this.scrollbar, activeState);
      SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities
          .getColorScheme(this.scrollbar,
              ColorSchemeAssociationKind.BORDER, activeState);
      BufferedImage layer = getThumbVertical(this.scrollbar, width,
          height, fillScheme, borderScheme);
      g2d.drawImage(layer, 0, 0, null);
View Full Code Here

Examples of org.pushingpixels.substance.api.SubstanceColorScheme

    ComponentState currState = modelStateInfo.getCurrModelState();
    // enabled scroll bar is always painted as active
    // if (currState == ComponentState.ENABLED)
    // currState = ComponentState.SELECTED;

    SubstanceColorScheme baseFillScheme = (currState != ComponentState.ENABLED) ? SubstanceColorSchemeUtilities
        .getColorScheme(this.scrollbar, currState)
        : SubstanceColorSchemeUtilities.getActiveColorScheme(
            this.scrollbar, currState);
    SubstanceColorScheme baseBorderScheme = SubstanceColorSchemeUtilities
        .getColorScheme(this.scrollbar,
            ColorSchemeAssociationKind.BORDER, currState);
    BufferedImage baseLayer = getThumbHorizontal(this.scrollbar, width,
        height, baseFillScheme, baseBorderScheme);

    Map<ComponentState, StateTransitionTracker.StateContributionInfo> activeStates = modelStateInfo
        .getStateContributionMap();
    if (currState.isDisabled() || (activeStates.size() == 1)) {
      return baseLayer;
    }

    BufferedImage result = SubstanceCoreUtilities.getBlankImage(baseLayer
        .getWidth(), baseLayer.getHeight());
    Graphics2D g2d = result.createGraphics();
    g2d.drawImage(baseLayer, 0, 0, null);

    for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
        .entrySet()) {
      ComponentState activeState = activeEntry.getKey();
      if (activeState == modelStateInfo.getCurrModelState())
        continue;
      // if (activeState == ComponentState.ENABLED)
      // activeState = ComponentState.SELECTED;

      float contribution = activeEntry.getValue().getContribution();
      if (contribution == 0.0f)
        continue;

      g2d.setComposite(AlphaComposite.SrcOver.derive(contribution));

      SubstanceColorScheme fillScheme = (activeState != ComponentState.ENABLED) ? SubstanceColorSchemeUtilities
          .getColorScheme(this.scrollbar, activeState)
          : SubstanceColorSchemeUtilities.getActiveColorScheme(
              this.scrollbar, activeState);
      SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities
          .getColorScheme(this.scrollbar,
              ColorSchemeAssociationKind.BORDER, activeState);
      BufferedImage layer = getThumbHorizontal(this.scrollbar, width,
          height, fillScheme, borderScheme);
      g2d.drawImage(layer, 0, 0, null);
View Full Code Here

Examples of org.pushingpixels.substance.api.SubstanceColorScheme

        .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);

    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);
        Icon iconLayer = iconMap.get(keyLayer);
        if (iconLayer == null) {
          iconLayer = new ImageIcon(SubstanceImageCreator
              .getRadioButton(this.menuItem, fillPainter,
View Full Code Here

Examples of org.pushingpixels.substance.api.SubstanceColorScheme

    // Use HIGHLIGHT for rollover menus (arrow icons)
    // and MARK for the rest
    ColorSchemeAssociationKind baseAssociationKind = isMenu
        && currState.isFacetActive(ComponentStateFacet.ROLLOVER) ? ColorSchemeAssociationKind.HIGHLIGHT
        : ColorSchemeAssociationKind.MARK;
    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);
        if (layer == null) {
          Icon fullOpacity = this.delegate.getColorSchemeIcon(scheme);
          if (alpha == 1.0f) {
            layer = fullOpacity;
View Full Code Here

Examples of org.pushingpixels.substance.api.SubstanceColorScheme

    JList.DropLocation dropLocation = list.getDropLocation();
    if (dropLocation != null && !dropLocation.isInsert()
        && dropLocation.getIndex() == row) {
      // mark drop location
      SubstanceColorScheme fillScheme = SubstanceColorSchemeUtilities
          .getColorScheme(list,
              ColorSchemeAssociationKind.TEXT_HIGHLIGHT,
              currState);
      SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities
          .getColorScheme(list, ColorSchemeAssociationKind.BORDER,
              currState);
      Rectangle cellRect = new Rectangle(cx, cy, cw, ch);
      HighlightPainterUtils.paintHighlight(g2d, this.rendererPane,
          rendererComponent, cellRect, 0.8f, null, fillScheme,
          borderScheme);
    } else {
      if (hasHighlights) {
        Rectangle cellRect = new Rectangle(cx, cy, cw, ch);
        if (activeStates == null) {
          float alpha = this.updateInfo.getHighlightAlpha(currState);
          if (alpha > 0.0f) {
            SubstanceColorScheme fillScheme = this.updateInfo
                .getHighlightColorScheme(currState);
            SubstanceColorScheme borderScheme = this.updateInfo
                .getHighlightBorderColorScheme(currState);
            g2d.setComposite(LafWidgetUtilities.getAlphaComposite(
                list, alpha, g));
            HighlightPainterUtils.paintHighlight(g2d,
                this.rendererPane, rendererComponent, cellRect,
                0.8f, null, fillScheme, borderScheme);
            g2d.setComposite(LafWidgetUtilities.getAlphaComposite(
                list, g));
          }
        } else {
          for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> stateEntry : activeStates
              .entrySet()) {
            ComponentState activeState = stateEntry.getKey();
            float alpha = this.updateInfo
                .getHighlightAlpha(activeState)
                * stateEntry.getValue().getContribution();
            if (alpha == 0.0f)
              continue;
            SubstanceColorScheme fillScheme = this.updateInfo
                .getHighlightColorScheme(activeState);
            SubstanceColorScheme borderScheme = this.updateInfo
                .getHighlightBorderColorScheme(activeState);
            g2d.setComposite(LafWidgetUtilities.getAlphaComposite(
                list, alpha, g));
            HighlightPainterUtils.paintHighlight(g2d,
                this.rendererPane, rendererComponent, cellRect,
View Full Code Here

Examples of org.pushingpixels.substance.api.SubstanceColorScheme

        String key = (String) i.nextElement();
        labelsList.add(key);
        labelsList.add(bundle.getObject(key));
      }
      SubstanceSkin skin = (SubstanceSkin) mSkin;
      final SubstanceColorScheme colorScheme = skin
          .getActiveColorScheme(DecorationAreaType.NONE);
      InsetsUIResource visualMargin = new InsetsUIResource(0, 0, 0, 0);
      Color foregroundColor = new ColorUIResource(colorScheme
          .getForegroundColor());
      Object[] mainDefaults = new Object[] {
          // quaqua
          "Slider.upThumbSmall",
          new UIDefaults.LazyValue() {
View Full Code Here

Examples of org.pushingpixels.substance.api.SubstanceColorScheme

          && !dropLocation.isInsert() && dropLocation.getIndex() == index);

      if (!isDropLocation && (modelStateInfo != null)) {
        Map<ComponentState, StateContributionInfo> activeStates = modelStateInfo
            .getStateContributionMap();
        SubstanceColorScheme colorScheme = getColorSchemeForState(list,
            ui, currState);
        if (currState.isDisabled() || (activeStates == null)
            || (activeStates.size() == 1)) {
          super.setForeground(new ColorUIResource(colorScheme
              .getForegroundColor()));
        } else {
          float aggrRed = 0;
          float aggrGreen = 0;
          float aggrBlue = 0;

          for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : modelStateInfo
              .getStateContributionMap().entrySet()) {
            ComponentState activeState = activeEntry.getKey();
            SubstanceColorScheme scheme = getColorSchemeForState(
                list, ui, activeState);
            Color schemeFg = scheme.getForegroundColor();
            float contribution = activeEntry.getValue()
                .getContribution();
            aggrRed += schemeFg.getRed() * contribution;
            aggrGreen += schemeFg.getGreen() * contribution;
            aggrBlue += schemeFg.getBlue() * contribution;
          }
          super.setForeground(new ColorUIResource(new Color(
              (int) aggrRed, (int) aggrGreen, (int) aggrBlue)));
        }
      } else {
        SubstanceColorScheme scheme = getColorSchemeForState(list, ui,
            currState);
        if (isDropLocation) {
          scheme = SubstanceColorSchemeUtilities.getColorScheme(list,
              ColorSchemeAssociationKind.TEXT_HIGHLIGHT,
              currState);
        }
        super.setForeground(new ColorUIResource(scheme
            .getForegroundColor()));
      }
    } else {
      if (isSelected) {
        this.setForeground(list.getSelectionForeground());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.