Examples of SubstanceButtonShaper


Examples of org.pushingpixels.substance.api.shaper.SubstanceButtonShaper

   * @return Horizontal track image.
   */
  private static BufferedImage getTrackHorizontal(JScrollBar scrollBar,
      ComponentState compLeftState, ComponentState compRightState,
      int width, int height) {
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(scrollBar);
    SubstanceColorScheme mainScheme = SubstanceColorSchemeUtilities
        .getColorScheme(scrollBar,
            scrollBar.isEnabled() ? ComponentState.DEFAULT
                : ComponentState.DISABLED_UNSELECTED);
    SubstanceColorScheme mainBorderScheme = SubstanceColorSchemeUtilities
        .getColorScheme(scrollBar, ColorSchemeAssociationKind.BORDER,
            scrollBar.isEnabled() ? ComponentState.DEFAULT
                : ComponentState.DISABLED_UNSELECTED);
    HashMapKey key = SubstanceCoreUtilities.getHashKey(mainScheme
        .getDisplayName(), mainBorderScheme.getDisplayName(), width,
        height, ((compLeftState == null) ? "null" : compLeftState
            .name()), ((compRightState == null) ? "null"
            : compRightState.name()), shaper.getDisplayName());
    float radius = height / 2;
    if (shaper instanceof ClassicButtonShaper)
      radius = SubstanceSizeUtils
          .getClassicButtonCornerRadius(SubstanceSizeUtils
              .getComponentFontSize(scrollBar));
View Full Code Here

Examples of org.pushingpixels.substance.api.shaper.SubstanceButtonShaper

   * @return Horizontal track image.
   */
  private static BufferedImage getTrackBackHorizontal(JScrollBar scrollBar,
      AbstractButton leftActiveButton, AbstractButton rightActiveButton,
      int width, int height) {
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(scrollBar);
    int radius = height / 2;
    if (shaper instanceof ClassicButtonShaper)
      radius = 2;
    BufferedImage opaque = SubstanceImageCreator
View Full Code Here

Examples of org.pushingpixels.substance.api.shaper.SubstanceButtonShaper

        cyclePos = highest.getFadePosition();
        if (!highest.isFadingIn())
          cyclePos = 1.0f - cyclePos;
      }

      SubstanceButtonShaper shaper = SubstanceCoreUtilities
          .getButtonShaper(this.scrollbar);
      HashMapKey key = SubstanceCoreUtilities.getHashKey(cyclePos, width,
          height, ((topActiveButton == null) ? "null"
              : ComponentState
                  .getState(topActiveButton.getModel(),
                      topActiveButton).name()),
          ((topActiveButton == null) ? "null"
              : SubstanceCoreUtilities.getPrevComponentState(
                  topActiveButton).name()),
          ((bottomActiveButton == null) ? "null" : ComponentState
              .getState(bottomActiveButton.getModel(),
                  bottomActiveButton).name()),
          ((bottomActiveButton == null) ? "null"
              : SubstanceCoreUtilities.getPrevComponentState(
                  bottomActiveButton).name()),
          ((compTopState == null) ? "null" : compTopState.name()),
          ((compBottomState == null) ? "null" : compBottomState
              .name()), ((compBottomState == null) ? "null"
              : SubstanceColorSchemeUtilities.getColorScheme(
                  bottomActiveButton, compBottomState)
                  .getDisplayName()),
          ((compTopState == null) ? "null"
              : SubstanceColorSchemeUtilities.getColorScheme(
                  topActiveButton, compTopState)
                  .getDisplayName()),
          SubstanceColorSchemeUtilities.getColorScheme(
              this.scrollbar, ComponentState.DEFAULT)
              .getDisplayName(), shaper.getDisplayName(),
          SubstanceSizeUtils.getBorderStrokeWidth(SubstanceSizeUtils
              .getComponentFontSize(scrollbar)));

      // System.out.println(key);
      if (trackFullVerticalMap.containsKey(key)) {
        // System.out.println("Cache hit");
        return trackFullVerticalMap.get(key);
      }
      // System.out.println("Cache miss");

      // System.out.println("New image for vertical track");
      BufferedImage imageBack = getTrackBackVertical(this.scrollbar,
          topActiveButton, bottomActiveButton, width, height);
      Graphics2D backGraphics = imageBack.createGraphics();

      BufferedImage imageDefault = getTrackVertical(this.scrollbar,
          compTopState, compBottomState, width, height);
      backGraphics.drawImage(imageDefault, 0, 0, null);
      BufferedImage imageActive = getTrackVertical(this.scrollbar,
          compTopState, compBottomState, width, height);
      backGraphics.setComposite(AlphaComposite.SrcOver.derive(cyclePos));
      // System.out.println("Painting " + cyclePos);
      backGraphics.drawImage(imageActive, 0, 0, null);

      // System.out.println("Cache update");
      trackFullVerticalMap.put(key, imageBack);
      return imageBack;
    }

    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(this.scrollbar);
    HashMapKey key = SubstanceCoreUtilities
        .getHashKey(
            width,
            height,
            ((compTopState == null) ? "null" : ComponentState
                .getState(topActiveButton.getModel(),
                    topActiveButton).name()),
            ((compTopState == null) ? "null"
                : SubstanceCoreUtilities.getPrevComponentState(
                    topActiveButton).name()),
            ((compBottomState == null) ? "null" : ComponentState
                .getState(bottomActiveButton.getModel(),
                    bottomActiveButton).name()),
            ((compBottomState == null) ? "null"
                : SubstanceCoreUtilities.getPrevComponentState(
                    bottomActiveButton).name()),
            ((compTopState == null) ? "null" : compTopState.name()),
            ((compBottomState == null) ? "null" : compBottomState
                .name()), ((compBottomState == null) ? "null"
                : SubstanceColorSchemeUtilities.getColorScheme(
                    bottomActiveButton, compBottomState)
                    .getDisplayName()),
            ((compTopState == null) ? "null"
                : SubstanceColorSchemeUtilities.getColorScheme(
                    topActiveButton, compTopState)
                    .getDisplayName()),
            SubstanceColorSchemeUtilities.getColorScheme(
                this.scrollbar, ComponentState.DEFAULT)
                .getDisplayName(), shaper.getDisplayName(),
            SubstanceSizeUtils
                .getBorderStrokeWidth(SubstanceSizeUtils
                    .getComponentFontSize(scrollbar)));
    if (trackFullVerticalMap.containsKey(key)) {
      // System.out.println("Cache hit");
View Full Code Here

Examples of org.pushingpixels.substance.api.shaper.SubstanceButtonShaper

   * @return Vertical track image.
   */
  private static BufferedImage getTrackVertical(JScrollBar scrollBar,
      ComponentState compTopState, ComponentState compBottomState,
      int width, int height) {
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(scrollBar);
    SubstanceColorScheme mainScheme = SubstanceColorSchemeUtilities
        .getColorScheme(scrollBar,
            scrollBar.isEnabled() ? ComponentState.DEFAULT
                : ComponentState.DISABLED_UNSELECTED);
    SubstanceColorScheme mainBorderScheme = SubstanceColorSchemeUtilities
        .getColorScheme(scrollBar, ColorSchemeAssociationKind.BORDER,
            scrollBar.isEnabled() ? ComponentState.DEFAULT
                : ComponentState.DISABLED_UNSELECTED);
    HashMapKey key = SubstanceCoreUtilities.getHashKey(mainScheme
        .getDisplayName(), mainBorderScheme.getDisplayName(), width,
        height,
        ((compTopState == null) ? "null" : compTopState.name()),
        ((compBottomState == null) ? "null" : compBottomState.name()),
        shaper.getDisplayName());
    BufferedImage result = SubstanceScrollBarUI.trackVerticalMap.get(key);
    if (result == null) {
      float radius = width / 2;
      if (shaper instanceof ClassicButtonShaper)
        radius = SubstanceSizeUtils
View Full Code Here

Examples of org.pushingpixels.substance.api.shaper.SubstanceButtonShaper

   * @return Vertical track image.
   */
  private static BufferedImage getTrackBackVertical(JScrollBar scrollBar,
      AbstractButton topActiveButton, AbstractButton bottomActiveButton,
      int width, int height) {
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(scrollBar);
    int radius = width / 2;
    if (shaper instanceof ClassicButtonShaper)
      radius = 2;
    BufferedImage opaque = SubstanceImageCreator.getRotated(
View Full Code Here

Examples of org.pushingpixels.substance.api.shaper.SubstanceButtonShaper

      SubstanceColorScheme scheme2, float borderCyclePos,
      SubstanceColorScheme borderScheme,
      SubstanceColorScheme borderScheme2) {
    SubstanceFillPainter painter = SubstanceCoreUtilities
        .getFillPainter(scrollBar);
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(scrollBar);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(scrollBar);
    HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
        scheme.getDisplayName(), scheme2.getDisplayName(), borderScheme
            .getDisplayName(), borderScheme2.getDisplayName(),
        cyclePos, borderCyclePos, painter.getDisplayName(), shaper
            .getDisplayName(), borderPainter.getDisplayName());
    BufferedImage result = SubstanceScrollBarUI.thumbVerticalMap.get(key);
    if (result == null) {
      // System.out.println("Cache miss - computing");
      // System.out.println("New image for vertical thumb");
View Full Code Here

Examples of org.pushingpixels.substance.api.shaper.SubstanceButtonShaper

      SubstanceColorScheme scheme2, float borderCyclePos,
      SubstanceColorScheme borderScheme,
      SubstanceColorScheme borderScheme2) {
    SubstanceFillPainter painter = SubstanceCoreUtilities
        .getFillPainter(scrollBar);
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(scrollBar);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(scrollBar);
    // GripPainter gripPainter = SubstanceCoreUtilities.getGripPainter(
    // scrollBar, null);
    // System.out.println(state.name());
    HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
        scheme.getDisplayName(), scheme2.getDisplayName(), borderScheme
            .getDisplayName(), borderScheme2.getDisplayName(),
        cyclePos, borderCyclePos, painter.getDisplayName(), shaper
            .getDisplayName(), borderPainter.getDisplayName());
    // + ":"
    // + ((gripPainter != null) ? gripPainter.getDisplayName()
    // : "null");
View Full Code Here

Examples of org.pushingpixels.substance.api.shaper.SubstanceButtonShaper

      AbstractButton button, int width, int height,
      SubstanceConstants.Side side, boolean toIgnoreOpenSides) {
    if (SubstanceCoreUtilities.isButtonNeverPainted(button))
      return;

    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(button);

    BufferedImage resultNonFlat = null;
    ComponentState state = ComponentState.getState(button);
    ComponentState prevState = SubstanceCoreUtilities
View Full Code Here

Examples of org.pushingpixels.substance.api.shaper.SubstanceButtonShaper

      b.putClientProperty(SubstanceButtonUI.BORDER_ORIGINAL, b
          .getBorder());

    trackGlowingIcon(b);

    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(b);

    if (b.getClientProperty(SubstanceButtonUI.BORDER_COMPUTED) == null) {
      b.setBorder(shaper.getButtonBorder(b));
    } else {
      Border currBorder = b.getBorder();
      if (!(currBorder instanceof SubstanceButtonBorder)) {
        b.setBorder(shaper.getButtonBorder(b));
      } else {
        SubstanceButtonBorder sbCurrBorder = (SubstanceButtonBorder) currBorder;
        if (shaper.getClass() != sbCurrBorder.getButtonShaperClass())
          b.setBorder(shaper.getButtonBorder(b));
      }
    }
    b.putClientProperty(SubstanceButtonUI.OPACITY_ORIGINAL, b.isOpaque());
    // fix for defect 140
    b.setOpaque(false);
View Full Code Here

Examples of org.pushingpixels.substance.api.shaper.SubstanceButtonShaper

   * javax.swing.plaf.ComponentUI#getPreferredSize(javax.swing.JComponent)
   */
  @Override
  public Dimension getPreferredSize(JComponent c) {
    AbstractButton button = (AbstractButton) c;
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(button);

    // fix for defect 263
    Dimension superPref = super.getPreferredSize(button);
    if (superPref == null)
      return null;

    if (shaper == null)
      return superPref;

    return shaper.getPreferredSize(button, superPref);
  }
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.