Skip to content
This repository has been archived by the owner on Jul 10, 2018. It is now read-only.

Commit

Permalink
Tweaking visuals and layouts
Browse files Browse the repository at this point in the history
* High-DPI support for ribbon galleries and collapsed ribbon bands
tracked in kirill-grouchnikov/flamingo#2
* Correct visuals for rollover animation on flat command buttons
tracked in kirill-grouchnikov/flamingo#6
  • Loading branch information
kirill-grouchnikov committed Aug 10, 2017
1 parent c20b400 commit 5b18e6d
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 82 deletions.
Binary file modified drop/7.1.00-dev/substance-flamingo-7.1.00-dev.jar
Binary file not shown.
Binary file modified drop/7.1.00-dev/substance-flamingo-tools-7.1.00-dev.jar
Binary file not shown.
Binary file modified drop/7.1.00-dev/substance-flamingo-tst-7.1.00-dev.jar
Binary file not shown.
Expand Up @@ -369,7 +369,7 @@ protected void paintButtonBackground(Graphics graphics, Rectangle toFill) {
g2d.setComposite(
LafWidgetUtilities.getAlphaComposite(this.commandButton, extraAlpha, graphics));
int factor = UIUtil.getScaleFactor();
graphics.drawImage(fullAlphaBackground, 0, 0, fullAlphaBackground.getWidth() / factor,
g2d.drawImage(fullAlphaBackground, 0, 0, fullAlphaBackground.getWidth() / factor,
fullAlphaBackground.getHeight() / factor, null);
g2d.dispose();
}
Expand Down
Expand Up @@ -52,11 +52,9 @@
import org.pushingpixels.flamingo.api.common.AbstractCommandButton;
import org.pushingpixels.flamingo.api.common.JCommandButton;
import org.pushingpixels.flamingo.api.common.icon.ResizableIcon;
import org.pushingpixels.flamingo.internal.hidpi.UIUtil;
import org.pushingpixels.flamingo.internal.ui.ribbon.BasicRibbonBandUI;
import org.pushingpixels.lafwidget.LafWidgetUtilities;
import org.pushingpixels.lafwidget.animation.effects.GhostPaintingUtils;
import org.pushingpixels.lafwidget.icon.HiDpiAwareIcon;
import org.pushingpixels.lafwidget.utils.RenderingUtils;
import org.pushingpixels.substance.api.ColorSchemeAssociationKind;
import org.pushingpixels.substance.api.ComponentState;
Expand All @@ -69,7 +67,6 @@
import org.pushingpixels.substance.api.watermark.SubstanceWatermark;
import org.pushingpixels.substance.flamingo.common.TransitionAwareResizableIcon;
import org.pushingpixels.substance.flamingo.common.ui.ActionPopupTransitionAwareUI;
import org.pushingpixels.substance.internal.animation.StateTransitionTracker;
import org.pushingpixels.substance.internal.painter.DecorationPainterUtils;
import org.pushingpixels.substance.internal.painter.SeparatorPainterUtils;
import org.pushingpixels.substance.internal.utils.SubstanceColorSchemeUtilities;
Expand Down Expand Up @@ -361,31 +358,16 @@ private static ResizableIcon getExpandButtonIcon(
.getSmallArrowIconHeight(fontSize) + 2;
int arrowIconWidth = (int) SubstanceSizeUtils
.getSmallArrowIconWidth(fontSize);
final ResizableIcon arrowIcon = new TransitionAwareResizableIcon(
button,
new TransitionAwareResizableIcon.StateTransitionTrackerDelegate() {
@Override
public StateTransitionTracker getStateTransitionTracker() {
return ((ActionPopupTransitionAwareUI) button.getUI())
.getActionTransitionTracker();
}
}, new TransitionAwareResizableIcon.Delegate() {
@Override
public HiDpiAwareIcon getColorSchemeIcon(SubstanceColorScheme scheme,
int width, int height) {
return SubstanceImageCreator
.getDoubleArrowIcon(
SubstanceSizeUtils
.getComponentFontSize(button),
width,
height,
SubstanceSizeUtils
.getDoubleArrowStrokeWidth(fontSize),
button.getComponentOrientation()
.isLeftToRight() ? SwingConstants.EAST
: SwingConstants.WEST, scheme);
}
}, new Dimension(arrowIconWidth, arrowIconHeight));
final ResizableIcon arrowIcon = new TransitionAwareResizableIcon(button,
() -> ((ActionPopupTransitionAwareUI) button.getUI()).getActionTransitionTracker(),
(SubstanceColorScheme scheme, int width, int height) -> SubstanceImageCreator
.getDoubleArrowIcon(SubstanceSizeUtils.getComponentFontSize(button), width,
height, SubstanceSizeUtils.getDoubleArrowStrokeWidth(fontSize),
button.getComponentOrientation().isLeftToRight()
? SwingConstants.EAST
: SwingConstants.WEST,
scheme),
new Dimension(arrowIconWidth, arrowIconHeight));
return arrowIcon;
}

Expand Down
Expand Up @@ -43,15 +43,13 @@
import org.pushingpixels.flamingo.internal.ui.ribbon.BasicRibbonGalleryUI;
import org.pushingpixels.flamingo.internal.ui.ribbon.JRibbonGallery;
import org.pushingpixels.lafwidget.animation.effects.GhostPaintingUtils;
import org.pushingpixels.lafwidget.icon.HiDpiAwareIcon;
import org.pushingpixels.substance.api.ColorSchemeAssociationKind;
import org.pushingpixels.substance.api.ComponentState;
import org.pushingpixels.substance.api.SubstanceColorScheme;
import org.pushingpixels.substance.api.SubstanceConstants;
import org.pushingpixels.substance.api.SubstanceLookAndFeel;
import org.pushingpixels.substance.flamingo.common.TransitionAwareResizableIcon;
import org.pushingpixels.substance.flamingo.common.ui.ActionPopupTransitionAwareUI;
import org.pushingpixels.substance.internal.animation.StateTransitionTracker;
import org.pushingpixels.substance.internal.utils.SubstanceColorSchemeUtilities;
import org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities;
import org.pushingpixels.substance.internal.utils.SubstanceImageCreator;
Expand Down Expand Up @@ -113,23 +111,13 @@ protected ExpandCommandButton createExpandButton() {
final int fontSize = SubstanceSizeUtils.getComponentFontSize(button);
int arrowIconHeight = (int) SubstanceSizeUtils.getSmallArrowIconHeight(fontSize) + 3;
int arrowIconWidth = (int) SubstanceSizeUtils.getSmallArrowIconWidth(fontSize);
final ResizableIcon arrowIcon = new TransitionAwareResizableIcon(button,
new TransitionAwareResizableIcon.StateTransitionTrackerDelegate() {
@Override
public StateTransitionTracker getStateTransitionTracker() {
return ((ActionPopupTransitionAwareUI) button.getUI())
.getActionTransitionTracker();
}
}, new TransitionAwareResizableIcon.Delegate() {
@Override
public HiDpiAwareIcon getColorSchemeIcon(SubstanceColorScheme scheme, int width,
int height) {
return SubstanceImageCreator.getDoubleArrowIcon(
SubstanceSizeUtils.getComponentFontSize(button), width, height,
SubstanceSizeUtils.getDoubleArrowStrokeWidth(fontSize),
SwingConstants.SOUTH, scheme);
}
}, new Dimension(arrowIconWidth, arrowIconHeight));
final ResizableIcon arrowIcon = new TransitionAwareResizableIcon(button,
() -> ((ActionPopupTransitionAwareUI) button.getUI()).getActionTransitionTracker(),
(SubstanceColorScheme scheme, int width, int height) -> SubstanceImageCreator
.getDoubleArrowIcon(SubstanceSizeUtils.getComponentFontSize(button), width,
height, SubstanceSizeUtils.getDoubleArrowStrokeWidth(fontSize),
SwingConstants.SOUTH, scheme),
new Dimension(arrowIconWidth, arrowIconHeight));
button.setIcon(arrowIcon);
button.putClientProperty(SubstanceLookAndFeel.BUTTON_SIDE_PROPERTY,
EnumSet.of(button.getComponentOrientation().isLeftToRight()
Expand All @@ -151,22 +139,13 @@ protected JCommandButton createScrollDownButton() {
final int fontSize = SubstanceSizeUtils.getComponentFontSize(button);
int arrowIconHeight = (int) SubstanceSizeUtils.getSmallArrowIconHeight(fontSize);
int arrowIconWidth = (int) SubstanceSizeUtils.getSmallArrowIconWidth(fontSize);
final ResizableIcon arrowIcon = new TransitionAwareResizableIcon(button,
new TransitionAwareResizableIcon.StateTransitionTrackerDelegate() {
@Override
public StateTransitionTracker getStateTransitionTracker() {
return ((ActionPopupTransitionAwareUI) button.getUI())
.getActionTransitionTracker();
}
}, new TransitionAwareResizableIcon.Delegate() {
@Override
public HiDpiAwareIcon getColorSchemeIcon(SubstanceColorScheme scheme, int width,
int height) {
return SubstanceImageCreator.getArrowIcon(width, height,
SubstanceSizeUtils.getDoubleArrowStrokeWidth(fontSize),
SwingConstants.SOUTH, scheme);
}
}, new Dimension(arrowIconWidth, arrowIconHeight));
final ResizableIcon arrowIcon = new TransitionAwareResizableIcon(button,
() -> ((ActionPopupTransitionAwareUI) button.getUI()).getActionTransitionTracker(),
(SubstanceColorScheme scheme, int width, int height) -> SubstanceImageCreator
.getArrowIcon(width, height,
SubstanceSizeUtils.getDoubleArrowStrokeWidth(fontSize),
SwingConstants.SOUTH, scheme),
new Dimension(arrowIconWidth, arrowIconHeight));
button.setIcon(arrowIcon);
button.putClientProperty(SubstanceLookAndFeel.BUTTON_SIDE_PROPERTY,
EnumSet.of(button.getComponentOrientation().isLeftToRight()
Expand All @@ -187,22 +166,13 @@ protected JCommandButton createScrollUpButton() {
final int fontSize = SubstanceSizeUtils.getComponentFontSize(button);
int arrowIconHeight = (int) SubstanceSizeUtils.getSmallArrowIconHeight(fontSize);
int arrowIconWidth = (int) SubstanceSizeUtils.getSmallArrowIconWidth(fontSize);
ResizableIcon arrowIcon = new TransitionAwareResizableIcon(button,
new TransitionAwareResizableIcon.StateTransitionTrackerDelegate() {
@Override
public StateTransitionTracker getStateTransitionTracker() {
return ((ActionPopupTransitionAwareUI) button.getUI())
.getActionTransitionTracker();
}
}, new TransitionAwareResizableIcon.Delegate() {
@Override
public HiDpiAwareIcon getColorSchemeIcon(SubstanceColorScheme scheme, int width,
int height) {
return SubstanceImageCreator.getArrowIcon(width, height,
SubstanceSizeUtils.getDoubleArrowStrokeWidth(fontSize),
SwingConstants.NORTH, scheme);
}
}, new Dimension(arrowIconWidth, arrowIconHeight));
final ResizableIcon arrowIcon = new TransitionAwareResizableIcon(button,
() -> ((ActionPopupTransitionAwareUI) button.getUI()).getActionTransitionTracker(),
(SubstanceColorScheme scheme, int width, int height) -> SubstanceImageCreator
.getArrowIcon(width, height,
SubstanceSizeUtils.getDoubleArrowStrokeWidth(fontSize),
SwingConstants.NORTH, scheme),
new Dimension(arrowIconWidth, arrowIconHeight));
button.setIcon(arrowIcon);
button.putClientProperty(SubstanceLookAndFeel.BUTTON_SIDE_PROPERTY,
EnumSet.of(button.getComponentOrientation().isLeftToRight()
Expand Down
3 changes: 1 addition & 2 deletions src/test/substance/ribbon/NewCheckRibbon.java
Expand Up @@ -37,7 +37,6 @@
import java.awt.Rectangle;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.BufferedReader;
Expand Down Expand Up @@ -192,7 +191,7 @@ public void propertyChange(PropertyChangeEvent evt) {

JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);

SwingUtilities.invokeLater(new Runnable() {
public void run() {
SubstanceLookAndFeel.setSkin(new OfficeBlue2007Skin());
Expand Down

0 comments on commit 5b18e6d

Please sign in to comment.