Package org.pushingpixels.substance.api.shaper

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;

    Dimension result = shaper.getPreferredSize(button, superPref);
    return result;
  }
View Full Code Here


  @Override
  public boolean isInside(MouseEvent me) {
    if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) {
      return false;
    }
    SubstanceButtonShaper shaper = ClassicButtonShaper.INSTANCE;
    if (shaper == null)
      return false;
    Shape contour = SubstanceOutlineUtilities.getBaseOutline(
        this.textField, 2.0f * SubstanceSizeUtils
            .getClassicButtonCornerRadius(SubstanceSizeUtils
 
View Full Code Here

  @Override
  public boolean isInside(MouseEvent me) {
    if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) {
      return false;
    }
    SubstanceButtonShaper shaper = ClassicButtonShaper.INSTANCE;
    if (shaper == null)
      return false;
    Shape contour = SubstanceOutlineUtilities.getBaseOutline(
        this.textField, 2.0f * SubstanceSizeUtils
            .getClassicButtonCornerRadius(SubstanceSizeUtils
 
View Full Code Here

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

      SubstanceButtonShaper shaper = SubstanceCoreUtilities
          .getButtonShaper(this.scrollbar);
      HashMapKey key = SubstanceCoreUtilities
          .getHashKey(cyclePos, width, height,
              ((leftActiveButton == null) ? "null"
                  : ComponentState.getState(
                      leftActiveButton.getModel(),
                      leftActiveButton).name()),
              ((leftActiveButton == null) ? "null"
                  : SubstanceCoreUtilities
                      .getPrevComponentState(
                          leftActiveButton).name()),
              ((rightActiveButton == null) ? "null"
                  : ComponentState.getState(
                      rightActiveButton.getModel(),
                      rightActiveButton).name()),
              ((rightActiveButton == null) ? "null"
                  : SubstanceCoreUtilities
                      .getPrevComponentState(
                          rightActiveButton).name()),
              ((compLeftState == null) ? "null" : compLeftState
                  .name()),
              ((compRightState == null) ? "null" : compRightState
                  .name()), ((compLeftState == null) ? "null"
                  : SubstanceColorSchemeUtilities
                      .getColorScheme(leftActiveButton,
                          compLeftState)
                      .getDisplayName()),
              ((compRightState == null) ? "null"
                  : SubstanceColorSchemeUtilities
                      .getColorScheme(rightActiveButton,
                          compRightState)
                      .getDisplayName()),
              SubstanceColorSchemeUtilities.getColorScheme(
                  this.scrollbar, ComponentState.DEFAULT)
                  .getDisplayName(), shaper.getDisplayName(),
              SubstanceSizeUtils
                  .getBorderStrokeWidth(SubstanceSizeUtils
                      .getComponentFontSize(scrollbar)));
      // System.out.println(key);
      if (trackFullHorizontalMap.containsKey(key)) {
        // System.out.println("Cache hit");
        return trackFullHorizontalMap.get(key);
      }
      // System.out.println("Cache miss");

      // System.out.println("New image for horizontal track");
      BufferedImage imageBack = getTrackBackHorizontal(this.scrollbar,
          leftActiveButton, rightActiveButton, width, height);
      Graphics2D backGraphics = imageBack.createGraphics();

      BufferedImage imageDefault = getTrackHorizontal(this.scrollbar,
          compLeftState, compRightState, width, height);

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

      trackFullHorizontalMap.put(key, imageBack);
      return imageBack;
    }

    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(this.scrollbar);
    HashMapKey key = SubstanceCoreUtilities
        .getHashKey(width, height, ((compLeftState == null) ? "null"
            : ComponentState.getState(leftActiveButton.getModel(),
                leftActiveButton).name()),
            ((compLeftState == null) ? "null"
                : SubstanceCoreUtilities.getPrevComponentState(
                    leftActiveButton).name()),
            ((compRightState == null) ? "null" : ComponentState
                .getState(rightActiveButton.getModel(),
                    rightActiveButton).name()),
            ((compRightState == null) ? "null"
                : SubstanceCoreUtilities.getPrevComponentState(
                    rightActiveButton).name()),
            ((compLeftState == null) ? "null" : compLeftState
                .name()), ((compRightState == null) ? "null"
                : compRightState.name()),
            ((compLeftState == null) ? "null"
                : SubstanceColorSchemeUtilities.getColorScheme(
                    leftActiveButton, compLeftState)
                    .getDisplayName()),
            ((compRightState == null) ? "null"
                : SubstanceColorSchemeUtilities.getColorScheme(
                    rightActiveButton, compRightState)
                    .getDisplayName()),
            SubstanceColorSchemeUtilities.getColorScheme(
                this.scrollbar, ComponentState.DEFAULT)
                .getDisplayName(), shaper.getDisplayName(),
            SubstanceSizeUtils
                .getBorderStrokeWidth(SubstanceSizeUtils
                    .getComponentFontSize(scrollbar)));

    // System.out.println(key);
View Full Code Here

   * @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

   * @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

        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

   * @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

   * @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

      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

TOP

Related Classes of org.pushingpixels.substance.api.shaper.SubstanceButtonShaper

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.