Package org.pushingpixels.substance.api

Examples of org.pushingpixels.substance.api.SubstanceColorScheme


        // elements in the drop down list
        StateTransitionTracker.ModelStateInfo modelStateInfo = listUI
            .getModelStateInfo(index, result);
        ComponentState currState = listUI.getCellState(index, result);
        if (modelStateInfo == null) {
          SubstanceColorScheme scheme = getColorSchemeForState(list,
              index, listUI, currState);
          // SubstanceColorScheme scheme =
          // SubstanceColorSchemeUtilities
          // .getColorScheme(list, kindForCurr, currState);
          result.setForeground(new ColorUIResource(scheme
              .getForegroundColor()));
        } else {
          Map<ComponentState, StateContributionInfo> activeStates = modelStateInfo
              .getStateContributionMap();
          SubstanceColorScheme colorScheme = getColorSchemeForState(
              list, index, listUI, currState);
          if (currState.isDisabled() || (activeStates == null)
              || (activeStates.size() == 1)) {
            super.setForeground(new ColorUIResource(colorScheme
                .getForegroundColor()));
          } else {
            float aggrRed = 0.0f;
            float aggrGreen = 0.0f;
            float aggrBlue = 0.0f;
            for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : modelStateInfo
                .getStateContributionMap().entrySet()) {
              ComponentState activeState = activeEntry.getKey();
              float activeContribution = activeEntry.getValue()
                  .getContribution();
              if (activeContribution == 0.0f)
                continue;

              SubstanceColorScheme scheme = getColorSchemeForState(
                  list, index, listUI, activeState);
              // SubstanceColorScheme scheme = (activeState ==
              // ComponentState.DEFAULT) ? listUI
              // .getDefaultColorScheme()
              // : listUI.getHighlightColorScheme(activeState);
              // if (scheme == null) {
              // scheme = (activeState == ComponentState.DEFAULT)
              // ?
              // SubstanceColorSchemeUtilities
              // .getColorScheme(list, activeState)
              // : SubstanceColorSchemeUtilities
              // .getColorScheme(
              // list,
              // ColorSchemeAssociationKind.HIGHLIGHT,
              // activeState);
              // }
              Color schemeFg = scheme.getForegroundColor();
              aggrRed += schemeFg.getRed() * activeContribution;
              aggrGreen += schemeFg.getGreen()
                  * activeContribution;
              aggrBlue += schemeFg.getBlue() * activeContribution;
            }
 
View Full Code Here


  /**
   * Creates a new <code>Business</code> skin.
   */
  public BusinessSkin() {
    SubstanceColorScheme activeScheme = new MetallicColorScheme()
        .tint(0.15).named("Business Active");
    SubstanceColorScheme enabledScheme = new MetallicColorScheme().shade(
        0.1).named("Business Enabled");
    SubstanceColorScheme disabledScheme = enabledScheme;

    SubstanceColorSchemeBundle defaultSchemeBundle = new SubstanceColorSchemeBundle(
        activeScheme, enabledScheme, disabledScheme);

    SubstanceSkin.ColorSchemes kitchenSinkSchemes = SubstanceSkin
        .getColorSchemes("org/pushingpixels/substance/api/skin/kitchen-sink.colorschemes");
    SubstanceColorScheme highlightColorScheme = kitchenSinkSchemes
        .get("Business Highlight");
    defaultSchemeBundle.registerHighlightColorScheme(highlightColorScheme);

    defaultSchemeBundle.registerColorScheme(disabledScheme, 0.4f,
        ComponentState.DISABLED_UNSELECTED);
View Full Code Here

  private boolean drawWatermarkImage(SubstanceSkin skin, Graphics2D graphics,
      int x, int y, int width, int height, boolean isPreview) {
    Color stampColorDark = null;
    Color stampColorAll = null;
    Color stampColorLight = null;
    SubstanceColorScheme scheme = skin.getWatermarkColorScheme();
    if (isPreview) {
      stampColorDark = scheme.isDark() ? Color.white : Color.black;
      stampColorAll = Color.lightGray;
      stampColorLight = scheme.isDark() ? Color.black : Color.white;
    } else {
      stampColorDark = scheme.getWatermarkDarkColor();
      stampColorAll = scheme.getWatermarkStampColor();
      stampColorLight = scheme.getWatermarkLightColor();
    }

    graphics.setColor(stampColorAll);
    graphics.fillRect(0, 0, width, height);
View Full Code Here

   * @return Indication whether the draw succeeded.
   */
  private boolean drawWatermarkImage(SubstanceSkin skin, Graphics2D graphics,
      int x, int y, int width, int height, boolean isPreview) {
    Color stampColor = null;
    SubstanceColorScheme scheme = skin.getWatermarkColorScheme();
    if (isPreview)
      stampColor = scheme.isDark() ? Color.lightGray : Color.darkGray;
    else {
      stampColor = scheme.getWatermarkStampColor();
    }

    graphics.setColor(stampColor);
    for (int row = y; row < (y + height); row += 2) {
      graphics.drawLine(x, row, x + width, row);
View Full Code Here

          .getRowForPath(dropLocation.getPath()) == row);

      if (!isDropLocation && (modelStateInfo != null)) {
        Map<ComponentState, StateContributionInfo> activeStates = modelStateInfo
            .getStateContributionMap();
        SubstanceColorScheme colorScheme = getColorSchemeForState(tree,
            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(
                tree, 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(tree, ui,
            currState);
        if (isDropLocation) {
          scheme = SubstanceColorSchemeUtilities.getColorScheme(tree,
              ColorSchemeAssociationKind.TEXT_HIGHLIGHT,
              currState);
        }
        super.setForeground(new ColorUIResource(scheme
            .getForegroundColor()));
      }
    } else {
      if (sel)
        this.setForeground(UIManager
View Full Code Here

    return this;
  }

  private SubstanceColorScheme getColorSchemeForState(JTree tree,
      SubstanceTreeUI ui, ComponentState activeState) {
    SubstanceColorScheme scheme = (activeState == ComponentState.ENABLED) ? ui
        .getDefaultColorScheme()
        : SubstanceColorSchemeUtilities.getColorScheme(tree,
            ColorSchemeAssociationKind.HIGHLIGHT, activeState);
    if (scheme == null) {
      scheme = SubstanceColorSchemeUtilities.getColorScheme(tree,
View Full Code Here

  /**
   * Creates a new <code>Business</code> skin.
   */
  public BusinessBlackSteelSkin() {
    SubstanceColorScheme activeScheme = new SteelBlueColorScheme().tint(
        0.15).named("Business Black Steel Active");
    SubstanceColorScheme enabledScheme = new MetallicColorScheme().tint(
        0.05).named("Business Black Steel Enabled");
    SubstanceColorScheme disabledScheme = new LightGrayColorScheme().tint(
        0.05).named("Business Black Steel Disabled");

    // the default color scheme bundle
    SubstanceColorSchemeBundle defaultSchemeBundle = new SubstanceColorSchemeBundle(
        activeScheme, enabledScheme, disabledScheme);
    defaultSchemeBundle.registerHighlightColorScheme(activeScheme, 0.6f,
        ComponentState.ROLLOVER_UNSELECTED);
    defaultSchemeBundle.registerHighlightColorScheme(activeScheme, 0.8f,
        ComponentState.SELECTED);
    defaultSchemeBundle.registerHighlightColorScheme(activeScheme, 0.95f,
        ComponentState.ROLLOVER_SELECTED);
    defaultSchemeBundle.registerHighlightColorScheme(activeScheme, 0.8f,
        ComponentState.ARMED, ComponentState.ROLLOVER_ARMED);
    this.registerDecorationAreaSchemeBundle(defaultSchemeBundle,
        DecorationAreaType.NONE);

    // color scheme bundle for title panes
    SubstanceColorScheme activeHeaderScheme = new EbonyColorScheme()
        .shiftBackground(Color.black, 0.3).tint(0.05).named(
            "Business Black Steel Active Header");
    SubstanceColorScheme enabledHeaderScheme = new EbonyColorScheme().tint(
        0.05).named("Business Black Steel Enabled Header");
    SubstanceColorSchemeBundle headerSchemeBundle = new SubstanceColorSchemeBundle(
        activeHeaderScheme, enabledHeaderScheme, disabledScheme);
    headerSchemeBundle.registerColorScheme(enabledHeaderScheme, 0.5f,
        ComponentState.DISABLED_UNSELECTED,
        ComponentState.DISABLED_SELECTED);
    headerSchemeBundle.registerHighlightColorScheme(activeScheme, 0.6f,
        ComponentState.ROLLOVER_UNSELECTED);
    headerSchemeBundle.registerHighlightColorScheme(activeScheme, 0.8f,
        ComponentState.SELECTED);
    headerSchemeBundle.registerHighlightColorScheme(activeScheme, 0.95f,
        ComponentState.ROLLOVER_SELECTED);
    headerSchemeBundle.registerHighlightColorScheme(activeScheme, 0.8f,
        ComponentState.ARMED, ComponentState.ROLLOVER_ARMED);

    this.registerDecorationAreaSchemeBundle(headerSchemeBundle,
        activeHeaderScheme, DecorationAreaType.PRIMARY_TITLE_PANE,
        DecorationAreaType.SECONDARY_TITLE_PANE,
        DecorationAreaType.HEADER);

    // color scheme bundle for general areas
    SubstanceColorScheme activeGeneralScheme = activeScheme.shade(0.1)
        .saturate(-0.5).named("Business Black Steel Active General");
    SubstanceColorScheme enabledGeneralScheme = activeScheme.tint(0.3)
        .saturate(-0.7).named("Business Black Steel Enabled General");
    SubstanceColorSchemeBundle generalSchemeBundle = new SubstanceColorSchemeBundle(
        activeGeneralScheme, enabledGeneralScheme, disabledScheme);
    generalSchemeBundle.registerColorScheme(disabledScheme, 0.5f,
        ComponentState.DISABLED_UNSELECTED);
View Full Code Here

  /**
   * Creates a new <code>Sahara</code> skin.
   */
  public SaharaSkin() {
    SubstanceColorScheme activeScheme = new DesertSandColorScheme();
    SubstanceColorScheme enabledScheme = new MetallicColorScheme();
    SubstanceColorScheme disabledScheme = new LightGrayColorScheme();

    SubstanceColorSchemeBundle defaultSchemeBundle = new SubstanceColorSchemeBundle(
        activeScheme, enabledScheme, disabledScheme);
    defaultSchemeBundle.registerHighlightColorScheme(new OliveColorScheme()
        .tint(0.2).named("Sahara Highlight"));
View Full Code Here

      SubstanceFillPainter fillPainter = SubstanceCoreUtilities
          .getFillPainter(slider);
      SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
          .getBorderPainter(slider);

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

      HashMapKey baseKey = SubstanceCoreUtilities.getHashKey(this.size,
          width, baseFillScheme.getDisplayName(), baseBorderScheme
              .getDisplayName(), fillPainter.getDisplayName(),
          borderPainter.getDisplayName(), this.isMirrorred);

      Icon baseLayer = SliderHorizontalIcon.icons.get(baseKey);
      if (baseLayer == null) {
        baseLayer = getSingleLayer(slider, width, delta, fillPainter,
            borderPainter, baseFillScheme, baseBorderScheme);
        SliderHorizontalIcon.icons.put(baseKey, baseLayer);
      }

      if (currState.isDisabled() || (activeStates.size() == 1))
        return baseLayer;

      BufferedImage result = SubstanceCoreUtilities.getBlankImage(
          baseLayer.getIconWidth(), baseLayer.getIconHeight());
      Graphics2D g2d = result.createGraphics();
      baseLayer.paintIcon(slider, g2d, 0, 0);

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

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

        SubstanceColorScheme fillScheme = SubstanceColorSchemeUtilities
            .getColorScheme(slider, activeState);
        SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities
            .getColorScheme(slider,
                ColorSchemeAssociationKind.BORDER, activeState);

        HashMapKey key = SubstanceCoreUtilities.getHashKey(this.size,
            width, fillScheme.getDisplayName(), borderScheme
                .getDisplayName(),
            fillPainter.getDisplayName(), borderPainter
                .getDisplayName(), this.isMirrorred);

        Icon layer = SliderHorizontalIcon.icons.get(key);
View Full Code Here

    if (skin == null) {
      SubstanceCoreUtilities
          .traceSubstanceApiUsage(this,
              "Substance delegate used when Substance is not the current LAF");
    }
    SubstanceColorScheme scheme = skin
        .getEnabledColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE);

    int xOffset = 0;
    String theTitle = this.getTitle();
View Full Code Here

TOP

Related Classes of org.pushingpixels.substance.api.SubstanceColorScheme

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.